Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Fix "reset" script removing .idea directory and add "cleanup" script #18309

Merged
merged 3 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
13 changes: 11 additions & 2 deletions scripts/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -203,7 +212,7 @@ function run() {
if (sure) {
return list;
}
throw new Error('problem is between keyboard and chair');
throw new Error('Cleanup canceled');
});
}
return list;
Expand Down
4 changes: 2 additions & 2 deletions scripts/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const cleaningProcess = spawn('git', [
'clean',
'-xdf',
'-n',
'--exclude=".vscode"',
'--exclude=".idea"',
'--exclude="/.vscode"',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okonet Any idea why this is necessary? This seems to be more restrictive than what was there before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without that it would try to match .vscode recursively which would increase the amount of directories it would output dramatically because .vscode is often present in node_modules. With the / it would only match the root directories.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't even think /.vscode is needed here since it's under VCS but I left it in case it contains some user-generated settings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, but I was more interested in '--exclude=".idea"', which already existed in the code and was replaced by --exclude="/.idea" which seems more restrictive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .idea didn't work for me at all. Thus the fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my question. Any idea why ".idea" doesn't work but "/.idea" does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. I would assume it could treat the . as part of regex but I didn't want to spend too much time investigating.

'--exclude="/.idea"',
]);

cleaningProcess.stdout.on('data', (data) => {
Expand Down
153 changes: 146 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down