From e77f583467d3426c058486523d011fea0eb09cf9 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Tue, 24 May 2022 12:25:49 +0200 Subject: [PATCH 1/3] fix: Do not delete .idea while doing the cleanup It also makes sure only root level directories are excluded Closes #18308 --- scripts/reset.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/reset.js b/scripts/reset.js index 3641cea93152..afbd4ee9b070 100644 --- a/scripts/reset.js +++ b/scripts/reset.js @@ -11,8 +11,8 @@ const cleaningProcess = spawn('git', [ 'clean', '-xdf', '-n', - '--exclude=".vscode"', - '--exclude=".idea"', + '--exclude="/.vscode"', + '--exclude="/.idea"', ]); cleaningProcess.stdout.on('data', (data) => { From 9b3584989411cc9eb05622e7005349eb42211df4 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Tue, 24 May 2022 13:37:45 +0200 Subject: [PATCH 2/3] Tweak the language in case when a users decides not to run the script --- scripts/bootstrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js index fa1d07f49e3e..21e029464a17 100755 --- a/scripts/bootstrap.js +++ b/scripts/bootstrap.js @@ -203,7 +203,7 @@ function run() { if (sure) { return list; } - throw new Error('problem is between keyboard and chair'); + throw new Error('Cleanup canceled'); }); } return list; From 8bdb1cdcb990f65d8f3d4667a782bb5618984cb7 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Tue, 24 May 2022 13:48:12 +0200 Subject: [PATCH 3/3] feat: Add cleanup task to bootstrap that removes compiled /dist folders --- package.json | 2 + scripts/bootstrap.js | 11 +++- yarn.lock | 153 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 158 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index c1c7debbca86..0713dc02c531 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "build-storybooks": "cross-env STORYBOOK_DISPLAY_WARNING=true DISPLAY_WARNING=true node -r esm ./scripts/build-storybooks.js", "changelog": "pr-log --sloppy --cherry-pick", "changelog:next": "pr-log --sloppy --since-prerelease", + "clean:dist": "del **/dist", "coverage": "codecov", "danger": "danger", "generate-repros": "zx scripts/repros-generator/index.mjs", @@ -228,6 +229,7 @@ "core-js": "^3.21.1", "cross-env": "^7.0.3", "danger": "^10.6.2", + "del-cli": "^4.0.1", "detect-port": "^1.3.0", "downlevel-dts": "^0.6.0", "dts-bundle-generator": "^6.2.0", diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js index 21e029464a17..c7c07e9abdc6 100755 --- a/scripts/bootstrap.js +++ b/scripts/bootstrap.js @@ -76,6 +76,15 @@ function run() { }, order: 1, }), + cleanup: createTask({ + name: `Remove compiled dist directories ${chalk.gray('(cleanup)')}`, + defaultValue: false, + option: '--cleanup', + command: () => { + spawn('npm run clean:dist'); + }, + order: 0, + }), reset: createTask({ name: `Clean repository ${chalk.red('(reset)')}`, defaultValue: false, @@ -142,7 +151,7 @@ function run() { const groups = { main: ['core'], buildtasks: ['install', 'build', 'manager'], - devtasks: ['dev', 'registry', 'reset'], + devtasks: ['dev', 'registry', 'cleanup', 'reset'], }; Object.keys(tasks) diff --git a/yarn.lock b/yarn.lock index fd9be8f2af5c..dfb5cd913b50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8542,6 +8542,7 @@ __metadata: cross-env: ^7.0.3 cypress: 8.7.0 danger: ^10.6.2 + del-cli: ^4.0.1 detect-port: ^1.3.0 downlevel-dts: ^0.6.0 dts-bundle-generator: ^6.2.0 @@ -16257,6 +16258,18 @@ __metadata: languageName: node linkType: hard +"camelcase-keys@npm:^7.0.0": + version: 7.0.2 + resolution: "camelcase-keys@npm:7.0.2" + dependencies: + camelcase: ^6.3.0 + map-obj: ^4.1.0 + quick-lru: ^5.1.1 + type-fest: ^1.2.1 + checksum: ae86a51168643e9e8a2f2c7bfa17850729979ec3dafc5253056a7d97931cbb0e3ef5b4185e59d54b7a56c54405dee2874b0c82033498d8626e512ff9034cb05c + languageName: node + linkType: hard + "camelcase@npm:5.3.1, camelcase@npm:^5.0.0, camelcase@npm:^5.3.1": version: 5.3.1 resolution: "camelcase@npm:5.3.1" @@ -16278,7 +16291,7 @@ __metadata: languageName: node linkType: hard -"camelcase@npm:^6.0.0, camelcase@npm:^6.1.0, camelcase@npm:^6.2.0": +"camelcase@npm:^6.0.0, camelcase@npm:^6.1.0, camelcase@npm:^6.2.0, camelcase@npm:^6.3.0": version: 6.3.0 resolution: "camelcase@npm:6.3.0" checksum: 0d701658219bd3116d12da3eab31acddb3f9440790c0792e0d398f0a520a6a4058018e546862b6fba89d7ae990efaeb97da71e1913e9ebf5a8b5621a3d55c710 @@ -19150,6 +19163,13 @@ __metadata: languageName: node linkType: hard +"decamelize@npm:^5.0.0": + version: 5.0.1 + resolution: "decamelize@npm:5.0.1" + checksum: 3da71022bc1e85487810fa0833138effb599fa331ca21e179650e93a765d0c4dabeb1ecdd6ad1474fa0bacd2457953c63ea335afb6e53b35f2b4bf779514e2a3 + languageName: node + linkType: hard + "decimal.js@npm:^10.2.1": version: 10.3.1 resolution: "decimal.js@npm:10.3.1" @@ -19363,6 +19383,19 @@ __metadata: languageName: node linkType: hard +"del-cli@npm:^4.0.1": + version: 4.0.1 + resolution: "del-cli@npm:4.0.1" + dependencies: + del: ^6.0.0 + meow: ^10.1.0 + bin: + del: cli.js + del-cli: cli.js + checksum: 01d314de214e7d96159f99d385186d90a71e0494a9262d98b8da15d144a22b894e0fae4d99d7c707cf3a50990f0513263c0e5b5b72ce5ad92f1ab1c7140e0f70 + languageName: node + linkType: hard + "del@npm:^2.2.0": version: 2.2.2 resolution: "del@npm:2.2.2" @@ -19393,6 +19426,22 @@ __metadata: languageName: node linkType: hard +"del@npm:^6.0.0": + version: 6.1.0 + resolution: "del@npm:6.1.0" + dependencies: + globby: ^11.0.1 + graceful-fs: ^4.2.4 + is-glob: ^4.0.1 + is-path-cwd: ^2.2.0 + is-path-inside: ^3.0.2 + p-map: ^4.0.0 + rimraf: ^3.0.2 + slash: ^3.0.0 + checksum: ce93c194f774ce2dcde8fa4dc44d29bf528f8e8fd27f4e70da8ddea6e56fc1a6dc0631c589399186a1f635f94d0f54e9549f48b90186674b3c602b14c4b82132 + languageName: node + linkType: hard + "delayed-stream@npm:0.0.5": version: 0.0.5 resolution: "delayed-stream@npm:0.0.5" @@ -26148,6 +26197,13 @@ __metadata: languageName: node linkType: hard +"indent-string@npm:^5.0.0": + version: 5.0.0 + resolution: "indent-string@npm:5.0.0" + checksum: 8ee77b57d92e71745e133f6f444d6fa3ed503ad0e1bcd7e80c8da08b42375c07117128d670589725ed07b1978065803fa86318c309ba45415b7fe13e7f170220 + languageName: node + linkType: hard + "indexes-of@npm:^1.0.1": version: 1.0.1 resolution: "indexes-of@npm:1.0.1" @@ -26946,7 +27002,7 @@ __metadata: languageName: node linkType: hard -"is-path-cwd@npm:^2.0.0": +"is-path-cwd@npm:^2.0.0, is-path-cwd@npm:^2.2.0": version: 2.2.0 resolution: "is-path-cwd@npm:2.2.0" checksum: afce71533a427a759cd0329301c18950333d7589533c2c90205bd3fdcf7b91eb92d1940493190567a433134d2128ec9325de2fd281e05be1920fbee9edd22e0a @@ -31159,7 +31215,7 @@ __metadata: languageName: node linkType: hard -"map-obj@npm:^4.0.0": +"map-obj@npm:^4.0.0, map-obj@npm:^4.1.0": version: 4.3.0 resolution: "map-obj@npm:4.3.0" checksum: 1c19e1c88513c8abdab25c316367154c6a0a6a0f77e3e8c391bb7c0e093aefed293f539d026dc013d86219e5e4c25f23b0003ea588be2101ccd757bacc12d43b @@ -31675,6 +31731,26 @@ __metadata: languageName: node linkType: hard +"meow@npm:^10.1.0": + version: 10.1.2 + resolution: "meow@npm:10.1.2" + dependencies: + "@types/minimist": ^1.2.2 + camelcase-keys: ^7.0.0 + decamelize: ^5.0.0 + decamelize-keys: ^1.1.0 + hard-rejection: ^2.1.0 + minimist-options: 4.1.0 + normalize-package-data: ^3.0.2 + read-pkg-up: ^8.0.0 + redent: ^4.0.0 + trim-newlines: ^4.0.2 + type-fest: ^1.2.2 + yargs-parser: ^20.2.9 + checksum: 8b4332e7b80b79188c2082ada65b592180a33e24aee76d2574ce1fb1c7542e8c8b65300c14abdfde984c1bffea429bf0d13670e00db36b326a7fd6e22dab9c9a + languageName: node + linkType: hard + "meow@npm:^3.1.0, meow@npm:^3.3.0": version: 3.7.0 resolution: "meow@npm:3.7.0" @@ -32320,7 +32396,7 @@ __metadata: languageName: node linkType: hard -"min-indent@npm:^1.0.0": +"min-indent@npm:^1.0.0, min-indent@npm:^1.0.1": version: 1.0.1 resolution: "min-indent@npm:1.0.1" checksum: 7e207bd5c20401b292de291f02913230cb1163abca162044f7db1d951fa245b174dc00869d40dd9a9f32a885ad6a5f3e767ee104cf278f399cb4e92d3f582d5c @@ -33369,7 +33445,7 @@ __metadata: languageName: node linkType: hard -"normalize-package-data@npm:^3.0.0": +"normalize-package-data@npm:^3.0.0, normalize-package-data@npm:^3.0.2": version: 3.0.3 resolution: "normalize-package-data@npm:3.0.3" dependencies: @@ -34717,7 +34793,7 @@ __metadata: languageName: node linkType: hard -"parse-json@npm:^5.0.0": +"parse-json@npm:^5.0.0, parse-json@npm:^5.2.0": version: 5.2.0 resolution: "parse-json@npm:5.2.0" dependencies: @@ -37652,6 +37728,13 @@ __metadata: languageName: node linkType: hard +"quick-lru@npm:^5.1.1": + version: 5.1.1 + resolution: "quick-lru@npm:5.1.1" + checksum: a24cba5da8cec30d70d2484be37622580f64765fb6390a928b17f60cd69e8dbd32a954b3ff9176fa1b86d86ff2ba05252fae55dc4d40d0291c60412b0ad096da + languageName: node + linkType: hard + "quick-temp@npm:^0.1.2, quick-temp@npm:^0.1.3, quick-temp@npm:^0.1.5, quick-temp@npm:^0.1.8": version: 0.1.8 resolution: "quick-temp@npm:0.1.8" @@ -38643,6 +38726,17 @@ __metadata: languageName: node linkType: hard +"read-pkg-up@npm:^8.0.0": + version: 8.0.0 + resolution: "read-pkg-up@npm:8.0.0" + dependencies: + find-up: ^5.0.0 + read-pkg: ^6.0.0 + type-fest: ^1.0.1 + checksum: cf3905ccbe5cd602f23192cc7ca65ed17561bab117eadb9aed817441d5bfc6b9a11215c2a3e9505f501d046818f3c4180dbea61fa83c42083e0b4e407d5cc745 + languageName: node + linkType: hard + "read-pkg@npm:^1.0.0": version: 1.1.0 resolution: "read-pkg@npm:1.1.0" @@ -38699,6 +38793,18 @@ __metadata: languageName: node linkType: hard +"read-pkg@npm:^6.0.0": + version: 6.0.0 + resolution: "read-pkg@npm:6.0.0" + dependencies: + "@types/normalize-package-data": ^2.4.0 + normalize-package-data: ^3.0.2 + parse-json: ^5.2.0 + type-fest: ^1.0.1 + checksum: b51ee5eed75324f4fac34c9a40b5e4b403de4c532242be01959c9bbdb1ff9db1c6c2aefaba569622fec49d1ead866e97ba856ab145f6e11039b11f7bec1318ba + languageName: node + linkType: hard + "read@npm:1, read@npm:~1.0.1": version: 1.0.7 resolution: "read@npm:1.0.7" @@ -38909,6 +39015,16 @@ __metadata: languageName: node linkType: hard +"redent@npm:^4.0.0": + version: 4.0.0 + resolution: "redent@npm:4.0.0" + dependencies: + indent-string: ^5.0.0 + strip-indent: ^4.0.0 + checksum: a9b640c8f4b2b5b26a1a908706475ff404dd50a97d6f094bc3c59717be922622927cc7d601d4ae2857d897ad243fd979bd76d751a0481cee8be7024e5fb4c662 + languageName: node + linkType: hard + "redeyed@npm:~1.0.0": version: 1.0.1 resolution: "redeyed@npm:1.0.1" @@ -42556,6 +42672,15 @@ __metadata: languageName: node linkType: hard +"strip-indent@npm:^4.0.0": + version: 4.0.0 + resolution: "strip-indent@npm:4.0.0" + dependencies: + min-indent: ^1.0.1 + checksum: 6b1fb4e22056867f5c9e7a6f3f45922d9a2436cac758607d58aeaac0d3b16ec40b1c43317de7900f1b8dd7a4107352fa47fb960f2c23566538c51e8585c8870e + languageName: node + linkType: hard + "strip-json-comments@npm:2.0.1, strip-json-comments@npm:^2.0.0, strip-json-comments@npm:~2.0.1": version: 2.0.1 resolution: "strip-json-comments@npm:2.0.1" @@ -43980,6 +44105,13 @@ __metadata: languageName: node linkType: hard +"trim-newlines@npm:^4.0.2": + version: 4.0.2 + resolution: "trim-newlines@npm:4.0.2" + checksum: 48d022e9d14f27cf8b71983691af61cd8ce511d159ed0962452d2fa23f58298398d905e1ff982566f9034f93df3ef676868c1c14d13bcd849e7500dbfbd6101b + languageName: node + linkType: hard + "trim-right@npm:^1.0.1": version: 1.0.1 resolution: "trim-right@npm:1.0.1" @@ -44406,6 +44538,13 @@ __metadata: languageName: node linkType: hard +"type-fest@npm:^1.0.1, type-fest@npm:^1.2.1, type-fest@npm:^1.2.2": + version: 1.4.0 + resolution: "type-fest@npm:1.4.0" + checksum: a3c0f4ee28ff6ddf800d769eafafcdeab32efa38763c1a1b8daeae681920f6e345d7920bf277245235561d8117dab765cb5f829c76b713b4c9de0998a5397141 + languageName: node + linkType: hard + "type-is@npm:~1.6.17, type-is@npm:~1.6.18": version: 1.6.18 resolution: "type-is@npm:1.6.18" @@ -47860,7 +47999,7 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:20.x, yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3, yargs-parser@npm:^20.2.7": +"yargs-parser@npm:20.x, yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3, yargs-parser@npm:^20.2.7, yargs-parser@npm:^20.2.9": version: 20.2.9 resolution: "yargs-parser@npm:20.2.9" checksum: 0685a8e58bbfb57fab6aefe03c6da904a59769bd803a722bb098bd5b0f29d274a1357762c7258fb487512811b8063fb5d2824a3415a0a4540598335b3b086c72