Skip to content

Commit 604cbc4

Browse files
committed
fixup!
1 parent 155ab46 commit 604cbc4

File tree

12 files changed

+69
-150
lines changed

12 files changed

+69
-150
lines changed

.github/CODEOWNERS

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ docs @nodejs/nodejs-website @nodejs/web-infra
3838
SECURITY.md @nodejs/security-wg
3939

4040
# Node.js Release Blog Posts
41-
apps/site/pages/en/blog/release @nodejs/releasers
42-
apps/site/pages/en/blog/announcements @nodejs/releasers
41+
packages/content/src/en/blog/release @nodejs/releasers
42+
packages/content/src/en/blog/announcements @nodejs/releasers
4343

4444
# The following users DO NOT have write access, and their review is requested
4545
# via a GitHub action.
46-
apps/site/pages/en/learn/diagnostics @nodejs/diagnostics
47-
apps/site/pages/en/learn/getting-started/security-best-practices.md @nodejs/security-wg
48-
apps/site/pages/en/learn/manipulating-files @nodejs/fs
49-
apps/site/pages/en/learn/test-runner @nodejs/test_runner
50-
apps/site/pages/en/learn/typescript @nodejs/typescript
51-
apps/site/pages/en/about/partners.mdx @nodejs/marketing
52-
apps/site/pages/en/about/branding.mdx @nodejs/marketing
46+
packages/content/src/en/learn/diagnostics @nodejs/diagnostics
47+
packages/content/src/en/learn/getting-started/security-best-practices.md @nodejs/security-wg
48+
packages/content/src/en/learn/manipulating-files @nodejs/fs
49+
packages/content/src/en/learn/test-runner @nodejs/test_runner
50+
packages/content/src/en/learn/typescript @nodejs/typescript
51+
packages/content/src/en/about/partners.mdx @nodejs/marketing
52+
packages/content/src/en/about/branding.mdx @nodejs/marketing

.github/workflows/translations-pr-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ on:
99
branches:
1010
- main
1111
paths:
12-
- 'apps/site/pages/**/*.md'
13-
- 'apps/site/pages/**/*.mdx'
14-
- '!apps/site/pages/en/**/*.md'
15-
- '!apps/site/pages/en/**/*.mdx'
12+
- 'packages/content/src/**/*.md'
13+
- 'packages/content/src/**/*.mdx'
14+
- '!packages/content/src/en/**/*.md'
15+
- '!packages/content/src/en/**/*.mdx'
1616
- 'packages/i18n/src/locales/*.json'
1717
- '!packages/i18n/src/locales/en.json'
1818
- 'apps/site/snippets/**/*.bash'

apps/site/next.helpers.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,9 @@
22

33
import { glob } from 'node:fs/promises';
44
import { join } from 'node:path';
5-
import { fileURLToPath } from 'node:url';
65

76
import { defaultLocale } from '@node-core/website-i18n/index.mjs';
87

9-
/**
10-
* This gets the relative path from `import.meta.url`
11-
*
12-
* @param {string} path the current import path
13-
* @returns {string} the relative path from import
14-
*/
15-
export const getRelativePath = path => fileURLToPath(new URL('.', path));
16-
178
// TODO(@avivkeller): Turbopack doesn't support `import.meta.resolve`-ing this path
189
export const contentBase = join(
1910
process.cwd(),

apps/site/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"prebuild": "node --run build:blog-data",
66
"build": "cross-env NODE_NO_WARNINGS=1 next build",
77
"build:blog-data": "cross-env NODE_NO_WARNINGS=1 node ./scripts/blog-data/index.mjs",
8-
"build:blog-data:watch": "node --watch --watch-path=pages/en/blog ./scripts/blog-data/index.mjs",
98
"cloudflare:build:worker": "OPEN_NEXT_CLOUDFLARE=true opennextjs-cloudflare build",
109
"cloudflare:deploy": "opennextjs-cloudflare deploy",
1110
"cloudflare:preview": "wrangler dev",
@@ -14,7 +13,7 @@
1413
"predev": "node --run build:blog-data",
1514
"dev": "cross-env NODE_NO_WARNINGS=1 next dev",
1615
"lint": "node --run lint:js && node --run lint:css && node --run lint:md",
17-
"lint:fix": "node --run lint:js:fix && node --run lint:css:fix && node --run lint:md:fix",
16+
"lint:fix": "node --run lint:js:fix && node --run lint:css:fix",
1817
"lint:css": "stylelint \"**/*.css\" --allow-empty-input --cache --cache-strategy=content --cache-location=.stylelintcache",
1918
"lint:css:fix": "node --run lint:css -- --fix",
2019
"lint:js": "eslint \"**/*.{js,mjs,ts,tsx}\"",
@@ -80,7 +79,6 @@
8079
"unist-util-visit": "^5.0.0"
8180
},
8281
"devDependencies": {
83-
"@flarelabs-net/wrangler-build-time-fs-assets-polyfilling": "^0.0.1",
8482
"@next/eslint-plugin-next": "16.0.7",
8583
"@opennextjs/cloudflare": "^1.14.4",
8684
"@playwright/test": "^1.56.1",

apps/site/scripts/orama-search/get-documents.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { readFile, glob } from 'node:fs/promises';
22
import { join, basename, posix, win32 } from 'node:path';
33

44
import generateReleaseData from '#site/next-data/generators/releaseData.mjs';
5-
import { getRelativePath } from '#site/next.helpers.mjs';
65

76
import { processDocument } from './process-documents.mjs';
87

@@ -47,12 +46,11 @@ export const getAPIDocs = async () => {
4746
};
4847

4948
/**
50-
* Collect all local markdown/mdx articles under /pages/en,
49+
* Collect all local markdown/mdx articles,
5150
* excluding blog content.
5251
*/
5352
export const getArticles = async () => {
54-
const relativePath = getRelativePath(import.meta.url);
55-
const root = join(relativePath, '..', '..', 'pages', 'en');
53+
const root = new URL(import.meta.resolve('@node-core/content/en'));
5654

5755
// Find all markdown files (excluding blog)
5856
const files = await Array.fromAsync(glob('**/*.{md,mdx}', { cwd: root }));

apps/site/scripts/release-post/index.mjs

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* will be picked from https://nodejs.org/dist/index.json.
1313
*
1414
* It'll create a file with the blog post content
15-
* into ../../pages/en/blog/release/vX.md ready for you to commit
15+
* into packages/content/src/en/blog/release/vX.md ready for you to commit
1616
* or possibly edit by hand before committing.
1717
*
1818
* Happy releasing!
@@ -22,15 +22,13 @@
2222

2323
import { existsSync, readFileSync, appendFileSync } from 'node:fs';
2424
import { writeFile } from 'node:fs/promises';
25-
import { resolve } from 'node:path';
2625
import { parseArgs } from 'node:util';
2726

2827
import handlebars from 'handlebars';
2928
import { format } from 'prettier';
3029

3130
import { downloadsTable } from './downloadsTable.mjs';
3231
import prettierConfig from '../../../../.prettierrc.json' with { type: 'json' };
33-
import { getRelativePath } from '../../next.helpers.mjs';
3432

3533
const URLS = {
3634
NODE_DIST_JSON: 'https://nodejs.org/dist/index.json',
@@ -70,14 +68,10 @@ const parsedArgs = parseArgs({
7068
});
7169

7270
const ARGS = {
73-
CURRENT_PATH: process.argv[1],
7471
SPECIFIC_VERSION: parsedArgs.positionals[0]?.replace(/^v/, ''),
7572
SHOULD_FORCE: Boolean(parsedArgs.values.force),
7673
};
7774

78-
// this allows us to get the current module working directory
79-
const __dirname = getRelativePath(import.meta.url);
80-
8175
const request = options => {
8276
return fetch(options.url, options).then(resp => {
8377
if (resp.status !== 200) {
@@ -216,7 +210,7 @@ const urlOrComingSoon = binary => {
216210

217211
const renderPost = results => {
218212
const blogTemplateSource = readFileSync(
219-
resolve(__dirname, 'template.hbs'),
213+
import.meta.resolve('./template.hbs'),
220214
'utf8'
221215
);
222216

@@ -240,47 +234,30 @@ const formatPost = results => {
240234
};
241235

242236
const writeToFile = results => {
243-
const blogPostPath = resolve(
244-
__dirname,
245-
'../../pages/en/blog/release',
246-
`v${results.version}.md`
237+
const blogPostURL = new URL(
238+
import.meta.resolve(
239+
`@node-core/content/en/blog/release/v${results.version}.md`
240+
)
247241
);
248242

249243
return new Promise((resolve, reject) => {
250-
if (existsSync(blogPostPath) && !ARGS.SHOULD_FORCE) {
244+
if (existsSync(blogPostURL) && !ARGS.SHOULD_FORCE) {
251245
reject(ERRORS.RELEASE_EXISTS(results.version));
252246
return;
253247
}
254248

255-
writeFile(blogPostPath, results.content)
256-
.then(() => resolve(blogPostPath))
249+
writeFile(blogPostURL, results.content)
250+
.then(() => resolve(blogPostURL))
257251
.catch(error => reject(ERRORS.FAILED_FILE_CREATION(error.message)));
258252
});
259253
};
260254

261255
const slugify = str => str.replace(/\./g, '-');
262256

263-
export {
264-
explicitVersion,
265-
fetchShasums,
266-
writeToFile,
267-
findLatestVersion,
268-
verifyDownloads,
269-
fetchChangelog,
270-
fetchChangelogBody,
271-
fetchAuthor,
272-
fetchVersionPolicy,
273-
};
274-
275-
// This allows us to verify that the script is being run directly from node.js/cli
276-
if (import.meta.url.startsWith('file:')) {
277-
if (ARGS.CURRENT_PATH === `${__dirname}index.mjs`) {
278-
explicitVersion(ARGS.SPECIFIC_VERSION)
279-
.then(null, findLatestVersion)
280-
.then(fetchDocs)
281-
.then(renderPost)
282-
.then(formatPost)
283-
.then(writeToFile)
284-
.then(filepath => console.log('Release post created:', filepath));
285-
}
286-
}
257+
explicitVersion(ARGS.SPECIFIC_VERSION)
258+
.then(null, findLatestVersion)
259+
.then(fetchDocs)
260+
.then(renderPost)
261+
.then(formatPost)
262+
.then(writeToFile)
263+
.then(filepath => console.log('Release post created:', filepath));

apps/site/turbo.json

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"build": {
2727
"dependsOn": ["build:blog-data", "^build"],
2828
"inputs": [
29-
"{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx}",
30-
"{app,components,layouts,pages,styles}/**/*.css",
29+
"{app,components,hooks,i18n,layouts,middlewares,providers,types,util}/**/*.{ts,tsx}",
30+
"{app,components,layouts,styles}/**/*.css",
3131
"{next-data,scripts,i18n}/**/*.{mjs,json}",
32-
"{app,pages}/**/*.{mdx,md}",
32+
"app/**/*.{mdx,md}",
3333
"*.{md,mdx,json,ts,tsx,mjs,yml}"
3434
],
3535
"outputs": [".next/**", "!.next/cache/**"],
@@ -73,10 +73,10 @@
7373
},
7474
"deploy": {
7575
"inputs": [
76-
"{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx}",
77-
"{app,components,layouts,pages,styles}/**/*.css",
76+
"{app,components,hooks,i18n,layouts,middlewares,providers,types,util}/**/*.{ts,tsx}",
77+
"{app,components,layouts,styles}/**/*.css",
7878
"{next-data,scripts,i18n}/**/*.{mjs,json}",
79-
"{app,pages}/**/*.{mdx,md}",
79+
"app/**/*.{mdx,md}",
8080
"*.{md,mdx,json,ts,tsx,mjs,yml}"
8181
],
8282
"outputs": [".next/**", "!.next/cache/**"],
@@ -99,18 +99,14 @@
9999
},
100100
"lint:js": {
101101
"inputs": [
102-
"{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx,mjs}",
102+
"{app,components,hooks,i18n,layouts,middlewares,providers,types,util}/**/*.{ts,tsx,mjs}",
103103
"{next-data,scripts,i18n}/**/*.{mjs,json}",
104104
"public/**/*.{ts,js,json}",
105105
"*.{json,ts,tsx}"
106106
]
107107
},
108-
"lint:md": {
109-
"inputs": ["{app,pages}/**/*.{md,mdx}", "*.{md,mdx}"],
110-
"outputs": [".eslintmdcache"]
111-
},
112108
"lint:css": {
113-
"inputs": ["{app,components,layouts,pages,styles}/**/*.css"],
109+
"inputs": ["{app,components,layouts,styles}/**/*.css"],
114110
"outputs": [".stylelintcache"]
115111
},
116112
"lint:fix": {
@@ -125,16 +121,15 @@
125121
"test:unit": {
126122
"dependsOn": ["build:blog-data"],
127123
"inputs": [
128-
"{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx,mjs}",
129-
"{app,components,layouts,pages,styles}/**/*.css",
124+
"{app,components,hooks,i18n,layouts,middlewares,providers,types,util}/**/*.{ts,tsx,mjs}",
125+
"{app,components,layouts,styles}/**/*.css",
130126
"{next-data,scripts,i18n}/**/*.{mjs,json}",
131-
"{app,pages}/**/*.{mdx,md}",
127+
"{app}/**/*.{mdx,md}",
132128
"*.{md,mdx,json,ts,tsx,mjs,yml}"
133129
],
134130
"outputs": ["coverage/**", "junit.xml"]
135131
},
136132
"build:blog-data": {
137-
"inputs": ["{pages}/**/*.{mdx,md}"],
138133
"outputs": ["public/blog-data.json"],
139134
"env": [
140135
"VERCEL_ENV",
@@ -148,32 +143,32 @@
148143
"cloudflare:build:worker": {
149144
"dependsOn": ["build:blog-data"],
150145
"inputs": [
151-
"{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx}",
152-
"{app,components,layouts,pages,styles}/**/*.css",
146+
"{app,components,hooks,i18n,layouts,middlewares,providers,types,util}/**/*.{ts,tsx}",
147+
"{app,components,layouts,styles}/**/*.css",
153148
"{next-data,scripts,i18n}/**/*.{mjs,json}",
154-
"{app,pages}/**/*.{mdx,md}",
149+
"app/**/*.{mdx,md}",
155150
"*.{md,mdx,json,ts,tsx,mjs,yml}"
156151
],
157152
"outputs": [".open-next/**"]
158153
},
159154
"cloudflare:preview": {
160155
"dependsOn": ["cloudflare:build:worker"],
161156
"inputs": [
162-
"{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx}",
163-
"{app,components,layouts,pages,styles}/**/*.css",
157+
"{app,components,hooks,i18n,layouts,middlewares,providers,types,util}/**/*.{ts,tsx}",
158+
"{app,components,layouts,styles}/**/*.css",
164159
"{next-data,scripts,i18n}/**/*.{mjs,json}",
165-
"{app,pages}/**/*.{mdx,md}",
160+
"{app}/**/*.{mdx,md}",
166161
"*.{md,mdx,json,ts,tsx,mjs,yml}"
167162
],
168163
"outputs": [".open-next/**"]
169164
},
170165
"cloudflare:deploy": {
171166
"dependsOn": ["cloudflare:build:worker"],
172167
"inputs": [
173-
"{app,components,hooks,i18n,layouts,middlewares,pages,providers,types,util}/**/*.{ts,tsx}",
174-
"{app,components,layouts,pages,styles}/**/*.css",
168+
"{app,components,hooks,i18n,layouts,middlewares,providers,types,util}/**/*.{ts,tsx}",
169+
"{app,components,layouts,styles}/**/*.css",
175170
"{next-data,scripts,i18n}/**/*.{mjs,json}",
176-
"{app,pages}/**/*.{mdx,md}",
171+
"{app}/**/*.{mdx,md}",
177172
"*.{md,mdx,json,ts,tsx,mjs,yml}"
178173
],
179174
"outputs": [".open-next/**"]

apps/site/wrangler.jsonc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@
2424
"enabled": true,
2525
"head_sampling_rate": 1,
2626
},
27-
"build": {
28-
"command": "wrangler-build-time-fs-assets-polyfilling --assets pages --assets snippets --assets-output-dir .open-next/assets",
29-
},
30-
"alias": {
31-
"node:fs": "./.wrangler/fs-assets-polyfilling/polyfills/node/fs.ts",
32-
"node:fs/promises": "./.wrangler/fs-assets-polyfilling/polyfills/node/fs/promises.ts",
33-
"fs": "./.wrangler/fs-assets-polyfilling/polyfills/node/fs.ts",
34-
"fs/promises": "./.wrangler/fs-assets-polyfilling/polyfills/node/fs/promises.ts",
35-
},
3627
"r2_buckets": [
3728
{
3829
"binding": "NEXT_INC_CACHE_R2_BUCKET",

docs/adding-pages.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This guide explains how to create new pages and content for the Node.js website.
4141

4242
### 1. Create the Page Content
4343

44-
Create a new markdown file in `apps/site/pages/en/` with the appropriate subdirectory structure.
44+
Create a new markdown file in `packages/content/src/en/` with the appropriate subdirectory structure.
4545

4646
```markdown
4747
---
@@ -82,7 +82,7 @@ The Learn section has special requirements and structure.
8282
### Learn Page Structure
8383

8484
```
85-
apps/site/pages/en/learn/
85+
packages/content/src/en/learn/
8686
├── category-name/
8787
│ ├── article-name.md
8888
│ └── another-article.md
@@ -184,7 +184,7 @@ import vm from 'node:vm';
184184
### Content Structure
185185

186186
```
187-
apps/site/pages/
187+
packages/content/src/
188188
├── en/ # English content (source)
189189
│ ├── learn/ # Learn section
190190
│ ├── blog/ # Blog posts

docs/cloudflare-build-and-deployment.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Key configurations include:
1717
- `main`: Points to the worker generated by the OpenNext adapter.
1818
- `account_id`: Specifies the Cloudflare account ID. This is not required for local previews but is necessary for deployments. You can obtain an account ID for free by signing up at [dash.cloudflare.com](https://dash.cloudflare.com/login).
1919
- This is currently set to `fb4a2d0f103c6ff38854ac69eb709272`, which is the ID of a Cloudflare account controlled by Node.js, and used for testing.
20-
- `build`: Defines the build command to generate the Node.js filesystem polyfills required for the application to run on Cloudflare Workers. This uses the [`@flarelabs/wrangler-build-time-fs-assets-polyfilling`](https://github.com/flarelabs-net/wrangler-build-time-fs-assets-polyfilling) package.
2120
- `alias`: Maps aliases for the Node.js filesystem polyfills generated during the build process.
2221
- `r2_buckets`: Contains a single R2 binding definition for `NEXT_INC_CACHE_R2_BUCKET`. This is used to implement the Next.js incremental cache.
2322
- This is currently set up to a R2 bucket in the aforementioned Cloudflare testing account.

0 commit comments

Comments
 (0)