Add build script
This commit is contained in:
parent
fc5a9311f1
commit
3f8cbe1a5c
|
@ -3,10 +3,8 @@
|
||||||
"repository": "unpkg/unpkg.com",
|
"repository": "unpkg/unpkg.com",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "heroku local -f Procfile.local",
|
"start": "heroku local -f Procfile.local",
|
||||||
"build": "npm run build-assets && npm run build-lib",
|
"build": "node ./tools/build.js",
|
||||||
"build-assets": "NODE_ENV=production webpack -p --json > stats.json",
|
"heroku-postbuild": "node ./tools/build.js",
|
||||||
"build-lib": "rimraf lib && babel ./modules -d lib --copy-files",
|
|
||||||
"heroku-postbuild": "npm run build",
|
|
||||||
"lint": "eslint modules",
|
"lint": "eslint modules",
|
||||||
"test": "npm run lint"
|
"test": "npm run lint"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
const { execSync } = require('child_process')
|
||||||
|
|
||||||
|
console.log('Building CommonJS modules ...')
|
||||||
|
|
||||||
|
execSync('rimraf lib && babel ./modules -d lib --copy-files', {
|
||||||
|
stdio: 'inherit'
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('\nBuilding client bundles ...')
|
||||||
|
|
||||||
|
execSync('webpack -p --json > stats.json', {
|
||||||
|
stdio: 'inherit',
|
||||||
|
env: Object.assign({}, process.env, {
|
||||||
|
NODE_ENV: 'production'
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in New Issue