binary: add CLI option to skip cleaning output dist folder

This commit is contained in:
Gleb Bahmutov
2017-06-29 16:07:49 -04:00
parent 12f3ec82b4
commit f33aeabfa0
4 changed files with 35 additions and 17 deletions

View File

@@ -188,3 +188,6 @@ You can pass options to each command to avoid answering questions, for example
npm run binary-deploy -- --platform darwin --version 0.20.0
npm run binary-upload -- --platform darwin --version 0.20.0 --zip cypress.zip
```
If something goes wrong, see debug messages using `DEBUG=cypress:binary ...` environment
variable

View File

@@ -49,6 +49,7 @@
"check-more-types": "^2.24.0",
"cloudflare-cli": "^2.1.0",
"coffeelint": "^1.16.0",
"debug": "^2.6.8",
"del": "^3.0.0",
"deps-ok": "^1.2.0",
"electron-osx-sign": "^0.4.6",

View File

@@ -36,7 +36,10 @@ smokeTests = {
linux: runLinuxSmokeTest
}
module.exports = (platform, version) ->
# can pass options to better control the build
# for example
# skipClean - do not delete "dist" folder before build
module.exports = (platform, version, options = {}) ->
distDir = _.partial(meta.distDir, platform)
buildDir = _.partial(meta.buildDir, platform)
buildAppDir = _.partial(meta.buildAppDir, platform)
@@ -46,6 +49,10 @@ module.exports = (platform, version) ->
cleanupPlatform = ->
log("#cleanupPlatform")
if options.skipClean
log("skipClean")
return
cleanup = =>
fs.removeAsync(distDir())
@@ -175,20 +182,16 @@ module.exports = (platform, version) ->
smokeTest()
Promise.resolve()
.then(cleanupPlatform)
.then(buildPackages)
.then(copyPackages)
.then(npmInstallPackages)
.then(createRootPackage)
.then(symlinkPackages)
.then(convertCoffeeToJs)
.then(removeTypeScript)
.then(cleanJs)
.then(symlinkDistPackages)
.then(@obfuscate)
.then(@cleanupSrc)
.then(@npmInstall)
.then(@npmInstall)
# .then(cleanupPlatform)
# .then(buildPackages)
# .then(copyPackages)
# .then(npmInstallPackages)
# .then(createRootPackage)
# .then(symlinkPackages)
# .then(convertCoffeeToJs)
# .then(removeTypeScript)
# .then(cleanJs)
# .then(symlinkDistPackages)
.then(elBuilder)
.then(symlinkBuildPackages)
.then(runSmokeTest)

View File

@@ -9,6 +9,7 @@ Promise = require("bluebird")
minimist = require("minimist")
la = require("lazy-ass")
check = require("check-more-types")
debug = require("debug")("cypress:binary")
zip = require("./zip")
ask = require("./ask")
@@ -77,11 +78,21 @@ deploy = {
# (new Platform(platform, options))
parseOptions: (argv) ->
opts = minimist(argv)
opts = minimist(argv, {
boolean: ["skip-clean"]
default: {
"skip-clean": false
}
alias: {
skipClean: "skip-clean"
}
})
opts.runTests = false if opts["skip-tests"]
if not opts.platform and os.platform() == "linux"
# only can build Linux on Linux
opts.platform = "linux"
debug("parsed command line options")
debug(opts)
opts
bump: ->
@@ -118,7 +129,7 @@ deploy = {
if !options then options = @parseOptions(process.argv)
askMissingOptions(['version', 'platform'])(options)
.then () ->
build(options.platform, options.version)
build(options.platform, options.version, options)
zip: (options) ->
console.log('#zip')