Skip to content

Commit 5acba5f

Browse files
kinda working
1 parent 218c80b commit 5acba5f

File tree

9 files changed

+4448
-4330
lines changed

9 files changed

+4448
-4330
lines changed

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
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

package.json

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,26 @@
1111
"prepack": "ncp README.md packages/cli/",
1212
"postpack": "rimraf packages/cli/README.md",
1313
"changeset": "changeset",
14-
"release": "changeset publish"
14+
"release": "changeset publish",
15+
"prepare": "husky install"
1516
},
17+
"dependencies": {},
1618
"devDependencies": {
17-
"@changesets/changelog-github": "^0.2.7",
18-
"@changesets/cli": "^2.10.2",
19+
"@changesets/changelog-github": "^0.4.0",
20+
"@changesets/cli": "^2.16.0",
1921
"babel-eslint": "^10.0.1",
20-
"eslint": "^7.12.1",
21-
"eslint-config-prettier": "^6.15.0",
22+
"eslint": "^7.24.0",
23+
"eslint-config-prettier": "^8.2.0",
2224
"eslint-plugin-babel": "^5.3.0",
23-
"eslint-plugin-prettier": "^3.1.0",
24-
"eslint-plugin-react": "^7.21.5",
25-
"husky": "^4.3.0",
26-
"lerna": "^3.16.4",
27-
"lint-staged": "^10.5.0",
25+
"eslint-plugin-prettier": "^3.4.0",
26+
"eslint-plugin-react": "^7.23.2",
27+
"husky": "^6.0.0",
28+
"lerna": "^4.0.0",
29+
"lint-staged": "^11.0.0",
2830
"ncp": "^2.0.0",
29-
"prettier": "^2.1.2",
31+
"prettier": "^2.2.1",
3032
"rimraf": "^3.0.2"
3133
},
32-
"husky": {
33-
"hooks": {
34-
"pre-commit": "lint-staged"
35-
}
36-
},
3734
"lint-staged": {
3835
"*.js": [
3936
"eslint --fix",

packages/async-loader/package.json

Lines changed: 1 addition & 1 deletion
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/lib/lib/webpack/webpack-client-config.js

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ async function clientConfig(env) {
3737
polyfills: resolve(__dirname, './polyfills'),
3838
};
3939

40+
let copyPatterns = [
41+
existsSync(source('manifest.json')) && { from: 'manifest.json' },
42+
// copy any static files
43+
existsSync(source('assets')) && { from: 'assets', to: 'assets' },
44+
// copy sw-debug
45+
!isProd && {
46+
from: resolve(__dirname, '../../resources/sw-debug.js'),
47+
to: 'sw-debug.js',
48+
},
49+
// copy files from static to build directory
50+
existsSync(source('static')) && {
51+
from: resolve(source('static')),
52+
to: '.',
53+
},
54+
].filter(Boolean);
55+
4056
return {
4157
entry: entry,
4258
output: {
@@ -86,24 +102,11 @@ async function clientConfig(env) {
86102
new PushManifestPlugin(env),
87103
...(await renderHTMLPlugin(env)),
88104
...getBabelEsmPlugin(env),
89-
new CopyWebpackPlugin({
90-
patterns: [
91-
existsSync(source('manifest.json')) && { from: 'manifest.json' },
92-
// copy any static files
93-
existsSync(source('assets')) && { from: 'assets', to: 'assets' },
94-
// copy sw-debug
95-
!isProd && {
96-
from: resolve(__dirname, '../../resources/sw-debug.js'),
97-
to: 'sw-debug.js',
98-
},
99-
// copy files from static to build directory
100-
existsSync(source('static')) && {
101-
from: resolve(source('static')),
102-
to: '.',
103-
},
104-
].filter(Boolean),
105-
}),
106-
],
105+
copyPatterns.length !== 0 &&
106+
new CopyWebpackPlugin({
107+
patterns: copyPatterns,
108+
}),
109+
].filter(Boolean),
107110
};
108111
}
109112

@@ -120,13 +123,7 @@ function getBabelEsmPlugin(config) {
120123
beforeStartExecution: (plugins, newConfig) => {
121124
const babelPlugins = newConfig.plugins;
122125
newConfig.plugins = babelPlugins.filter(plugin => {
123-
if (
124-
Array.isArray(plugin) &&
125-
plugin[0].indexOf('fast-async') !== -1
126-
) {
127-
return false;
128-
}
129-
return true;
126+
return !(Array.isArray(plugin) && plugin[0].includes('fast-async'));
130127
});
131128
plugins.forEach(plugin => {
132129
if (

packages/cli/package.json

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"scripts": {
1111
"pretest": "rimraf ./tests/output",
12-
"test": "jest --forceExit"
12+
"test": "jest --forceExit --silent --bail"
1313
},
1414
"jest": {
1515
"setupFilesAfterEnv": [
@@ -46,93 +46,95 @@
4646
"homepage": "https://github.com/preactjs/preact-cli",
4747
"devDependencies": {
4848
"html-looks-like": "^1.0.2",
49-
"jest": "^26.0.1",
49+
"jest": "^27.0.1",
5050
"mkdirp": "^1.0.3",
5151
"ncp": "^2.0.0",
52-
"node-sass": "^4.12.0",
53-
"p-retry": "^4.1.0",
52+
"node-sass": "^5.0.0",
53+
"p-retry": "^4.5.0",
5454
"polka": "^0.5.2",
55-
"preact": "^10.0.0",
56-
"preact-render-to-string": "^5.0.6",
55+
"preact": "^10.5.13",
56+
"preact-render-to-string": "^5.1.19",
5757
"preact-router": "^3.0.1",
58-
"puppeteer": "^5.3.1",
59-
"sass-loader": "^10.0.4",
58+
"puppeteer": "^8.0.0",
59+
"sass-loader": "^10.1.1",
6060
"shelljs": "^0.8.3",
61-
"sirv": "^1.0.0-next.2"
61+
"sirv": "^1.0.11"
6262
},
6363
"peerDependencies": {
6464
"preact": "*",
6565
"preact-render-to-string": "*"
6666
},
6767
"dependencies": {
68-
"@babel/core": "^7.9.0",
69-
"@babel/plugin-proposal-class-properties": "^7.8.3",
70-
"@babel/plugin-proposal-decorators": "^7.8.3",
71-
"@babel/plugin-proposal-object-rest-spread": "^7.9.0",
68+
"@babel/core": "^7.13.16",
69+
"@babel/plugin-proposal-class-properties": "^7.13.0",
70+
"@babel/plugin-proposal-decorators": "^7.13.15",
71+
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
7272
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
73-
"@babel/plugin-transform-object-assign": "^7.8.3",
74-
"@babel/plugin-transform-react-jsx": "^7.9.0",
75-
"@babel/preset-env": "^7.9.0",
76-
"@babel/preset-typescript": "^7.9.0",
73+
"@babel/plugin-transform-object-assign": "^7.12.13",
74+
"@babel/plugin-transform-react-jsx": "^7.13.12",
75+
"@babel/preset-env": "^7.13.15",
76+
"@babel/preset-typescript": "^7.13.0",
7777
"@preact/async-loader": "^3.0.1",
78-
"@prefresh/webpack": "^2.1.0",
79-
"autoprefixer": "^10.0.1",
78+
"@prefresh/babel-plugin": "^0.4.1",
79+
"@prefresh/webpack": "^3.2.2",
80+
"autoprefixer": "^10.2.5",
8081
"babel-esm-plugin": "^0.9.0",
81-
"babel-loader": "^8.0.6",
82-
"babel-plugin-macros": "^2.5.1",
82+
"babel-loader": "^8.2.2",
83+
"babel-plugin-macros": "^3.1.0",
8384
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
84-
"browserslist": "^4.6.4",
85+
"browserlist": "^1.0.1",
86+
"browserslist": "^4.16.4",
8587
"compression-webpack-plugin": "^6.0.4",
8688
"console-clear": "^1.0.0",
8789
"copy-webpack-plugin": "^6.2.1",
8890
"critters-webpack-plugin": "^2.5.0",
8991
"cross-spawn-promise": "^0.10.1",
90-
"css-loader": "^5.0.0",
92+
"css-loader": "^5.2.4",
9193
"ejs-loader": "^0.5.0",
92-
"envinfo": "^7.3.1",
94+
"envinfo": "^7.8.1",
9395
"esm": "^3.2.25",
9496
"fast-async": "^6.3.7",
95-
"file-loader": "^6.0.0",
97+
"file-loader": "^6.2.0",
9698
"fork-ts-checker-webpack-plugin": "^5.2.1",
9799
"get-port": "^5.0.0",
98100
"gittar": "^0.1.0",
99101
"glob": "^7.1.4",
100102
"html-webpack-exclude-assets-plugin": "0.0.7",
101103
"html-webpack-plugin": "^3.2.0",
102104
"ip": "^1.1.5",
103-
"isomorphic-unfetch": "^3.0.0",
104-
"kleur": "^4.0.2",
105+
"isomorphic-unfetch": "^3.1.0",
106+
"kleur": "^4.1.4",
105107
"loader-utils": "^2.0.0",
106-
"mini-css-extract-plugin": "^1.2.1",
108+
"mini-css-extract-plugin": "^1.5.0",
107109
"minimatch": "^3.0.3",
108110
"native-url": "0.3.4",
109111
"optimize-css-assets-webpack-plugin": "^5.0.1",
110-
"ora": "^5.1.0",
111-
"postcss": "^8.1.4",
112-
"postcss-load-config": "^3.0.0",
112+
"ora": "^5.4.0",
113+
"postcss": "^8.2.10",
114+
"postcss-load-config": "^3.0.1",
113115
"postcss-loader": "^4.0.4",
114116
"progress-bar-webpack-plugin": "^2.1.0",
115-
"promise-polyfill": "^8.1.0",
116-
"prompts": "^2.2.1",
117-
"raw-loader": "^4.0.0",
117+
"promise-polyfill": "^8.2.0",
118+
"prompts": "^2.4.1",
119+
"raw-loader": "^4.0.2",
118120
"react-refresh": "0.9.0",
119121
"require-relative": "^0.8.7",
120122
"resolve-from": "^5.0.0",
121123
"rimraf": "^3.0.2",
122-
"sade": "^1.4.1",
124+
"sade": "^1.7.4",
123125
"size-plugin": "^2.0.1",
124126
"source-map": "^0.7.2",
125127
"stack-trace": "0.0.10",
126128
"style-loader": "^2.0.0",
127129
"terser-webpack-plugin": "^3.0.3",
128-
"typescript": "^4.0.5",
129-
"update-notifier": "^5.0.0",
130-
"url-loader": "^4.0.0",
130+
"typescript": "^4.2.4",
131+
"update-notifier": "^5.1.0",
132+
"url-loader": "^4.1.1",
131133
"validate-npm-package-name": "^3.0.0",
132134
"webpack": "^4.38.0",
133135
"webpack-bundle-analyzer": "^3.3.2",
134-
"webpack-dev-server": "^3.4.1",
135-
"webpack-fix-style-only-entries": "^0.6.0",
136+
"webpack-dev-server": "^3.11.2",
137+
"webpack-fix-style-only-entries": "^0.6.1",
136138
"webpack-merge": "^5.3.0",
137139
"webpack-plugin-replace": "^1.2.0",
138140
"which": "^2.0.2",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ 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).toContain('caches.match(j("/200.html")||j("/index.html")');
9494
const page = await browser.newPage();
9595
await page.setCacheEnabled(false);
9696
await page.goto('http://localhost:3000', {

packages/cli/tests/setup.js

Lines changed: 1 addition & 1 deletion
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 => {

0 commit comments

Comments
 (0)