From 3603ab4f3c064c1d9c8938a709ec08d683faddeb Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Tue, 31 Dec 2024 16:54:57 -0500 Subject: [PATCH 1/6] adopt NodeJS register function API for custom loader hooks --- package.json | 4 ++-- packages/cli/package.json | 5 +++++ packages/cli/src/register.js | 5 +++++ test/test-register.js | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 packages/cli/src/register.js create mode 100644 test/test-register.js diff --git a/package.json b/package.json index 4444e172a..cdd96028c 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "serve": "node . serve", "develop": "node . develop", "test": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 c8 mocha --exclude \"./packages/**/test/cases/loaders-*/**\" \"./packages/**/**/*.spec.js\"", - "test:loaders": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 node --loader $(pwd)/test/test-loader.js ./node_modules/mocha/bin/mocha \"./packages/**/**/*.spec.js\"", - "test:loaders:win": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 node --loader file:\\\\%cd%\\test\\test-loader.js ./node_modules/mocha/bin/mocha --exclude \"./packages/init/test/cases/**\" \"./packages/**/**/*.spec.js\"", + "test:loaders": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 node --import $(pwd)/test/test-register.js ./node_modules/mocha/bin/mocha \"./packages/**/**/*.spec.js\"", + "test:loaders:win": "cross-env BROWSERSLIST_IGNORE_OLD_DATA=true __GWD_ROLLUP_MODE__=strict NODE_NO_WARNINGS=1 node --import file:\\\\%cd%\\test\\test-register.js ./node_modules/mocha/bin/mocha --exclude \"./packages/init/test/cases/**\" \"./packages/**/**/*.spec.js\"", "test:tdd": "yarn test --watch", "lint:js": "eslint \"*.js\" \"./packages/**/**/*.js\" \"./test/*.js\" \"./www/**/**/*.js\"", "lint:ts": "eslint \"./packages/**/**/*.ts\"", diff --git a/packages/cli/package.json b/packages/cli/package.json index 3c059c9cb..94c6f5289 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -23,6 +23,11 @@ "node": "^18.20.5 || ^20.10.0 || ^22.12.0" }, "main": "./src/index.js", + "exports": { + ".": "./src/index.js", + "./register": "./src/register.js", + "./src/*": "./src/*" + }, "bin": { "greenwood": "./src/index.js" }, diff --git a/packages/cli/src/register.js b/packages/cli/src/register.js new file mode 100644 index 000000000..b19d76788 --- /dev/null +++ b/packages/cli/src/register.js @@ -0,0 +1,5 @@ +import { register } from 'node:module'; + +register('./loader.js', import.meta.url); + +// await import('./index.js'); \ No newline at end of file diff --git a/test/test-register.js b/test/test-register.js new file mode 100644 index 000000000..1082177b5 --- /dev/null +++ b/test/test-register.js @@ -0,0 +1,5 @@ +import { register } from 'node:module'; + +register('./test-loader.js', import.meta.url); + +// await import('./index.js'); \ No newline at end of file From db2f7c12c27b9eb6c772e82ba3a8e1aa2d5b0c37 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 11 Jan 2025 14:00:21 -0500 Subject: [PATCH 2/6] clean up comments --- packages/cli/src/register.js | 4 +--- test/test-register.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/register.js b/packages/cli/src/register.js index b19d76788..781b24081 100644 --- a/packages/cli/src/register.js +++ b/packages/cli/src/register.js @@ -1,5 +1,3 @@ import { register } from 'node:module'; -register('./loader.js', import.meta.url); - -// await import('./index.js'); \ No newline at end of file +register('./loader.js', import.meta.url); \ No newline at end of file diff --git a/test/test-register.js b/test/test-register.js index 1082177b5..a7611fc32 100644 --- a/test/test-register.js +++ b/test/test-register.js @@ -1,5 +1,3 @@ import { register } from 'node:module'; -register('./test-loader.js', import.meta.url); - -// await import('./index.js'); \ No newline at end of file +register('./test-loader.js', import.meta.url); \ No newline at end of file From 7ca6488b3bfac754e81adaefcfe7f1bdb73a365d Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sun, 12 Jan 2025 10:28:15 -0500 Subject: [PATCH 3/6] upgrade all github actions runners --- .github/workflows/ci-loaders.yml | 4 ++-- .github/workflows/ci-win-loaders.yml | 4 ++-- .github/workflows/ci-win.yml | 4 ++-- .github/workflows/ci.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-loaders.yml b/.github/workflows/ci-loaders.yml index 42ab4211b..6bea9ce36 100644 --- a/.github/workflows/ci-loaders.yml +++ b/.github/workflows/ci-loaders.yml @@ -12,12 +12,12 @@ jobs: node: [20, 22] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Install Chromium Library Dependencies run: | sh ./.github/workflows/chromium-lib-install.sh - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Installing project dependencies diff --git a/.github/workflows/ci-win-loaders.yml b/.github/workflows/ci-win-loaders.yml index aae8c1372..3a0ebca6b 100644 --- a/.github/workflows/ci-win-loaders.yml +++ b/.github/workflows/ci-win-loaders.yml @@ -12,9 +12,9 @@ jobs: node: [20] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Installing project dependencies diff --git a/.github/workflows/ci-win.yml b/.github/workflows/ci-win.yml index 304f9d4d3..6b7879c07 100644 --- a/.github/workflows/ci-win.yml +++ b/.github/workflows/ci-win.yml @@ -12,9 +12,9 @@ jobs: node: [20] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Installing project dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd76cd960..fdd426d1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,12 +12,12 @@ jobs: node: [20, 22] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Install Chromium Library Dependencies run: | sh ./.github/workflows/chromium-lib-install.sh - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Installing project dependencies From 34d883ac10b02f3f75ea24c7a318b44f4879f0a3 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sun, 12 Jan 2025 11:55:10 -0500 Subject: [PATCH 4/6] increase mocha timeout --- .mocharc.cjs | 2 +- .../build.config-optimization-overrides.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.mocharc.cjs b/.mocharc.cjs index 51980dafe..e50a014a1 100644 --- a/.mocharc.cjs +++ b/.mocharc.cjs @@ -1,3 +1,3 @@ module.exports = { - timeout: 90000 + timeout: 120000 }; \ No newline at end of file diff --git a/packages/cli/test/cases/build.config.optimization-overrides/build.config-optimization-overrides.spec.js b/packages/cli/test/cases/build.config.optimization-overrides/build.config-optimization-overrides.spec.js index 42d2e2de4..41fc513d1 100644 --- a/packages/cli/test/cases/build.config.optimization-overrides/build.config-optimization-overrides.spec.js +++ b/packages/cli/test/cases/build.config.optimization-overrides/build.config-optimization-overrides.spec.js @@ -41,7 +41,7 @@ describe('Build Greenwood With: ', function() { this.context = { publicDir: path.join(outputPath, 'public') }; - runner = new Runner(); + runner = new Runner(true); }); describe(LABEL, function() { From f9523441d91e6659896364e687e64dab843c40da Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sun, 12 Jan 2025 12:18:45 -0500 Subject: [PATCH 5/6] try windows-2025 for github actions --- .github/workflows/ci-win-loaders.yml | 2 +- .github/workflows/ci-win.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-win-loaders.yml b/.github/workflows/ci-win-loaders.yml index 3a0ebca6b..423be52df 100644 --- a/.github/workflows/ci-win-loaders.yml +++ b/.github/workflows/ci-win-loaders.yml @@ -5,7 +5,7 @@ on: [pull_request] jobs: build: - runs-on: windows-latest + runs-on: windows-2025 strategy: matrix: diff --git a/.github/workflows/ci-win.yml b/.github/workflows/ci-win.yml index 6b7879c07..4a0135d64 100644 --- a/.github/workflows/ci-win.yml +++ b/.github/workflows/ci-win.yml @@ -5,7 +5,7 @@ on: [pull_request] jobs: build: - runs-on: windows-latest + runs-on: windows-2025 strategy: matrix: From 465bfc38e7b45e92b3a59c436a6853ace013c037 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sun, 12 Jan 2025 12:36:32 -0500 Subject: [PATCH 6/6] revert testing changes --- .github/workflows/ci-win-loaders.yml | 2 +- .github/workflows/ci-win.yml | 2 +- .mocharc.cjs | 2 +- .../build.config-optimization-overrides.spec.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-win-loaders.yml b/.github/workflows/ci-win-loaders.yml index 423be52df..3a0ebca6b 100644 --- a/.github/workflows/ci-win-loaders.yml +++ b/.github/workflows/ci-win-loaders.yml @@ -5,7 +5,7 @@ on: [pull_request] jobs: build: - runs-on: windows-2025 + runs-on: windows-latest strategy: matrix: diff --git a/.github/workflows/ci-win.yml b/.github/workflows/ci-win.yml index 4a0135d64..6b7879c07 100644 --- a/.github/workflows/ci-win.yml +++ b/.github/workflows/ci-win.yml @@ -5,7 +5,7 @@ on: [pull_request] jobs: build: - runs-on: windows-2025 + runs-on: windows-latest strategy: matrix: diff --git a/.mocharc.cjs b/.mocharc.cjs index e50a014a1..51980dafe 100644 --- a/.mocharc.cjs +++ b/.mocharc.cjs @@ -1,3 +1,3 @@ module.exports = { - timeout: 120000 + timeout: 90000 }; \ No newline at end of file diff --git a/packages/cli/test/cases/build.config.optimization-overrides/build.config-optimization-overrides.spec.js b/packages/cli/test/cases/build.config.optimization-overrides/build.config-optimization-overrides.spec.js index 41fc513d1..42d2e2de4 100644 --- a/packages/cli/test/cases/build.config.optimization-overrides/build.config-optimization-overrides.spec.js +++ b/packages/cli/test/cases/build.config.optimization-overrides/build.config-optimization-overrides.spec.js @@ -41,7 +41,7 @@ describe('Build Greenwood With: ', function() { this.context = { publicDir: path.join(outputPath, 'public') }; - runner = new Runner(true); + runner = new Runner(); }); describe(LABEL, function() {