Provide a bundle per app
This commit is contained in:
Родитель
280bb604fb
Коммит
a7680b7885
35
README.md
35
README.md
|
@ -22,17 +22,30 @@ nvm. See https://github.com/creationix/nvm for more info.
|
|||
|
||||
## NPM scripts
|
||||
|
||||
| Script | Description |
|
||||
|------------------------|---------------------------------------------------|
|
||||
| npm start | Starts the express server |
|
||||
| npm test | Runs the tests |
|
||||
| npm run build | Builds the lib |
|
||||
| npm run dev | Starts the dev server (Express + webpack) |
|
||||
| npm run dev:search | As above but just the search code |
|
||||
| npm run dev:disco | As above but just the discovery pane code |
|
||||
| npm run lint | Lints the files with `eslint` (Run in `npm test`)|
|
||||
| npm run eslint | An alias for `npm run lint` |
|
||||
| npm run version-check | Checks you have the minimum node + npm versions |
|
||||
| Script | Description |
|
||||
|------------------------|-------------------------------------------------------|
|
||||
| npm start | Starts the express server (prod mode all apps) |
|
||||
| npm start:disco | Starts the express server (prod mode discovery pane) |
|
||||
| npm start:search | Starts the express server (prod mode search) |
|
||||
| npm test | Runs the tests |
|
||||
| npm run build | Builds the libs (all apps) |
|
||||
| npm run build:disco | Builds the libs (discovery pane) |
|
||||
| npm run build:search | Builds the libs (search) |
|
||||
| npm run dev | Starts the dev server (Express + webpack) |
|
||||
| npm run dev:search | As above but just the search code |
|
||||
| npm run dev:disco | As above but just the discovery pane code |
|
||||
| npm run lint | Lints the files with `eslint` (Run in `npm test`) |
|
||||
| npm run eslint | An alias for `npm run lint` |
|
||||
| npm run version-check | Checks you have the minimum node + npm versions |
|
||||
|
||||
|
||||
### Running a production build of a specific app:
|
||||
|
||||
Running a specific prod build is as follows:
|
||||
|
||||
```
|
||||
npm run build:search && npm run start:search
|
||||
```
|
||||
|
||||
## Overview and rationale
|
||||
|
||||
|
|
28
package.json
28
package.json
|
@ -6,6 +6,8 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"build": "better-npm-run build",
|
||||
"build:disco": "better-npm-run build:disco",
|
||||
"build:search": "better-npm-run build:search",
|
||||
"clean": "rimraf './dist/*+(css|js|map)' './src/webpack-assets.json'",
|
||||
"dev": "concurrently --kill-others 'npm run webpack-dev-server' 'npm run start-dev'",
|
||||
"dev:disco": "better-npm-run dev:disco",
|
||||
|
@ -14,6 +16,8 @@
|
|||
"lint": "eslint .",
|
||||
"servertest": "npm run build && better-npm-run servertest",
|
||||
"start": "better-npm-run start",
|
||||
"start:disco": "better-npm-run start:disco",
|
||||
"start:search": "better-npm-run start:search",
|
||||
"start-dev": "better-npm-run start-dev",
|
||||
"test": "npm run version-check && npm run unittest && npm run servertest && npm run lint",
|
||||
"unittest": "karma start --single-run",
|
||||
|
@ -29,6 +33,18 @@
|
|||
"NODE_PATH": "$NODE_PATH:./src"
|
||||
}
|
||||
},
|
||||
"build:disco": {
|
||||
"command": "npm run build",
|
||||
"env": {
|
||||
"APP_NAME": "disco"
|
||||
}
|
||||
},
|
||||
"build:search": {
|
||||
"command": "npm run build",
|
||||
"env": {
|
||||
"APP_NAME": "search"
|
||||
}
|
||||
},
|
||||
"dev:disco": {
|
||||
"command": "npm run dev",
|
||||
"env": {
|
||||
|
@ -55,6 +71,18 @@
|
|||
"NODE_PATH": "$NODE_PATH:./src"
|
||||
}
|
||||
},
|
||||
"start:search": {
|
||||
"command": "npm run start",
|
||||
"env": {
|
||||
"APP_NAME": "search"
|
||||
}
|
||||
},
|
||||
"start:disco": {
|
||||
"command": "npm run start",
|
||||
"env": {
|
||||
"APP_NAME": "disco"
|
||||
}
|
||||
},
|
||||
"start-dev": {
|
||||
"command": "node bin/server.js",
|
||||
"env": {
|
||||
|
|
|
@ -47,8 +47,8 @@ export default Object.assign({}, webpackConfig, {
|
|||
},
|
||||
output: Object.assign({}, webpackConfig.output, {
|
||||
path: assetsPath,
|
||||
filename: '[name]-[hash].js',
|
||||
chunkFilename: '[name]-[chunkhash].js',
|
||||
filename: `${APP_NAME}-[name]-[chunkhash].js`,
|
||||
chunkFilename: `${APP_NAME}-[name]-[chunkhash].js`,
|
||||
publicPath: `http://${webpackHost}:${webpackPort}/`,
|
||||
}),
|
||||
module: {
|
||||
|
|
|
@ -22,8 +22,8 @@ export default {
|
|||
},
|
||||
output: {
|
||||
path: path.join(__dirname, '../../dist'),
|
||||
filename: '[name]-[chunkhash].js',
|
||||
chunkFilename: '[name]-[chunkhash].js',
|
||||
filename: `${APP_NAME}-[name]-[chunkhash].js`,
|
||||
chunkFilename: `${APP_NAME}-[name]-[chunkhash].js`,
|
||||
publicPath: '/',
|
||||
},
|
||||
module: {
|
||||
|
@ -49,7 +49,7 @@ export default {
|
|||
'NODE_ENV',
|
||||
'API_HOST',
|
||||
]),
|
||||
new ExtractTextPlugin('[name]-[chunkhash].css', {allChunks: true}),
|
||||
new ExtractTextPlugin(`${APP_NAME}-[name]-[chunkhash].css`, {allChunks: true}),
|
||||
// ignore dev config
|
||||
new webpack.IgnorePlugin(/\.\/webpack\.dev/, /\/babel$/),
|
||||
// optimizations
|
||||
|
|
Загрузка…
Ссылка в новой задаче