Skip to content

Commit b74a583

Browse files
Merge pull request #267 from FormidableLabs/task/simplify-contribution-process
Simplify contribution process. Integrate inspectpack fixtures.
2 parents ab047f9 + c151062 commit b74a583

File tree

29 files changed

+229
-12
lines changed

29 files changed

+229
-12
lines changed

.eslintrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "formidable/configurations/es6-node",
3+
"rules": {
4+
"func-style": "off",
5+
"arrow-parens": ["error", "as-needed"]
6+
}
7+
}

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# dependencies
2-
node_modules
2+
/node_modules/
33

44
# misc
55
.DS_Store
66
npm-debug.log*
77
.nyc_output
88
.coverage
9-
.lankrc*
109
yarn-error.log
1110
package-lock.json
11+
dist-*
12+
.vscode

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,33 @@ Webpack Dashboard works in Terminal, iTerm 2, and Hyper. For mouse events, like
9494

9595
*Note: you can also just pass a function in as an argument, which then becomes the handler, i.e. `new DashboardPlugin(dashboard.setData)`*
9696

97+
### Local Development
98+
99+
We've standardized our local development process for `webpack-dashboard` on using `yarn`. We recommend using `yarn 1.10.x+`, as these versions include the `integrity` checksum. The checksum helps to verify the integrity of an installed package before its code is executed. 🚀
100+
101+
To run this repo locally against our provided examples, take the usual steps.
102+
103+
```sh
104+
yarn
105+
yarn dev
106+
```
107+
108+
We re-use a small handful of the fixtures from [`inspectpack`](https://github.com/FormidableLabs/inspectpack) so that you can work locally on the dashboard while simulating common `node_modules` dependency issues you might face in the wild. These live in `/examples`.
109+
110+
To change the example you're working against, simply alter the `EXAMPLE` env variable in the `dev` script in `package.json` to match the scenario you want to run in `/examples`. For example, if you want to run the `tree-shaking` example, change the `dev` script from this:
111+
112+
```sh
113+
cross-env EXAMPLE=duplicates-esm node bin/webpack-dashboard.js -- webpack-cli --config examples/config/webpack.config.js --watch
114+
```
115+
116+
to this:
117+
118+
```sh
119+
cross-env EXAMPLE=tree-shaking node bin/webpack-dashboard.js -- webpack-cli --config examples/config/webpack.config.js --watch
120+
```
121+
122+
Then just run `yarn dev` to get up and running. PRs are very much appreciated!
123+
97124
#### Credits
98125

99126
Module output deeply inspired by: [https://github.com/robertknight/webpack-bundle-size-analyzer](https://github.com/robertknight/webpack-bundle-size-analyzer)

bin/webpack-dashboard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const program = new commander.Command("webpack-dashboard");
1313
const pkg = require("../package.json");
1414

1515
// Wrap up side effects in a script.
16-
const main = module.exports = opts => { // eslint-disable-line max-statements
16+
const main = module.exports = opts => { // eslint-disable-line max-statements, complexity
1717
opts = opts || {};
1818
const argv = typeof opts.argv === "undefined" ? process.argv : opts.argv;
1919

examples/.eslintrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"parserOptions": {
3+
"sourceType": "module"
4+
}
5+
}

examples/config/webpack.config.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const { resolve } = require("path");
2+
const { StatsWriterPlugin } = require("webpack-stats-plugin");
3+
const { DuplicatesPlugin } = require("inspectpack/plugin");
4+
const Dashboard = require("../../plugin");
5+
6+
// Specify the directory of the example we're working with
7+
const cwd = `${process.cwd()}/examples/${process.env.EXAMPLE}`;
8+
if (!process.env.EXAMPLE) {
9+
throw new Error("EXAMPLE is required");
10+
}
11+
12+
module.exports = {
13+
mode: "development",
14+
devtool: false,
15+
context: resolve(cwd),
16+
entry: {
17+
bundle: "./src/index.js"
18+
},
19+
output: {
20+
path: resolve(cwd, "dist-development-4"),
21+
pathinfo: true,
22+
filename: "[name].js"
23+
},
24+
plugins: [
25+
new StatsWriterPlugin({
26+
fields: ["assets", "modules"]
27+
}),
28+
new DuplicatesPlugin({
29+
verbose: true,
30+
emitErrors: false
31+
}),
32+
new Dashboard()
33+
]
34+
};

examples/duplicates-esm/node_modules/foo/index.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/duplicates-esm/node_modules/foo/package.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/duplicates-esm/node_modules/uses-foo/index.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)