Skip to content

Commit

Permalink
chore: Create a prebuild script to generate next data. (#5461)
Browse files Browse the repository at this point in the history
* chore: create a prebuild script

* chore: fix double prebuild run

* chore: fix EOF
  • Loading branch information
Harkunwar authored Jul 2, 2023
1 parent 54c1e9e commit 6a0b0b5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
7 changes: 0 additions & 7 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
'use strict';

import * as nextConstants from './next.constants.mjs';
import * as nextData from './next-data/index.mjs';

// generate the node.js releases json file
await nextData.generateNodeReleasesJson();

// generate the data from blog posts
await nextData.generateBlogPostsData();

/** @type {import('next').NextConfig} */
const nextConfig = {
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
},
"scripts": {
"scripts:release-post": "cross-env NODE_NO_WARNINGS=1 node scripts/release-post/index.mjs",
"serve": "cross-env NODE_NO_WARNINGS=1 next dev",
"build": "cross-env NODE_NO_WARNINGS=1 next build",
"start": "cross-env NODE_NO_WARNINGS=1 next start",
"prebuild": "cross-env NODE_NO_WARNINGS=1 node scripts/prebuild/generateNextData.mjs",
"serve": "cross-env NODE_NO_WARNINGS=1 npm run prebuild && next dev",
"build": "cross-env NODE_NO_WARNINGS=1 npm run prebuild && next build",
"start": "cross-env NODE_NO_WARNINGS=1 npm run prebuild && next start",
"deploy": "cross-env NEXT_STATIC_EXPORT=true npm run build",
"lint:js": "cross-env NODE_NO_WARNINGS=1 next lint --file \"**/*.{mjs,ts,tsx}\"",
"lint:md": "cross-env NODE_NO_WARNINGS=1 next lint --file \"**/*.md?(x)\"",
Expand Down
9 changes: 9 additions & 0 deletions scripts/prebuild/generateNextData.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

import * as nextData from '../../next-data/index.mjs';

// generate the node.js releases json file
await nextData.generateNodeReleasesJson();

// generate the data from blog posts
await nextData.generateBlogPostsData();

2 comments on commit 6a0b0b5

@vercel
Copy link

@vercel vercel bot commented on 6a0b0b5 Jul 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 6a0b0b5 Jul 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nodejs-org-stories – ./

nodejs-org-stories-openjs.vercel.app
nodejs-org-storybook.vercel.app
nodejs-org-stories-git-main-openjs.vercel.app

Please sign in to comment.