diff --git a/README.md b/README.md index 48b2e84bd..90d521539 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ -[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) - - - # rescript-lang.org +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) This is the official documentation platform for the [ReScript](https://rescript-lang.org) programming language. diff --git a/next.config.mjs b/next.config.mjs index b13f7fccd..7aba6c534 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -15,13 +15,12 @@ const { ProvidePlugin } = webpack; const transpileModules = ["rescript"].concat(bsconfig["bs-dependencies"]); const config = { - output: process.env.BUILD_STATIC === "true" ? "export" : undefined, + output: "export", pageExtensions: ["jsx", "js", "bs.js", "mdx", "mjs"], env: { ENV: process.env.NODE_ENV, VERSION_LATEST: process.env.VERSION_LATEST, VERSION_NEXT: process.env.VERSION_NEXT, - VERCEL: process.env.VERCEL, }, swcMinify: false, webpack: (config, options) => { @@ -85,70 +84,6 @@ const config = { config.plugins.push(new ProvidePlugin({ React: "react" })); return config; }, - async redirects() { - return [ - { - source: "/community", - destination: "/community/overview", - permanent: true, - }, - { - source: "/bucklescript-rebranding", - destination: "/blog/bucklescript-is-rebranding", - permanent: true, - }, - { - source: "/docs/manual/latest/migrate-from-bucklescript-reason", - destination: "/docs/manual/v10.0.0/migrate-from-bucklescript-reason", - permanent: true, - }, - { - source: "/docs/manual/latest/unboxed", - destination: "/docs/manual/v10.0.0/unboxed", - permanent: true, - }, - { - source: "/docs/gentype/latest/introduction", - destination: "/docs/manual/latest/typescript-integration", - permanent: true, - }, - { - source: "/docs/gentype/latest/getting-started", - destination: "/docs/manual/latest/typescript-integration", - permanent: true, - }, - { - source: "/docs/gentype/latest/usage", - destination: "/docs/manual/latest/typescript-integration", - permanent: true, - }, - { - source: "/docs/gentype/latest/supported-types", - destination: "/docs/manual/latest/typescript-integration", - permanent: true, - }, - { - source: "/docs/manual/latest/:slug*", - destination: `/docs/manual/${process.env.VERSION_LATEST}/:slug*`, - permanent: false, - }, - { - source: "/docs/manual/next/:slug*", - destination: `/docs/manual/${process.env.VERSION_NEXT}/:slug*`, - permanent: false, - }, - { - source: "/llms/manual/latest/:file*", - destination: `/llms/manual/${process.env.VERSION_LATEST}/:file*`, - permanent: false, - }, - { - source: "/llms/manual/next/:file*", - destination: `/llms/manual/${process.env.VERSION_NEXT}/:file*`, - permanent: false, - }, - ]; - }, }; export default { diff --git a/now.json b/now.json deleted file mode 100644 index 29820c2f7..000000000 --- a/now.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 2, - "scope": "reason-association", - "github": { - "silent": true - } -} diff --git a/pages/api/revalidate.js b/pages/api/revalidate.js deleted file mode 100644 index a2618b5d4..000000000 --- a/pages/api/revalidate.js +++ /dev/null @@ -1 +0,0 @@ -export { handler as default } from "src/others/Revalidate.mjs"; diff --git a/src/Packages.res b/src/Packages.res index 00d2ffe0d..23e766eb4 100644 --- a/src/Packages.res +++ b/src/Packages.res @@ -563,7 +563,7 @@ let parsePkgs = data => } }) -let getStaticProps: Next.GetStaticProps.revalidate = async _ctx => { +let getStaticProps: Next.GetStaticProps.t = async _ctx => { let baseUrl = "https://registry.npmjs.org/-/v1/search?text=keywords:rescript&size=250&maintenance=1.0&popularity=0.5&quality=0.9" let (one, two, three) = await Promise.all3(( @@ -603,17 +603,12 @@ let getStaticProps: Next.GetStaticProps.revalidate = async _ctx => ->Node.Fs.readFileSync ->JSON.parseExn ->unsafeToUrlResource - let props: props = { - "packages": pkges, - "unmaintained": unmaintained, - "urlResources": urlResources, - } { - "props": props, - "revalidate": switch Node.Process.env->Dict.get("BUILD_STATIC") { - | Some("true") => Nullable.undefined - | _ => Nullable.make(43200) + "props": { + "packages": pkges, + "unmaintained": unmaintained, + "urlResources": urlResources, }, } } diff --git a/src/Packages.resi b/src/Packages.resi index de70e70d3..1c976f951 100644 --- a/src/Packages.resi +++ b/src/Packages.resi @@ -25,4 +25,4 @@ type props = { let default: props => React.element -let getStaticProps: Next.GetStaticProps.revalidate +let getStaticProps: Next.GetStaticProps.t diff --git a/src/bindings/Next.res b/src/bindings/Next.res index d836daeed..05c0a55f5 100644 --- a/src/bindings/Next.res +++ b/src/bindings/Next.res @@ -31,11 +31,6 @@ module GetStaticProps = { } type t<'props, 'params> = context<'props, 'params> => promise<{"props": 'props}> - - type revalidate<'props, 'params> = context<'props, 'params> => promise<{ - "props": 'props, - "revalidate": Nullable.t, - }> } module GetStaticPaths = { diff --git a/src/common/CompilerManagerHook.res b/src/common/CompilerManagerHook.res index 99a1a97c7..6243fe240 100644 --- a/src/common/CompilerManagerHook.res +++ b/src/common/CompilerManagerHook.res @@ -35,10 +35,7 @@ module LoadScript = { } module CdnMeta = { - let baseUrl = switch Node.Process.env->Dict.get("VERCEL") { - | Some(_) => "https://cdn.rescript-lang.org" - | None => "/playground-bundles" - } + let baseUrl = "/playground-bundles" let getCompilerUrl = (version): string => `${baseUrl}/${Semver.toString(version)}/compiler.js` diff --git a/src/components/Footer.res b/src/components/Footer.res index dc4c88fc5..d402614bc 100644 --- a/src/components/Footer.res +++ b/src/components/Footer.res @@ -23,22 +23,6 @@ let make = () => {

{React.string(`© ${copyrightYear} The ReScript Project`)}

-

- {React.string("Software and assets distribution powered by ")} - {React.string("KeyCDN")} - {React.string(".")} -

-

- - - -

} -} - -module Res = { - type res - - @send external revalidate: (res, string) => promise = "revalidate" - @send external json: (res, {..}) => res = "json" - - module Status = { - type t - @send external make: (res, int) => t = "status" - @send external send: (t, string) => res = "send" - @send external json: (t, {..}) => res = "json" - } -} - -let handler = async (req: Req.req, res: Res.res) => { - switch req.query->Dict.get("secret") { - | Some(secret) => - switch Node.Process.env->Dict.get("NEXT_REVALIDATE_SECRET_TOKEN") { - | Some(token) => - if secret !== token { - res->Res.Status.make(401)->Res.Status.json({"message": "Invalid secret"}) - } else { - try { - let () = await res->Res.revalidate("/try") - res->Res.json({"revalidated": true}) - } catch { - | Exn.Error(_) => res->Res.Status.make(500)->Res.Status.send("Error revalidating") - } - } - | None => - res - ->Res.Status.make(500) - ->Res.Status.send("Error revalidating, `NEXT_REVALIDATE_SECRET_TOKEN` not found") - } - | None => - res->Res.Status.make(500)->Res.Status.send("Error revalidating, param `secret` not found") - } -} diff --git a/src/others/Revalidate.resi b/src/others/Revalidate.resi deleted file mode 100644 index 694cd1958..000000000 --- a/src/others/Revalidate.resi +++ /dev/null @@ -1,7 +0,0 @@ -module Req: { - type req -} -module Res: { - type res -} -let handler: (Req.req, Res.res) => promise