diff --git a/npm/webpack-preprocessor/package.json b/npm/webpack-preprocessor/package.json index 5094cca30b..1668611066 100644 --- a/npm/webpack-preprocessor/package.json +++ b/npm/webpack-preprocessor/package.json @@ -5,7 +5,7 @@ "private": false, "main": "dist", "scripts": { - "build": "shx rm -rf dist && tsc || echo 'built, with errors'", + "build": "rimraf dist && tsc || echo 'built, with errors'", "build-prod": "yarn build", "deps": "deps-ok && dependency-check --no-dev .", "secure": "nsp check", @@ -53,8 +53,8 @@ "react": "16.13.1", "react-dom": "16.13.1", "react-scripts": "3.2", + "rimraf": "3.0.2", "semantic-release": "17.2.3", - "shx": "0.3.3", "sinon": "^9.0.0", "sinon-chai": "^3.5.0", "snap-shot-it": "7.9.2", diff --git a/package.json b/package.json index 48bb6c6ecb..099444c72a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "check-terminal": "node scripts/check-terminal.js", "clean": "lerna run clean --parallel --no-bail || echo 'ok, errors while cleaning'", "check-ts": "gulp checkTs", - "clean-deps": "find . -depth -name node_modules -type d -exec rm -rf {} \\;", + "clean-deps": "find . -depth -name node_modules -type d -exec rimraf {} \\;", "clean-untracked-files": "git clean -d -f", "codegen": "yarn gulp codegen", "precypress:open": "yarn ensure-deps", @@ -40,7 +40,7 @@ "effective:circle:config": "circleci config process circle.yml | sed /^#/d", "ensure-deps": "./scripts/ensure-dependencies.sh", "get-next-version": "node scripts/get-next-version.js", - "postinstall": "patch-package && ./scripts/run-if-not-ci.sh yarn-deduplicate --strategy=highest && yarn clean && gulp postinstall && ./scripts/run-if-not-ci.sh yarn build", + "postinstall": "node ./scripts/run-postInstall.js", "jscodeshift": "jscodeshift -t ./node_modules/js-codemod/transforms/arrow-function-arguments.js", "lint": "eslint --ext .js,.jsx,.ts,.tsx,.json,.vue .", "lint-changed": "lint-changed", @@ -203,6 +203,7 @@ "pretty-ms": "7.0.0", "print-arch": "1.0.0", "proxyquire": "2.1.3", + "rimraf": "3.0.2", "semantic-release": "17.2.3", "semantic-release-monorepo": "7.0.3", "semver": "7.3.2", diff --git a/packages/config/package.json b/packages/config/package.json index faf10399d6..585cd329d9 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -8,8 +8,8 @@ "scripts": { "build-prod": "tsc || echo 'built, with errors'", "check-ts": "tsc --noEmit", - "clean-deps": "rm -rf node_modules", - "clean": "rm -f ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'", + "clean-deps": "rimraf node_modules", + "clean": "rimraf --glob ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'", "test": "yarn test-unit", "test-debug": "yarn test-unit --inspect-brk=5566", "test-unit": "mocha --configFile=../../mocha-reporter-config.json -r @packages/ts/register test/unit/**/*.spec.ts --exit" @@ -26,7 +26,8 @@ "@packages/types": "0.0.0-development", "@types/mocha": "9.1.0", "chai": "4.2.0", - "mocha": "7.0.1" + "mocha": "7.0.1", + "rimraf": "3.0.2" }, "files": [ "src" diff --git a/packages/data-context/package.json b/packages/data-context/package.json index 3d0f5807df..6b13d045df 100644 --- a/packages/data-context/package.json +++ b/packages/data-context/package.json @@ -9,7 +9,7 @@ "check-ts": "tsc --noEmit && yarn -s tslint", "clean-deps": "rimraf node_modules", "tslint": "tslint --config ../ts/tslint.json --project .", - "clean": "rimraf './{src,test}/**/*!(.stories).js'", + "clean": "rimraf --glob \"./{src,test}/**/*!(.stories).js\"", "test": "yarn test-unit", "test-unit": "mocha -r @packages/ts/register --config ./test/.mocharc.js" }, diff --git a/packages/errors/package.json b/packages/errors/package.json index 49ed97cf79..cab38595f8 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -10,8 +10,8 @@ "build": "../../scripts/run-if-ci.sh tsc || echo 'type errors'", "build-prod": "tsc", "check-ts": "tsc --noEmit", - "clean-deps": "rm -rf node_modules", - "clean": "rm -f ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'", + "clean-deps": "rimraf node_modules", + "clean": "rimraf ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'", "pretest-unit": "yarn clean", "test-unit": "mocha", "test-electron": "HTML_IMAGE_CONVERSION=1 xvfb-maybe electron --no-sandbox ./node_modules/.bin/_mocha" @@ -36,6 +36,7 @@ "is-ci": "^3.0.1", "mocha": "7.0.1", "pngjs": "^6.0.0", + "rimraf": "3.0.2", "sinon": "7.5.0", "terminal-banner": "^1.1.0", "xvfb-maybe": "^0.2.1" diff --git a/packages/https-proxy/package.json b/packages/https-proxy/package.json index b91d0e8101..4b77bac00c 100644 --- a/packages/https-proxy/package.json +++ b/packages/https-proxy/package.json @@ -4,7 +4,7 @@ "private": true, "main": "index.js", "scripts": { - "clean-deps": "rm -rf node_modules", + "clean-deps": "rimraf node_modules", "https": "node https.js", "regenerate:certs": "cd ./test/helpers/certs && ./regenerate-certs.sh", "start": "node index.js", @@ -30,6 +30,7 @@ "chai": "3.5.0", "cross-env": "6.0.3", "mocha": "3.5.3", + "rimraf": "3.0.2", "sinon": "1.17.7", "sinon-as-promised": "4.0.3", "sinon-chai": "3.3.0", diff --git a/packages/icons/package.json b/packages/icons/package.json index fd3c2b47f3..02feff9fef 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -6,7 +6,7 @@ "main": "index.js", "scripts": { "build-prod": "yarn build", - "build": "scripts/build.sh && ts-node ./src/ico.ts", + "build": "ts-node ./scripts/build.ts && ts-node ./src/ico.ts", "test-unit": "NODE_ENV=test mocha -r @packages/ts/register test/*.ts", "test": "yarn test-unit" }, @@ -14,6 +14,7 @@ "@types/mocha": "^8.0.3", "@types/to-ico": "^1.1.1", "chai": "^4.2.0", + "fs-extra": "9.1.0", "mocha": "^8.1.3", "to-ico": "^1.1.5" }, diff --git a/packages/icons/scripts/build.sh b/packages/icons/scripts/build.sh deleted file mode 100755 index 97d8708f0f..0000000000 --- a/packages/icons/scripts/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -e -rm -rf dist && mkdir dist && mkdir dist/icons -yarn tsc -p ./tsconfig.build.json -if [[ "$OSTYPE" == "darwin"* ]]; then - iconutil -c icns assets/cypress.iconset -o dist/icons/cypress.icns -fi -cp -r assets/* dist -mv dist/cypress.iconset/* dist/icons -rm -r dist/cypress.iconset \ No newline at end of file diff --git a/packages/icons/scripts/build.ts b/packages/icons/scripts/build.ts new file mode 100644 index 0000000000..5c7f6edc1e --- /dev/null +++ b/packages/icons/scripts/build.ts @@ -0,0 +1,26 @@ +import fs from 'fs-extra' +import path from 'path' +import { exec } from 'child_process' +import os from 'os' + +async function build () { + const distPath = path.join(__dirname, '../dist') + const assetsPath = path.join(__dirname, '../assets') + const iconsPath = path.join(distPath, 'icons') + const iconsetPath = path.join(distPath, 'cypress.iconset') + + await fs.remove(distPath) + await fs.mkdir(iconsPath, { recursive: true }) + + await exec('yarn tsc -p ./tsconfig.build.json') + + if (os.platform() === 'darwin') { + await exec('iconutil -c icns assets/cypress.iconset -o dist/icons/cypress.icns') + } + + await fs.copy(assetsPath, distPath) + await fs.copy(iconsetPath, iconsPath, { overwrite: true }) + await fs.remove(iconsetPath) +} + +build() diff --git a/packages/launcher/package.json b/packages/launcher/package.json index 61e2ade0e6..2a10a6dc40 100644 --- a/packages/launcher/package.json +++ b/packages/launcher/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "build-prod": "tsc --project .", - "clean": "node scripts/clean.js || true", + "clean": "rimraf --glob \"lib/*.js\" && rimraf --glob \"lib/**/*.js\" || true", "clean-deps": "rimraf node_modules", "clean-js": "yarn clean", "size": "t=\"cypress-v0.0.0.tgz\"; yarn pack --filename \"${t}\"; wc -c \"cli/${t}\"; tar tvf \"${t}\"; rm \"${t}\";", @@ -29,7 +29,6 @@ "cross-env": "6.0.3", "mocha": "3.5.3", "rimraf": "3.0.2", - "shelljs": "0.8.5", "sinon": "^10.0.0", "sinon-chai": "3.4.0", "typescript": "^4.2.3" diff --git a/packages/launcher/scripts/clean.js b/packages/launcher/scripts/clean.js deleted file mode 100644 index 32b3ab2d32..0000000000 --- a/packages/launcher/scripts/clean.js +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env node - -const shell = require('shelljs') - -shell.set('-v') // verbose - -shell.rm('lib/*.js') -shell.rm('lib/**/*.js') diff --git a/packages/launchpad/cypress/e2e/migration.cy.ts b/packages/launchpad/cypress/e2e/migration.cy.ts index b1b8c00eb9..ee4dde3425 100644 --- a/packages/launchpad/cypress/e2e/migration.cy.ts +++ b/packages/launchpad/cypress/e2e/migration.cy.ts @@ -1,6 +1,9 @@ import type { e2eProjectDirs } from '@packages/frontend-shared/cypress/e2e/support/e2eProjectDirs' import { decodeBase64Unicode } from '@packages/frontend-shared/src/utils/base64' +// @ts-ignore +const platform = window.Cypress.platform + const renameAutoStep = `[data-cy="migration-step renameAuto"]` const renameManualStep = `[data-cy="migration-step renameManual"]` const renameSupportStep = `[data-cy="migration-step renameSupport"]` @@ -949,7 +952,9 @@ describe('Full migration flow for each project', { retries: { openMode: 2, runMo cy.contains('Error Loading Config') // correct location of error - cy.get('[data-testid="error-code-frame"]').contains(`cypress/plugins/index.js:2:9`) + const pluginsPath = platform === 'win32' ? 'cypress\\plugins\\index.js:2:9' : 'cypress/plugins/index.js:2:9' + + cy.get('[data-testid="error-code-frame"]').contains(pluginsPath) // correct error from pluginsFile cy.contains(`throw Error('Uh oh, there was an error!')`) diff --git a/packages/scaffold-config/package.json b/packages/scaffold-config/package.json index f91e651570..80d761a40e 100644 --- a/packages/scaffold-config/package.json +++ b/packages/scaffold-config/package.json @@ -7,8 +7,8 @@ "scripts": { "build-prod": "tsc || echo 'built, with errors'", "check-ts": "tsc --noEmit", - "clean": "rm -f ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'", - "clean-deps": "rm -rf node_modules", + "clean": "rimraf ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'", + "clean-deps": "rimraf node_modules", "test-unit": "mocha -r @packages/ts/register 'test/unit/**' --config ./test/.mocharc.js --exit" }, "dependencies": { @@ -17,7 +17,8 @@ "devDependencies": { "@packages/ts": "0.0.0-development", "chai": "4.2.0", - "mocha": "7.0.1" + "mocha": "7.0.1", + "rimraf": "3.0.2" }, "files": [ "src" diff --git a/scripts/gulp/tasks/gulpMakePackage.ts b/scripts/gulp/tasks/gulpMakePackage.ts index 451fc27ded..3a2bdffc5d 100644 --- a/scripts/gulp/tasks/gulpMakePackage.ts +++ b/scripts/gulp/tasks/gulpMakePackage.ts @@ -61,8 +61,8 @@ export async function makePackage () { scripts: { 'build-prod': 'tsc || echo \'built, with errors\'', 'check-ts': 'tsc --noEmit', - 'clean-deps': 'rm -rf node_modules', - 'clean': 'rm -f ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo \'cleaned\'', + 'clean-deps': 'rimraf node_modules', + 'clean': 'rimraf ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo \'cleaned\'', ...(results.scaffoldTests ? { 'test-unit': 'mocha -r @packages/ts/register test/unit/**/*.spec.ts --config ./test/.mocharc.js --exit', 'test-integration': 'mocha -r @packages/ts/register test/integration/**/*.spec.ts --config ./test/.mocharc.js --exit', @@ -71,10 +71,12 @@ export async function makePackage () { files: ['src'], dependencies: {}, devDependencies: results.scaffoldTests ? { + 'rimraf': '3.0.2', 'mocha': '7.0.1', 'chai': '4.2.0', '@packages/ts': '0.0.0-development', } : { + 'rimraf': '3.0.2', '@packages/ts': '0.0.0-development', }, }, diff --git a/scripts/run-if-not-ci.sh b/scripts/run-if-not-ci.sh deleted file mode 100755 index cb44de5d52..0000000000 --- a/scripts/run-if-not-ci.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# If we're in CI, exit early -if [[ $CI ]]; then exit 0; fi -# otherwise, run the supplied command -"${@:1}" diff --git a/scripts/run-postInstall.js b/scripts/run-postInstall.js new file mode 100644 index 0000000000..b590ac0aae --- /dev/null +++ b/scripts/run-postInstall.js @@ -0,0 +1,12 @@ +const { execSync } = require('child_process') + +const executionEnv = process.env.CI ? 'ci' : 'local' + +const postInstallCommands = { + local: 'patch-package && yarn-deduplicate --strategy=highest && yarn clean && gulp postinstall && yarn build', + ci: 'patch-package && yarn clean && gulp postinstall', +} + +execSync(postInstallCommands[executionEnv], { + stdio: 'inherit', +})