Files
cypress/cli/scripts/build.js
Nicholas Boll 6db7a83125 chore: Add dtslint and Cypress static types (#1044)
* chore: Add dtslint and Cypress static types

* chore: Fix types location for cli build

* chore: Removed api from api command paths

* chore: Remove semicolons from type definitions

* chore: Removed semicolons not caught by tslint

* chore: Add type tests
2017-12-08 16:41:34 -05:00

53 lines
1.1 KiB
JavaScript

const _ = require('lodash')
const path = require('path')
const fs = require('../lib/fs')
// grab the current version from the root monorepo package.json
const {
version,
description,
author,
homepage,
license,
bugs,
repository,
engines,
} = require('@packages/root')
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,
author,
homepage,
license,
bugs,
repository,
engines,
types: 'types', // typescript types
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,
})
})