Skip to content

Commit c0a48a8

Browse files
authored
Merge pull request #723 from aspeddro/nextjs-13-using-pages-dir
Upgrade to NextJS 13 / MDX v2 / Tailwindcss v3
2 parents a66149e + 0072541 commit c0a48a8

File tree

92 files changed

+13167
-11124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+13167
-11124
lines changed

.babelrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ _tempFile.cmj
1515
_tempFile.cmt
1616

1717
# these docs are checked in, but we consider them frozen.
18-
pages/docs/manual/v8.0.0/
19-
pages/docs/manual/v9.0.0/
18+
# pages/docs/manual/v8.0.0/
19+
# pages/docs/manual/v9.0.0/
2020

2121
.bsb.lock
2222
.merlin

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ If you need inspiration on what to work on, you can check out issues tagged with
3030

3131
We really appreciate all input from users, community members and potential contributors. Please make sure to consider the other person's opinion and don't assume any common knowledge.
3232

33-
**Most importantly: Keep it professional and be nice to each other**
33+
**Most importantly: Keep it professional and be nice to eachother**
3434

35-
There might be situations where others don't understand a proposed feature or have different opinions on certain writing styles. That's fine, discussions are always welcome! Communicate in clear actionables, make your plans clear and always stick to the original topic.
35+
There might be situations where others don't understand a proposed feature or have different opinions on certain writing styles. That's fine, discussions are always welcome! Communicate in clear actionables, make your plans clear and always to stick to the original topic.
3636

3737
If other contributors disagree with certain proposals and don't change their mind after longer discussions, please don't get discouraged when an issue gets closed / postponed. Everyone tries their best to make the platform better, and to look at it in another perspective: Closed issues are also a highly valuable resource for others to understand technical decisions later on.
3838

3939
### Communicate your Time Commitment
4040

4141
Open Source development can be a challenge to coordinate, so please make sure to block enough time to work on your tasks and show commitment when taking on some work. Let other contributors know if your time schedule changes significantly, and also let others know if you can't finish a task.
4242

43-
We value your voluntary work, and of course it's fine to step back from a ticket for any reason (we can also help you if you are getting stuck). Please talk to us in any case, otherwise we might re-assign the ticket to other contributors.
43+
We value your voluntary work, and of course it's fine to step back from a ticket for any reasons (we can also help you if you are getting stuck). Please talk to us in any case, otherwise we might re-assign the ticket to other contributors.
4444

4545
### Communication Channels
4646

@@ -66,7 +66,7 @@ Always check if there are any designs for certain UI components and think about
6666
### Technical Writing (Documentation)
6767

6868
- Think and write in a JS friendly mindset when explaining concepts / showing examples.
69-
- No `foo` examples if somewhat possible. Try to establish practical context in your showcase examples.
69+
- No `foo` examples if somewhat possible. Try to establish practical context in your show case examples.
7070
- No references to `OCaml`. ReScript is its own language, and we don't rely on external resources of our host language.
7171
- If possible, no references to `Reason` examples / external resources. Our goal is to migrate everything to ReScript syntax.
7272

_blogposts/2020-09-25-release-8-3-2.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ There are two ways of removing staled artifacts, the second one is introduced in
8686

8787
- Based on live analysis and prebuilt-in knowledge
8888

89-
We scan `lib/bs` directory and check some dangling cm{i,t,j,ti} files, if it does not exist in
89+
We scan `lib/bs` directory and check some dangling `cm{i,t,j,ti}` files, if it does not exist in
9090
the current build set, it is considered stale artifacts. If it is `cmt` file, it would trigger some hooks of `genType`, notably -cmt-rm.
9191

9292
- Based on previous build logs

_blogposts/2021-02-09-release-9-0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ReScript is a robustly typed language that compiles to efficient and human-reada
1616

1717
Use `npm` to install the newest [9.0.1 release](https://www.npmjs.com/package/bs-platform/v/9.0.1) with the following command:
1818

19-
```
19+
```sh
2020
npm install bs-platform@9.0.1
2121
```
2222

_blogposts/archive/2017-10-09-bucklescript-release-1-7-5.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ A detailed list of changes are listed as below:
2626
- #1658, fix typeof = "null" issue
2727
- #1656, bs.get/set/get_index/set_index respects bs.ignore
2828
- #1654, `bsb -init` fails if package or current dir has space (parent dir can have spaces)
29-
- #1678, bs.get{null;undefined} in object type
29+
- #1678, `bs.get{null;undefined}` in object type
3030
- #1692, fix invalid js syntax output
3131
- #1701, fix tailcall handling interaction with exception handler
3232
- #1666, fix misue of GADT api

next.config.js

Lines changed: 0 additions & 88 deletions
This file was deleted.

next.config.mjs

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import fs from "fs";
2+
import webpack from "webpack";
3+
import rehypeSlug from 'rehype-slug';
4+
import remarkGfm from 'remark-gfm';
5+
import remarkComment from 'remark-comment';
6+
import remarkFrontmatter from 'remark-frontmatter'
7+
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
8+
import { createLoader } from 'simple-functional-loader'
9+
10+
const bsconfig = JSON.parse(fs.readFileSync("./bsconfig.json"))
11+
12+
const { ProvidePlugin } = webpack;
13+
14+
const transpileModules = ["rescript"].concat(bsconfig["bs-dependencies"]);
15+
16+
const config = {
17+
pageExtensions: ["jsx", "js", "bs.js", "mdx", "mjs"],
18+
env: {
19+
ENV: process.env.NODE_ENV,
20+
},
21+
swcMinify: true,
22+
webpack: (config, options) => {
23+
const { isServer } = options;
24+
if (!isServer) {
25+
// We shim fs for things like the blog slugs component
26+
// where we need fs access in the server-side part
27+
config.resolve.fallback = {
28+
fs: false,
29+
path: false,
30+
};
31+
}
32+
// We need this additional rule to make sure that mjs files are
33+
// correctly detected within our src/ folder
34+
config.module.rules.push({
35+
test: /\.m?js$/,
36+
// v-- currently using an experimental setting with esbuild-loader
37+
//use: options.defaultLoaders.babel,
38+
use: [{ loader: "esbuild-loader", options: { loader: "jsx" } }],
39+
exclude: /node_modules/,
40+
type: "javascript/auto",
41+
resolve: {
42+
fullySpecified: false,
43+
},
44+
});
45+
46+
function mainMdxLoader(plugins) {
47+
return [
48+
createLoader(function(source) {
49+
const result = `${source}\n\nMDXContent.frontmatter = frontmatter`
50+
return result
51+
}),
52+
]
53+
}
54+
55+
config.module.rules.push({
56+
test: /\.mdx?$/,
57+
use: mainMdxLoader(),
58+
});
59+
60+
config.module.rules.push({
61+
test: /\.mdx?$/,
62+
use: [
63+
{
64+
loader: '@mdx-js/loader',
65+
/** @type {import('@mdx-js/loader').Options} */
66+
options: {
67+
remarkPlugins: [remarkComment, remarkGfm, remarkFrontmatter, remarkMdxFrontmatter],
68+
providerImportSource: '@mdx-js/react',
69+
rehypePlugins: [rehypeSlug]
70+
}
71+
}
72+
]
73+
});
74+
75+
76+
config.plugins.push(new ProvidePlugin({ React: "react" }));
77+
return config;
78+
},
79+
async redirects() {
80+
return [
81+
{
82+
source: "/community",
83+
destination: "/community/overview",
84+
permanent: true,
85+
},
86+
{
87+
source: "/bucklescript-rebranding",
88+
destination: "/blog/bucklescript-is-rebranding",
89+
permanent: true,
90+
},
91+
];
92+
},
93+
};
94+
95+
export default {
96+
transpilePackages: transpileModules,
97+
...config
98+
}

0 commit comments

Comments
 (0)