Skip to content

Commit ce96bf4

Browse files
feat: update dependencies (#228)
Co-authored-by: Michaël De Boey <[email protected]> Co-authored-by: Nick McCurdy <[email protected]>
1 parent 01550fe commit ce96bf4

File tree

10 files changed

+109
-93
lines changed

10 files changed

+109
-93
lines changed

.github/workflows/validate.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: [ubuntu-latest, windows-latest]
20-
node: [12, 14, 16]
20+
node: [12.22.0, 12, 14.17.0, 14, 16.10.0, 16, 18]
2121
runs-on: ${{ matrix.os }}
2222
steps:
2323
- name: 🛑 Cancel Previous Runs

package.json

+75-75
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
"name": "kcd-scripts",
33
"version": "0.0.0-semantically-released",
44
"description": "CLI for common scripts for my projects",
5-
"engines": {
6-
"node": "^12.22.0 || ^14.17.0 || >=16.0.0",
7-
"npm": ">=6"
5+
"keywords": [],
6+
"homepage": "https://github.com/kentcdodds/kcd-scripts#readme",
7+
"bugs": {
8+
"url": "https://github.com/kentcdodds/kcd-scripts/issues"
89
},
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/kentcdodds/kcd-scripts"
13+
},
14+
"license": "MIT",
15+
"author": "Kent C. Dodds <[email protected]> (https://kentcdodds.com)",
916
"bin": {
1017
"kcd-scripts": "dist/index.js"
1118
},
12-
"scripts": {
13-
"test": "node src test",
14-
"test:update": "node src test --updateSnapshot",
15-
"build": "node src build",
16-
"lint": "node src lint",
17-
"format": "node src format",
18-
"validate": "node src validate"
19-
},
2019
"files": [
2120
"dist",
2221
"babel.js",
@@ -27,98 +26,99 @@
2726
"prettier.js",
2827
"shared-tsconfig.json"
2928
],
30-
"keywords": [],
31-
"author": "Kent C. Dodds <[email protected]> (https://kentcdodds.com)",
32-
"license": "MIT",
29+
"scripts": {
30+
"build": "node src build",
31+
"format": "node src format",
32+
"lint": "node src lint",
33+
"test": "node src test",
34+
"test:update": "node src test --updateSnapshot",
35+
"validate": "node src validate"
36+
},
37+
"eslintConfig": {
38+
"extends": [
39+
"kentcdodds",
40+
"kentcdodds/jest"
41+
],
42+
"rules": {
43+
"no-console": "off",
44+
"no-nested-ternary": "off",
45+
"no-process-exit": "off",
46+
"no-useless-catch": "off",
47+
"import/extensions": "off",
48+
"import/no-dynamic-require": "off",
49+
"import/no-import-module-exports": "off",
50+
"import/no-unassigned-import": "off"
51+
}
52+
},
53+
"eslintIgnore": [
54+
"node_modules",
55+
"coverage",
56+
"dist"
57+
],
3358
"dependencies": {
34-
"@babel/cli": "^7.17.6",
35-
"@babel/core": "^7.17.8",
36-
"@babel/plugin-proposal-class-properties": "^7.16.7",
37-
"@babel/plugin-transform-modules-commonjs": "^7.17.7",
38-
"@babel/plugin-transform-runtime": "^7.17.0",
39-
"@babel/preset-env": "^7.16.11",
40-
"@babel/preset-react": "^7.16.7",
41-
"@babel/preset-typescript": "^7.16.7",
42-
"@babel/runtime": "^7.17.8",
59+
"@babel/cli": "^7.18.10",
60+
"@babel/core": "^7.18.13",
61+
"@babel/plugin-proposal-class-properties": "^7.18.6",
62+
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
63+
"@babel/plugin-transform-runtime": "^7.18.10",
64+
"@babel/preset-env": "^7.18.10",
65+
"@babel/preset-react": "^7.18.6",
66+
"@babel/preset-typescript": "^7.18.6",
67+
"@babel/runtime": "^7.18.9",
4368
"@rollup/plugin-babel": "^5.3.1",
44-
"@rollup/plugin-commonjs": "^21.0.3",
69+
"@rollup/plugin-commonjs": "^22.0.2",
4570
"@rollup/plugin-json": "^4.1.0",
46-
"@rollup/plugin-node-resolve": "^13.1.3",
71+
"@rollup/plugin-node-resolve": "^13.3.0",
4772
"@rollup/plugin-replace": "^4.0.0",
48-
"@types/jest": "^27.4.1",
73+
"@types/jest": "^27.5.2",
4974
"arrify": "^2.0.1",
50-
"babel-jest": "^27.5.1",
75+
"babel-jest": "^28.1.3",
5176
"babel-plugin-macros": "^3.1.0",
52-
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
77+
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
5378
"babel-plugin-module-resolver": "^4.1.0",
54-
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
79+
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
5580
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
56-
"browserslist": "^4.20.2",
57-
"builtin-modules": "^3.2.0",
81+
"browserslist": "^4.21.3",
82+
"builtin-modules": "^3.3.0",
5883
"chalk": "^4.1.2",
59-
"concurrently": "^7.1.0",
84+
"concurrently": "^7.3.0",
6085
"cosmiconfig": "^7.0.1",
6186
"cpy": "^8.1.2",
6287
"cross-env": "^7.0.3",
6388
"cross-spawn": "^7.0.3",
64-
"doctoc": "^2.1.0",
65-
"eslint": "^8.12.0",
66-
"eslint-config-kentcdodds": "^20.2.0",
67-
"glob": "^7.2.0",
89+
"doctoc": "^2.2.0",
90+
"eslint": "^8.23.0",
91+
"eslint-config-kentcdodds": "^20.4.0",
92+
"glob": "^8.0.3",
6893
"husky": "^4.3.8",
6994
"is-ci": "^3.0.1",
70-
"jest": "^27.5.1",
95+
"jest": "^28.1.3",
96+
"jest-environment-jsdom": "^28.1.3",
7197
"jest-serializer-path": "^0.1.15",
7298
"jest-snapshot-serializer-raw": "^1.2.0",
73-
"jest-watch-typeahead": "^1.0.0",
74-
"lint-staged": "^12.3.7",
99+
"jest-watch-typeahead": "^1.1.0",
100+
"lint-staged": "^12.5.0",
75101
"lodash.camelcase": "^4.3.0",
76102
"lodash.has": "^4.5.2",
77103
"lodash.omit": "^4.5.0",
78104
"mkdirp": "^1.0.4",
79-
"prettier": "2.6.2",
105+
"prettier": "2.7.1",
80106
"read-pkg-up": "^7.0.1",
81-
"resolve": "^1.22.0",
107+
"resolve": "^1.22.1",
82108
"rimraf": "^3.0.2",
83-
"rollup": "^2.70.1",
84-
"rollup-plugin-node-builtins": "^2.1.2",
85-
"rollup-plugin-node-globals": "^1.4.0",
109+
"rollup": "^2.78.1",
110+
"rollup-plugin-polyfill-node": "^0.10.2",
86111
"rollup-plugin-terser": "^7.0.2",
87-
"semver": "^7.3.5",
112+
"semver": "^7.3.7",
88113
"which": "^2.0.2",
89-
"yargs-parser": "^21.0.1"
114+
"yargs-parser": "^21.1.1"
90115
},
91116
"devDependencies": {
92117
"jest-in-case": "^1.0.2",
93118
"slash": "^3.0.0"
94119
},
95-
"eslintConfig": {
96-
"extends": [
97-
"kentcdodds",
98-
"kentcdodds/jest"
99-
],
100-
"rules": {
101-
"no-process-exit": "off",
102-
"import/no-dynamic-require": "off",
103-
"import/no-import-module-exports": "off",
104-
"import/no-unassigned-import": "off",
105-
"import/extensions": "off",
106-
"no-console": "off",
107-
"no-nested-ternary": "off",
108-
"no-useless-catch": "off"
109-
}
110-
},
111-
"eslintIgnore": [
112-
"node_modules",
113-
"coverage",
114-
"dist"
115-
],
116-
"repository": {
117-
"type": "git",
118-
"url": "https://github.com/kentcdodds/kcd-scripts"
119-
},
120-
"bugs": {
121-
"url": "https://github.com/kentcdodds/kcd-scripts/issues"
122-
},
123-
"homepage": "https://github.com/kentcdodds/kcd-scripts#readme"
120+
"engines": {
121+
"node": "^12.22.0 || ^14.17.0 || ^16.10.0 || >=17.0.0",
122+
"npm": ">=6"
123+
}
124124
}

src/__tests__/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ cases(
3737
expect(crossSpawnSyncMock).toHaveBeenCalledTimes(1)
3838
const [firstCall] = crossSpawnSyncMock.mock.calls
3939
const [script, calledArgs] = firstCall
40-
expect([script, ...calledArgs].join(' ')).toMatchSnapshot('format script')
40+
expect([script, ...calledArgs].join(' ')).toMatchSnapshot(
41+
'format script',
42+
)
4143
}
4244
} catch (error) {
4345
if (throws) {

src/config/jest.config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ const ignores = [
1414
'__mocks__',
1515
]
1616

17+
/** @type {import('@jest/types').Config.InitialOptions} */
1718
const jestConfig = {
1819
roots: ['<rootDir>/src'],
1920
testEnvironment: ifAnyDep(
2021
['webpack', 'rollup', 'react', 'preact'],
2122
'jsdom',
2223
'node',
2324
),
24-
testURL: 'http://localhost',
25+
testEnvironmentOptions: {
26+
url: 'http://localhost',
27+
},
2528
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
2629
modulePaths: ['<rootDir>/src', 'shared', '<rootDir>/tests'],
2730
collectCoverageFrom: ['src/**/*.+(js|jsx|ts|tsx)'],

src/config/prettierrc.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
/** @type {import('prettier').Options} */
12
module.exports = {
23
arrowParens: 'avoid',
4+
bracketSameLine: false,
35
bracketSpacing: false,
46
embeddedLanguageFormatting: 'auto',
57
endOfLine: 'lf',
68
htmlWhitespaceSensitivity: 'css',
79
insertPragma: false,
8-
bracketSameLine: false,
910
jsxSingleQuote: false,
1011
printWidth: 80,
1112
proseWrap: 'always',
1213
quoteProps: 'as-needed',
1314
requirePragma: false,
1415
semi: false,
16+
singleAttributePerLine: false,
1517
singleQuote: true,
1618
tabWidth: 2,
1719
trailingComma: 'all',

src/config/rollup.config.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ const {
99
} = require('@rollup/plugin-node-resolve')
1010
const replace = require('@rollup/plugin-replace')
1111
const camelcase = require('lodash.camelcase')
12-
const {terser} = require('rollup-plugin-terser')
13-
const nodeBuiltIns = require('rollup-plugin-node-builtins')
14-
const nodeGlobals = require('rollup-plugin-node-globals')
1512
const omit = require('lodash.omit')
13+
const nodePolyfills = require('rollup-plugin-polyfill-node')
14+
const {terser} = require('rollup-plugin-terser')
1615
const {
1716
pkg,
1817
hasFile,
@@ -133,13 +132,13 @@ const output = [
133132
},
134133
]
135134

135+
/** @returns {import('rollup').RollupOptions} */
136136
module.exports = {
137137
input: codeSplitting ? input : input[0],
138138
output,
139139
external: externalPredicate,
140140
plugins: [
141-
isNode ? nodeBuiltIns() : null,
142-
isNode ? nodeGlobals() : null,
141+
isNode ? nodePolyfills() : null,
143142
nodeResolve({
144143
preferBuiltins: isNode,
145144
mainFields: ['module', 'main', 'jsnext', 'browser'],

src/run-script.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
const path = require('path')
22
const spawn = require('cross-spawn')
33
const glob = require('glob')
4+
const {toPOSIX} = require('./utils')
45

56
const [executor, ignoredBin, script] = process.argv
67

78
if (script && script !== '--help' && script !== 'help') {
89
spawnScript()
910
} else {
1011
const scriptsPath = path.join(__dirname, 'scripts/')
11-
const scriptsAvailable = glob.sync(path.join(__dirname, 'scripts', '*'))
12+
const scriptsAvailable = glob.sync(
13+
toPOSIX(path.join(__dirname, 'scripts', '*')),
14+
)
1215
// `glob.sync` returns paths with unix style path separators even on Windows.
1316
// So we normalize it before attempting to strip out the scripts path.
1417
const scriptsAvailableMessage = scriptsAvailable

src/scripts/__tests__/precommit.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ cases(
3131
expect(crossSpawnSyncMock).toHaveBeenCalledTimes(2)
3232
const [firstCall, secondCall] = crossSpawnSyncMock.mock.calls
3333
const [scriptOne, calledArgsOne] = firstCall
34-
expect([scriptOne, ...calledArgsOne].join(' ')).toMatchSnapshot('pre-commit scriptOne')
34+
expect([scriptOne, ...calledArgsOne].join(' ')).toMatchSnapshot(
35+
'pre-commit scriptOne',
36+
)
3537
const [scriptTwo, calledArgsTwo] = secondCall
36-
expect([scriptTwo, ...calledArgsTwo].join(' ')).toMatchSnapshot('pre-commit scriptTwo')
38+
expect([scriptTwo, ...calledArgsTwo].join(' ')).toMatchSnapshot(
39+
'pre-commit scriptTwo',
40+
)
3741
} catch (error) {
3842
throw error
3943
} finally {

src/scripts/build/rollup.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
hasFile,
99
resolveBin,
1010
fromRoot,
11+
toPOSIX,
1112
getConcurrentlyArgs,
1213
writeExtraEntry,
1314
hasTypescript,
@@ -76,8 +77,8 @@ function go() {
7677
writeExtraEntry(
7778
'preact',
7879
{
79-
cjs: glob.sync(fromRoot('preact/**/*.cjs.js'))[0],
80-
esm: glob.sync(fromRoot('preact/**/*.esm.js'))[0],
80+
cjs: glob.sync(toPOSIX(fromRoot('preact/**/*.cjs.js')))[0],
81+
esm: glob.sync(toPOSIX(fromRoot('preact/**/*.esm.js')))[0],
8182
},
8283
false,
8384
)
@@ -101,7 +102,7 @@ function go() {
101102
const isCodesplitting = rollupInputs.length > 1
102103

103104
const outputs = isCodesplitting
104-
? glob.sync(fromRoot(path.join(dirpath, format, '*.js')))
105+
? glob.sync(toPOSIX(fromRoot(path.posix.join(dirpath, format, '*.js'))))
105106
: [fromRoot(path.join(dirpath, filename))]
106107

107108
for (const output of outputs) {
@@ -123,8 +124,8 @@ function go() {
123124
// because typescript generates type defs for ignored files, we need to
124125
// remove the ignored files
125126
const ignoredFiles = [
126-
...glob.sync(fromRoot('dist', '**/__tests__/**')),
127-
...glob.sync(fromRoot('dist', '**/__mocks__/**')),
127+
...glob.sync(toPOSIX(fromRoot('dist', '**/__tests__/**'))),
128+
...glob.sync(toPOSIX(fromRoot('dist', '**/__mocks__/**'))),
128129
]
129130
ignoredFiles.forEach(ignoredFile => {
130131
rimraf.sync(ignoredFile)

src/utils.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function resolveBin(modName, {executable = modName, cwd = process.cwd()} = {}) {
5555
}
5656

5757
const fromRoot = (...p) => path.join(appDirectory, ...p)
58+
const toPOSIX = p => p.split(path.sep).join(path.posix.sep)
5859
const hasFile = (...p) => fs.existsSync(fromRoot(...p))
5960
const ifFile = (files, t, f) =>
6061
arrify(files).some(file => hasFile(file)) ? t : f
@@ -192,7 +193,7 @@ function getRollupInputs() {
192193
const buildInputGlob =
193194
process.env.BUILD_INPUT ||
194195
(hasTypescript ? 'src/index.{js,ts,tsx}' : 'src/index.js')
195-
const input = glob.sync(fromRoot(buildInputGlob))
196+
const input = glob.sync(toPOSIX(fromRoot(buildInputGlob)))
196197
if (!input.length) {
197198
throw new Error(`Unable to find files with this glob: ${buildInputGlob}`)
198199
}
@@ -222,6 +223,7 @@ function getRollupOutput(format = process.env.BUILD_FORMAT) {
222223
module.exports = {
223224
appDirectory,
224225
fromRoot,
226+
toPOSIX,
225227
getConcurrentlyArgs,
226228
hasFile,
227229
hasLocalConfig,

0 commit comments

Comments
 (0)