From 791bbfe705ab225fde81e89cfb52deea448765f1 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Thu, 3 Jun 2021 15:06:53 -0600 Subject: [PATCH 01/16] feat(deps): update all dependencies --- package.json | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 87a82c6f..6f999355 100644 --- a/package.json +++ b/package.json @@ -32,56 +32,56 @@ "author": "Kent C. Dodds (https://kentcdodds.com)", "license": "MIT", "dependencies": { - "@babel/cli": "^7.13.14", - "@babel/core": "^7.13.15", + "@babel/cli": "^7.14.3", + "@babel/core": "^7.14.3", "@babel/plugin-proposal-class-properties": "^7.13.0", - "@babel/plugin-transform-modules-commonjs": "^7.13.8", - "@babel/plugin-transform-runtime": "^7.13.15", - "@babel/preset-env": "^7.13.15", + "@babel/plugin-transform-modules-commonjs": "^7.14.0", + "@babel/plugin-transform-runtime": "^7.14.3", + "@babel/preset-env": "^7.14.4", "@babel/preset-react": "^7.13.13", "@babel/preset-typescript": "^7.13.0", - "@babel/runtime": "^7.13.10", + "@babel/runtime": "^7.14.0", "@rollup/plugin-babel": "^5.3.0", - "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-commonjs": "^19.0.0", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-node-resolve": "^13.0.0", "@rollup/plugin-replace": "^2.4.2", - "@types/jest": "^26.0.22", + "@types/jest": "^26.0.23", "arrify": "^2.0.1", - "babel-jest": "^27.0.1", - "babel-plugin-macros": "^3.0.1", + "babel-jest": "^27.0.2", + "babel-plugin-macros": "^3.1.0", "babel-plugin-minify-dead-code-elimination": "^0.5.1", "babel-plugin-module-resolver": "^4.1.0", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", - "browserslist": "^4.16.4", + "browserslist": "^4.16.6", "builtin-modules": "^3.2.0", - "chalk": "^4.1.0", - "concurrently": "^6.0.1", + "chalk": "^4.1.1", + "concurrently": "^6.2.0", "cosmiconfig": "^7.0.0", "cpy": "^8.1.2", "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", "doctoc": "^2.0.0", - "eslint": "^7.24.0", - "eslint-config-kentcdodds": "^18.0.0", - "glob": "^7.1.6", + "eslint": "^7.27.0", + "eslint-config-kentcdodds": "^19.0.0", + "glob": "^7.1.7", "husky": "^4.3.8", "is-ci": "^3.0.0", - "jest": "^27.0.1", + "jest": "^27.0.4", "jest-serializer-path": "^0.1.15", "jest-snapshot-serializer-raw": "^1.2.0", "jest-watch-typeahead": "^0.6.4", - "lint-staged": "^10.5.4", + "lint-staged": "^11.0.0", "lodash.camelcase": "^4.3.0", "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^1.0.4", - "prettier": "2.2.1", + "prettier": "2.3.0", "read-pkg-up": "^7.0.1", "resolve": "^1.20.0", "rimraf": "^3.0.2", - "rollup": "^2.45.1", + "rollup": "^2.50.6", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-terser": "^7.0.2", From 32f3cfbf4727f0642fddc5279b4e1992b5b326b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Tue, 20 Jul 2021 14:42:27 +0200 Subject: [PATCH 02/16] feat: update dependencies (#217) --- .github/workflows/validate.yml | 2 +- README.md | 8 +++-- package.json | 54 +++++++++++++++++----------------- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 175c8652..b471275d 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -40,7 +40,7 @@ jobs: run: npm run validate - name: ⬆️ Upload coverage report - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 release: needs: main diff --git a/README.md b/README.md index 57cbeb15..175c8cec 100644 --- a/README.md +++ b/README.md @@ -136,9 +136,11 @@ This is inspired by `react-scripts`. ## Other Solutions -If you are aware of any please [make a pull request][prs] and add it -here! Again, this is a very specific-to-me solution. -- [Rollpkg](https://github.com/rafgraph/rollpkg) - convention over config build tool to create packages with TypeScript and Rollup. +If you are aware of any please [make a pull request][prs] and add it here! +Again, this is a very specific-to-me solution. + +- [Rollpkg](https://github.com/rafgraph/rollpkg) - convention over config build + tool to create packages with TypeScript and Rollup. ## Issues diff --git a/package.json b/package.json index 6f999355..3b03883d 100644 --- a/package.json +++ b/package.json @@ -32,23 +32,23 @@ "author": "Kent C. Dodds (https://kentcdodds.com)", "license": "MIT", "dependencies": { - "@babel/cli": "^7.14.3", - "@babel/core": "^7.14.3", - "@babel/plugin-proposal-class-properties": "^7.13.0", - "@babel/plugin-transform-modules-commonjs": "^7.14.0", - "@babel/plugin-transform-runtime": "^7.14.3", - "@babel/preset-env": "^7.14.4", - "@babel/preset-react": "^7.13.13", - "@babel/preset-typescript": "^7.13.0", - "@babel/runtime": "^7.14.0", + "@babel/cli": "^7.14.5", + "@babel/core": "^7.14.6", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@babel/plugin-transform-modules-commonjs": "^7.14.5", + "@babel/plugin-transform-runtime": "^7.14.5", + "@babel/preset-env": "^7.14.7", + "@babel/preset-react": "^7.14.5", + "@babel/preset-typescript": "^7.14.5", + "@babel/runtime": "^7.14.6", "@rollup/plugin-babel": "^5.3.0", - "@rollup/plugin-commonjs": "^19.0.0", + "@rollup/plugin-commonjs": "^19.0.1", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.0.0", - "@rollup/plugin-replace": "^2.4.2", - "@types/jest": "^26.0.23", + "@rollup/plugin-node-resolve": "^13.0.2", + "@rollup/plugin-replace": "^3.0.0", + "@types/jest": "^26.0.24", "arrify": "^2.0.1", - "babel-jest": "^27.0.2", + "babel-jest": "^27.0.6", "babel-plugin-macros": "^3.1.0", "babel-plugin-minify-dead-code-elimination": "^0.5.1", "babel-plugin-module-resolver": "^4.1.0", @@ -62,32 +62,36 @@ "cpy": "^8.1.2", "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", - "doctoc": "^2.0.0", - "eslint": "^7.27.0", - "eslint-config-kentcdodds": "^19.0.0", + "doctoc": "^2.0.1", + "eslint": "^7.31.0", + "eslint-config-kentcdodds": "^19.1.0", "glob": "^7.1.7", "husky": "^4.3.8", "is-ci": "^3.0.0", - "jest": "^27.0.4", + "jest": "^27.0.6", "jest-serializer-path": "^0.1.15", "jest-snapshot-serializer-raw": "^1.2.0", "jest-watch-typeahead": "^0.6.4", - "lint-staged": "^11.0.0", + "lint-staged": "^11.0.1", "lodash.camelcase": "^4.3.0", "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^1.0.4", - "prettier": "2.3.0", + "prettier": "2.3.2", "read-pkg-up": "^7.0.1", "resolve": "^1.20.0", "rimraf": "^3.0.2", - "rollup": "^2.50.6", + "rollup": "^2.53.2", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-terser": "^7.0.2", "semver": "^7.3.5", "which": "^2.0.2", - "yargs-parser": "^20.2.7" + "yargs-parser": "^20.2.9" + }, + "devDependencies": { + "jest-in-case": "^1.0.2", + "slash": "^3.0.0" }, "eslintConfig": { "extends": [ @@ -117,9 +121,5 @@ "bugs": { "url": "https://github.com/kentcdodds/kcd-scripts/issues" }, - "homepage": "https://github.com/kentcdodds/kcd-scripts#readme", - "devDependencies": { - "jest-in-case": "^1.0.2", - "slash": "^3.0.0" - } + "homepage": "https://github.com/kentcdodds/kcd-scripts#readme" } From 438ed612db87462b5424a748b2d546c57d7bfdac Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Wed, 15 Sep 2021 11:02:36 -0400 Subject: [PATCH 03/16] fix: use `modulePaths` to improve Jest 27 imports (#220) --- src/config/jest.config.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/config/jest.config.js b/src/config/jest.config.js index 8548f4fa..1f09faa6 100644 --- a/src/config/jest.config.js +++ b/src/config/jest.config.js @@ -1,5 +1,5 @@ const path = require('path') -const {ifAnyDep, hasFile, hasPkgProp, fromRoot} = require('../utils') +const {ifAnyDep, hasFile, hasPkgProp} = require('../utils') const here = p => path.join(__dirname, p) @@ -15,7 +15,7 @@ const ignores = [ ] const jestConfig = { - roots: [fromRoot('src')], + roots: ['/src'], testEnvironment: ifAnyDep( ['webpack', 'rollup', 'react', 'preact'], 'jsdom', @@ -23,12 +23,7 @@ const jestConfig = { ), testURL: 'http://localhost', moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'], - moduleDirectories: [ - 'node_modules', - fromRoot('src'), - 'shared', - fromRoot('tests'), - ], + modulePaths: ['/src', 'shared', '/tests'], collectCoverageFrom: ['src/**/*.+(js|jsx|ts|tsx)'], testMatch: ['**/__tests__/**/*.+(js|jsx|ts|tsx)'], testPathIgnorePatterns: [...ignores], @@ -59,7 +54,7 @@ const setupFiles = [ ] for (const setupFile of setupFiles) { if (hasFile(setupFile)) { - jestConfig.setupFilesAfterEnv = [fromRoot(setupFile)] + jestConfig.setupFilesAfterEnv = `/${setupFile}` } } From 7632e9885404096180bb96339205994632336ab7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien <567105+nstepien@users.noreply.github.com> Date: Wed, 15 Sep 2021 16:50:13 +0100 Subject: [PATCH 04/16] fix: `setupFilesAfterEnv` must be an array (#221) --- src/config/jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/jest.config.js b/src/config/jest.config.js index 1f09faa6..222ea890 100644 --- a/src/config/jest.config.js +++ b/src/config/jest.config.js @@ -54,7 +54,7 @@ const setupFiles = [ ] for (const setupFile of setupFiles) { if (hasFile(setupFile)) { - jestConfig.setupFilesAfterEnv = `/${setupFile}` + jestConfig.setupFilesAfterEnv = [`/${setupFile}`] } } From 0e54122a66320c7a06132814a0b7698cc422247b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 15 Sep 2021 09:52:27 -0600 Subject: [PATCH 05/16] docs: add nstepien as a contributor for code (#222) * docs: update README.md * docs: update .all-contributorsrc Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index bae03901..44460108 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -313,6 +313,15 @@ "contributions": [ "code" ] + }, + { + "login": "nstepien", + "name": "Nicolas Stepien", + "avatar_url": "https://avatars.githubusercontent.com/u/567105?v=4", + "profile": "https://github.com/nstepien", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index 175c8cec..158df89b 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ Thanks goes to these people ([emoji key][emojis]):
HOU Ce

💻
Ari Perkkiö

💻 ⚠️
Sebastian Silbermann

💻 +
Nicolas Stepien

💻 From 2e31cffd3326306761fafca9ceef47fae86f4cb7 Mon Sep 17 00:00:00 2001 From: Varun Date: Wed, 6 Oct 2021 05:08:27 +0530 Subject: [PATCH 06/16] updated npm repo to https://registry.npmjs.org/ (#223) --- .npmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.npmrc b/.npmrc index a57cc9e5..214c29d1 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -registry=http://registry.npmjs.org/ +registry=https://registry.npmjs.org/ From fec3fea6dc6d23b62376ed947d75b4fb78b3d01e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 5 Oct 2021 17:38:57 -0600 Subject: [PATCH 07/16] docs: add KSVarun as a contributor for doc (#224) Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 44460108..52a3a3c1 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -322,6 +322,15 @@ "contributions": [ "code" ] + }, + { + "login": "KSVarun", + "name": "Varun", + "avatar_url": "https://avatars.githubusercontent.com/u/15784650?v=4", + "profile": "https://github.com/KSVarun", + "contributions": [ + "doc" + ] } ] } diff --git a/README.md b/README.md index 158df89b..9b0a0477 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,7 @@ Thanks goes to these people ([emoji key][emojis]):
Ari Perkkiö

💻 ⚠️
Sebastian Silbermann

💻
Nicolas Stepien

💻 +
Varun

📖 From 7e7a463c8bfee15cbd7fdc99fbdeccb3381560b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Fri, 7 Jan 2022 23:15:36 +0100 Subject: [PATCH 08/16] feat: update dependencies (#225) BREAKING CHANGE: Requires Node@^12.22.0 || ^14.17.0 || >=16.0.0 BREAKING CHANGE: ESLint v8.x will now be used to lint your code --- .github/workflows/validate.yml | 6 ++-- package.json | 65 +++++++++++++++++----------------- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b471275d..4bb7aa5f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: 🛑 Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.0 + uses: styfle/cancel-workflow-action@0.9.1 - name: ⬇️ Checkout repo uses: actions/checkout@v2 @@ -51,7 +51,7 @@ jobs: github.ref) && github.event_name == 'push' }} steps: - name: 🛑 Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.0 + uses: styfle/cancel-workflow-action@0.9.1 - name: ⬇️ Checkout repo uses: actions/checkout@v2 @@ -72,7 +72,7 @@ jobs: - name: 🚀 Release uses: cycjimmy/semantic-release-action@v2 with: - semantic_version: 17 + semantic_version: 18 branches: | [ '+([0-9])?(.{+([0-9]),x}).x', diff --git a/package.json b/package.json index 3b03883d..a528b4b1 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,8 @@ "version": "0.0.0-semantically-released", "description": "CLI for common scripts for my projects", "engines": { - "node": ">=10.18", - "npm": ">=6", - "yarn": ">=1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0", + "npm": ">=6" }, "bin": { "kcd-scripts": "dist/index.js" @@ -32,62 +31,62 @@ "author": "Kent C. Dodds (https://kentcdodds.com)", "license": "MIT", "dependencies": { - "@babel/cli": "^7.14.5", - "@babel/core": "^7.14.6", - "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/plugin-transform-modules-commonjs": "^7.14.5", - "@babel/plugin-transform-runtime": "^7.14.5", - "@babel/preset-env": "^7.14.7", - "@babel/preset-react": "^7.14.5", - "@babel/preset-typescript": "^7.14.5", - "@babel/runtime": "^7.14.6", + "@babel/cli": "^7.16.7", + "@babel/core": "^7.16.7", + "@babel/plugin-proposal-class-properties": "^7.16.7", + "@babel/plugin-transform-modules-commonjs": "^7.16.7", + "@babel/plugin-transform-runtime": "^7.16.7", + "@babel/preset-env": "^7.16.7", + "@babel/preset-react": "^7.16.7", + "@babel/preset-typescript": "^7.16.7", + "@babel/runtime": "^7.16.7", "@rollup/plugin-babel": "^5.3.0", - "@rollup/plugin-commonjs": "^19.0.1", + "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.0.2", - "@rollup/plugin-replace": "^3.0.0", - "@types/jest": "^26.0.24", + "@rollup/plugin-node-resolve": "^13.1.3", + "@rollup/plugin-replace": "^3.0.1", + "@types/jest": "^27.4.0", "arrify": "^2.0.1", - "babel-jest": "^27.0.6", + "babel-jest": "^27.4.6", "babel-plugin-macros": "^3.1.0", "babel-plugin-minify-dead-code-elimination": "^0.5.1", "babel-plugin-module-resolver": "^4.1.0", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", - "browserslist": "^4.16.6", + "browserslist": "^4.19.1", "builtin-modules": "^3.2.0", - "chalk": "^4.1.1", - "concurrently": "^6.2.0", - "cosmiconfig": "^7.0.0", + "chalk": "^4.1.2", + "concurrently": "^7.0.0", + "cosmiconfig": "^7.0.1", "cpy": "^8.1.2", "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", - "doctoc": "^2.0.1", - "eslint": "^7.31.0", - "eslint-config-kentcdodds": "^19.1.0", - "glob": "^7.1.7", + "doctoc": "^2.1.0", + "eslint": "^8.6.0", + "eslint-config-kentcdodds": "^20.0.0", + "glob": "^7.2.0", "husky": "^4.3.8", - "is-ci": "^3.0.0", - "jest": "^27.0.6", + "is-ci": "^3.0.1", + "jest": "^27.4.7", "jest-serializer-path": "^0.1.15", "jest-snapshot-serializer-raw": "^1.2.0", - "jest-watch-typeahead": "^0.6.4", - "lint-staged": "^11.0.1", + "jest-watch-typeahead": "^1.0.0", + "lint-staged": "^12.1.5", "lodash.camelcase": "^4.3.0", "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^1.0.4", - "prettier": "2.3.2", + "prettier": "2.5.1", "read-pkg-up": "^7.0.1", - "resolve": "^1.20.0", + "resolve": "^1.21.0", "rimraf": "^3.0.2", - "rollup": "^2.53.2", + "rollup": "^2.63.0", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-terser": "^7.0.2", "semver": "^7.3.5", "which": "^2.0.2", - "yargs-parser": "^20.2.9" + "yargs-parser": "^21.0.0" }, "devDependencies": { "jest-in-case": "^1.0.2", From c485fc0dae8f9d348f53a2fb7d7ddcc4b74bc37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Mon, 7 Mar 2022 18:17:30 +0100 Subject: [PATCH 09/16] feat: update dependencies (#226) --- .github/workflows/validate.yml | 10 ++++----- package.json | 38 +++++++++++++++++----------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 4bb7aa5f..bb20ea86 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -24,10 +24,10 @@ jobs: uses: styfle/cancel-workflow-action@0.9.1 - name: ⬇️ Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: ⎔ Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} @@ -54,12 +54,12 @@ jobs: uses: styfle/cancel-workflow-action@0.9.1 - name: ⬇️ Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: ⎔ Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 - name: 📥 Download deps uses: bahmutov/npm-install@v1 diff --git a/package.json b/package.json index a528b4b1..6d89c0fc 100644 --- a/package.json +++ b/package.json @@ -31,29 +31,29 @@ "author": "Kent C. Dodds (https://kentcdodds.com)", "license": "MIT", "dependencies": { - "@babel/cli": "^7.16.7", - "@babel/core": "^7.16.7", + "@babel/cli": "^7.17.6", + "@babel/core": "^7.17.5", "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-transform-modules-commonjs": "^7.16.7", - "@babel/plugin-transform-runtime": "^7.16.7", - "@babel/preset-env": "^7.16.7", + "@babel/plugin-transform-modules-commonjs": "^7.16.8", + "@babel/plugin-transform-runtime": "^7.17.0", + "@babel/preset-env": "^7.16.11", "@babel/preset-react": "^7.16.7", "@babel/preset-typescript": "^7.16.7", - "@babel/runtime": "^7.16.7", - "@rollup/plugin-babel": "^5.3.0", - "@rollup/plugin-commonjs": "^21.0.1", + "@babel/runtime": "^7.17.2", + "@rollup/plugin-babel": "^5.3.1", + "@rollup/plugin-commonjs": "^21.0.2", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.1.3", - "@rollup/plugin-replace": "^3.0.1", - "@types/jest": "^27.4.0", + "@rollup/plugin-replace": "^4.0.0", + "@types/jest": "^27.4.1", "arrify": "^2.0.1", - "babel-jest": "^27.4.6", + "babel-jest": "^27.5.1", "babel-plugin-macros": "^3.1.0", "babel-plugin-minify-dead-code-elimination": "^0.5.1", "babel-plugin-module-resolver": "^4.1.0", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", - "browserslist": "^4.19.1", + "browserslist": "^4.19.3", "builtin-modules": "^3.2.0", "chalk": "^4.1.2", "concurrently": "^7.0.0", @@ -62,31 +62,31 @@ "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", "doctoc": "^2.1.0", - "eslint": "^8.6.0", - "eslint-config-kentcdodds": "^20.0.0", + "eslint": "^8.10.0", + "eslint-config-kentcdodds": "^20.0.1", "glob": "^7.2.0", "husky": "^4.3.8", "is-ci": "^3.0.1", - "jest": "^27.4.7", + "jest": "^27.5.1", "jest-serializer-path": "^0.1.15", "jest-snapshot-serializer-raw": "^1.2.0", "jest-watch-typeahead": "^1.0.0", - "lint-staged": "^12.1.5", + "lint-staged": "^12.3.5", "lodash.camelcase": "^4.3.0", "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^1.0.4", "prettier": "2.5.1", "read-pkg-up": "^7.0.1", - "resolve": "^1.21.0", + "resolve": "^1.22.0", "rimraf": "^3.0.2", - "rollup": "^2.63.0", + "rollup": "^2.69.1", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-terser": "^7.0.2", "semver": "^7.3.5", "which": "^2.0.2", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.0.1" }, "devDependencies": { "jest-in-case": "^1.0.2", From 4b01d0ff61e34b60e334db0b6bb9a3ce20a92514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Tue, 5 Apr 2022 21:12:03 +0200 Subject: [PATCH 10/16] feat: update dependencies (#227) * feat: update dependencies * chore: fix ESLint errors --- package.json | 22 ++++++++--------- src/__tests__/__snapshots__/index.js.snap | 14 +++++------ src/__tests__/index.js | 8 +++---- .../__tests__/__snapshots__/precommit.js.snap | 24 +++++++++---------- src/scripts/__tests__/precommit.js | 4 ++-- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 6d89c0fc..9cd76b32 100644 --- a/package.json +++ b/package.json @@ -32,16 +32,16 @@ "license": "MIT", "dependencies": { "@babel/cli": "^7.17.6", - "@babel/core": "^7.17.5", + "@babel/core": "^7.17.8", "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-transform-modules-commonjs": "^7.16.8", + "@babel/plugin-transform-modules-commonjs": "^7.17.7", "@babel/plugin-transform-runtime": "^7.17.0", "@babel/preset-env": "^7.16.11", "@babel/preset-react": "^7.16.7", "@babel/preset-typescript": "^7.16.7", - "@babel/runtime": "^7.17.2", + "@babel/runtime": "^7.17.8", "@rollup/plugin-babel": "^5.3.1", - "@rollup/plugin-commonjs": "^21.0.2", + "@rollup/plugin-commonjs": "^21.0.3", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.1.3", "@rollup/plugin-replace": "^4.0.0", @@ -53,17 +53,17 @@ "babel-plugin-module-resolver": "^4.1.0", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", - "browserslist": "^4.19.3", + "browserslist": "^4.20.2", "builtin-modules": "^3.2.0", "chalk": "^4.1.2", - "concurrently": "^7.0.0", + "concurrently": "^7.1.0", "cosmiconfig": "^7.0.1", "cpy": "^8.1.2", "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", "doctoc": "^2.1.0", - "eslint": "^8.10.0", - "eslint-config-kentcdodds": "^20.0.1", + "eslint": "^8.12.0", + "eslint-config-kentcdodds": "^20.2.0", "glob": "^7.2.0", "husky": "^4.3.8", "is-ci": "^3.0.1", @@ -71,16 +71,16 @@ "jest-serializer-path": "^0.1.15", "jest-snapshot-serializer-raw": "^1.2.0", "jest-watch-typeahead": "^1.0.0", - "lint-staged": "^12.3.5", + "lint-staged": "^12.3.7", "lodash.camelcase": "^4.3.0", "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^1.0.4", - "prettier": "2.5.1", + "prettier": "2.6.2", "read-pkg-up": "^7.0.1", "resolve": "^1.22.0", "rimraf": "^3.0.2", - "rollup": "^2.69.1", + "rollup": "^2.70.1", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-terser": "^7.0.2", diff --git a/src/__tests__/__snapshots__/index.js.snap b/src/__tests__/__snapshots__/index.js.snap index 343a16e8..7376bee2 100644 --- a/src/__tests__/__snapshots__/index.js.snap +++ b/src/__tests__/__snapshots__/index.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`format calls node with the script path and args 1`] = `node /src/scripts/test.js --no-watch`; +exports[`format calls node with the script path and args including inspect-brk argument: format script 1`] = `node --inspect-brk=3080 /src/scripts/test.js --no-watch`; -exports[`format calls node with the script path and args including inspect-brk argument 1`] = `node --inspect-brk=3080 /src/scripts/test.js --no-watch`; +exports[`format calls node with the script path and args: format script 1`] = `node /src/scripts/test.js --no-watch`; -exports[`format does not log for other signals 1`] = `Array []`; +exports[`format does not log for other signals: format signal 1`] = `Array []`; -exports[`format logs for SIGKILL signal 1`] = ` +exports[`format logs for SIGKILL signal: format signal 1`] = ` Array [ Array [ The script "lint" failed because the process exited too early. This probably means the system ran out of memory or someone called \`kill -9\` on the process., @@ -14,7 +14,7 @@ Array [ ] `; -exports[`format logs for SIGTERM signal 1`] = ` +exports[`format logs for SIGTERM signal: format signal 1`] = ` Array [ Array [ The script "build" failed because the process exited too early. Someone might have called \`kill\` or \`killall\`, or the system could be shutting down., @@ -22,7 +22,7 @@ Array [ ] `; -exports[`format logs help with no args 1`] = ` +exports[`format logs help with no args: format snapshotLog 1`] = ` Array [ Array [ @@ -46,4 +46,4 @@ May the force be with you. ] `; -exports[`format throws unknown script 1`] = `Unknown script "unknown-script".`; +exports[`format throws unknown script: format error 1`] = `Unknown script "unknown-script".`; diff --git a/src/__tests__/index.js b/src/__tests__/index.js index eb69c322..91325e86 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -28,20 +28,20 @@ cases( } require('../') if (snapshotLog) { - expect(console.log.mock.calls).toMatchSnapshot() + expect(console.log.mock.calls).toMatchSnapshot('format snapshotLog') } else if (signal) { expect(process.exit).toHaveBeenCalledTimes(1) expect(process.exit).toHaveBeenCalledWith(1) - expect(console.log.mock.calls).toMatchSnapshot() + expect(console.log.mock.calls).toMatchSnapshot('format signal') } else { expect(crossSpawnSyncMock).toHaveBeenCalledTimes(1) const [firstCall] = crossSpawnSyncMock.mock.calls const [script, calledArgs] = firstCall - expect([script, ...calledArgs].join(' ')).toMatchSnapshot() + expect([script, ...calledArgs].join(' ')).toMatchSnapshot('format script') } } catch (error) { if (throws) { - expect(error.message).toMatchSnapshot() + expect(error.message).toMatchSnapshot('format error') } else { throw error } diff --git a/src/scripts/__tests__/__snapshots__/precommit.js.snap b/src/scripts/__tests__/__snapshots__/precommit.js.snap index 9f717644..4d6fbf72 100644 --- a/src/scripts/__tests__/__snapshots__/precommit.js.snap +++ b/src/scripts/__tests__/__snapshots__/precommit.js.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`pre-commit calls lint-staged CLI with default args 1`] = `lint-staged --config ./src/config/lintstagedrc.js`; +exports[`pre-commit calls lint-staged CLI with default args: pre-commit scriptOne 1`] = `lint-staged --config ./src/config/lintstagedrc.js`; -exports[`pre-commit calls lint-staged CLI with default args 2`] = `npm run validate`; +exports[`pre-commit calls lint-staged CLI with default args: pre-commit scriptTwo 1`] = `npm run validate`; -exports[`pre-commit does not use built-in config with .lintstagedrc file 1`] = `lint-staged`; +exports[`pre-commit does not use built-in config with .lintstagedrc file: pre-commit scriptOne 1`] = `lint-staged`; -exports[`pre-commit does not use built-in config with .lintstagedrc file 2`] = `npm run validate`; +exports[`pre-commit does not use built-in config with .lintstagedrc file: pre-commit scriptTwo 1`] = `npm run validate`; -exports[`pre-commit does not use built-in config with --config 1`] = `lint-staged --config ./custom-config.js`; +exports[`pre-commit does not use built-in config with --config: pre-commit scriptOne 1`] = `lint-staged --config ./custom-config.js`; -exports[`pre-commit does not use built-in config with --config 2`] = `npm run validate`; +exports[`pre-commit does not use built-in config with --config: pre-commit scriptTwo 1`] = `npm run validate`; -exports[`pre-commit does not use built-in config with lint-staged pkg prop 1`] = `lint-staged`; +exports[`pre-commit does not use built-in config with lint-staged pkg prop: pre-commit scriptOne 1`] = `lint-staged`; -exports[`pre-commit does not use built-in config with lint-staged pkg prop 2`] = `npm run validate`; +exports[`pre-commit does not use built-in config with lint-staged pkg prop: pre-commit scriptTwo 1`] = `npm run validate`; -exports[`pre-commit does not use built-in config with lint-staged.config.js file 1`] = `lint-staged`; +exports[`pre-commit does not use built-in config with lint-staged.config.js file: pre-commit scriptOne 1`] = `lint-staged`; -exports[`pre-commit does not use built-in config with lint-staged.config.js file 2`] = `npm run validate`; +exports[`pre-commit does not use built-in config with lint-staged.config.js file: pre-commit scriptTwo 1`] = `npm run validate`; -exports[`pre-commit forwards args 1`] = `lint-staged --config ./src/config/lintstagedrc.js --verbose`; +exports[`pre-commit forwards args: pre-commit scriptOne 1`] = `lint-staged --config ./src/config/lintstagedrc.js --verbose`; -exports[`pre-commit forwards args 2`] = `npm run validate`; +exports[`pre-commit forwards args: pre-commit scriptTwo 1`] = `npm run validate`; diff --git a/src/scripts/__tests__/precommit.js b/src/scripts/__tests__/precommit.js index 76bf605e..fd5d0460 100644 --- a/src/scripts/__tests__/precommit.js +++ b/src/scripts/__tests__/precommit.js @@ -31,9 +31,9 @@ cases( expect(crossSpawnSyncMock).toHaveBeenCalledTimes(2) const [firstCall, secondCall] = crossSpawnSyncMock.mock.calls const [scriptOne, calledArgsOne] = firstCall - expect([scriptOne, ...calledArgsOne].join(' ')).toMatchSnapshot() + expect([scriptOne, ...calledArgsOne].join(' ')).toMatchSnapshot('pre-commit scriptOne') const [scriptTwo, calledArgsTwo] = secondCall - expect([scriptTwo, ...calledArgsTwo].join(' ')).toMatchSnapshot() + expect([scriptTwo, ...calledArgsTwo].join(' ')).toMatchSnapshot('pre-commit scriptTwo') } catch (error) { throw error } finally { From c5851db7b4e33d25548b48b60eb1aff01a349388 Mon Sep 17 00:00:00 2001 From: Chris O'Donnell Date: Tue, 9 Aug 2022 22:49:11 -0400 Subject: [PATCH 11/16] feat: bump deps BREAKING CHANGE: drop Node 12 support --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 9cd75280..16afdf68 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,6 @@ "author": "Chris O'Donnell (http://codfish.io/)", "license": "MIT", "dependencies": { - "@commitlint/cli": "^13.1.0", - "@commitlint/config-conventional": "^13.1.0", "@babel/cli": "^7.17.6", "@babel/core": "^7.17.8", "@babel/plugin-proposal-class-properties": "^7.16.7", @@ -44,6 +42,8 @@ "@babel/preset-react": "^7.16.7", "@babel/preset-typescript": "^7.16.7", "@babel/runtime": "^7.17.8", + "@commitlint/cli": "^17.0.3", + "@commitlint/config-conventional": "^17.0.3", "@rollup/plugin-babel": "^5.3.1", "@rollup/plugin-commonjs": "^21.0.3", "@rollup/plugin-json": "^4.1.0", @@ -57,11 +57,9 @@ "babel-plugin-module-resolver": "^4.0.0", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", - "eslint-config-codfish": "^10.3.0", - "husky": "^7.0.1", "browserslist": "^4.20.2", "builtin-modules": "^3.2.0", - "chalk": "^4.1.2", + "chalk": "^5.0.1", "concurrently": "^7.1.0", "cosmiconfig": "^7.0.1", "cpy": "^8.1.2", @@ -69,20 +67,22 @@ "cross-spawn": "^7.0.3", "doctoc": "^2.1.0", "eslint": "^8.12.0", + "eslint-config-codfish": "^11.0.0", "eslint-config-kentcdodds": "^20.2.0", - "glob": "^7.2.0", + "glob": "^8.0.3", + "husky": "^8.0.1", "is-ci": "^3.0.1", "jest": "^27.5.1", "jest-serializer-path": "^0.1.15", "jest-snapshot-serializer-raw": "^1.2.0", "jest-watch-typeahead": "^1.0.0", - "lint-staged": "^12.3.7", + "lint-staged": "^13.0.3", "lodash.camelcase": "^4.3.0", "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^1.0.4", - "react-app-polyfill": "^2.0.0", - "prettier": "2.6.2", + "prettier": "^2.7.1", + "react-app-polyfill": "^3.0.0", "read-pkg-up": "^7.0.1", "resolve": "^1.22.0", "rimraf": "^3.0.2", From 894cd1a4c4fceda99b48ee19b7188f8c2a058f31 Mon Sep 17 00:00:00 2001 From: Chris O'Donnell Date: Tue, 9 Aug 2022 22:32:52 -0400 Subject: [PATCH 12/16] ci: update node versions --- .github/workflows/release.yml | 2 +- .github/workflows/validate.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1203f0df..62cade44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: 12.x + node-version: 18.x - name: validate before release run: | diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7b9fb716..cd7d7f67 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -8,8 +8,8 @@ jobs: strategy: matrix: - # Test with Node.js v12 (LTS), v14 (LTS), and v16 (latest) - node: [12.x, 14.x, 15.x, 16.x] + # Test with Node.js v14 (LTS), v16 (LTS), and v18 + node: [14.x, 16.x, 18.x] steps: - name: 🛑 Cancel Previous Runs @@ -38,11 +38,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: - node-version: '14.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - name: install dependencies From fc6c23a58b78634ea272743a7abbef69445c57a8 Mon Sep 17 00:00:00 2001 From: Chris O'Donnell Date: Tue, 9 Aug 2022 22:30:41 -0400 Subject: [PATCH 13/16] feat: prettier jsxBracketSameLine -> bracketSameLine --- src/config/prettierrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/prettierrc.js b/src/config/prettierrc.js index 2dff51a0..69d45fab 100644 --- a/src/config/prettierrc.js +++ b/src/config/prettierrc.js @@ -14,7 +14,7 @@ module.exports = { requirePragma: false, singleQuote: true, trailingComma: 'all', - jsxBracketSameLine: false, + bracketSameLine: false, proseWrap: 'always', vueIndentScriptAndStyle: false, } From e725f84486948518b8664d895128ca838c0a8e91 Mon Sep 17 00:00:00 2001 From: Chris O'Donnell Date: Tue, 9 Aug 2022 23:01:01 -0400 Subject: [PATCH 14/16] style: fix linting errors --- src/__tests__/index.js | 4 +++- src/config/jest.config.js | 6 +++++- src/scripts/__tests__/format.js | 2 +- src/scripts/__tests__/pre-commit.js | 8 ++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/__tests__/index.js b/src/__tests__/index.js index 75e9e478..5a7f0190 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -37,7 +37,9 @@ cases( expect(crossSpawnSyncMock).toHaveBeenCalledTimes(1) const [firstCall] = crossSpawnSyncMock.mock.calls const [script, calledArgs] = firstCall - expect([script, ...calledArgs].join(' ')).toMatchSnapshot('format script') + expect([script, ...calledArgs].join(' ')).toMatchSnapshot( + 'format script', + ) } } catch (error) { if (throws) { diff --git a/src/config/jest.config.js b/src/config/jest.config.js index 2efdcdc9..6547015c 100644 --- a/src/config/jest.config.js +++ b/src/config/jest.config.js @@ -17,7 +17,11 @@ const ignores = [ const jestConfig = { roots: [hasFile('src') ? '/src' : ''], - testEnvironment: ifAnyDep(['webpack', 'rollup', 'react', 'preact'], 'jsdom', 'node'), + testEnvironment: ifAnyDep( + ['webpack', 'rollup', 'react', 'preact'], + 'jsdom', + 'node', + ), testURL: 'http://localhost', moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'], modulePaths: ['/src', 'shared', '/tests'], diff --git a/src/scripts/__tests__/format.js b/src/scripts/__tests__/format.js index bab68a53..40322e5e 100644 --- a/src/scripts/__tests__/format.js +++ b/src/scripts/__tests__/format.js @@ -1,5 +1,5 @@ +/* eslint-disable jest/prefer-snapshot-hint */ import cases from 'jest-in-case' - import {winPathSerializer} from './helpers/serializers' expect.addSnapshotSerializer(winPathSerializer) diff --git a/src/scripts/__tests__/pre-commit.js b/src/scripts/__tests__/pre-commit.js index fd5d0460..e59718c8 100644 --- a/src/scripts/__tests__/pre-commit.js +++ b/src/scripts/__tests__/pre-commit.js @@ -31,9 +31,13 @@ cases( expect(crossSpawnSyncMock).toHaveBeenCalledTimes(2) const [firstCall, secondCall] = crossSpawnSyncMock.mock.calls const [scriptOne, calledArgsOne] = firstCall - expect([scriptOne, ...calledArgsOne].join(' ')).toMatchSnapshot('pre-commit scriptOne') + expect([scriptOne, ...calledArgsOne].join(' ')).toMatchSnapshot( + 'pre-commit scriptOne', + ) const [scriptTwo, calledArgsTwo] = secondCall - expect([scriptTwo, ...calledArgsTwo].join(' ')).toMatchSnapshot('pre-commit scriptTwo') + expect([scriptTwo, ...calledArgsTwo].join(' ')).toMatchSnapshot( + 'pre-commit scriptTwo', + ) } catch (error) { throw error } finally { From cd6319562e141b68469f85e675d052ff2cf5cfd4 Mon Sep 17 00:00:00 2001 From: Chris O'Donnell Date: Fri, 12 Aug 2022 15:06:38 -0400 Subject: [PATCH 15/16] feat: bump eslint-config-codfish --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 16afdf68..475656aa 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "cross-spawn": "^7.0.3", "doctoc": "^2.1.0", "eslint": "^8.12.0", - "eslint-config-codfish": "^11.0.0", + "eslint-config-codfish": "^11.1.0", "eslint-config-kentcdodds": "^20.2.0", "glob": "^8.0.3", "husky": "^8.0.1", From becb8dcc284cb2f39835afff74c9f39214c0d50f Mon Sep 17 00:00:00 2001 From: Chris O'Donnell Date: Fri, 12 Aug 2022 15:16:16 -0400 Subject: [PATCH 16/16] feat(jest): add esmodules support --- README.md | 14 ++++++++++++++ src/config/jest.config.js | 19 ++++++++++++++++++- src/utils.js | 2 ++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d3e67e95..f2ef2211 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,20 @@ module.exports = { > configuring things to make it less magical and more straightforward. Extending > can take place on your terms. I think this is actually a great way to do this. +### ES Module Support with jest (`cod-scripts test`) + +As of this writing, jest esmodule support is still a [WIP](https://github.com/facebook/jest/issues/12270). If you're testing a nodejs esmodule, you need to pass +the `--experimental-vm-modules` flag to node. For example: + +**package.json** +```json +"scripts": { + "test": "NODE_OPTIONS=--experimental-vm-modules cod-scripts test" +} +``` + +See: + ### TypeScript Support If the `tsconfig.json`-file is present in the project root directory and diff --git a/src/config/jest.config.js b/src/config/jest.config.js index 6547015c..73190533 100644 --- a/src/config/jest.config.js +++ b/src/config/jest.config.js @@ -1,5 +1,12 @@ const path = require('path') -const {ifAnyDep, hasFile, ifFile, hasPkgProp, fromRoot} = require('../utils') +const { + ifAnyDep, + hasFile, + ifFile, + hasPkgProp, + fromRoot, + isEsm, +} = require('../utils') const here = p => path.join(__dirname, p) @@ -74,6 +81,16 @@ if (useBuiltInBabelConfig) { } } +// make esmodules work +// https://jestjs.io/docs/ecmascript-modules +if (isEsm) { + // see https://github.com/chalk/chalk/issues/532#issuecomment-1062018375 + jestConfig.moduleNameMapper = { + '#(.*)': '/node_modules/$1', + } + jestConfig.transform = {} +} + if (jestConfig.testEnvironment === 'jsdom') { jestConfig.setupFiles = [require.resolve('react-app-polyfill/jsdom')] } diff --git a/src/utils.js b/src/utils.js index f95a8234..aa3daf26 100644 --- a/src/utils.js +++ b/src/utils.js @@ -15,6 +15,7 @@ const {packageJson: pkg, path: pkgPath} = readPkgUp.sync({ cwd: fs.realpathSync(process.cwd()), }) const appDirectory = path.dirname(pkgPath) +const isEsm = pkg.type === 'module' function resolveBin(modName, {executable = modName, cwd = process.cwd()} = {}) { let pathFromWhich @@ -248,4 +249,5 @@ module.exports = { generateTypeDefs, getRollupInputs, getRollupOutput, + isEsm, }