mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-04 22:30:00 -06:00
Merge branch 'move-deploy-scripts'
# Conflicts: # package.json # scripts/deploy/build.coffee # scripts/deploy/util/packages.coffee
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,6 +6,7 @@ node_modules
|
||||
*.orig
|
||||
dist
|
||||
dist-*
|
||||
build
|
||||
.vscode
|
||||
.publish
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"bluebird": "^3.4.5",
|
||||
"chai": "^4.0.2",
|
||||
"del": "^3.0.0",
|
||||
"electron-osx-sign": "^0.4.6",
|
||||
"deps-ok": "^1.2.0",
|
||||
"electron-osx-sign": "^0.4.6",
|
||||
"eslint": "^3.18.0",
|
||||
@@ -63,7 +64,6 @@
|
||||
"obfuscator": "^0.5.4",
|
||||
"plist": "^2.1.0",
|
||||
"pluralize": "^5.0.0",
|
||||
"run-sequence": "^1.2.2",
|
||||
"typescript": "^2.3.4",
|
||||
"vagrant": "0.0.1",
|
||||
"vinyl-paths": "^2.1.0",
|
||||
|
||||
@@ -7,10 +7,11 @@ Promise = require("bluebird")
|
||||
gulpDebug = require("gulp-debug")
|
||||
gulpCoffee = require("gulp-coffee")
|
||||
gulpTypeScript = require("gulp-typescript")
|
||||
pluralize = require("pluralize")
|
||||
vinylPaths = require("vinyl-paths")
|
||||
coffee = require("@packages/coffee")
|
||||
electron = require("@packages/electron")
|
||||
packages = require("./util/packages")
|
||||
pluralize = require("pluralize")
|
||||
|
||||
fs = Promise.promisifyAll(fs)
|
||||
|
||||
@@ -18,9 +19,23 @@ log = (msg, platform) ->
|
||||
console.log(chalk.yellow(msg), chalk.bgWhite(chalk.black(platform)))
|
||||
|
||||
module.exports = (platform, version) ->
|
||||
## returns a path into the /dist directory
|
||||
distDir = (args...) ->
|
||||
path.resolve("dist", platform, args...)
|
||||
|
||||
## returns a path into the /build directory
|
||||
buildDir = (args...) ->
|
||||
path.resolve("build", platform, args...)
|
||||
|
||||
## returns a path into the /build/*/app directory
|
||||
## specific to each platform
|
||||
buildAppDir = (args...) ->
|
||||
switch platform
|
||||
when "darwin"
|
||||
buildDir("Cypress.app", "Contents", "resources", "app", args...)
|
||||
when "linux"
|
||||
buildDir("Cypress", "resources", "app", args...)
|
||||
|
||||
cleanupPlatform = ->
|
||||
log("#cleanupPlatform", platform)
|
||||
|
||||
@@ -38,9 +53,8 @@ module.exports = (platform, version) ->
|
||||
|
||||
copyPackages = ->
|
||||
log("#copyPackages", platform)
|
||||
destination = distDir()
|
||||
|
||||
packages.copyAllToDist(destination)
|
||||
packages.copyAllToDist(distDir())
|
||||
|
||||
npmInstallPackages = ->
|
||||
log("#npmInstallPackages", platform)
|
||||
@@ -78,11 +92,28 @@ module.exports = (platform, version) ->
|
||||
## except those in node_modules
|
||||
"!" + distDir("**", "node_modules", "**", "*.ts")
|
||||
])
|
||||
.then((paths) ->
|
||||
console.log("deleted %d TS %s",
|
||||
paths.length, pluralize("file", paths.length))
|
||||
.then (paths) ->
|
||||
console.log(
|
||||
"deleted %d TS %s",
|
||||
paths.length,
|
||||
pluralize("file", paths.length)
|
||||
)
|
||||
console.log(paths)
|
||||
)
|
||||
|
||||
symlinkBuildPackages = ->
|
||||
log("#symlinkBuildPackages", platform)
|
||||
|
||||
packages.symlinkAll(buildAppDir)
|
||||
|
||||
symlinkDistPackages = ->
|
||||
log("#symlinkDistPackages", platform)
|
||||
|
||||
packages.symlinkAll(distDir)
|
||||
|
||||
cleanJs = ->
|
||||
log("#cleanJs", platform)
|
||||
|
||||
packages.runAllCleanJs()
|
||||
|
||||
convertCoffeeToJs = ->
|
||||
log("#convertCoffeeToJs", platform)
|
||||
@@ -106,7 +137,16 @@ module.exports = (platform, version) ->
|
||||
.on("end", resolve)
|
||||
.on("error", reject)
|
||||
|
||||
log("#distDir", "building into folder #{distDir()}")
|
||||
elBuilder = ->
|
||||
log("#elBuilder", platform)
|
||||
|
||||
electron.install({
|
||||
dir: distDir()
|
||||
dist: buildDir()
|
||||
platform: platform
|
||||
"app-version": version
|
||||
})
|
||||
|
||||
Promise
|
||||
.bind(@)
|
||||
.then(cleanupPlatform)
|
||||
@@ -117,12 +157,15 @@ module.exports = (platform, version) ->
|
||||
.then(symlinkPackages)
|
||||
.then(convertCoffeeToJs)
|
||||
.then(removeTypeScript)
|
||||
.then(packages.runAllCleanJs)
|
||||
.then(cleanJs)
|
||||
.then(symlinkDistPackages)
|
||||
# .then(@obfuscate)
|
||||
# .then(@cleanupSrc)
|
||||
# .then(@npmInstall)
|
||||
# .then(@npmInstall)
|
||||
# .then(@elBuilder)
|
||||
.then(elBuilder)
|
||||
.then(symlinkBuildPackages)
|
||||
# .then(@runSmokeTest)
|
||||
# .then(@runProjectTest)
|
||||
# .then(@runFailingProjectTest)
|
||||
@@ -130,4 +173,3 @@ module.exports = (platform, version) ->
|
||||
# .then(@codeSign) ## codesign after running smoke tests due to changing .cy
|
||||
# .then(@verifyAppCanOpen)
|
||||
.return(@)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ runAll = (args) ->
|
||||
msg = "npm " + args.join(" ") + " failed with exit code: #{code}"
|
||||
reject(new Error(msg))
|
||||
|
||||
# transpile projects in place that need TypeScrpt -> JavaScript conversion
|
||||
|
||||
runAllBuildJs = _.partial(runAll, ["run", "all", "build-js"])
|
||||
|
||||
# removes transpiled JS files in the original package folders
|
||||
@@ -36,16 +36,6 @@ runAllCleanJs = _.partial(runAll, ["run", "all", "clean-js"])
|
||||
runAllBuild = _.partial(runAll, ["run", "all", "build", "--", "--skip-packages", "cli,docs"])
|
||||
|
||||
copyAllToDist = (distDir) ->
|
||||
collectAllPaths = (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)
|
||||
|
||||
copyRelativePathToDist = (relative) ->
|
||||
dest = path.join(distDir, relative)
|
||||
|
||||
@@ -85,8 +75,6 @@ copyAllToDist = (distDir) ->
|
||||
fs.ensureDirAsync(distDir)
|
||||
.then ->
|
||||
glob("./packages/*")
|
||||
.filter((name) ->
|
||||
name.includes("launcher"))
|
||||
.map(copyPackage, {concurrency: 1})
|
||||
.then ->
|
||||
console.log("Finished Copying", new Date() - started)
|
||||
@@ -117,12 +105,11 @@ npmInstallAll = (pathToPackages) ->
|
||||
stdio: "inherit"
|
||||
})
|
||||
.on("error", reject)
|
||||
.on("exit", (code) ->
|
||||
.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)
|
||||
@@ -142,15 +129,12 @@ npmInstallAll = (pathToPackages) ->
|
||||
.then ->
|
||||
console.log("Finished NPM Installing", new Date() - started)
|
||||
|
||||
symlinkAll = (distDir) ->
|
||||
pathToPackages = path.join('node_modules', '@')
|
||||
pathToDistPackages = distDir("packages", "*")
|
||||
|
||||
symlinkAll = (pathTo) ->
|
||||
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))
|
||||
dest = pathTo("node_modules", "@packages", path.basename(pkg))
|
||||
|
||||
fs.ensureSymlinkAsync(pkg, dest)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user