-
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add --all flag to migrate command for migrating all packages and implement tests
#80
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
Open
dreyfus92
wants to merge
16
commits into
e18e:main
Choose a base branch
from
dreyfus92:feat/add-migrate-all
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2bbc99f
feat: add --all flag to migrate command for migrating all packages an…
dreyfus92 084575c
format
dreyfus92 6410406
chore: migrate tests to spawn actual CLI process and optimize array h…
dreyfus92 26d7f91
format
dreyfus92 7279f67
fix: update stripVersion function to handle additional temporary file…
dreyfus92 8502fa7
format
dreyfus92 643c46f
test: update migrate tests to check for essential output content inst…
dreyfus92 0aa351b
format
dreyfus92 888156a
Apply suggestions.
dreyfus92 e86e47d
format
dreyfus92 fe3b060
apply more suggestions
dreyfus92 508f87a
test
dreyfus92 6ff434b
test-2
dreyfus92 e182132
format
dreyfus92 4fd2b92
refactor tests
dreyfus92 c61797c
test: update snapshots
43081j File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
|
||
| exports[`migrate command > should handle custom include pattern 1`] = ` | ||
| "[36me18e[39m (cli <version>) | ||
|
|
||
| [90m┌[39m Migrating packages... | ||
| [90m│[39m | ||
| [90m│[39m Targets: [2mchalk[22m | ||
| [90m│[39m | ||
| [32m◇[39m {cwd}/lib/main.js... | ||
| [90m│[39m | ||
| [90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [2K[1A[2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [90m│[39m [2mwriting {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G[90m│[39m | ||
| [32m◆[39m {cwd}/lib/main.js [2m(1 migrated)[22m | ||
| [90m│[39m | ||
| [90m└[39m Migration complete. | ||
|
|
||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should handle custom include pattern 2`] = ` | ||
| "import * as pc from 'picocolors'; | ||
|
|
||
| console.log(pc.cyan('I am _so_ cyan')); | ||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should handle interactive mode 1`] = ` | ||
| "[36me18e[39m (cli <version>) | ||
|
|
||
| [90m┌[39m Migrating packages... | ||
| [?25l[90m│[39m | ||
| [36m◆[39m Select packages to migrate | ||
|
|
||
| [36m│[39m [2mSearch:[22m [7m[8m_[28m[27m | ||
| [36m│[39m [32m◼[39m chalk | ||
| [36m│[39m [2m[2m↑/↓[22m[2m to navigate • [2mSpace:[22m[2m select • [2mEnter:[22m[2m confirm • [2mType:[22m[2m to search[22m | ||
| [36m└[39m" | ||
| `; | ||
|
|
||
| exports[`migrate command > should handle interactive mode 2`] = ` | ||
| "import chalk from 'chalk'; | ||
|
|
||
| console.log(chalk.cyan('I am _so_ cyan')); | ||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should migrate specific package 1`] = ` | ||
| "[36me18e[39m (cli <version>) | ||
|
|
||
| [90m┌[39m Migrating packages... | ||
| [90m│[39m | ||
| [90m│[39m Targets: [2mchalk[22m | ||
| [90m│[39m | ||
| [32m◇[39m {cwd}/lib/main.js... | ||
| [90m│[39m | ||
| [90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [2K[1A[2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [90m│[39m [2mwriting {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G[90m│[39m | ||
| [32m◆[39m {cwd}/lib/main.js [2m(1 migrated)[22m | ||
| [90m│[39m | ||
| [90m└[39m Migration complete. | ||
|
|
||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should migrate specific package 2`] = ` | ||
| "import * as pc from 'picocolors'; | ||
|
|
||
| console.log(pc.cyan('I am _so_ cyan')); | ||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should migrate with --all flag 1`] = ` | ||
| "[36me18e[39m (cli <version>) | ||
|
|
||
| [90m┌[39m Migrating packages... | ||
| [90m│[39m | ||
| [90m│[39m Targets: [2mchalk[22m | ||
| [90m│[39m | ||
| [32m◇[39m {cwd}/lib/main.js... | ||
| [90m│[39m | ||
| [90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [2K[1A[2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [90m│[39m [2mwriting {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G[90m│[39m | ||
| [32m◆[39m {cwd}/lib/main.js [2m(1 migrated)[22m | ||
| [90m│[39m | ||
| [90m└[39m Migration complete. | ||
|
|
||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should migrate with --all flag 2`] = ` | ||
| "import * as pc from 'picocolors'; | ||
|
|
||
| console.log(pc.cyan('I am _so_ cyan')); | ||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should not modify files with --all flag in dry-run mode 1`] = ` | ||
| "[36me18e[39m (cli <version>) | ||
|
|
||
| [90m┌[39m Migrating packages... | ||
| [90m│[39m | ||
| [90m│[39m Targets: [2mchalk[22m | ||
| [90m│[39m | ||
| [32m◇[39m {cwd}/lib/main.js... | ||
| [90m│[39m | ||
| [90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [2K[1A[2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [90m│[39m [2mwriting {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G[90m│[39m | ||
| [32m◆[39m {cwd}/lib/main.js [2m(1 migrated)[22m | ||
| [90m│[39m | ||
| [90m└[39m Migration complete. | ||
|
|
||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should not modify files with --all flag in dry-run mode 2`] = ` | ||
| "import chalk from 'chalk'; | ||
|
|
||
| console.log(chalk.cyan('I am _so_ cyan')); | ||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should not modify files with specific package in dry-run mode 1`] = ` | ||
| "[36me18e[39m (cli <version>) | ||
|
|
||
| [90m┌[39m Migrating packages... | ||
| [90m│[39m | ||
| [90m│[39m Targets: [2mchalk[22m | ||
| [90m│[39m | ||
| [32m◇[39m {cwd}/lib/main.js... | ||
| [90m│[39m | ||
| [90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [2K[1A[2K[1A[2K[G[90m│[39m [2mloading {cwd}/lib/main.js[22m | ||
| [90m│[39m [2mmigrating chalk to picocolors[22m | ||
| [90m│[39m [2mwriting {cwd}/lib/main.js[22m | ||
| [2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G[90m│[39m | ||
| [32m◆[39m {cwd}/lib/main.js [2m(1 migrated)[22m | ||
| [90m│[39m | ||
| [90m└[39m Migration complete. | ||
|
|
||
| " | ||
| `; | ||
|
|
||
| exports[`migrate command > should not modify files with specific package in dry-run mode 2`] = ` | ||
| "import chalk from 'chalk'; | ||
|
|
||
| console.log(chalk.cyan('I am _so_ cyan')); | ||
| " | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.