Add build script

This commit is contained in:
Michael Jackson 2017-03-24 18:05:25 -07:00
parent fc5a9311f1
commit 3f8cbe1a5c
2 changed files with 18 additions and 4 deletions

View File

@ -3,10 +3,8 @@
"repository": "unpkg/unpkg.com",
"scripts": {
"start": "heroku local -f Procfile.local",
"build": "npm run build-assets && npm run build-lib",
"build-assets": "NODE_ENV=production webpack -p --json > stats.json",
"build-lib": "rimraf lib && babel ./modules -d lib --copy-files",
"heroku-postbuild": "npm run build",
"build": "node ./tools/build.js",
"heroku-postbuild": "node ./tools/build.js",
"lint": "eslint modules",
"test": "npm run lint"
},

16
tools/build.js Normal file
View File

@ -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'
})
})