Files
cypress/scripts/binary/ask.coffee
T
Gleb Bahmutov a0c08bbdf3 Windows support (#484)
* try installing on Windows

* Handle windows setup

- no browser detection on windows yet, just placeholder code
- symlink types

* add appveyor file

* add appveyor windows build

* use execa to run server unit tests

* run server unit tests on appveyor

* ignore root install errors

* upgrade rebuild-node-sass

and work on Json unit test that fails on Windows

* print npm version

before installing, commented out caching node modules in the root

* a few small tweaks for windows support

* fix bin-up in launcher project

use bin-up@1.1.0 for windows support, close #491

* cli: build script on Windows, close #492

* cli: build errors are fatal

* use cross-env in extension

Fixes environment variables on Windows in #490

* extension: fix 3 tests on Windows

1 more broken test remaining

* extension: use EOL before comparing text

* example: update test for Windows

* example: replace build.sh with build.js

Close #488

* remove trailing whitespace

* cli: build script again

* server: work on unit tests for windows

* binary: add windows as build platform

* windows: try building binary

started work on building on CI for windows
2017-09-25 10:17:28 -04:00

167 lines
3.3 KiB
CoffeeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
_ = require("lodash")
fs = require("fs-extra")
glob = require("glob")
Promise = require("bluebird")
inquirer = require("inquirer")
glob = Promise.promisify(glob)
prompt = (questions) ->
Promise.resolve(inquirer.prompt(questions))
fs = Promise.promisifyAll(fs)
getZipFile = ->
[{
name: "zipFile"
type: "string"
default: "cypress.zip"
message: "Which zip file should we upload?"
}]
getPlatformQuestion = ->
[{
name: "platform"
type: "list"
message: "Which OS should we deploy?"
choices: [{
name: "Mac"
value: "darwin"
},{
name: "Linux"
value: "linux"
}, {
name: "Windows",
value: "win32"
}]
}]
getQuestions = (version) ->
[{
name: "publish"
type: "list"
message: "Publish a new version? (currently: #{version})"
choices: [{
name: "Yes: set a new version and deploy new version."
value: true
},{
name: "No: just override the current deployed version."
value: false
}]
},{
name: "version"
type: "input"
message: "Bump version to...? (currently: #{version})"
default: ->
a = version.split(".")
v = a[a.length - 1]
v = Number(v) + 1
a.splice(a.length - 1, 1, v)
a.join(".")
when: (answers) ->
answers.publish
}]
getReleases = (releases) ->
[{
name: "release"
type: "list"
message: "Release which version?"
choices: _.map releases, (r) ->
{
name: r
value: r
}
}]
getVersions = (releases) ->
[{
name: "version"
type: "list"
message: "Bump to which version?"
choices: _.map releases, (r) ->
{
name: r
value: r
}
}]
getBumpTasks = ->
[{
name: "task"
type: "list"
message: "Which bump task?"
choices: [{
name: "Bump Cypress Version for all CI providers"
value: "version"
},{
name: "Run All Projects for all CI providers"
value: "run"
}]
}]
deployNewVersion = ->
fs.readJsonAsync("./package.json")
.then (json) =>
prompt(getQuestions(json.version))
.then (answers) ->
## set the new version if we're publishing!
## update our own local package.json as well
if answers.publish
# @updateLocalPackageJson(answers.version, json).then ->
answers.version
else
json.version
whichZipFile = ->
prompt(getZipFile())
.get("zipFile")
whichVersion = (distDir) ->
## realpath returns the absolute full path
glob("*/package.json", {cwd: distDir, realpath: true})
.map (pkg) =>
fs.readJsonAsync(pkg)
.get("version")
.then (versions) =>
versions = _.uniq(versions)
prompt(getVersions(versions))
.get("version")
whichRelease = (distDir) ->
## realpath returns the absolute full path
glob("*/package.json", {cwd: distDir, realpath: true})
.map (pkg) =>
fs.readJsonAsync(pkg)
.get("version")
.then (versions) =>
versions = _.uniq(versions)
prompt(getReleases(versions))
.get("release")
whichPlatform = ->
prompt(getPlatformQuestion())
.get("platform")
whichBumpTask = ->
prompt(getBumpTasks())
.get("task")
module.exports = {
getZipFile
getPlatformQuestion
getQuestions
getReleases
getVersions
getBumpTasks
deployNewVersion
whichZipFile
whichVersion
whichRelease
whichPlatform
whichBumpTask
}