diff --git a/.github/workflows/nocobase-test.yml b/.github/workflows/nocobase-test.yml index 91de994e4..c1102272c 100644 --- a/.github/workflows/nocobase-test.yml +++ b/.github/workflows/nocobase-test.yml @@ -19,7 +19,7 @@ jobs: sqlite-test: strategy: matrix: - node_version: ['16'] + node_version: ['16', '18'] runs-on: ubuntu-latest container: node:${{ matrix.node_version }} steps: @@ -30,6 +30,7 @@ jobs: node-version: ${{ matrix.node_version }} cache: 'yarn' - run: yarn install + - run: yarn build - name: Test with Sqlite run: yarn test env: @@ -39,7 +40,7 @@ jobs: postgres-test: strategy: matrix: - node_version: ['16'] + node_version: ['16', '18'] runs-on: ubuntu-latest container: node:${{ matrix.node_version }} @@ -66,6 +67,7 @@ jobs: node-version: ${{ matrix.node_version }} cache: 'yarn' - run: yarn install + - run: yarn build - name: Test with postgres run: yarn test env: @@ -79,7 +81,7 @@ jobs: mysql-test: strategy: matrix: - node_version: ['16'] + node_version: ['16', '18'] runs-on: ubuntu-latest container: node:${{ matrix.node_version }} services: @@ -97,6 +99,7 @@ jobs: node-version: ${{ matrix.node_version }} cache: 'yarn' - run: yarn install + - run: yarn build - name: Test with MySQL run: yarn test env: diff --git a/packages/core/cli/bin/index.js b/packages/core/cli/bin/index.js index 06bba306e..3b3ac86a8 100755 --- a/packages/core/cli/bin/index.js +++ b/packages/core/cli/bin/index.js @@ -35,6 +35,21 @@ for (const key in env) { } } +if (require('semver').satisfies(process.version, '>16') && !process.env.UNSET_NODE_OPTIONS) { + if (process.env.NODE_OPTIONS) { + let opts = process.env.NODE_OPTIONS; + if (!opts.includes('--openssl-legacy-provider')) { + opts = opts + ' --openssl-legacy-provider'; + } + if (!opts.includes('--no-experimental-fetch')) { + opts = opts + ' --no-experimental-fetch'; + } + process.env.NODE_OPTIONS = opts; + } else { + process.env.NODE_OPTIONS = '--openssl-legacy-provider --no-experimental-fetch'; + } +} + const cli = require('../src/cli'); cli.parse(process.argv);