@carbon/upgrade 10.16.0 → 11.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +12 -16
  2. package/bin/carbon-upgrade.js +4 -8
  3. package/cli.js +55013 -0
  4. package/package.json +17 -10
  5. package/transforms/ARCHITECTURE.md +47 -0
  6. package/transforms/__testfixtures__/icons-react-size-prop-object-key.input.js +16 -0
  7. package/transforms/__testfixtures__/icons-react-size-prop-object-key.output.js +16 -0
  8. package/transforms/__testfixtures__/icons-react-size-prop-rename.input.js +44 -0
  9. package/transforms/__testfixtures__/icons-react-size-prop-rename.output.js +44 -0
  10. package/transforms/__testfixtures__/icons-react-size-prop-with-prop.input.js +19 -0
  11. package/transforms/__testfixtures__/icons-react-size-prop-with-prop.output.js +22 -0
  12. package/transforms/__testfixtures__/size-prop-update.input.js +143 -0
  13. package/transforms/__testfixtures__/size-prop-update.output.js +143 -0
  14. package/transforms/__testfixtures__/small-to-size-prop.input.js +11 -0
  15. package/transforms/__testfixtures__/small-to-size-prop.output.js +11 -0
  16. package/transforms/__testfixtures__/sort-prop-types.input.js +7 -0
  17. package/transforms/__testfixtures__/sort-prop-types.output.js +7 -0
  18. package/transforms/__testfixtures__/sort-prop-types2.input.js +7 -0
  19. package/transforms/__testfixtures__/sort-prop-types2.output.js +7 -0
  20. package/transforms/__testfixtures__/update-carbon-components-react-import-to-scoped.input.js +8 -0
  21. package/transforms/__testfixtures__/update-carbon-components-react-import-to-scoped.output.js +8 -0
  22. package/transforms/__tests__/icons-react-size-prop.js +64 -0
  23. package/transforms/__tests__/size-prop-update-test.js +12 -0
  24. package/transforms/__tests__/small-to-size-test.js +12 -0
  25. package/transforms/__tests__/sort-prop-types-test.js +13 -0
  26. package/transforms/__tests__/update-carbon-components-react-import-to-scoped.js +12 -0
  27. package/transforms/icons-react-size-prop.js +324 -0
  28. package/transforms/size-prop-update.js +140 -0
  29. package/transforms/small-to-size-prop.js +56 -0
  30. package/transforms/sort-prop-types.js +88 -0
  31. package/transforms/update-carbon-components-react-import-to-scoped.js +33 -0
  32. package/src/cli.js +0 -100
  33. package/src/error.js +0 -21
  34. package/src/hash.js +0 -87
  35. package/src/migration.js +0 -85
  36. package/src/migrations/index.js +0 -41
  37. package/src/planner.js +0 -58
  38. package/src/project/__tests__/project-test.js +0 -52
  39. package/src/project/__tests__/workspace-test.js +0 -92
  40. package/src/project/index.js +0 -16
  41. package/src/project/project.js +0 -92
  42. package/src/project/workspace.js +0 -172
  43. package/src/runner.js +0 -76
package/README.md CHANGED
@@ -24,28 +24,24 @@ You can install `@carbon/upgrade` in your project, or use a tool like
24
24
  [`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b)
25
25
  by running the following command in your project:
26
26
 
27
- # Runs the command in "dry" mode, which means no files are altered.
28
- # To update the files, re-run the command without the `-d` flag.
29
- npx @carbon/upgrade -d
27
+ ```bash
28
+ npx @carbon/upgrade -d
29
+ ```
30
30
 
31
31
  Below is a full output of the options and commands available:
32
32
 
33
33
  ```bash
34
- Usage: carbon-upgrade [options]
35
-
36
- Commands:
37
- carbon-upgrade run to upgrade your project[default]
38
- carbon-upgrade migrate <package> <from> run a specific migration for a
39
- <to> package
34
+ Usage: @carbon/upgrade [options]
40
35
 
41
36
  Options:
42
- --help Show help [boolean]
43
- --version Show version number [boolean]
44
- --verbose display the full output while running a command [default: false]
45
- --dry, -d view the result of running this command without changing any
46
- files [default: false]
47
- --ignore, -i provide a glob pattern for directories you would like ignored
48
- [default: ""]
37
+ --help Show help [boolean]
38
+ --version Show version number [boolean]
39
+ --force force execution if the cli encounters an error while doing
40
+ safety checks [boolean] [default: false]
41
+ -w, --write update the files with changes found by running the migration
42
+ [default: false]
43
+ -v, --verbose optionally include additional logs, useful for debugging
44
+ [boolean] [default: false]
49
45
  ```
50
46
 
51
47
  ## 🙌 Contributing
@@ -18,24 +18,20 @@ process.on('unhandledRejection', (error) => {
18
18
  console.error(error);
19
19
  });
20
20
 
21
- var chalk = require('chalk');
22
-
23
21
  var currentNodeVersion = process.versions.node;
24
22
  var semver = currentNodeVersion.split('.');
25
23
  var major = semver[0];
26
24
 
27
25
  if (major < 14) {
28
26
  console.error(
29
- chalk.red(
30
- `You are running Node ${currentNodeVersion}.\n` +
31
- `carbon-upgrade requires Node 14 or higher, please update your ` +
32
- `version of Node.`
33
- )
27
+ `You are running Node ${currentNodeVersion}.\n` +
28
+ `carbon-upgrade requires Node 14 or higher, please update your ` +
29
+ `version of Node.`
34
30
  );
35
31
  process.exit(1);
36
32
  }
37
33
 
38
- var main = require('../src/cli');
34
+ var { main } = require('../cli');
39
35
 
40
36
  main(process).catch((error) => {
41
37
  console.error(error);