Skip to content

Commit

Permalink
pkg: Require webpack-cli v4 (#51)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: args from period to space
(e.g., --env readable)

Also requires webpack-cli v4
  • Loading branch information
ntucker committed Oct 24, 2020
1 parent 11933ef commit 4cc699f
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 108 deletions.
6 changes: 3 additions & 3 deletions examples/linaria/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"build": "webpack --mode=production",
"build:server": "webpack --mode=production --target=node",
"build:clean": "rm -rf dist",
"analyze": "webpack --mode=production --env.analyze",
"profile": "webpack --mode=production --env.profile",
"pkgcheck": "webpack --env.check=nobuild",
"analyze": "webpack --mode=production --env analyze",
"profile": "webpack --mode=production --env profile",
"pkgcheck": "webpack --env check=nobuild",
"type-check": "tsc --noEmit",
"format": "eslint --fix \"src/**/*.{js,ts,tsx}\"",
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
Expand Down
6 changes: 3 additions & 3 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"build": "webpack --mode=production",
"build:server": "webpack --mode=production --target=node",
"build:clean": "rm -rf dist",
"analyze": "webpack --mode=production --env.analyze",
"profile": "webpack --mode=production --env.profile",
"pkgcheck": "webpack --env.check=nobuild",
"analyze": "webpack --mode=production --env analyze",
"profile": "webpack --mode=production --env profile",
"pkgcheck": "webpack --env check=nobuild",
"type-check": "tsc --noEmit",
"format": "eslint --fix \"src/**/*.{js,ts,tsx}\"",
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"lerna": "^3.22.1",
"typescript": "^4.0.2",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-cli": "^4.1.0",
"webpack-dev-server": "^3.11.0"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-js/src/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class WebpackGenerator extends InstallPeersMixin(BetterGenerator) {
this.installPeers('@anansi/webpack-config', [], { dev: true });
const devDeps = [
'@anansi/webpack-config',
'webpack-cli@3',
'webpack-cli@4',
'webpack-dev-server@3',
];
if (this?.props?.style === 'linaria') {
Expand Down
6 changes: 3 additions & 3 deletions packages/generator-js/src/webpack/templates/package.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"start": "webpack-dev-server --mode=development",
"prod": "serve <%= assetPath %>",
"build": "webpack --mode=production",
"analyze": "webpack --mode=production --env.analyze",
"profile": "webpack --mode=production --env.profile",
"pkgcheck": "webpack --env.check=nobuild"
"analyze": "webpack --mode=production --env analyze",
"profile": "webpack --mode=production --env profile",
"pkgcheck": "webpack --env check=nobuild"
}
}
14 changes: 7 additions & 7 deletions packages/webpack-config-anansi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ module.exports = makeConfig(options);
"start": "webpack-dev-server --mode=development",
"build": "webpack --mode=production",
"build:server": "webpack --mode=production --target=node",
"analyze": "webpack --mode=production --env.analyze",
"profile": "webpack --mode=production --env.profile",
"pkgcheck": "webpack --env.check=nobuild",
"analyze": "webpack --mode=production --env analyze",
"profile": "webpack --mode=production --env profile",
"pkgcheck": "webpack --env check=nobuild",
}
}
```
Expand Down Expand Up @@ -67,26 +67,26 @@ yarn add --dev react-refresh

If set, will build a static [treemap visualization of your packages](https://www.npmjs.com/package/webpack-bundle-analyzer). Highly recommended to run in production mode to get accurate results.

`webpack --mode=production --env.analyze`
`webpack --mode=production --env analyze`

### check

If set will run package checks to check for duplicates or ciruclar dependencies. Set equal to 'nobuild' for a standalone run where build output is not needed.

Examples:
`webpack --mode=production --env.check` or `webpack --env.check=nobuild`
`webpack --mode=production --env check` or `webpack --env check=nobuild`

### profile

If set, will enable [React DevTools Profiler](https://reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html). This feature is only available in production mode since it is enabled in development by default.

`webpack --mode=production --env.profile`
`webpack --mode=production --env profile`

### readable

Skips minification. This is useful when trying to debug production code.

`webpack --mode=production --env.readable`
`webpack --mode=production --env readable`

### target

Expand Down
6 changes: 5 additions & 1 deletion packages/webpack-config-anansi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
"@hot-loader/react-dom": "^16.0.0",
"@storybook/react": "^6.0.0",
"react-refresh": "^0.8.0",
"webpack": "^4.43.0 || ^5.0.0-beta.28"
"webpack": "^4.43.0 || ^5.0.0-beta.28",
"webpack-cli": "^4.1.0"
},
"peerDependenciesMeta": {
"react-refresh": {
Expand All @@ -106,6 +107,9 @@
},
"@storybook/react": {
"optional": true
},
"webpack-cli": {
"optional": true
}
}
}

0 comments on commit 4cc699f

Please sign in to comment.