@octaviaflow/upgrade 1.0.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 (58) hide show
  1. package/README.md +97 -0
  2. package/bin/carbon-upgrade.js +48 -0
  3. package/cli.js +53573 -0
  4. package/package.json +56 -0
  5. package/telemetry.yml +17 -0
  6. package/transforms/ARCHITECTURE.md +47 -0
  7. package/transforms/__testfixtures__/featureflag-deprecate-flags-prop.input.js +143 -0
  8. package/transforms/__testfixtures__/featureflag-deprecate-flags-prop.output.js +133 -0
  9. package/transforms/__testfixtures__/ibm-products-update-userprofileimage.input.js +57 -0
  10. package/transforms/__testfixtures__/ibm-products-update-userprofileimage.output.js +50 -0
  11. package/transforms/__testfixtures__/icons-react-size-prop-object-key.input.js +25 -0
  12. package/transforms/__testfixtures__/icons-react-size-prop-object-key.output.js +25 -0
  13. package/transforms/__testfixtures__/icons-react-size-prop-rename.input.js +53 -0
  14. package/transforms/__testfixtures__/icons-react-size-prop-rename.output.js +53 -0
  15. package/transforms/__testfixtures__/icons-react-size-prop-with-prop.input.js +25 -0
  16. package/transforms/__testfixtures__/icons-react-size-prop-with-prop.output.js +28 -0
  17. package/transforms/__testfixtures__/refactor-light-to-layer.input.js +23 -0
  18. package/transforms/__testfixtures__/refactor-light-to-layer.output.js +23 -0
  19. package/transforms/__testfixtures__/refactor-to-callout.input.js +34 -0
  20. package/transforms/__testfixtures__/refactor-to-callout.output.js +32 -0
  21. package/transforms/__testfixtures__/refactor-to-callout2.input.js +13 -0
  22. package/transforms/__testfixtures__/refactor-to-callout2.output.js +13 -0
  23. package/transforms/__testfixtures__/refactor-to-callout3.input.js +14 -0
  24. package/transforms/__testfixtures__/refactor-to-callout3.output.js +14 -0
  25. package/transforms/__testfixtures__/refactor-to-callout4.input.js +12 -0
  26. package/transforms/__testfixtures__/refactor-to-callout4.output.js +12 -0
  27. package/transforms/__testfixtures__/size-prop-update.input.js +152 -0
  28. package/transforms/__testfixtures__/size-prop-update.output.js +152 -0
  29. package/transforms/__testfixtures__/small-to-size-prop.input.js +20 -0
  30. package/transforms/__testfixtures__/small-to-size-prop.output.js +19 -0
  31. package/transforms/__testfixtures__/sort-prop-types.input.js +16 -0
  32. package/transforms/__testfixtures__/sort-prop-types.output.js +16 -0
  33. package/transforms/__testfixtures__/sort-prop-types2.input.js +16 -0
  34. package/transforms/__testfixtures__/sort-prop-types2.output.js +16 -0
  35. package/transforms/__testfixtures__/update-carbon-components-react-import-to-scoped.input.js +17 -0
  36. package/transforms/__testfixtures__/update-carbon-components-react-import-to-scoped.output.js +17 -0
  37. package/transforms/__testfixtures__/update-carbon-icons-react-import-to-carbon-react.input.js +17 -0
  38. package/transforms/__testfixtures__/update-carbon-icons-react-import-to-carbon-react.output.js +17 -0
  39. package/transforms/__tests__/featureflag-deprecate-flags-prop-test.js +15 -0
  40. package/transforms/__tests__/ibm-products-update-userprofileimage-test.js +21 -0
  41. package/transforms/__tests__/icons-react-size-prop.js +67 -0
  42. package/transforms/__tests__/refactor-light-to-layer-test.js +14 -0
  43. package/transforms/__tests__/refactor-to-callout.js +18 -0
  44. package/transforms/__tests__/size-prop-update-test.js +15 -0
  45. package/transforms/__tests__/small-to-size-test.js +15 -0
  46. package/transforms/__tests__/sort-prop-types-test.js +16 -0
  47. package/transforms/__tests__/update-carbon-components-react-import-to-scoped.js +15 -0
  48. package/transforms/__tests__/update-carbon-icons-react-import-to-carbon-react.js +15 -0
  49. package/transforms/featureflag-deprecate-flags-prop.js +89 -0
  50. package/transforms/ibm-products-update-userprofileimage.js +134 -0
  51. package/transforms/icons-react-size-prop.js +327 -0
  52. package/transforms/refactor-light-to-layer.js +117 -0
  53. package/transforms/refactor-to-callout.js +160 -0
  54. package/transforms/size-prop-update.js +143 -0
  55. package/transforms/small-to-size-prop.js +59 -0
  56. package/transforms/sort-prop-types.js +91 -0
  57. package/transforms/update-carbon-components-react-import-to-scoped.js +42 -0
  58. package/transforms/update-carbon-icons-react-import-to-carbon-react.js +42 -0
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # @octaviaflow/upgrade
2
+
3
+ > A tool for upgrading Carbon versions
4
+
5
+ ## Getting started
6
+
7
+ To install `@octaviaflow/upgrade` in your project, you will need to run the following
8
+ command using [npm](https://www.npmjs.com/):
9
+
10
+ ```bash
11
+ npm install -S @octaviaflow/upgrade
12
+ ```
13
+
14
+ If you prefer [Yarn](https://yarnpkg.com/en/), use the following command
15
+ instead:
16
+
17
+ ```bash
18
+ yarn add @octaviaflow/upgrade
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ You can install `@octaviaflow/upgrade` in your project, or use a tool like
24
+ [`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b)
25
+ by running the following command in your project:
26
+
27
+ ```bash
28
+ npx @octaviaflow/upgrade
29
+ ```
30
+
31
+ Below is a full output of the options and commands available:
32
+
33
+ ```bash
34
+ Usage: @octaviaflow/upgrade [options]
35
+
36
+ Commands:
37
+ @octaviaflow/upgrade upgrade upgrade your project [default]
38
+ @octaviaflow/upgrade migrate <migration> run a Carbon migration on your
39
+ [paths...] source files
40
+ @octaviaflow/upgrade migrate list list all available migrations
41
+
42
+ Options:
43
+ --help Show help [boolean]
44
+ --version Show version number [boolean]
45
+ --force force execution if the cli encounters an error while doing
46
+ safety checks [boolean] [default: false]
47
+ -w, --write update the files with changes found by running the migration
48
+ [boolean] [default: false]
49
+ -v, --verbose optionally include additional logs, useful for debugging
50
+ [boolean] [default: false]
51
+ ```
52
+
53
+ ### Migrations
54
+
55
+ Included within the CLI are a number of migrations available to you to be ran on
56
+ your project's source files.
57
+
58
+ Migrations are automated scripts (codemods) ran using the
59
+ [jscodeshift](https://github.com/facebook/jscodeshift) runner, that will apply
60
+ intelligent transformations to your code.
61
+
62
+ These migrations range from simple automations like a find and replace of import
63
+ statements, to more sophisticated migrations that rewrite component prop usage,
64
+ configuration, and set up. The source of these migrations can be viewed within
65
+ the
66
+ [transforms folder](https://github.com/octaviaflow-design-system/tree/main/packages/upgrade/transforms).
67
+ Each is tested against a series of test fixtures to ensure transforms are
68
+ predictable and consistently provide the intended output.
69
+
70
+ #### Output formatting
71
+
72
+ The output of a codemod may not match your codebase's formatting style. It is
73
+ recommended to always run the result of a codemod through an autoformatter like
74
+ [Prettier](https://prettier.io/).
75
+
76
+ ## 🙌 Contributing
77
+
78
+ If you have ideas on how we could make your migration experience easier, please
79
+ reach out by
80
+ [opening a new discussion](https://github.com/octaviaflow-design-system/discussions/new).
81
+
82
+ We're always looking for contributors to help us fix bugs, build new features,
83
+ or help us improve the project documentation. If you're interested, definitely
84
+ check out our [Contributing Guide](/.github/CONTRIBUTING.md)! 👀
85
+
86
+ ## 📝 License
87
+
88
+ Licensed under the [Apache 2.0 License](/LICENSE).
89
+
90
+ ## <picture><source height="20" width="20" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-dark.svg"><source height="20" width="20" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"><img height="20" width="20" alt="IBM Telemetry" src="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"></picture> IBM Telemetry
91
+
92
+ This package uses IBM Telemetry to collect de-identified and anonymized metrics
93
+ data. By installing this package as a dependency you are agreeing to telemetry
94
+ collection. To opt out, see
95
+ [Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
96
+ For more information on the data being collected, please see the
97
+ [IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright OctaviaFlow
3
+ * Author: Vishal Kumar
4
+ * Created: 11/November/2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ #!/usr/bin/env node
11
+
12
+ /**
13
+ * Copyright OctaviaFlow
14
+ * Author: Vishal Kumar
15
+ * Created: 11/November/2025
16
+ *
17
+ */
18
+
19
+ /* eslint-disable no-console */
20
+
21
+ 'use strict';
22
+
23
+ // Makes the script crash on unhandled rejections instead of silently
24
+ // ignoring them. In the future, promise rejections that are not handled will
25
+ // terminate the Node.js process with a non-zero exit code.
26
+ process.on('unhandledRejection', (error) => {
27
+ console.error(error);
28
+ });
29
+
30
+ var currentNodeVersion = process.versions.node;
31
+ var semver = currentNodeVersion.split('.');
32
+ var major = semver[0];
33
+
34
+ if (major < 14) {
35
+ console.error(
36
+ `You are running Node ${currentNodeVersion}.\n` +
37
+ `octaviaflow-upgrade requires Node 14 or higher, please update your ` +
38
+ `version of Node.`
39
+ );
40
+ process.exit(1);
41
+ }
42
+
43
+ var { main } = require('../cli');
44
+
45
+ main(process).catch((error) => {
46
+ console.error(error);
47
+ process.exit(1);
48
+ });