Skip to content

Commit

Permalink
chore: use node script for cleaning scripts (#9547)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Feb 10, 2020
1 parent bcfbcda commit 327b26b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,24 @@
"which": "^2.0.1"
},
"scripts": {
"build-clean": "rm -rf ./packages/*/build ./packages/*/build-es5 ./packages/*/tsconfig.tsbuildinfo",
"build-clean": "rimraf ./packages/*/build ./packages/*/build-es5 ./packages/*/tsconfig.tsbuildinfo",
"prebuild": "yarn build:ts",
"build": "node ./scripts/build.js",
"build:ts": "node scripts/buildTs.js",
"build:ts": "node ./scripts/buildTs.js",
"check-copyright-headers": "node ./scripts/checkCopyrightHeaders.js",
"clean-all": "rm -rf ./node_modules && rm -rf ./packages/*/node_modules && yarn clean-e2e && yarn build-clean",
"clean-e2e": "find ./e2e -not \\( -path ./e2e/presets/js -prune \\) -not \\( -path ./e2e/presets/json -prune \\) -not \\( -path ./e2e/global-setup-node-modules -prune \\) -mindepth 1 -type d \\( -name node_modules -prune \\) -exec rm -r '{}' +",
"clean-all": "rimraf ./node_modules && rimraf ./packages/*/node_modules && yarn clean-e2e && yarn build-clean",
"clean-e2e": "node ./scripts/cleanE2e.js",
"jest": "node ./packages/jest-cli/bin/jest.js",
"jest-coverage": "yarn jest --coverage",
"lint": "eslint . --cache --ext js,jsx,ts,tsx,md",
"lint-es5-build": "eslint --no-eslintrc --no-ignore --env=browser packages/*/build-es5",
"lint:prettier": "yarn --silent lint:prettier:ci --fix",
"lint:prettier:ci": "prettylint '**/*.{md,yml,yaml}' --ignore-path .gitignore",
"postinstall": "opencollective postinstall && yarn build",
"install-no-ts-build": "node scripts/remove-postinstall && yarn --no-progress --frozen-lockfile && node scripts/build",
"install-no-ts-build": "node ./scripts/remove-postinstall && yarn --no-progress --frozen-lockfile && node ./scripts/build",
"publish": "yarn build-clean && yarn build && lerna publish --silent",
"test-ci-es5-build-in-browser": "karma start --single-run",
"test-ci": "yarn jest-coverage --color -i --config jest.config.ci.js && yarn test-leak && node scripts/mapCoverage.js && codecov",
"test-ci": "yarn jest-coverage --color -i --config jest.config.ci.js && yarn test-leak && node ./scripts/mapCoverage.js && codecov",
"test-ci-partial": "yarn jest --color -i --config jest.config.ci.js",
"test-pretty-format-perf": "node packages/pretty-format/perf/test.js",
"test-leak": "yarn jest -i --detectLeaks jest-mock jest-diff jest-repl",
Expand Down
28 changes: 28 additions & 0 deletions scripts/cleanE2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

const {normalize, resolve} = require('path');
const {sync: glob} = require('glob');
const {sync: rimraf} = require('rimraf');

const blacklist = [
'e2e/global-setup-node-modules/node_modules/',
'e2e/presets/js/node_modules/',
'e2e/presets/json/node_modules/',
].map(dir => normalize(dir));

const e2eNodeModules = glob('e2e/*/node_modules/')
.concat(glob('e2e/*/*/node_modules/'))
.filter(dir => !blacklist.includes(dir))
.map(dir => resolve(__dirname, '..', dir))
.sort();

e2eNodeModules.forEach(dir => {
rimraf(dir, {glob: false});
});

0 comments on commit 327b26b

Please sign in to comment.