mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-03 13:30:26 -05:00
Move deploy scripts (#205)
* root: move deploy scripts from server to top level scripts * remove postinstall download stop variable * deploy: list all dev dependencies * working on deploy run * WIP comment out obsolete run-sequence * add cypress-io/cypress-example-recipes * root: enable run all to skip package or packages by name * deploy: move coffee lint to root * deploy: make bump async * deploy: WIP update deploy + build processes for monorepo * Add cypress-io/cypress-example-module-api project build to bump * remove commas * Add project cypress-io/cypress-test-ci-environments to list of projects to test * deploy: WIP refactor classes -> functional * deploy: don't copy node_modules or prune -> just npm install * cli: consolidate important fields into monorepo root, pull out and build * all: cleanup package.json, remove versions, license, repo information -move some deps to devDeps * all: convert es5 -> es6 + fix linting * deploy: specify files to include when copying packages for dist * deploy: convert coffee script in place + remove coffee files
This commit is contained in:
@@ -40,3 +40,4 @@ docs/support
|
||||
|
||||
# CLI tool
|
||||
cli/build
|
||||
scripts/deploy/support/
|
||||
|
||||
+2
-13
@@ -1,12 +1,11 @@
|
||||
{
|
||||
"name": "cypress",
|
||||
"version": "0.0.0",
|
||||
"description": "dev build project for Cypress NPM package",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
"bin": {
|
||||
"cypress": "bin/cypress"
|
||||
},
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run test-unit",
|
||||
@@ -60,15 +59,5 @@
|
||||
"bin",
|
||||
"lib",
|
||||
"index.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cypress-io/cypress.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress"
|
||||
]
|
||||
}
|
||||
|
||||
+14
-1
@@ -5,7 +5,15 @@ 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 {
|
||||
version,
|
||||
description,
|
||||
author,
|
||||
homepage,
|
||||
license,
|
||||
bugs,
|
||||
repository,
|
||||
} = require('../../package.json')
|
||||
|
||||
const packageJsonSrc = path.join('package.json')
|
||||
const packageJsonDest = path.join('build', 'package.json')
|
||||
@@ -19,6 +27,11 @@ function preparePackageForNpmRelease (json) {
|
||||
_.extend(json, {
|
||||
version,
|
||||
description,
|
||||
author,
|
||||
homepage,
|
||||
license,
|
||||
bugs,
|
||||
repository,
|
||||
scripts: {
|
||||
postinstall: 'node index.js --exec install',
|
||||
size: 't=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "cypress-documentation",
|
||||
"version": "0.0.0",
|
||||
"description": "Cypress.io documentation",
|
||||
"private": true,
|
||||
"hexo": {
|
||||
"version": "3.3.7"
|
||||
|
||||
+36
-5
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "cypress-monorepo",
|
||||
"name": "cypress",
|
||||
"productName": "Cypresss",
|
||||
"version": "0.19.4",
|
||||
"description": "Cypress.io end to end testing tool",
|
||||
"private": true,
|
||||
@@ -15,13 +16,16 @@
|
||||
"all": "node ./scripts/run.js",
|
||||
"test": "echo '⚠️ This root monorepo is only for local development and new contributions. There are no tests.'",
|
||||
"link": "node ./scripts/link-packages.js",
|
||||
"postinstall": "CYPRESS_DOWNLOAD=0 npm run link && npm run all install && npm run build",
|
||||
"postinstall": "npm run link && npm run all install && npm run build",
|
||||
"clean-deps": "npm run all clean-deps",
|
||||
"docker": "./scripts/run-docker-local.sh",
|
||||
"lint": "eslint --fix scripts/*.js",
|
||||
"pretest": "npm run lint && npm run all lint",
|
||||
"precommit": "lint-staged",
|
||||
"precommit-lint": "eslint --fix --rule 'no-only-tests/no-only-tests: 2'"
|
||||
"precommit-lint": "eslint --fix --rule 'no-only-tests/no-only-tests: 2'",
|
||||
"bump": "gulp bump",
|
||||
"deploy": "node ./scripts/deploy.js",
|
||||
"release": "gulp release"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
@@ -30,19 +34,46 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/bumpercar": "^1.0.6",
|
||||
"@cypress/npm-run-all": "^4.0.4",
|
||||
"ascii-table": "0.0.9",
|
||||
"babel-eslint": "^6.0.4",
|
||||
"bluebird": "^3.4.5",
|
||||
"chai": "^4.0.2",
|
||||
"del": "^3.0.0",
|
||||
"electron-osx-sign": "^0.4.6",
|
||||
"deps-ok": "^1.2.0",
|
||||
"eslint": "^3.18.0",
|
||||
"eslint-plugin-mocha": "^4.9.0",
|
||||
"eslint-plugin-no-only-tests": "levibuzolic/eslint-plugin-no-only-tests#dbb7270c4f48e33081729c0ef076441b39f35487",
|
||||
"eslint-plugin-react": "^5.1.1",
|
||||
"fs-extra": "^2.1.2",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-awspublish": "^3.3.0",
|
||||
"gulp-coffee": "^2.3.4",
|
||||
"gulp-debug": "^3.1.0",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"human-interval": "^0.1.6",
|
||||
"husky": "^0.13.4",
|
||||
"inquirer": "^3.1.1",
|
||||
"konfig": "^0.2.1",
|
||||
"lint-staged": "^3.6.0",
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.4",
|
||||
"obfuscator": "^0.5.4",
|
||||
"plist": "^2.1.0",
|
||||
"run-sequence": "^1.2.2",
|
||||
"vagrant": "0.0.1",
|
||||
"vinyl-paths": "^2.1.0",
|
||||
"xvfb": "^0.2.3"
|
||||
},
|
||||
"license": "MIT"
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/cypress-io/cypress",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cypress-io/cypress.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress/issues"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "@packages/desktop-gui",
|
||||
"version": "0.4.9",
|
||||
"description": "Desktop GUI for managing Cypress projects.",
|
||||
"version": "0.0.0",
|
||||
"main": "lib/gui.js",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -17,16 +16,6 @@
|
||||
"test": "echo 'No unit tests to run, but there are e2e tests'",
|
||||
"pretest": "npm run lint"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cypress-io/cypress-core-desktop-gui.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-desktop-gui/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-desktop-gui",
|
||||
"files": [
|
||||
"dist",
|
||||
"lib"
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
var path = require('path')
|
||||
const path = require('path')
|
||||
|
||||
function dist () {
|
||||
var args = [].slice.call(arguments)
|
||||
var paths = [__dirname, '..', 'dist'].concat(args)
|
||||
return path.join.apply(path, paths)
|
||||
function dist (...args) {
|
||||
const paths = [__dirname, '..', 'dist'].concat(args)
|
||||
return path.join(...paths)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getPathToDist: function(){
|
||||
return dist.apply(null, arguments)
|
||||
getPathToDist (...args) {
|
||||
return dist(...args)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "@packages/driver",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"postinstall": "echo '@packages/driver needs: npm run build'",
|
||||
@@ -10,6 +9,10 @@
|
||||
"clean-deps": "rm -rf node_modules",
|
||||
"test": "gulp test"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@cypress/bower-kendo-ui": "0.0.2",
|
||||
"angular": "^1.3.1",
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@packages/electron",
|
||||
"version": "0.3.4",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"electronVersion": "1.4.6",
|
||||
"description": "Cypress electron wrapper shell",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"postinstall": "echo '@packages/electron needs: npm run build'",
|
||||
@@ -15,16 +14,10 @@
|
||||
"bin": {
|
||||
"cypress-electron": "./bin/cypress-electron"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cypress-io/cypress-core-electron.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-electron/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-electron#readme",
|
||||
"files": [
|
||||
"dist",
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@cypress/releaser": "0.1.12",
|
||||
"chai": "^3.5.0",
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
let fs = require('fs')
|
||||
let path = require('path')
|
||||
let glob = require('glob')
|
||||
/* eslint-disable quotes */
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const glob = require('glob')
|
||||
|
||||
function replaceStringsIn (file) {
|
||||
fs.readFile(file, 'utf8', function (err, str) {
|
||||
if (err) throw err
|
||||
|
||||
let replace = function (source, dest) {
|
||||
const replace = function (source, dest) {
|
||||
str = str.split(source).join(dest)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
let path = require('path')
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
getPathToExample () {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"name": "@packages/example",
|
||||
"version": "0.8.0",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Interal Cypress repo for managing https://example.cypress.io",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"postinstall": "echo '@packages/example needs: npm run build'",
|
||||
@@ -17,29 +16,21 @@
|
||||
"lint": "$(bin-up eslint) --fix *.js bin/*.js lib/*.js test/*.js",
|
||||
"pretest": "npm run lint"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cypress-example-kitchensink": "0.7.0",
|
||||
"glob": "^7.0.3"
|
||||
},
|
||||
"files": [
|
||||
"cypress",
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@cypress/releaser": "0.1.12",
|
||||
"bin-up": "^1.0.1",
|
||||
"chai": "^3.5.0",
|
||||
"cypress-example-kitchensink": "0.7.0",
|
||||
"glob": "^7.0.3",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-clean": "^0.3.1",
|
||||
"gulp-gh-pages": "^0.5.4",
|
||||
"gulp-rev-all": "^0.8.22",
|
||||
"mocha": "^2.4.5",
|
||||
"run-sequence": "^1.1.5"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cypress-io/cypress-core-example.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-example/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-example#readme"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"name": "@packages/extension",
|
||||
"version": "0.4.2",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Cypress Chrome Extension",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"postinstall": "echo '@packages/extension needs: npm run build'",
|
||||
@@ -20,18 +19,9 @@
|
||||
"lib",
|
||||
"theme"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cypress-io/cypress-core-extension.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-extension/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-extension#readme",
|
||||
"devDependencies": {
|
||||
"@cypress/core-socket": "0.1.0",
|
||||
"@cypress/icons": "0.5.4",
|
||||
"@cypress/releaser": "0.1.12",
|
||||
"browserify": "^13.0.0",
|
||||
"chai": "^3.5.0",
|
||||
@@ -47,7 +37,6 @@
|
||||
"vinyl-source-stream": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cypress/icons": "0.5.4",
|
||||
"bluebird": "^3.3.5",
|
||||
"lodash": "^4.11.2"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "@packages/https-proxy",
|
||||
"version": "0.1.5",
|
||||
"description": "",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -12,16 +11,9 @@
|
||||
"https": "node https.js",
|
||||
"release": "releaser"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cypress-io/cypress-core-https-proxy.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-https-proxy/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-https-proxy#readme",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@cypress/releaser": "0.1.12",
|
||||
"chai": "^3.5.0",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "@packages/launcher",
|
||||
"version": "0.1.1",
|
||||
"description": "Internal lib for spawning browser processes",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"types": "../ts/index.d.ts",
|
||||
@@ -15,16 +14,9 @@
|
||||
"lint-coffee": "../coffee/node_modules/.bin/coffeelint test/*.coffee test/**/*.coffee",
|
||||
"format-ts": "prettier --no-semi --single-quote --write lib/*.ts lib/**/*.ts"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cypress-io/cypress-core-launcher.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-launcher/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-launcher#readme",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@cypress/releaser": "0.1.12",
|
||||
"@types/bluebird": "^3.5.3",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "@packages/reporter",
|
||||
"version": "0.3.4",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "lib/reporter",
|
||||
"main": "lib/reporter.js",
|
||||
"browser": "src/main",
|
||||
"scripts": {
|
||||
"postinstall": "echo '@packages/reporter needs: npm run build'",
|
||||
@@ -14,6 +14,10 @@
|
||||
"test": "node ./scripts/test.js",
|
||||
"lint": "$(bin-up eslint) --fix lib/*.js scripts/*.js src/*.js* src/**/*.js*"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"dist"
|
||||
],
|
||||
"browserify": {
|
||||
"transform": [
|
||||
[
|
||||
@@ -32,16 +36,6 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cypress-io/cypress-core-reporter.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-reporter/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-reporter#readme",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
var path = require('path')
|
||||
const path = require('path')
|
||||
|
||||
function dist () {
|
||||
var args = [].slice.call(arguments)
|
||||
var paths = [__dirname, '..', 'dist'].concat(args)
|
||||
return path.join.apply(path, paths)
|
||||
function dist (...args) {
|
||||
const paths = [__dirname, '..', 'dist'].concat(args)
|
||||
return path.join(...paths)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getPathToDist: function(){
|
||||
return dist.apply(null, arguments)
|
||||
getPathToDist (...args) {
|
||||
return dist(...args)
|
||||
},
|
||||
|
||||
getPathToIndex: function(){
|
||||
getPathToIndex () {
|
||||
return dist('index.html')
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
{
|
||||
"name": "@packages/runner",
|
||||
"version": "0.3.11",
|
||||
"version": "0.0.0",
|
||||
"main": "lib/runner.js",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cypress-io/cypress-core-runner.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-runner/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-runner#readme",
|
||||
"scripts": {
|
||||
"postinstall": "echo '@packages/runner needs: npm run build'",
|
||||
"build": "node ./scripts/build-dev.js",
|
||||
@@ -24,7 +15,7 @@
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"lib/runner.js"
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@cypress/react-tooltip": "^0.2.4",
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
_ = require("lodash")
|
||||
os = require("os")
|
||||
chalk = require("chalk")
|
||||
Promise = require("bluebird")
|
||||
minimist = require("minimist")
|
||||
zip = require("./zip")
|
||||
ask = require("./ask")
|
||||
bump = require("./bump")
|
||||
meta = require("./meta")
|
||||
upload = require("./upload")
|
||||
Base = require("./base")
|
||||
Linux = require("./linux")
|
||||
Darwin = require("./darwin")
|
||||
|
||||
success = (str) ->
|
||||
console.log chalk.bgGreen(" " + chalk.black(str) + " ")
|
||||
|
||||
fail = (str) ->
|
||||
console.log chalk.bgRed(" " + chalk.black(str) + " ")
|
||||
|
||||
deploy = {
|
||||
zip: zip
|
||||
ask: ask
|
||||
meta: meta
|
||||
upload: upload
|
||||
Base: Base
|
||||
Darwin: Darwin
|
||||
Linux: Linux
|
||||
|
||||
getPlatform: (platform, options) ->
|
||||
platform ?= os.platform()
|
||||
|
||||
Platform = @[platform.slice(0, 1).toUpperCase() + platform.slice(1)]
|
||||
|
||||
throw new Error("Platform: '#{platform}' not found") if not Platform
|
||||
|
||||
options ?= @parseOptions(process.argv.slice(2))
|
||||
|
||||
(new Platform(platform, options))
|
||||
|
||||
parseOptions: (argv) ->
|
||||
opts = minimist(argv)
|
||||
opts.runTests = false if opts["skip-tests"]
|
||||
opts
|
||||
|
||||
build: (platform) ->
|
||||
## read off the argv
|
||||
options = @parseOptions(process.argv)
|
||||
|
||||
@getPlatform(platform?.osName, options).build()
|
||||
|
||||
bump: ->
|
||||
ask.whichBumpTask()
|
||||
.then (task) ->
|
||||
switch task
|
||||
when "run"
|
||||
bump.run()
|
||||
when "version"
|
||||
ask.whichVersion(meta.distDir)
|
||||
.then (v) ->
|
||||
bump.version(v)
|
||||
|
||||
release: ->
|
||||
## read off the argv
|
||||
options = @parseOptions(process.argv)
|
||||
|
||||
release = (version) =>
|
||||
upload.s3Manifest(version)
|
||||
.then ->
|
||||
success("Release Complete")
|
||||
.catch (err) ->
|
||||
fail("Release Failed")
|
||||
reject(err)
|
||||
|
||||
if v = options.version
|
||||
release(v)
|
||||
else
|
||||
ask.whichRelease(meta.distDir)
|
||||
.then(release)
|
||||
|
||||
deploy: ->
|
||||
## read off the argv
|
||||
options = @parseOptions(process.argv)
|
||||
|
||||
ask.whichPlatform()
|
||||
.then (o) =>
|
||||
ask.deployNewVersion()
|
||||
.then (version) =>
|
||||
options.version = version
|
||||
|
||||
@getPlatform(o, options).deploy()
|
||||
.then (platform) =>
|
||||
zip.ditto(platform)
|
||||
.then =>
|
||||
upload.toS3(platform)
|
||||
.then ->
|
||||
success("Dist Complete")
|
||||
.catch (err) ->
|
||||
fail("Dist Failed")
|
||||
console.log(err)
|
||||
|
||||
}
|
||||
|
||||
module.exports = _.bindAll(deploy, _.functions(deploy))
|
||||
@@ -1,18 +1,13 @@
|
||||
{
|
||||
"name": "@packages/server",
|
||||
"productName": "Cypress",
|
||||
"version": "0.19.2",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Javascript Test Engine",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"server": "node index.js --mode server",
|
||||
"repl": "node repl.js",
|
||||
"bump": "gulp bump",
|
||||
"clean-deps": "rm -rf node_modules",
|
||||
"deploy": "gulp deploy",
|
||||
"release": "gulp release",
|
||||
"test": "./test/support/run",
|
||||
"test-watch": "./test/support/watch test",
|
||||
"test-unit": "./test/support/run test/unit",
|
||||
@@ -28,16 +23,10 @@
|
||||
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
||||
"lint": "../coffee/node_modules/.bin/coffeelint test/*.coffee test/unit/*.coffee test/integration/*.coffee"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cypress-io/cypress.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress",
|
||||
"files": [
|
||||
"config",
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"body-parser": "1.12.4",
|
||||
"chokidar-cli": "^1.2.0",
|
||||
@@ -46,7 +35,6 @@
|
||||
"coffee-coverage": "^1.0.1",
|
||||
"cors": "^2.8.3",
|
||||
"coveralls": "^2.11.8",
|
||||
"cypress-bumpercar": "^1.0.5",
|
||||
"electron-osx-sign": "^0.3.0",
|
||||
"express-session": "^1.14.1",
|
||||
"express-useragent": "^1.0.4",
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
var fs = require("fs")
|
||||
var path = require("path")
|
||||
var server = require("socket.io")
|
||||
var client = require("socket.io-client")
|
||||
var version = require("socket.io-client/package.json").version
|
||||
var clientPath = require.resolve("socket.io-client")
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const server = require('socket.io')
|
||||
const client = require('socket.io-client')
|
||||
const version = require('socket.io-client/package.json').version
|
||||
const clientPath = require.resolve('socket.io-client')
|
||||
|
||||
module.exports = {
|
||||
server: server,
|
||||
server,
|
||||
|
||||
client: client,
|
||||
client,
|
||||
|
||||
getPathToClientSource: function(){
|
||||
getPathToClientSource () {
|
||||
// clientPath returns the path to socket.io-client/lib/index.js
|
||||
// so walk up two levels to get to the root
|
||||
return path.join(clientPath, "..", "..", "socket.io.js")
|
||||
return path.join(clientPath, '..', '..', 'socket.io.js')
|
||||
},
|
||||
|
||||
getClientVersion: function(){
|
||||
getClientVersion () {
|
||||
return version
|
||||
},
|
||||
|
||||
getClientSource: function(){
|
||||
return fs.readFileSync(this.getPathToClientSource(), "utf8")
|
||||
}
|
||||
}
|
||||
getClientSource () {
|
||||
return fs.readFileSync(this.getPathToClientSource(), 'utf8')
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,24 +1,16 @@
|
||||
{
|
||||
"name": "@packages/socket",
|
||||
"version": "0.2.1",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Cypress Shared Socket Libs",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "NODE_ENV=test mocha",
|
||||
"test-watch": "NODE_ENV=test mocha --watch",
|
||||
"clean-deps": "rm -rf node_modules"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cypress-io/cypress-core-socket.git"
|
||||
},
|
||||
"author": "Brian Mann",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cypress-io/cypress-core-socket/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cypress-io/cypress-core-socket#readme",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"socket.io": "1.4.5",
|
||||
"socket.io-client": "1.4.5"
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
var path = require('path')
|
||||
const path = require('path')
|
||||
|
||||
function dist () {
|
||||
var args = [].slice.call(arguments)
|
||||
var paths = [__dirname, '..', 'dist'].concat(args)
|
||||
return path.join.apply(path, paths)
|
||||
function dist (...args) {
|
||||
const paths = [__dirname, '..', 'dist'].concat(args)
|
||||
return path.join(...paths)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getPathToDist: function(){
|
||||
return dist.apply(null, arguments)
|
||||
getPathToDist (...args) {
|
||||
return dist(...args)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "@packages/static",
|
||||
"version": "0.0.0",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -7,6 +8,10 @@
|
||||
"build": "gulp build",
|
||||
"test": "echo 'Nothing to test yet'"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@cypress/icons": "0.5.4",
|
||||
"gulp": "^3.9.1"
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
{
|
||||
"name": "@packages/ts",
|
||||
"version": "1.0.0",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "TypeScript runtime Node hook",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"ts-node": "^3.0.4",
|
||||
"typescript": "^2.3.2"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
require('@packages/coffee/register')
|
||||
|
||||
require('./deploy/index').deploy()
|
||||
@@ -4,7 +4,10 @@ glob = require("glob")
|
||||
Promise = require("bluebird")
|
||||
inquirer = require("inquirer")
|
||||
|
||||
throw new Error("TODO: upgrade inquirer to promise interface")
|
||||
glob = Promise.promisify(glob)
|
||||
|
||||
prompt = (questions) ->
|
||||
Promise.resolve(inquirer.prompt(questions))
|
||||
|
||||
fs = Promise.promisifyAll(fs)
|
||||
|
||||
@@ -89,55 +92,48 @@ module.exports = {
|
||||
}]
|
||||
|
||||
deployNewVersion: ->
|
||||
new Promise (resolve, reject) =>
|
||||
fs.readJsonAsync("./package.json").then (json) =>
|
||||
inquirer.prompt @getQuestions(json.version), (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 ->
|
||||
resolve(answers.version)
|
||||
else
|
||||
resolve(json.version)
|
||||
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
|
||||
|
||||
whichVersion: (distDir) ->
|
||||
new Promise (resolve, reject) =>
|
||||
## realpath returns the absolute full path
|
||||
glob "*/package.json", {cwd: distDir, realpath: true}, (err, pkgs) =>
|
||||
return reject(err) if err
|
||||
## 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)
|
||||
|
||||
Promise
|
||||
.map pkgs, (pkg) ->
|
||||
fs.readJsonAsync(pkg).get("version")
|
||||
.then (versions) =>
|
||||
versions = _.uniq(versions)
|
||||
|
||||
inquirer.prompt @getVersions(versions), (answers) =>
|
||||
resolve(answers.version)
|
||||
prompt(@getVersions(versions))
|
||||
.get("version")
|
||||
|
||||
whichRelease: (distDir) ->
|
||||
new Promise (resolve, reject) =>
|
||||
## realpath returns the absolute full path
|
||||
glob "*/package.json", {cwd: distDir, realpath: true}, (err, pkgs) =>
|
||||
return reject(err) if err
|
||||
## 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)
|
||||
|
||||
Promise
|
||||
.map pkgs, (pkg) ->
|
||||
fs.readJsonAsync(pkg).get("version")
|
||||
.then (versions) =>
|
||||
versions = _.uniq(versions)
|
||||
|
||||
inquirer.prompt @getReleases(versions), (answers) =>
|
||||
resolve(answers.release)
|
||||
prompt(@getReleases(versions))
|
||||
.get("release")
|
||||
|
||||
whichPlatform: ->
|
||||
new Promise (resolve, reject) =>
|
||||
inquirer.prompt @getPlatformQuestion(), (answers) =>
|
||||
resolve(answers.platform)
|
||||
prompt(@getPlatformQuestion())
|
||||
.get("platform")
|
||||
|
||||
whichBumpTask: ->
|
||||
new Promise (resolve, reject) =>
|
||||
inquirer.prompt @getBumpTasks(), (answers) =>
|
||||
resolve(answers.task)
|
||||
prompt(@getBumpTasks())
|
||||
.get("task")
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
require("../gulpfile.coffee")
|
||||
|
||||
_ = require("lodash")
|
||||
$ = require("gulp-load-plugins")()
|
||||
gulpCoffee = require("gulp-coffee")
|
||||
fs = require("fs-extra")
|
||||
cp = require("child_process")
|
||||
path = require("path")
|
||||
@@ -11,19 +9,25 @@ chalk = require("chalk")
|
||||
expect = require("chai").expect
|
||||
Promise = require("bluebird")
|
||||
obfuscator = require("obfuscator")
|
||||
runSequence = require("run-sequence")
|
||||
# runSequence = require("run-sequence")
|
||||
cypressElectron = require("@packages/electron")
|
||||
log = require("./log")
|
||||
meta = require("./meta")
|
||||
pkg = require("../package.json")
|
||||
konfig = require("../lib/konfig")
|
||||
appData = require("../lib/util/app_data")
|
||||
Fixtures = require("../test/support/helpers/fixtures")
|
||||
pkg = require("../../package.json")
|
||||
konfig = require("@packages/server/lib/konfig")
|
||||
appData = require("@packages/server/lib/util/app_data")
|
||||
Fixtures = require("@packages/server/test/support/helpers/fixtures")
|
||||
|
||||
# pkgr = Promise.promisify(pkgr)
|
||||
fs = Promise.promisifyAll(fs)
|
||||
glob = Promise.promisify(glob)
|
||||
zipName = "cypress.zip"
|
||||
|
||||
DEFAULT_PATHS = "node_modules package.json".split(" ")
|
||||
|
||||
pathToPackageJson = (pkg) ->
|
||||
path.join(pkg, "package.json")
|
||||
|
||||
class Base
|
||||
constructor: (os, @options = {}) ->
|
||||
_.defaults @options,
|
||||
@@ -49,8 +53,10 @@ class Base
|
||||
getVersion: ->
|
||||
@options.version ? fs.readJsonSync(@distDir("package.json")).version
|
||||
|
||||
copyFiles: ->
|
||||
@log("#copyFiles")
|
||||
copyPackages: ->
|
||||
@log("#copyPackages")
|
||||
|
||||
dist = @distDir()
|
||||
|
||||
copy = (src, dest) =>
|
||||
dest ?= src
|
||||
@@ -58,81 +64,105 @@ class Base
|
||||
|
||||
fs.copyAsync(src, dest)
|
||||
|
||||
copyRelativePathToDist = (relative) ->
|
||||
dest = path.join(dist, relative)
|
||||
|
||||
console.log(relative, "->", dest)
|
||||
|
||||
# copy = ->
|
||||
# new Promise (resolve, reject) ->
|
||||
# cp.spawn("cp", ["-R", relative, dest], {stdio: "inherit"})
|
||||
# .on "error", reject
|
||||
# .on "exit", resolve
|
||||
|
||||
# if relative.includes(".")
|
||||
# copy()
|
||||
# else
|
||||
# fs.ensureDirAsync(dest)
|
||||
# .then(copy)
|
||||
|
||||
fs.copyAsync(relative, dest)
|
||||
|
||||
copyPackage = (pkg) ->
|
||||
## copies the package to dist
|
||||
## including the default paths
|
||||
## and any specified in package.json files
|
||||
fs.readJsonAsync(pathToPackageJson(pkg))
|
||||
.then (json) ->
|
||||
## grab all the files
|
||||
## and default included paths
|
||||
## and convert to relative paths
|
||||
DEFAULT_PATHS
|
||||
.concat(json.files or [])
|
||||
.map (file) ->
|
||||
path.join(pkg, file)
|
||||
.map(copyRelativePathToDist, {concurrency: 1})
|
||||
|
||||
## fs-extra concurrency tests (copyPackage / copyRelativePathToDist)
|
||||
## 1/1 41688
|
||||
## 1/5 42218
|
||||
## 1/10 42566
|
||||
## 2/1 45041
|
||||
## 2/2 43589
|
||||
## 3/3 51399
|
||||
|
||||
## cp -R concurrency tests
|
||||
## 1/1 65811
|
||||
|
||||
started = new Date()
|
||||
|
||||
fs
|
||||
.removeAsync(@distDir())
|
||||
.removeAsync(dist)
|
||||
.bind(@)
|
||||
.then ->
|
||||
fs.ensureDirAsync(@distDir())
|
||||
fs.ensureDirAsync(dist)
|
||||
.then ->
|
||||
[
|
||||
## copy root files
|
||||
copy("./package.json")
|
||||
copy("./config/app.yml")
|
||||
copy("./lib/html")
|
||||
copy("./lib/public")
|
||||
copy("./lib/scaffold")
|
||||
copy("./lib/ipc")
|
||||
glob("./packages/*")
|
||||
.map(copyPackage, {concurrency: 1})
|
||||
.then ->
|
||||
console.log("Finished Copying", new Date() - started)
|
||||
|
||||
## copy entry point
|
||||
copy("./index.js", "/src/index.js")
|
||||
prunePackages: ->
|
||||
pathToDistPackages = @distDir("packages", "*")
|
||||
|
||||
## copy coffee src files
|
||||
copy("./lib/automation", "/src/lib/automation")
|
||||
copy("./lib/browsers", "/src/lib/browsers")
|
||||
copy("./lib/controllers", "/src/lib/controllers")
|
||||
copy("./lib/gui", "/src/lib/gui")
|
||||
copy("./lib/modes", "/src/lib/modes")
|
||||
copy("./lib/util", "/src/lib/util")
|
||||
copy("./lib/api.coffee", "/src/lib/api.coffee")
|
||||
copy("./lib/cache.coffee", "/src/lib/cache.coffee")
|
||||
copy("./lib/config.coffee", "/src/lib/config.coffee")
|
||||
copy("./lib/cwd.coffee", "/src/lib/cwd.coffee")
|
||||
copy("./lib/cypress.coffee", "/src/lib/cypress.coffee")
|
||||
copy("./lib/environment.coffee", "/src/lib/environment.coffee")
|
||||
copy("./lib/errors.coffee", "/src/lib/errors.coffee")
|
||||
copy("./lib/exception.coffee", "/src/lib/exception.coffee")
|
||||
copy("./lib/exec.coffee", "/src/lib/exec.coffee")
|
||||
copy("./lib/file_server.coffee", "/src/lib/file_server.coffee")
|
||||
copy("./lib/files.coffee", "/src/lib/files.coffee")
|
||||
copy("./lib/fixture.coffee", "/src/lib/fixture.coffee")
|
||||
copy("./lib/ids.coffee", "/src/lib/ids.coffee")
|
||||
copy("./lib/konfig.coffee", "/src/lib/konfig.coffee")
|
||||
copy("./lib/logger.coffee", "/src/lib/logger.coffee")
|
||||
copy("./lib/open_project.coffee", "/src/lib/open_project.coffee")
|
||||
copy("./lib/project.coffee", "/src/lib/project.coffee")
|
||||
copy("./lib/reporter.coffee", "/src/lib/reporter.coffee")
|
||||
copy("./lib/request.coffee", "/src/lib/request.coffee")
|
||||
copy("./lib/routes.coffee", "/src/lib/routes.coffee")
|
||||
copy("./lib/saved_state.coffee", "/src/lib/saved_state.coffee")
|
||||
copy("./lib/scaffold.coffee", "/src/lib/scaffold.coffee")
|
||||
copy("./lib/screenshots.coffee", "/src/lib/screenshots.coffee")
|
||||
copy("./lib/server.coffee", "/src/lib/server.coffee")
|
||||
copy("./lib/socket.coffee", "/src/lib/socket.coffee")
|
||||
copy("./lib/stats.coffee", "/src/lib/stats.coffee")
|
||||
copy("./lib/stdout.coffee", "/src/lib/stdout.coffee")
|
||||
copy("./lib/updater.coffee", "/src/lib/updater.coffee")
|
||||
copy("./lib/upload.coffee", "/src/lib/upload.coffee")
|
||||
copy("./lib/user.coffee", "/src/lib/user.coffee")
|
||||
copy("./lib/video.coffee", "/src/lib/video.coffee")
|
||||
copy("./lib/watchers.coffee", "/src/lib/watchers.coffee")
|
||||
## 1,060,495,784 bytes (1.54 GB on disk) for 179,156 items
|
||||
## 313,416,512 bytes (376.6 MB on disk) for 23,576 items
|
||||
|
||||
]
|
||||
.all()
|
||||
prune = (pkg) ->
|
||||
console.log("prune", pkg)
|
||||
|
||||
convertToJs: ->
|
||||
@log("#convertToJs")
|
||||
new Promise (resolve, reject) ->
|
||||
cp.spawn("npm", ["prune", "--production"], {
|
||||
cwd: pkg
|
||||
stdio: "inherit"
|
||||
})
|
||||
.on("error", reject)
|
||||
.on("exit", (code) ->
|
||||
if code is 0
|
||||
resolve()
|
||||
else
|
||||
reject(new Error("'npm prune --production' on #{pkg} failed with exit code: #{code}"))
|
||||
)
|
||||
|
||||
## prunes out all of the devDependencies
|
||||
## from what was copied
|
||||
glob(pathToDistPackages)
|
||||
.map(prune)
|
||||
|
||||
convertCoffeeToJs: ->
|
||||
@log("#convertCoffeeToJs")
|
||||
|
||||
## grab everything in src
|
||||
## convert to js
|
||||
new Promise (resolve, reject) =>
|
||||
gulp.src(@distDir("src/**/*.coffee"))
|
||||
.pipe $.coffee()
|
||||
.pipe gulp.dest(@distDir("src"))
|
||||
.on "end", resolve
|
||||
.on "error", reject
|
||||
gulp.src(@distDir("lib", "**", "*.coffee"))
|
||||
.pipe gulpCoffee()
|
||||
.pipe gulp.dest(@distDir("lib"))
|
||||
.on("end", resolve)
|
||||
.on("error", reject)
|
||||
|
||||
distDir: (src) ->
|
||||
args = _.compact [meta.distDir, @osName, src]
|
||||
distDir: (args...) ->
|
||||
args = _.compact [meta.distDir, @osName, args...]
|
||||
path.join args...
|
||||
|
||||
obfuscate: ->
|
||||
@@ -172,23 +202,54 @@ class Base
|
||||
|
||||
cleanup().catch(cleanup)
|
||||
|
||||
## add tests around this method
|
||||
updatePackage: ->
|
||||
@log("#updatePackage")
|
||||
symlinkPackages: ->
|
||||
@log("#symlinkPackages")
|
||||
|
||||
dist = @distDir()
|
||||
pathToPackages = path.join('node_modules', '@')
|
||||
pathToDistPackages = @distDir("packages", "*")
|
||||
|
||||
symlink = (pkg) ->
|
||||
# console.log(pkg, dist)
|
||||
## strip off the initial './'
|
||||
## ./packages/foo -> node_modules/@packages/foo
|
||||
dest = path.join(dist, "node_modules", "@packages", path.basename(pkg))
|
||||
|
||||
fs.ensureSymlinkAsync(pkg, dest)
|
||||
|
||||
glob(pathToDistPackages)
|
||||
.map(symlink)
|
||||
|
||||
# // glob all of the names of packages
|
||||
# glob('./packages/*')
|
||||
# .map((folder) => {
|
||||
# // strip off the initial './'
|
||||
# // ./packages/foo -> node_modules/@packages/foo
|
||||
# const dest = pathToPackages + folder.slice(2)
|
||||
#
|
||||
# console.log('symlinking', folder, '->', dest)
|
||||
#
|
||||
# return fs.ensureSymlinkAsync(folder, dest)
|
||||
# })
|
||||
|
||||
## add tests around this method
|
||||
createRootPackage: ->
|
||||
version = @options.version
|
||||
|
||||
fs.readJsonAsync(@distDir("package.json")).then (json) =>
|
||||
json.env = "production"
|
||||
json.version = version if version
|
||||
json.scripts = {}
|
||||
@log("#createRootPackage #{version}")
|
||||
|
||||
@log("#settingVersion: #{json.version}")
|
||||
fs.outputJsonAsync(@distDir("package.json"), {
|
||||
name: "cypress"
|
||||
productName: "Cypress",
|
||||
version: version
|
||||
main: "index.js"
|
||||
scripts: {}
|
||||
env: "production"
|
||||
})
|
||||
.then =>
|
||||
str = "require('./packages/server')"
|
||||
|
||||
delete json.devDependencies
|
||||
delete json.bin
|
||||
|
||||
fs.writeJsonAsync(@distDir("package.json"), json)
|
||||
fs.outputFileAsync(@distDir("index.js"), str)
|
||||
|
||||
npmInstall: ->
|
||||
@log("#npmInstall")
|
||||
@@ -247,12 +308,21 @@ class Base
|
||||
log: ->
|
||||
log.apply(@, arguments)
|
||||
|
||||
gulpBuild: ->
|
||||
@log("#gulpBuild")
|
||||
buildPackages: ->
|
||||
@log("#buildPackages")
|
||||
|
||||
new Promise (resolve, reject) ->
|
||||
runSequence "app:build", (err) ->
|
||||
if err then reject(err) else resolve()
|
||||
console.log(process.cwd())
|
||||
|
||||
## build all the packages except for
|
||||
## cli and docs
|
||||
cp.spawn("npm", ["run", "all", "build", "--", "--skip-packages", "cli,docs"], { stdio: "inherit" })
|
||||
.on "error", reject
|
||||
.on "exit", (code) ->
|
||||
if code is 0
|
||||
resolve()
|
||||
else
|
||||
reject(new Error("'npm run build' failed with exit code: #{code}"))
|
||||
|
||||
_runProjectTest: ->
|
||||
@log("#runProjectTest")
|
||||
@@ -348,22 +418,24 @@ class Base
|
||||
build: ->
|
||||
Promise
|
||||
.bind(@)
|
||||
.then(@cleanupPlatform)
|
||||
.then(@gulpBuild)
|
||||
.then(@copyFiles)
|
||||
.then(@updatePackage)
|
||||
.then(@convertToJs)
|
||||
.then(@obfuscate)
|
||||
.then(@cleanupSrc)
|
||||
.then(@npmInstall)
|
||||
.then(@npmInstall)
|
||||
.then(@elBuilder)
|
||||
.then(@runSmokeTest)
|
||||
.then(@runProjectTest)
|
||||
.then(@runFailingProjectTest)
|
||||
.then(@cleanupCy)
|
||||
.then(@codeSign) ## codesign after running smoke tests due to changing .cy
|
||||
.then(@verifyAppCanOpen)
|
||||
# .then(@cleanupPlatform)
|
||||
# .then(@buildPackages)
|
||||
# .then(@copyPackages)
|
||||
# .then(@prunePackages)
|
||||
.then(@createRootPackage)
|
||||
.then(@symlinkPackages)
|
||||
# .then(@convertCoffeeToJs)
|
||||
# .then(@obfuscate)
|
||||
# .then(@cleanupSrc)
|
||||
# .then(@npmInstall)
|
||||
# .then(@npmInstall)
|
||||
# .then(@elBuilder)
|
||||
# .then(@runSmokeTest)
|
||||
# .then(@runProjectTest)
|
||||
# .then(@runFailingProjectTest)
|
||||
# .then(@cleanupCy)
|
||||
# .then(@codeSign) ## codesign after running smoke tests due to changing .cy
|
||||
# .then(@verifyAppCanOpen)
|
||||
.return(@)
|
||||
|
||||
module.exports = Base
|
||||
@@ -0,0 +1,109 @@
|
||||
fs = require("fs-extra")
|
||||
del = require("del")
|
||||
path = require("path")
|
||||
gulp = require("gulp")
|
||||
chalk = require("chalk")
|
||||
Promise = require("bluebird")
|
||||
gulpDebug = require("gulp-debug")
|
||||
gulpCoffee = require("gulp-coffee")
|
||||
vinylPaths = require("vinyl-paths")
|
||||
coffee = require("@packages/coffee")
|
||||
packages = require("./util/packages")
|
||||
|
||||
fs = Promise.promisifyAll(fs)
|
||||
|
||||
log = (msg, platform) ->
|
||||
console.log(chalk.yellow(msg), chalk.bgWhite(chalk.black(platform)))
|
||||
|
||||
module.exports = (platform, version) ->
|
||||
distDir = (args...) ->
|
||||
path.resolve("dist", platform, args...)
|
||||
|
||||
cleanupPlatform = ->
|
||||
log("#cleanupPlatform", platform)
|
||||
|
||||
cleanup = =>
|
||||
fs.removeAsync(distDir())
|
||||
|
||||
cleanup()
|
||||
.catch(cleanup)
|
||||
|
||||
buildPackages = ->
|
||||
log("#buildPackages", platform)
|
||||
|
||||
packages.runAllBuild()
|
||||
|
||||
copyPackages = ->
|
||||
log("#copyPackages", platform)
|
||||
|
||||
packages.copyAllToDist(distDir())
|
||||
|
||||
npmInstallPackages = ->
|
||||
log("#npmInstallPackages", platform)
|
||||
|
||||
packages.npmInstallAll(distDir("packages", "*"))
|
||||
|
||||
createRootPackage = ->
|
||||
log("#createRootPackage", platform, version)
|
||||
|
||||
fs.outputJsonAsync(distDir("package.json"), {
|
||||
name: "cypress"
|
||||
productName: "Cypress",
|
||||
version: version
|
||||
main: "index.js"
|
||||
scripts: {}
|
||||
env: "production"
|
||||
})
|
||||
.then =>
|
||||
str = "require('./packages/server')"
|
||||
|
||||
fs.outputFileAsync(distDir("index.js"), str)
|
||||
|
||||
symlinkPackages = ->
|
||||
log("#symlinkPackages", platform)
|
||||
|
||||
packages.symlinkAll(distDir)
|
||||
|
||||
convertCoffeeToJs = ->
|
||||
log("#convertCoffeeToJs", platform)
|
||||
|
||||
## grab everything in src
|
||||
## convert to js
|
||||
new Promise (resolve, reject) =>
|
||||
gulp.src([
|
||||
## include coffee files of packages
|
||||
distDir("**", "*.coffee")
|
||||
|
||||
## except those in node_modules
|
||||
"!" + distDir("**", "node_modules", "**", "*.coffee")
|
||||
])
|
||||
.pipe vinylPaths(del)
|
||||
.pipe(gulpDebug())
|
||||
.pipe gulpCoffee({
|
||||
coffee: coffee
|
||||
})
|
||||
.pipe gulp.dest(distDir())
|
||||
.on("end", resolve)
|
||||
.on("error", reject)
|
||||
|
||||
Promise
|
||||
.bind(@)
|
||||
.then(cleanupPlatform)
|
||||
.then(buildPackages)
|
||||
.then(copyPackages)
|
||||
.then(npmInstallPackages)
|
||||
.then(createRootPackage)
|
||||
.then(symlinkPackages)
|
||||
.then(convertCoffeeToJs)
|
||||
# .then(@obfuscate)
|
||||
# .then(@cleanupSrc)
|
||||
# .then(@npmInstall)
|
||||
# .then(@npmInstall)
|
||||
# .then(@elBuilder)
|
||||
# .then(@runSmokeTest)
|
||||
# .then(@runProjectTest)
|
||||
# .then(@runFailingProjectTest)
|
||||
# .then(@cleanupCy)
|
||||
# .then(@codeSign) ## codesign after running smoke tests due to changing .cy
|
||||
# .then(@verifyAppCanOpen)
|
||||
# .return(@)
|
||||
@@ -1,21 +1,10 @@
|
||||
_ = require("lodash")
|
||||
fs = require("fs-extra")
|
||||
Promise = require("bluebird")
|
||||
bumpercar = require("cypress-bumpercar")
|
||||
bumpercar = require("@cypress/bumpercar")
|
||||
path = require("path")
|
||||
|
||||
creds = fs.readJsonSync("./support/ci.json", "utf8")
|
||||
|
||||
## configure a new Bumpercar
|
||||
car = bumpercar.create({
|
||||
providers: {
|
||||
travis: {
|
||||
githubToken: creds.githubToken
|
||||
}
|
||||
circle: {
|
||||
circleToken: creds.circleToken
|
||||
}
|
||||
}
|
||||
})
|
||||
fs = Promise.promisifyAll(fs)
|
||||
|
||||
PROVIDERS = {
|
||||
circle: [
|
||||
@@ -26,6 +15,9 @@ PROVIDERS = {
|
||||
"cypress-io/cypress-example-todomvc"
|
||||
"cypress-io/cypress-example-piechopper"
|
||||
"cypress-io/cypress-example-recipes"
|
||||
"cypress-io/cypress-example-node-versions"
|
||||
"cypress-io/cypress-example-module-api"
|
||||
"cypress-io/cypress-test-ci-environments"
|
||||
]
|
||||
|
||||
travis: [
|
||||
@@ -40,11 +32,27 @@ PROVIDERS = {
|
||||
}
|
||||
|
||||
awaitEachProjectAndProvider = (fn) ->
|
||||
promises = _.map PROVIDERS, (projects, provider) ->
|
||||
Promise.map projects, (project) ->
|
||||
fn(project, provider)
|
||||
ciJson = path.join(__dirname, "support/ci.json")
|
||||
creds = fs.readJsonSync(ciJson, "utf8")
|
||||
|
||||
Promise.all(promises)
|
||||
fs.readJsonAsync(ciJson)
|
||||
.then (creds) ->
|
||||
## configure a new Bumpercar
|
||||
car = bumpercar.create({
|
||||
providers: {
|
||||
travis: {
|
||||
githubToken: creds.githubToken
|
||||
}
|
||||
circle: {
|
||||
circleToken: creds.circleToken
|
||||
}
|
||||
}
|
||||
})
|
||||
.then ->
|
||||
_.map PROVIDERS, (projects, provider) ->
|
||||
Promise.map projects, (project) ->
|
||||
fn(project, provider)
|
||||
.all()
|
||||
|
||||
module.exports = {
|
||||
version: (version) ->
|
||||
@@ -0,0 +1,133 @@
|
||||
## store the cwd
|
||||
cwd = process.cwd()
|
||||
|
||||
_ = require("lodash")
|
||||
os = require("os")
|
||||
chalk = require("chalk")
|
||||
Promise = require("bluebird")
|
||||
minimist = require("minimist")
|
||||
zip = require("./zip")
|
||||
ask = require("./ask")
|
||||
bump = require("./bump")
|
||||
meta = require("./meta")
|
||||
build = require("./build")
|
||||
upload = require("./upload")
|
||||
Base = require("./base")
|
||||
Linux = require("./linux")
|
||||
Darwin = require("./darwin")
|
||||
|
||||
success = (str) ->
|
||||
console.log chalk.bgGreen(" " + chalk.black(str) + " ")
|
||||
|
||||
fail = (str) ->
|
||||
console.log chalk.bgRed(" " + chalk.black(str) + " ")
|
||||
|
||||
## hack for @packages/server modifying cwd
|
||||
process.chdir(cwd)
|
||||
|
||||
askWhichPlatform = (platform) ->
|
||||
## if we already have a platform
|
||||
## just resolve with that
|
||||
if platform
|
||||
return Promise.resolve(platform)
|
||||
|
||||
## else go ask for it!
|
||||
ask.whichPlatform()
|
||||
|
||||
askWhichVersion = (version) ->
|
||||
## if we already have a version
|
||||
## just resolve with that
|
||||
if version
|
||||
return Promise.resolve(version)
|
||||
|
||||
## else go ask for it!
|
||||
ask.deployNewVersion()
|
||||
|
||||
deploy = {
|
||||
zip: zip
|
||||
ask: ask
|
||||
meta: meta
|
||||
upload: upload
|
||||
Base: Base
|
||||
Darwin: Darwin
|
||||
Linux: Linux
|
||||
|
||||
# getPlatform: (platform, options) ->
|
||||
# platform ?= os.platform()
|
||||
#
|
||||
# Platform = @[platform.slice(0, 1).toUpperCase() + platform.slice(1)]
|
||||
#
|
||||
# throw new Error("Platform: '#{platform}' not found") if not Platform
|
||||
#
|
||||
# options ?= @parseOptions(process.argv.slice(2))
|
||||
#
|
||||
# (new Platform(platform, options))
|
||||
|
||||
parseOptions: (argv) ->
|
||||
opts = minimist(argv)
|
||||
opts.runTests = false if opts["skip-tests"]
|
||||
opts
|
||||
|
||||
# build: (platform) ->
|
||||
# ## read off the argv
|
||||
# options = @parseOptions(process.argv)
|
||||
#
|
||||
# @getPlatform(platform?.osName, options).build()
|
||||
|
||||
bump: ->
|
||||
ask.whichBumpTask()
|
||||
.then (task) ->
|
||||
switch task
|
||||
when "run"
|
||||
bump.run()
|
||||
when "version"
|
||||
ask.whichVersion(meta.distDir)
|
||||
.then (v) ->
|
||||
bump.version(v)
|
||||
|
||||
release: ->
|
||||
## read off the argv
|
||||
options = @parseOptions(process.argv)
|
||||
|
||||
release = (version) =>
|
||||
upload.s3Manifest(version)
|
||||
.then ->
|
||||
success("Release Complete")
|
||||
.catch (err) ->
|
||||
fail("Release Failed")
|
||||
reject(err)
|
||||
|
||||
if v = options.version
|
||||
release(v)
|
||||
else
|
||||
ask.whichRelease(meta.distDir)
|
||||
.then(release)
|
||||
|
||||
deploy: ->
|
||||
## read off the argv
|
||||
options = @parseOptions(process.argv)
|
||||
|
||||
askWhichPlatform(options.platform)
|
||||
.then (platform) ->
|
||||
askWhichVersion(options.version)
|
||||
.then (version) ->
|
||||
# options.version = version
|
||||
|
||||
build(platform, version)
|
||||
# .return([platform, version])
|
||||
# .spread (platform, version) ->
|
||||
|
||||
# @getPlatform(plat, options).deploy()
|
||||
# .then (platform) =>
|
||||
# zip.ditto(platform)
|
||||
# .then =>
|
||||
# upload.toS3(platform)
|
||||
# .then ->
|
||||
# success("Dist Complete")
|
||||
# .catch (err) ->
|
||||
# fail("Dist Failed")
|
||||
# console.log(err)
|
||||
|
||||
}
|
||||
|
||||
module.exports = _.bindAll(deploy, _.functions(deploy))
|
||||
@@ -3,4 +3,4 @@ chalk = require("chalk")
|
||||
module.exports = (msg, color = "yellow") ->
|
||||
return if process.env["NODE_ENV"] is "test"
|
||||
|
||||
console.log chalk[color](msg), chalk.bgWhite(chalk.black(@osName))
|
||||
console.log chalk[color](msg), chalk.bgWhite(chalk.black(@osName))
|
||||
@@ -1,20 +1,25 @@
|
||||
$ = require("gulp-load-plugins")()
|
||||
awspublish = require('gulp-awspublish')
|
||||
rename = require('gulp-rename')
|
||||
debug = require('gulp-debug')
|
||||
fs = require("fs-extra")
|
||||
cp = require("child_process")
|
||||
path = require("path")
|
||||
gulp = require("gulp")
|
||||
human = require("human-interval")
|
||||
konfig = require("konfig")()
|
||||
konfig = require("@packages/server/lib/konfig")()
|
||||
Promise = require("bluebird")
|
||||
meta = require("./meta")
|
||||
|
||||
# TODO please do not hardcode me
|
||||
# CDN_URL = "https://cdn.cypress.io"
|
||||
|
||||
fs = Promise.promisifyAll(fs)
|
||||
|
||||
module.exports = {
|
||||
getPublisher: ->
|
||||
aws = @getAwsObj()
|
||||
|
||||
$.awspublish.create
|
||||
awspublish.create
|
||||
httpOptions: {
|
||||
timeout: human("10 minutes")
|
||||
}
|
||||
@@ -38,7 +43,7 @@ module.exports = {
|
||||
uploadOsName = platform.uploadOsName
|
||||
zipName = platform.zipName
|
||||
|
||||
url = [konfig.app.cdn_url, "desktop", version, uploadOsName, zipName].join("/")
|
||||
url = [konfig('cdn_url'), "desktop", version, uploadOsName, zipName].join("/")
|
||||
|
||||
cp.exec "cfcli purgefile #{url}", (err, stdout, stderr) ->
|
||||
return reject(err) if err
|
||||
@@ -53,7 +58,7 @@ module.exports = {
|
||||
|
||||
getUrl = (uploadOsName) ->
|
||||
{
|
||||
url: [konfig.app.cdn_url, folder, version, uploadOsName, zipName].join("/")
|
||||
url: [konfig('cdn_url'), folder, version, uploadOsName, zipName].join("/")
|
||||
}
|
||||
|
||||
obj = {
|
||||
@@ -80,12 +85,12 @@ module.exports = {
|
||||
new Promise (resolve, reject) =>
|
||||
@createRemoteManifest(aws.folder, version).then (src) ->
|
||||
gulp.src(src)
|
||||
.pipe $.rename (p) ->
|
||||
.pipe rename (p) ->
|
||||
p.dirname = aws.folder + "/" + p.dirname
|
||||
p
|
||||
.pipe $.debug()
|
||||
.pipe debug()
|
||||
.pipe publisher.publish(headers)
|
||||
.pipe $.awspublish.reporter()
|
||||
.pipe awspublish.reporter()
|
||||
.on "error", reject
|
||||
.on "end", resolve
|
||||
|
||||
@@ -103,16 +108,16 @@ module.exports = {
|
||||
headers["Cache-Control"] = "no-cache"
|
||||
|
||||
gulp.src(pathToZipFile)
|
||||
.pipe $.rename (p) =>
|
||||
.pipe rename (p) =>
|
||||
p.dirname = @getUploadDirName(platform)
|
||||
p
|
||||
.pipe $.debug()
|
||||
.pipe debug()
|
||||
.pipe publisher.publish(headers)
|
||||
.pipe $.awspublish.reporter()
|
||||
.pipe awspublish.reporter()
|
||||
.on "error", reject
|
||||
.on "end", resolve
|
||||
|
||||
upload()
|
||||
.then =>
|
||||
@purgeCache(platform)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
_ = require("lodash")
|
||||
fs = require("fs-extra")
|
||||
cp = require("child_process")
|
||||
path = require("path")
|
||||
glob = require("glob")
|
||||
Promise = require("bluebird")
|
||||
|
||||
fs = Promise.promisifyAll(fs)
|
||||
glob = Promise.promisify(glob)
|
||||
|
||||
DEFAULT_PATHS = "package.json".split(" ")
|
||||
|
||||
pathToPackageJson = (pkg) ->
|
||||
path.join(pkg, "package.json")
|
||||
|
||||
runAllBuild = ->
|
||||
new Promise (resolve, reject) ->
|
||||
reject = _.once(reject)
|
||||
|
||||
## build all the packages except for
|
||||
## cli and docs
|
||||
cp.spawn("npm", ["run", "all", "build", "--", "--skip-packages", "cli,docs"], { stdio: "inherit" })
|
||||
.on "error", reject
|
||||
.on "exit", (code) ->
|
||||
if code is 0
|
||||
resolve()
|
||||
else
|
||||
reject(new Error("'npm run build' failed with exit code: #{code}"))
|
||||
|
||||
|
||||
copyAllToDist = (distDir) ->
|
||||
copyRelativePathToDist = (relative) ->
|
||||
dest = path.join(distDir, relative)
|
||||
|
||||
console.log(relative, "->", dest)
|
||||
|
||||
fs.copyAsync(relative, dest)
|
||||
|
||||
copyPackage = (pkg) ->
|
||||
## copies the package to dist
|
||||
## including the default paths
|
||||
## and any specified in package.json files
|
||||
fs.readJsonAsync(pathToPackageJson(pkg))
|
||||
.then (json) ->
|
||||
## grab all the files
|
||||
## and default included paths
|
||||
## and convert to relative paths
|
||||
DEFAULT_PATHS
|
||||
.concat(json.files or [])
|
||||
.concat(json.main or [])
|
||||
.map (file) ->
|
||||
path.join(pkg, file)
|
||||
.map(copyRelativePathToDist, {concurrency: 1})
|
||||
|
||||
## fs-extra concurrency tests (copyPackage / copyRelativePathToDist)
|
||||
## 1/1 41688
|
||||
## 1/5 42218
|
||||
## 1/10 42566
|
||||
## 2/1 45041
|
||||
## 2/2 43589
|
||||
## 3/3 51399
|
||||
|
||||
## cp -R concurrency tests
|
||||
## 1/1 65811
|
||||
|
||||
started = new Date()
|
||||
|
||||
fs.ensureDirAsync(distDir)
|
||||
.then ->
|
||||
glob("./packages/*")
|
||||
.map(copyPackage, {concurrency: 1})
|
||||
.then ->
|
||||
console.log("Finished Copying", new Date() - started)
|
||||
|
||||
npmInstallAll = (pathToPackages) ->
|
||||
## 1,060,495,784 bytes (1.54 GB on disk) for 179,156 items
|
||||
## 313,416,512 bytes (376.6 MB on disk) for 23,576 items
|
||||
|
||||
started = new Date()
|
||||
|
||||
retryGlobbing = ->
|
||||
glob(pathToPackages)
|
||||
.catch {code: "EMFILE"}, ->
|
||||
## wait 1 second then retry
|
||||
Promise
|
||||
.delay(1000)
|
||||
.then(retryGlobbing)
|
||||
|
||||
npmInstall = (pkg) ->
|
||||
console.log("npm installing", pkg)
|
||||
|
||||
new Promise (resolve, reject) ->
|
||||
reject = _.once(reject)
|
||||
|
||||
## ignore node_modules/.bin due to symlinking
|
||||
cp.spawn("npm", ["install", "--production"], {
|
||||
cwd: pkg
|
||||
stdio: "inherit"
|
||||
})
|
||||
.on("error", reject)
|
||||
.on("exit", (code) ->
|
||||
if code is 0
|
||||
resolve()
|
||||
else
|
||||
reject(new Error("'npm install --production' on #{pkg} failed with exit code: #{code}"))
|
||||
)
|
||||
|
||||
retryNpmInstall = (pkg) ->
|
||||
npmInstall(pkg)
|
||||
.catch {code: "EMFILE"}, ->
|
||||
Promise
|
||||
.delay(1000)
|
||||
.then ->
|
||||
retryNpmInstall(pkg)
|
||||
.catch (err) ->
|
||||
console.log(err, err.code)
|
||||
throw err
|
||||
|
||||
## prunes out all of the devDependencies
|
||||
## from what was copied
|
||||
retryGlobbing()
|
||||
.map(retryNpmInstall)
|
||||
.then ->
|
||||
console.log("Finished NPM Installing", new Date() - started)
|
||||
|
||||
symlinkAll = (distDir) ->
|
||||
pathToPackages = path.join('node_modules', '@')
|
||||
pathToDistPackages = distDir("packages", "*")
|
||||
|
||||
symlink = (pkg) ->
|
||||
# console.log(pkg, dist)
|
||||
## strip off the initial './'
|
||||
## ./packages/foo -> node_modules/@packages/foo
|
||||
dest = path.join(distDir(), "node_modules", "@packages", path.basename(pkg))
|
||||
|
||||
fs.ensureSymlinkAsync(pkg, dest)
|
||||
|
||||
glob(pathToDistPackages)
|
||||
.map(symlink)
|
||||
|
||||
module.exports = {
|
||||
runAllBuild
|
||||
|
||||
copyAllToDist
|
||||
|
||||
npmInstallAll
|
||||
|
||||
symlinkAll
|
||||
}
|
||||
+18
-2
@@ -32,15 +32,29 @@ const getDirs = () => {
|
||||
.map((dir) => path.join(process.cwd(), dir).replace(/\/$/, ''))
|
||||
}
|
||||
|
||||
const packageNameInArray = (dir, packages) => {
|
||||
const packageName = packageNameFromPath(dir)
|
||||
return _.includes(packages, packageName)
|
||||
}
|
||||
|
||||
const filterDirsByPackage = (dirs, filter) => {
|
||||
if (!filter) return dirs
|
||||
|
||||
return dirs.filter((dir) => {
|
||||
const packageName = packageNameFromPath(dir)
|
||||
return _.includes(filter, packageName)
|
||||
return packageNameInArray(dir, filter)
|
||||
})
|
||||
}
|
||||
|
||||
const rejectDirsByPackage = (dirs, rejected) => {
|
||||
if (!rejected) return dirs
|
||||
|
||||
if (rejected && rejected.length) {
|
||||
return _.reject(dirs, (dir) => {
|
||||
return packageNameInArray(dir, rejected)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const filterDirsByCmd = (dirs, cmd) => {
|
||||
switch (cmd) {
|
||||
case 'install': case 'i':
|
||||
@@ -123,10 +137,12 @@ function keepDirsWithPackageJson (dirs) {
|
||||
|
||||
module.exports = (cmd, options) => {
|
||||
const packagesFilter = options.package || options.packages
|
||||
const packagesReject = options['skip-package'] || options['skip-packages']
|
||||
|
||||
return getDirs()
|
||||
.then(keepDirsWithPackageJson)
|
||||
.then((dirs) => filterDirsByPackage(dirs, packagesFilter))
|
||||
.then((dirs) => rejectDirsByPackage(dirs, packagesReject))
|
||||
.then((dirs) => checkDirsLength(dirs, `No packages were found with the filter '${packagesFilter}'`))
|
||||
.then((dirs) => filterDirsByCmd(dirs, cmd))
|
||||
.then((dirs) => {
|
||||
|
||||
Reference in New Issue
Block a user