diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index fa8c59ca..011c9bc0 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -22,14 +22,14 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - node: [14.17.0, 14, 16.10.0, 16, 18] + node: [lts/-1, lts/*, latest] runs-on: ${{ matrix.os }} steps: - name: ⬇️ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: ⎔ Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} @@ -42,7 +42,7 @@ jobs: run: npm run validate - name: ⬆️ Upload coverage report - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 release: needs: main @@ -53,12 +53,12 @@ jobs: github.ref) && github.event_name == 'push' }} steps: - name: ⬇️ Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: ⎔ Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 16 + node-version: lts/* - name: 📥 Download deps uses: bahmutov/npm-install@v1 @@ -69,9 +69,8 @@ jobs: run: npm run build - name: 🚀 Release - uses: cycjimmy/semantic-release-action@v2 + uses: cycjimmy/semantic-release-action@v4 with: - semantic_version: 18 branches: | [ '+([0-9])?(.{+([0-9]),x}).x', diff --git a/package.json b/package.json index d4e20ec1..4e88dc50 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "dependencies": { "@babel/cli": "^7.18.10", "@babel/core": "^7.18.13", - "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-transform-class-properties": "^7.18.6", "@babel/plugin-transform-modules-commonjs": "^7.18.6", "@babel/plugin-transform-runtime": "^7.18.10", "@babel/preset-env": "^7.18.10", @@ -70,12 +70,13 @@ "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.3.0", "@rollup/plugin-replace": "^4.0.0", + "@rollup/plugin-terser": "^0.4.4", "@types/jest": "^29.4.0", "arrify": "^2.0.1", "babel-jest": "^29.4.1", "babel-plugin-macros": "^3.1.0", "babel-plugin-minify-dead-code-elimination": "^0.5.2", - "babel-plugin-module-resolver": "^4.1.0", + "babel-plugin-module-resolver": "^5.0.0", "babel-plugin-transform-inline-environment-variables": "^0.4.4", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "browserslist": "4.21.3", @@ -83,7 +84,7 @@ "chalk": "^4.1.2", "concurrently": "^7.3.0", "cosmiconfig": "^7.0.1", - "cpy": "^8.1.2", + "cpy": "npm:@brickdoc/cpy@8.1.2-patch.1", "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", "doctoc": "^2.2.0", @@ -102,13 +103,12 @@ "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^1.0.4", - "prettier": "2.7.1", + "prettier": "^3", "read-pkg-up": "^7.0.1", "resolve": "^1.22.1", "rimraf": "^3.0.2", "rollup": "^2.78.1", - "rollup-plugin-polyfill-node": "^0.10.2", - "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-polyfill-node": "^0.13.0", "semver": "^7.3.7", "which": "^2.0.2", "yargs-parser": "^21.1.1" @@ -121,7 +121,7 @@ "caniuse-lite": "1.0.30001553" }, "engines": { - "node": "^14.17.0 || ^16.10.0 || >=17.0.0", + "node": "^16.10.0 || >=17.0.0", "npm": ">=6" } } diff --git a/src/config/babelrc.js b/src/config/babelrc.js index b1ae08d0..43cc42f3 100644 --- a/src/config/babelrc.js +++ b/src/config/babelrc.js @@ -48,8 +48,8 @@ const browsersConfig = browserslist.loadConfig({path: appDirectory}) || [ const envTargets = isTest ? {node: 'current'} : isWebpack || isRollup - ? {browsers: browsersConfig} - : {node: getNodeVersion(pkg)} + ? {browsers: browsersConfig} + : {node: getNodeVersion(pkg)} const envOptions = {modules: false, loose: true, targets: envTargets} module.exports = () => ({ @@ -86,7 +86,10 @@ module.exports = () => ({ isUMD ? require.resolve('babel-plugin-transform-inline-environment-variables') : null, - [require.resolve('@babel/plugin-proposal-class-properties'), {loose: true}], + [ + require.resolve('@babel/plugin-transform-class-properties'), + {loose: true}, + ], isMinify ? require.resolve('babel-plugin-minify-dead-code-elimination') : null, diff --git a/src/config/rollup.config.js b/src/config/rollup.config.js index b1f8e4b9..426582ef 100644 --- a/src/config/rollup.config.js +++ b/src/config/rollup.config.js @@ -11,7 +11,7 @@ const replace = require('@rollup/plugin-replace') const camelcase = require('lodash.camelcase') const omit = require('lodash.omit') const nodePolyfills = require('rollup-plugin-polyfill-node') -const {terser} = require('rollup-plugin-terser') +const terser = require('@rollup/plugin-terser') const { pkg, hasFile, diff --git a/src/utils.js b/src/utils.js index 973ce844..0f761e57 100644 --- a/src/utils.js +++ b/src/utils.js @@ -37,6 +37,13 @@ function resolveBin(modName, {executable = modName, cwd = process.cwd()} = {}) { // ignore _error } try { + if (modName === 'rollup') { + // Rollup uses subpath exports without exporting package.json which is problematic + // Convert to absolute path first + const modPkgPathDist = require.resolve('rollup/dist/rollup.js') + const modPkgDirDist = path.dirname(modPkgPathDist) + modName = path.join(modPkgDirDist, '..') + } const modPkgPath = require.resolve(`${modName}/package.json`) const modPkgDir = path.dirname(modPkgPath) const {bin} = require(modPkgPath)