mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-19 21:51:16 -06:00
deploy: build electron app + symlink node_modules for build app dir
This commit is contained in:
@@ -8,6 +8,7 @@ gulpDebug = require("gulp-debug")
|
||||
gulpCoffee = require("gulp-coffee")
|
||||
vinylPaths = require("vinyl-paths")
|
||||
coffee = require("@packages/coffee")
|
||||
electron = require("@packages/electron")
|
||||
packages = require("./util/packages")
|
||||
|
||||
fs = Promise.promisifyAll(fs)
|
||||
@@ -16,9 +17,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)
|
||||
|
||||
@@ -59,8 +74,13 @@ module.exports = (platform, version) ->
|
||||
|
||||
fs.outputFileAsync(distDir("index.js"), str)
|
||||
|
||||
symlinkPackages = ->
|
||||
log("#symlinkPackages", platform)
|
||||
symlinkBuildPackages = ->
|
||||
log("#symlinkBuildPackages", platform)
|
||||
|
||||
packages.symlinkAll(buildAppDir)
|
||||
|
||||
symlinkDistPackages = ->
|
||||
log("#symlinkDistPackages", platform)
|
||||
|
||||
packages.symlinkAll(distDir)
|
||||
|
||||
@@ -86,6 +106,17 @@ module.exports = (platform, version) ->
|
||||
.on("end", resolve)
|
||||
.on("error", reject)
|
||||
|
||||
|
||||
elBuilder = ->
|
||||
log("#elBuilder", platform)
|
||||
|
||||
electron.install({
|
||||
dir: distDir()
|
||||
dist: buildDir()
|
||||
platform: platform
|
||||
"app-version": version
|
||||
})
|
||||
|
||||
Promise
|
||||
.bind(@)
|
||||
.then(cleanupPlatform)
|
||||
@@ -93,13 +124,14 @@ module.exports = (platform, version) ->
|
||||
.then(copyPackages)
|
||||
.then(npmInstallPackages)
|
||||
.then(createRootPackage)
|
||||
.then(symlinkPackages)
|
||||
.then(symlinkDistPackages)
|
||||
.then(convertCoffeeToJs)
|
||||
# .then(@obfuscate)
|
||||
# .then(@cleanupSrc)
|
||||
# .then(@npmInstall)
|
||||
# .then(@npmInstall)
|
||||
# .then(@elBuilder)
|
||||
.then(elBuilder)
|
||||
.then(symlinkBuildPackages)
|
||||
# .then(@runSmokeTest)
|
||||
# .then(@runProjectTest)
|
||||
# .then(@runFailingProjectTest)
|
||||
|
||||
@@ -123,15 +123,14 @@ npmInstallAll = (pathToPackages) ->
|
||||
.then ->
|
||||
console.log("Finished NPM Installing", new Date() - started)
|
||||
|
||||
symlinkAll = (distDir) ->
|
||||
pathToPackages = path.join('node_modules', '@')
|
||||
pathToDistPackages = distDir("packages", "*")
|
||||
symlinkAll = (pathTo) ->
|
||||
pathToDistPackages = pathTo("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))
|
||||
dest = path.join(pathTo(), "node_modules", "@packages", path.basename(pkg))
|
||||
|
||||
fs.ensureSymlinkAsync(pkg, dest)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user