mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-05 14:09:46 -06:00
add printing package folder sizes to the build script (#5978)
- and work around `parse-domain` Jest inclusion to minimize bundle size
This commit is contained in:
@@ -27,6 +27,7 @@ xvfb = require("../../cli/lib/exec/xvfb")
|
||||
linkPackages = require('../link-packages')
|
||||
{ transformRequires } = require('./util/transform-requires')
|
||||
{ testStaticAssets } = require('./util/testStaticAssets')
|
||||
performanceTracking = require('../../packages/server/test/support/helpers/performance.js')
|
||||
|
||||
rootPackage = require("@packages/root")
|
||||
|
||||
@@ -301,6 +302,46 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
else
|
||||
reject new Error("Verifying App via GateKeeper failed")
|
||||
|
||||
printPackageSizes = ->
|
||||
appFolder = meta.buildAppDir(platform, "packages")
|
||||
log("#printPackageSizes #{appFolder}")
|
||||
|
||||
if (platform == "win32") then return Promise.resolve()
|
||||
|
||||
# "du" - disk usage utility
|
||||
# -d -1 depth of 1
|
||||
# -h human readable sizes (K and M)
|
||||
args = ["-d", "1", appFolder]
|
||||
|
||||
parseDiskUsage = (result) ->
|
||||
lines = result.stdout.split(os.EOL)
|
||||
# will store {package name: package size}
|
||||
data = {}
|
||||
|
||||
lines.forEach (line) ->
|
||||
parts = line.split('\t')
|
||||
packageSize = parseFloat(parts[0])
|
||||
folder = parts[1]
|
||||
|
||||
packageName = path.basename(folder)
|
||||
if packageName is "packages"
|
||||
return # root "packages" information
|
||||
|
||||
data[packageName] = packageSize
|
||||
|
||||
return data
|
||||
|
||||
printDiskUsage = (sizes) ->
|
||||
bySize = R.sortBy(R.prop('1'))
|
||||
console.log(bySize(R.toPairs(sizes)))
|
||||
|
||||
execa("du", args)
|
||||
.then(parseDiskUsage)
|
||||
.then(R.tap(printDiskUsage))
|
||||
.then((sizes) ->
|
||||
performanceTracking.track('test runner size', sizes)
|
||||
)
|
||||
|
||||
Promise.resolve()
|
||||
.then(checkPlatform)
|
||||
.then(cleanupPlatform)
|
||||
@@ -320,6 +361,7 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
.then(runSmokeTests)
|
||||
.then(codeSign) ## codesign after running smoke tests due to changing .cy
|
||||
.then(verifyAppCanOpen)
|
||||
.then(printPackageSizes)
|
||||
.return({
|
||||
buildDir: buildDir()
|
||||
})
|
||||
|
||||
@@ -10,8 +10,6 @@ gulpDebug = require('gulp-debug')
|
||||
gulp = require("gulp")
|
||||
human = require("human-interval")
|
||||
R = require("ramda")
|
||||
|
||||
konfig = require('../binary/get-config')()
|
||||
uploadUtils = require("./util/upload")
|
||||
|
||||
npmPackageExtension = ".tgz"
|
||||
@@ -30,7 +28,9 @@ getCDN = ({version, hash, filename}) ->
|
||||
la(check.unemptyString(hash), 'missing hash', hash)
|
||||
la(check.unemptyString(filename), 'missing filename', filename)
|
||||
la(isNpmPackageFile(filename), 'wrong extension for file', filename)
|
||||
[konfig("cdn_url"), rootFolder, npmFolder, version, hash, filename].join("/")
|
||||
url = uploadUtils.getUploadUrl()
|
||||
la(check.url(url), "could not get upload url", url)
|
||||
[url, rootFolder, npmFolder, version, hash, filename].join("/")
|
||||
|
||||
getUploadDirName = (options) ->
|
||||
la(check.unemptyString(options.version), 'missing version', options)
|
||||
|
||||
@@ -12,7 +12,6 @@ human = require("human-interval")
|
||||
R = require("ramda")
|
||||
hasha = require('hasha')
|
||||
|
||||
konfig = require('../binary/get-config')()
|
||||
uploadUtils = require("./util/upload")
|
||||
s3helpers = require("./s3-api").s3helpers
|
||||
|
||||
@@ -35,7 +34,8 @@ getCDN = ({version, hash, filename, platform}) ->
|
||||
la(isBinaryFile(filename), 'wrong extension for file', filename)
|
||||
la(check.unemptyString(platform), 'missing platform', platform)
|
||||
|
||||
cdnUrl = konfig("cdn_url")
|
||||
cdnUrl = uploadUtils.getUploadUrl()
|
||||
la(check.url(cdnUrl), "could not get cdn url", cdnUrl)
|
||||
[cdnUrl, rootFolder, folder, version, platform, hash, filename].join("/")
|
||||
|
||||
# returns folder that contains beta (unreleased) binaries for given version
|
||||
|
||||
@@ -6,7 +6,6 @@ cp = require("child_process")
|
||||
path = require("path")
|
||||
gulp = require("gulp")
|
||||
human = require("human-interval")
|
||||
konfig = require('../binary/get-config')()
|
||||
Promise = require("bluebird")
|
||||
meta = require("./meta")
|
||||
la = require("lazy-ass")
|
||||
@@ -59,8 +58,10 @@ module.exports = {
|
||||
dirName
|
||||
|
||||
getManifestUrl: (folder, version, uploadOsName) ->
|
||||
url = uploadUtils.getUploadUrl()
|
||||
la(check.url(url), "could not get upload url", url)
|
||||
{
|
||||
url: [konfig('cdn_url'), folder, version, uploadOsName, zipName].join("/")
|
||||
url: [url, folder, version, uploadOsName, zipName].join("/")
|
||||
}
|
||||
|
||||
getRemoteManifest: (folder, version) ->
|
||||
|
||||
@@ -9,9 +9,15 @@ fse = require("fs-extra")
|
||||
os = require("os")
|
||||
Promise = require("bluebird")
|
||||
{configFromEnvOrJsonFile, filenameToShellVariable} = require('@cypress/env-or-json-file')
|
||||
konfig = require('../../binary/get-config')()
|
||||
konfig = require('../get-config')()
|
||||
{ purgeCloudflareCache } = require('./purge-cloudflare-cache')
|
||||
|
||||
getUploadUrl = () ->
|
||||
url = konfig("cdn_url")
|
||||
la(check.url(url), "could not get CDN url", url)
|
||||
console.log("upload url", url)
|
||||
url
|
||||
|
||||
formHashFromEnvironment = () ->
|
||||
env = process.env
|
||||
if env.BUILDKITE
|
||||
@@ -59,7 +65,8 @@ getPublisher = (getAwsObj = getS3Credentials) ->
|
||||
}
|
||||
|
||||
getDesktopUrl = (version, osName, zipName) ->
|
||||
[konfig("cdn_url"), "desktop", version, osName, zipName].join("/")
|
||||
url = getUploadUrl()
|
||||
[url, "desktop", version, osName, zipName].join("/")
|
||||
|
||||
# purges desktop application url from Cloudflare cache
|
||||
purgeDesktopAppFromCache = ({version, platform, zipName}) ->
|
||||
@@ -135,5 +142,6 @@ module.exports = {
|
||||
getValidPlatformArchs,
|
||||
isValidPlatformArch,
|
||||
saveUrl,
|
||||
formHashFromEnvironment
|
||||
formHashFromEnvironment,
|
||||
getUploadUrl
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user