cli: WIP build script to generate cli/build folder

This commit is contained in:
Brian Mann
2017-06-19 12:59:27 -04:00
parent 3d7039ddf4
commit 3e72e7be1c
5 changed files with 110 additions and 14 deletions
+37
View File
@@ -0,0 +1,37 @@
const _ = require('lodash')
const path = require('path')
const Promise = require('bluebird')
const fs = Promise.promisifyAll(require('fs-extra'))
// grab the current version from the root monorepo package.json
const { version, description } = require('../../package.json')
const packageJsonSrc = path.join('package.json')
const packageJsonDest = path.join('build', 'package.json')
function preparePackageForNpmRelease (json) {
// modify the existing package.json
// to prepare it for releasing to npm
delete json.devDependencies
delete json['private']
_.extend(json, {
version,
description,
scripts: {
postinstall: 'node index.js --exec install',
size: 't=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";',
},
})
return json
}
fs.readJsonAsync(packageJsonSrc)
.then(preparePackageForNpmRelease)
.then((json) => {
return fs.outputJsonAsync(packageJsonDest, json, {
spaces: 2,
})
})
+9
View File
@@ -0,0 +1,9 @@
## copy over binary
mkdir -p build/bin || true
cp bin/cypress build/bin/cypress
## copy readme
cp NPM_README.md build/README.md
## generate babel'd js index + lib
babel lib -d build/lib && babel index.js -o build/index.js