Skip to content

Commit 3a11043

Browse files
authoredMay 26, 2021
chore: update dependencies (#1465)
1 parent a5fc80b commit 3a11043

15 files changed

+5333
-4936
lines changed
 

‎.changeset/chilly-tables-cheer.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"preact-cli": minor
3+
---
4+
5+
chore: update dependencies

‎.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

‎.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged

‎.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
**/tests/output
33
**/package.json
44
**/*.ejs
5+
.changeset/*.md

‎package.json

+13-16
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,26 @@
99
"prettier": "prettier --write **/*.{js,ts,tsx,json,css,scss,md,yml}",
1010
"lint": "eslint .",
1111
"changeset": "changeset",
12-
"release": "ncp README.md packages/cli/README.md && changeset publish && rimraf packages/cli/README.md"
12+
"release": "ncp README.md packages/cli/README.md && changeset publish && rimraf packages/cli/README.md",
13+
"prepare": "husky install"
1314
},
15+
"dependencies": {},
1416
"devDependencies": {
15-
"@changesets/changelog-github": "^0.2.7",
16-
"@changesets/cli": "^2.10.2",
17+
"@changesets/changelog-github": "^0.4.0",
18+
"@changesets/cli": "^2.16.0",
1719
"babel-eslint": "^10.0.1",
18-
"eslint": "^7.12.1",
19-
"eslint-config-prettier": "^6.15.0",
20+
"eslint": "^7.24.0",
21+
"eslint-config-prettier": "^8.2.0",
2022
"eslint-plugin-babel": "^5.3.0",
21-
"eslint-plugin-prettier": "^3.1.0",
22-
"eslint-plugin-react": "^7.21.5",
23-
"husky": "^4.3.0",
24-
"lerna": "^3.16.4",
25-
"lint-staged": "^10.5.0",
23+
"eslint-plugin-prettier": "^3.4.0",
24+
"eslint-plugin-react": "^7.23.2",
25+
"husky": "^6.0.0",
26+
"lerna": "^4.0.0",
27+
"lint-staged": "^11.0.0",
2628
"ncp": "^2.0.0",
27-
"prettier": "^2.1.2",
29+
"prettier": "^2.2.1",
2830
"rimraf": "^3.0.2"
2931
},
30-
"husky": {
31-
"hooks": {
32-
"pre-commit": "lint-staged"
33-
}
34-
},
3532
"lint-staged": {
3633
"*.js": [
3734
"eslint --fix",

‎packages/async-loader/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"node": ">=8"
1414
},
1515
"dependencies": {
16-
"kleur": "^4.0.2",
16+
"kleur": "^4.1.4",
1717
"loader-utils": "^2.0.0"
1818
},
1919
"peerDependencies": {

‎packages/cli/jest.config.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* For a detailed explanation regarding each configuration property, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
6+
module.exports = {
7+
// All imported modules in your tests should be mocked automatically
8+
automock: false,
9+
10+
// Stop running tests after `n` failures
11+
bail: 0,
12+
13+
// Automatically clear mock calls and instances between every test
14+
clearMocks: true,
15+
16+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
17+
modulePathIgnorePatterns: [
18+
'<rootDir>/tests/output',
19+
'<rootDir>/tests/subjects',
20+
],
21+
22+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
23+
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
24+
25+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
26+
testPathIgnorePatterns: [
27+
'\\\\node_modules\\\\',
28+
'<rootDir>/tests/output',
29+
'<rootDir>/tests/subjects',
30+
],
31+
32+
// This option allows use of a custom test runner
33+
// testRunner: "jest-circus/runner",
34+
};

‎packages/cli/lib/lib/webpack/webpack-base-config.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function getSassConfiguration(...includePaths) {
7070
return config;
7171
}
7272

73-
module.exports = function (env) {
73+
module.exports = function createBaseConfig(env) {
7474
const { cwd, isProd, isWatch, src, source } = env;
7575
const babelConfigFile = env.babelConfig || '.babelrc';
7676
const IS_SOURCE_PREACT_X_OR_ABOVE = isInstalledVersionPreactXOrAbove(cwd);
@@ -260,9 +260,10 @@ module.exports = function (env) {
260260
{
261261
loader: require.resolve('postcss-loader'),
262262
options: {
263-
ident: 'postcss',
264263
sourceMap: true,
265-
plugins: postcssPlugins,
264+
postcssOptions: {
265+
plugins: postcssPlugins,
266+
},
266267
},
267268
},
268269
],
@@ -284,9 +285,10 @@ module.exports = function (env) {
284285
{
285286
loader: require.resolve('postcss-loader'),
286287
options: {
287-
ident: 'postcss',
288288
sourceMap: true,
289-
plugins: postcssPlugins,
289+
postcssOptions: {
290+
plugins: postcssPlugins,
291+
},
290292
},
291293
},
292294
],

‎packages/cli/lib/lib/webpack/webpack-client-config.js

+24-27
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const webpack = require('webpack');
22
const { resolve, join } = require('path');
33
const { existsSync } = require('fs');
44
const { isInstalledVersionPreactXOrAbove } = require('./utils');
5-
const merge = require('webpack-merge');
5+
const { merge } = require('webpack-merge');
66
const { filter } = require('minimatch');
77
const SizePlugin = require('size-plugin');
88
const CopyWebpackPlugin = require('copy-webpack-plugin');
@@ -78,6 +78,22 @@ async function clientConfig(env) {
7878
];
7979
}
8080

81+
let copyPatterns = [
82+
existsSync(source('manifest.json')) && { from: 'manifest.json' },
83+
// copy any static files
84+
existsSync(source('assets')) && { from: 'assets', to: 'assets' },
85+
// copy sw-debug
86+
!isProd && {
87+
from: resolve(__dirname, '../../resources/sw-debug.js'),
88+
to: 'sw-debug.js',
89+
},
90+
// copy files from static to build directory
91+
existsSync(source('static')) && {
92+
from: resolve(source('static')),
93+
to: '.',
94+
},
95+
].filter(Boolean);
96+
8197
return {
8298
entry: entry,
8399
output: {
@@ -130,25 +146,12 @@ async function clientConfig(env) {
130146
new PushManifestPlugin(env),
131147
...(await renderHTMLPlugin(env)),
132148
...getBabelEsmPlugin(env),
133-
new CopyWebpackPlugin(
134-
[
135-
existsSync(source('manifest.json')) && { from: 'manifest.json' },
136-
// copy any static files
137-
existsSync(source('assets')) && { from: 'assets', to: 'assets' },
138-
// copy sw-debug
139-
!isProd && {
140-
from: resolve(__dirname, '../../resources/sw-debug.js'),
141-
to: 'sw-debug.js',
142-
},
143-
// copy files from static to build directory
144-
existsSync(source('static')) && {
145-
from: resolve(source('static')),
146-
to: '.',
147-
},
148-
].filter(Boolean)
149-
),
149+
copyPatterns.length !== 0 &&
150+
new CopyWebpackPlugin({
151+
patterns: copyPatterns,
152+
}),
150153
...swInjectManifest,
151-
],
154+
].filter(Boolean),
152155
};
153156
}
154157

@@ -165,13 +168,7 @@ function getBabelEsmPlugin(config) {
165168
beforeStartExecution: (plugins, newConfig) => {
166169
const babelPlugins = newConfig.plugins;
167170
newConfig.plugins = babelPlugins.filter(plugin => {
168-
if (
169-
Array.isArray(plugin) &&
170-
plugin[0].indexOf('fast-async') !== -1
171-
) {
172-
return false;
173-
}
174-
return true;
171+
return !(Array.isArray(plugin) && plugin[0].includes('fast-async'));
175172
});
176173
plugins.forEach(plugin => {
177174
if (
@@ -319,7 +316,7 @@ function isDev(config) {
319316
};
320317
}
321318

322-
module.exports = async function (env) {
319+
module.exports = async function createClientConfig(env) {
323320
return merge(
324321
baseConfig(env),
325322
await clientConfig(env),

‎packages/cli/lib/lib/webpack/webpack-server-config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { resolve } = require('path');
2-
const merge = require('webpack-merge');
2+
const { merge } = require('webpack-merge');
33
const baseConfig = require('./webpack-base-config');
44

55
function serverConfig(env) {
@@ -26,6 +26,6 @@ function serverConfig(env) {
2626
};
2727
}
2828

29-
module.exports = function (env) {
29+
module.exports = function createServerConfig(env) {
3030
return merge(baseConfig(env), serverConfig(env));
3131
};

‎packages/cli/package.json

+148-157
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,150 @@
11
{
2-
"name": "preact-cli",
3-
"version": "3.1.0",
4-
"description": "Start building a Preact Progressive Web App in seconds.",
5-
"repository": "preactjs/preact-cli",
6-
"main": "lib/index.js",
7-
"bin": {
8-
"preact": "lib/index.js"
9-
},
10-
"scripts": {
11-
"pretest": "rimraf ./tests/output",
12-
"test": "jest --forceExit"
13-
},
14-
"jest": {
15-
"setupFilesAfterEnv": [
16-
"<rootDir>/tests/setup.js"
17-
],
18-
"testEnvironment": "node",
19-
"testPathIgnorePatterns": [
20-
"<rootDir>/tests/output",
21-
"<rootDir>/tests/subjects"
22-
],
23-
"modulePathIgnorePatterns": [
24-
"<rootDir>/tests/output",
25-
"<rootDir>/tests/subjects"
26-
]
27-
},
28-
"engines": {
29-
"node": ">=8"
30-
},
31-
"files": [
32-
"sw",
33-
"lib",
34-
"babel"
35-
],
36-
"keywords": [
37-
"preact",
38-
"cli",
39-
"pwa",
40-
"project",
41-
"generator"
42-
],
43-
"author": "Jason Miller <jason@developit.ca> (http://jasonformat.com)",
44-
"license": "MIT",
45-
"bugs": "https://github.com/preactjs/preact-cli/issues",
46-
"homepage": "https://github.com/preactjs/preact-cli",
47-
"devDependencies": {
48-
"html-looks-like": "^1.0.2",
49-
"jest": "^26.0.1",
50-
"less-loader": "^7.0.1",
51-
"ncp": "^2.0.0",
52-
"node-sass": "^4.12.0",
53-
"p-retry": "^4.1.0",
54-
"polka": "^0.5.2",
55-
"preact": "^10.0.0",
56-
"preact-render-to-string": "^5.0.6",
57-
"preact-router": "^3.0.1",
58-
"puppeteer": "^5.3.1",
59-
"sass-loader": "^10.0.4",
60-
"shelljs": "^0.8.3",
61-
"sirv": "^1.0.0-next.2",
62-
"stylus-loader": "^3.0.2"
63-
},
64-
"peerDependencies": {
65-
"less-loader": "^7.0.1",
66-
"preact": "*",
67-
"preact-render-to-string": "*",
68-
"sass-loader": "^10.0.0 || ^9.0.2",
69-
"stylus-loader": "^3.0.2"
70-
},
71-
"peerDependenciesMeta": {
72-
"less-loader": {
73-
"optional": true
74-
},
75-
"sass-loader": {
76-
"optional": true
77-
},
78-
"stylus-loader": {
79-
"optional": true
80-
}
81-
},
82-
"dependencies": {
83-
"@babel/core": "^7.9.0",
84-
"@babel/plugin-proposal-class-properties": "^7.8.3",
85-
"@babel/plugin-proposal-decorators": "^7.8.3",
86-
"@babel/plugin-proposal-object-rest-spread": "^7.9.0",
87-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
88-
"@babel/plugin-transform-object-assign": "^7.8.3",
89-
"@babel/plugin-transform-react-jsx": "^7.9.0",
90-
"@babel/preset-env": "^7.9.0",
91-
"@babel/preset-typescript": "^7.9.0",
92-
"@preact/async-loader": "^3.0.1",
93-
"@prefresh/webpack": "^1.0.2",
94-
"autoprefixer": "^9.6.0",
95-
"babel-esm-plugin": "^0.9.0",
96-
"babel-loader": "^8.0.6",
97-
"babel-plugin-macros": "^2.5.1",
98-
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
99-
"browserslist": "^4.6.4",
100-
"compression-webpack-plugin": "^4.0.0",
101-
"console-clear": "^1.0.0",
102-
"copy-webpack-plugin": "^5.0.4",
103-
"critters-webpack-plugin": "^2.5.0",
104-
"cross-spawn-promise": "^0.10.1",
105-
"css-loader": "^3.1.0",
106-
"ejs-loader": "^0.5.0",
107-
"envinfo": "^7.3.1",
108-
"esm": "^3.2.25",
109-
"fast-async": "^6.3.7",
110-
"file-loader": "^6.0.0",
111-
"fork-ts-checker-webpack-plugin": "^4.0.4",
112-
"get-port": "^5.0.0",
113-
"gittar": "^0.1.0",
114-
"glob": "^7.1.4",
115-
"html-webpack-exclude-assets-plugin": "0.0.7",
116-
"html-webpack-plugin": "^3.2.0",
117-
"ip": "^1.1.5",
118-
"isomorphic-unfetch": "^3.0.0",
119-
"kleur": "^4.0.2",
120-
"loader-utils": "^2.0.0",
121-
"mini-css-extract-plugin": "^0.9.0",
122-
"minimatch": "^3.0.3",
123-
"native-url": "0.3.4",
124-
"optimize-css-assets-webpack-plugin": "^5.0.1",
125-
"ora": "^4.0.3",
126-
"pnp-webpack-plugin": "^1.6.4",
127-
"postcss-load-config": "^2.1.0",
128-
"postcss-loader": "^3.0.0",
129-
"progress-bar-webpack-plugin": "^2.1.0",
130-
"promise-polyfill": "^8.1.0",
131-
"prompts": "^2.2.1",
132-
"raw-loader": "^4.0.0",
133-
"react-refresh": "0.8.3",
134-
"rimraf": "^3.0.2",
135-
"sade": "^1.4.1",
136-
"size-plugin": "^2.0.1",
137-
"source-map": "^0.7.2",
138-
"stack-trace": "0.0.10",
139-
"style-loader": "^1.1.3",
140-
"terser-webpack-plugin": "^3.0.3",
141-
"typescript": "^3.4.5",
142-
"update-notifier": "^4.1.0",
143-
"url-loader": "^4.0.0",
144-
"validate-npm-package-name": "^3.0.0",
145-
"webpack": "^4.38.0",
146-
"webpack-bundle-analyzer": "^3.3.2",
147-
"webpack-dev-server": "^3.4.1",
148-
"webpack-fix-style-only-entries": "^0.5.1",
149-
"webpack-merge": "^4.1.0",
150-
"webpack-plugin-replace": "^1.2.0",
151-
"which": "^2.0.2",
152-
"workbox-cacheable-response": "^5.1.3",
153-
"workbox-core": "^5.1.3",
154-
"workbox-precaching": "^5.1.3",
155-
"workbox-routing": "^5.1.3",
156-
"workbox-strategies": "^5.1.3",
157-
"workbox-webpack-plugin": "^5.1.3"
158-
}
2+
"name": "preact-cli",
3+
"version": "3.1.0",
4+
"description": "Start building a Preact Progressive Web App in seconds.",
5+
"repository": "preactjs/preact-cli",
6+
"main": "lib/index.js",
7+
"bin": {
8+
"preact": "lib/index.js"
9+
},
10+
"scripts": {
11+
"pretest": "rimraf ./tests/output",
12+
"test": "jest"
13+
},
14+
"engines": {
15+
"node": ">=12"
16+
},
17+
"files": [
18+
"sw",
19+
"lib",
20+
"babel"
21+
],
22+
"keywords": [
23+
"preact",
24+
"cli",
25+
"pwa",
26+
"project",
27+
"generator"
28+
],
29+
"author": "Jason Miller <jason@developit.ca> (http://jasonformat.com)",
30+
"license": "MIT",
31+
"bugs": "https://github.com/preactjs/preact-cli/issues",
32+
"homepage": "https://github.com/preactjs/preact-cli",
33+
"devDependencies": {
34+
"html-looks-like": "^1.0.2",
35+
"jest": "^27.0.1",
36+
"less": "^4.1.1",
37+
"less-loader": "^7.3.0",
38+
"ncp": "^2.0.0",
39+
"p-retry": "^4.5.0",
40+
"polka": "^0.5.2",
41+
"preact": "^10.5.13",
42+
"preact-render-to-string": "^5.1.19",
43+
"preact-router": "^3.0.1",
44+
"puppeteer": "^9.1.1",
45+
"sass": "^1.34.0",
46+
"sass-loader": "^10.2.0",
47+
"shelljs": "^0.8.3",
48+
"sirv": "^1.0.11",
49+
"stylus": "^0.54.8",
50+
"stylus-loader": "^4.3.3"
51+
},
52+
"peerDependencies": {
53+
"less-loader": "^7.3.0",
54+
"preact": "*",
55+
"preact-render-to-string": "*",
56+
"sass-loader": "^10.2.0",
57+
"stylus-loader": "^4.3.3"
58+
},
59+
"peerDependenciesMeta": {
60+
"less-loader": {
61+
"optional": true
62+
},
63+
"sass-loader": {
64+
"optional": true
65+
},
66+
"stylus-loader": {
67+
"optional": true
68+
}
69+
},
70+
"dependencies": {
71+
"@babel/core": "^7.13.16",
72+
"@babel/plugin-proposal-class-properties": "^7.13.0",
73+
"@babel/plugin-proposal-decorators": "^7.13.15",
74+
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
75+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
76+
"@babel/plugin-transform-object-assign": "^7.12.13",
77+
"@babel/plugin-transform-react-jsx": "^7.13.12",
78+
"@babel/preset-env": "^7.13.15",
79+
"@babel/preset-typescript": "^7.13.0",
80+
"@preact/async-loader": "^3.0.1",
81+
"@prefresh/babel-plugin": "^0.4.1",
82+
"@prefresh/webpack": "^3.2.2",
83+
"autoprefixer": "^10.2.5",
84+
"babel-esm-plugin": "^0.9.0",
85+
"babel-loader": "^8.2.2",
86+
"babel-plugin-macros": "^3.1.0",
87+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
88+
"browserlist": "^1.0.1",
89+
"browserslist": "^4.16.4",
90+
"compression-webpack-plugin": "^6.0.4",
91+
"console-clear": "^1.0.0",
92+
"copy-webpack-plugin": "^6.2.1",
93+
"critters-webpack-plugin": "^2.5.0",
94+
"cross-spawn-promise": "^0.10.1",
95+
"css-loader": "^5.2.4",
96+
"ejs-loader": "^0.5.0",
97+
"envinfo": "^7.8.1",
98+
"esm": "^3.2.25",
99+
"fast-async": "^6.3.7",
100+
"file-loader": "^6.2.0",
101+
"fork-ts-checker-webpack-plugin": "^6.2.10",
102+
"get-port": "^5.0.0",
103+
"gittar": "^0.1.0",
104+
"glob": "^7.1.4",
105+
"html-webpack-exclude-assets-plugin": "0.0.7",
106+
"html-webpack-plugin": "^3.2.0",
107+
"ip": "^1.1.5",
108+
"isomorphic-unfetch": "^3.1.0",
109+
"kleur": "^4.1.4",
110+
"loader-utils": "^2.0.0",
111+
"mini-css-extract-plugin": "^1.5.0",
112+
"minimatch": "^3.0.3",
113+
"native-url": "0.3.4",
114+
"optimize-css-assets-webpack-plugin": "^6.0.0",
115+
"ora": "^5.4.0",
116+
"pnp-webpack-plugin": "^1.6.4",
117+
"postcss": "^8.2.10",
118+
"postcss-load-config": "^3.0.1",
119+
"postcss-loader": "^4.0.4",
120+
"progress-bar-webpack-plugin": "^2.1.0",
121+
"promise-polyfill": "^8.2.0",
122+
"prompts": "^2.4.1",
123+
"raw-loader": "^4.0.2",
124+
"react-refresh": "0.10.0",
125+
"rimraf": "^3.0.2",
126+
"sade": "^1.7.4",
127+
"size-plugin": "^3.0.0",
128+
"source-map": "^0.7.2",
129+
"stack-trace": "0.0.10",
130+
"style-loader": "^2.0.0",
131+
"terser-webpack-plugin": "^4.2.3",
132+
"typescript": "^4.2.4",
133+
"update-notifier": "^5.1.0",
134+
"url-loader": "^4.1.1",
135+
"validate-npm-package-name": "^3.0.0",
136+
"webpack": "^4.38.0",
137+
"webpack-bundle-analyzer": "^4.4.2",
138+
"webpack-dev-server": "^3.11.2",
139+
"webpack-fix-style-only-entries": "^0.6.1",
140+
"webpack-merge": "^5.3.0",
141+
"webpack-plugin-replace": "^1.2.0",
142+
"which": "^2.0.2",
143+
"workbox-cacheable-response": "^6.1.5",
144+
"workbox-core": "^6.1.5",
145+
"workbox-precaching": "^6.1.5",
146+
"workbox-routing": "^6.1.5",
147+
"workbox-strategies": "^6.1.5",
148+
"workbox-webpack-plugin": "^6.1.5"
149+
}
159150
}

‎packages/cli/tests/images/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ exports['default-esm'] = exports.full = Object.assign({}, exports.default, {
4545

4646
exports.sass = `
4747
<body>
48-
<div class="background__21gOq">
48+
<div class="background__2mKGE">
4949
<h1>Header on background</h1>
5050
<p>Paragraph on background</p>
5151
</div>

‎packages/cli/tests/service-worker.test.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ describe('preact service worker tests', () => {
4141
await browser.close();
4242
});
4343

44-
afterAll(async () => {
45-
await server.server.stop();
44+
afterAll(() => {
45+
server.server.close();
4646
});
4747

4848
it('works offline', async () => {
@@ -90,7 +90,9 @@ describe('preact service worker tests', () => {
9090
res.text()
9191
);
9292
// eslint-disable-next-line no-useless-escape
93-
expect(swText).toContain('caches.match(T("/200.html")||T("/index.html"))');
93+
expect(swText).toMatch(
94+
/caches.match\(\w\("\/200.html"\)\|\|\w\("\/index.html"\)/
95+
);
9496
const page = await browser.newPage();
9597
await page.setCacheEnabled(false);
9698
await page.goto('http://localhost:3000', {

‎packages/cli/tests/setup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 240 * 1000;
1+
jest.setTimeout(240 * 1000);
22

33
if (!process.env.LISTENING_TO_UNHANDLED_REJECTION) {
44
process.on('unhandledRejection', err => {

‎yarn.lock

+5,086-4,723
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.