@workday/canvas-kit-codemod 8.5.9 → 8.5.11
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.
- package/README.md +41 -5
- package/index.js +23 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Canvas Kit Codemods
|
|
2
2
|
|
|
3
|
-
This package is designed to help you migrate between major versions of Canvas Kit and adopt API
|
|
3
|
+
This package is designed to help you migrate between major versions of Canvas Kit and adopt API
|
|
4
|
+
changes.
|
|
4
5
|
|
|
5
6
|
## Usage
|
|
6
7
|
|
|
@@ -13,13 +14,18 @@ Commands (transforms):
|
|
|
13
14
|
canvas-kit-codemod v5 [path] Canvas Kit v4 > v5 migration transform
|
|
14
15
|
|
|
15
16
|
Options:
|
|
16
|
-
-
|
|
17
|
-
-
|
|
17
|
+
--ignore-config, Ignore files if they match patterns sourced from a config file [string]
|
|
18
|
+
--ignore-pattern, Ignore files that match a provided glob expression [string] [default: **/node_modules/**]
|
|
19
|
+
--verbose, Show more information about the transform process [number] [choices: 0, 1, 2] [default: 0]
|
|
20
|
+
-v, --version Show version number [boolean]
|
|
21
|
+
-h, --help Show help [boolean]
|
|
18
22
|
```
|
|
19
23
|
|
|
20
|
-
> Note: These codemods only work on .js, .jsx, .ts, and .tsx extensions. You may need to make some
|
|
24
|
+
> Note: These codemods only work on .js, .jsx, .ts, and .tsx extensions. You may need to make some
|
|
25
|
+
> manual changes in other file types (.json, .mdx, .md, etc.).
|
|
21
26
|
|
|
22
|
-
> Note: You may need to run your linter after executing the codemod, as it's resulting formatting
|
|
27
|
+
> Note: You may need to run your linter after executing the codemod, as it's resulting formatting
|
|
28
|
+
> (spacing, quotes, etc.) may not match your project's styling.
|
|
23
29
|
|
|
24
30
|
## Installation
|
|
25
31
|
|
|
@@ -29,3 +35,33 @@ Alternatively, you can install the codemod package and run it without npx.
|
|
|
29
35
|
> yarn add @workday/canvas-kit-codemod
|
|
30
36
|
> canvas-kit-codemod <transform> [path]
|
|
31
37
|
```
|
|
38
|
+
|
|
39
|
+
## Options
|
|
40
|
+
|
|
41
|
+
### Ignore Config
|
|
42
|
+
|
|
43
|
+
If you'd like to provide a configuration for files to ignore instead of a glob, use
|
|
44
|
+
`--ignore-config`.
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
> canvas-kit-codemod <transform> [path] --ignore-config=.gitignore
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Ignore Pattern
|
|
51
|
+
|
|
52
|
+
If you'd like to provide a glob to ignore files, use `--ignore-pattern`. By default, this is set to
|
|
53
|
+
ignore all `node_modules` directories.
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
> canvas-kit-codemod <transform> [path] --ignore-pattern=**/dist/**
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Verbose
|
|
60
|
+
|
|
61
|
+
If you'd like to have more verbose logging to know which files are being parsed, use `--verbose`. By
|
|
62
|
+
default this is set to `0`.
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
# See all files being parsed
|
|
66
|
+
> canvas-kit-codemod <transform> [path] --verbose=2
|
|
67
|
+
```
|
package/index.js
CHANGED
|
@@ -4,9 +4,27 @@
|
|
|
4
4
|
const {spawn} = require('child_process');
|
|
5
5
|
const chalk = require('chalk');
|
|
6
6
|
|
|
7
|
-
const {_: commands, path} = require('yargs')
|
|
7
|
+
const {_: commands, path, ignoreConfig, ignorePattern, verbose } = require('yargs')
|
|
8
8
|
.scriptName('canvas-kit-codemod')
|
|
9
9
|
.usage(chalk.bold.blueBright('$0 <transform> [path]'))
|
|
10
|
+
.options({
|
|
11
|
+
'ignore-config': {
|
|
12
|
+
type: 'string',
|
|
13
|
+
describe: 'Ignore files if they match patterns sourced from a configuration file (e.g. a .gitignore)',
|
|
14
|
+
default: '',
|
|
15
|
+
},
|
|
16
|
+
'ignore-pattern': {
|
|
17
|
+
type: 'string',
|
|
18
|
+
describe: 'Ignore files that match a provided glob expression (e.g. **/dist/**)',
|
|
19
|
+
default: '**/node_modules/**',
|
|
20
|
+
},
|
|
21
|
+
verbose: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
describe: 'Show more information about the transform process',
|
|
24
|
+
default: 0,
|
|
25
|
+
choices: [0, 1, 2]
|
|
26
|
+
},
|
|
27
|
+
})
|
|
10
28
|
.command('v5 [path]', chalk.gray('Canvas Kit v4 > v5 migration transform'), yargs => {
|
|
11
29
|
yargs.positional('path', {
|
|
12
30
|
type: 'string',
|
|
@@ -60,10 +78,12 @@ const {_: commands, path} = require('yargs')
|
|
|
60
78
|
.help().argv;
|
|
61
79
|
|
|
62
80
|
const transform = commands[0];
|
|
63
|
-
|
|
81
|
+
// Only add an ignore-config if one is provided
|
|
82
|
+
const ignoreConfigArg = ignoreConfig ? `--ignore-config=${ignoreConfig}` : '';
|
|
83
|
+
console.log(ignorePattern)
|
|
64
84
|
|
|
65
85
|
console.log(chalk.blueBright(`\nApplying ${transform} transform to '${path}'\n`));
|
|
66
|
-
const args = `-t ${__dirname}/dist/es6/${transform} ${path} --parser tsx --extensions js,jsx,ts,tsx`.split(
|
|
86
|
+
const args = `-t ${__dirname}/dist/es6/${transform} ${path} --parser tsx --extensions js,jsx,ts,tsx ${ignoreConfigArg} --ignore-pattern=${ignorePattern} --verbose=${verbose}`.split(
|
|
67
87
|
' '
|
|
68
88
|
);
|
|
69
89
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@workday/canvas-kit-codemod",
|
|
3
3
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "8.5.
|
|
5
|
+
"version": "8.5.11",
|
|
6
6
|
"description": "A collection of codemods for use on Workday Canvas Kit packages.",
|
|
7
7
|
"main": "dist/es6/index.js",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"test": "TZ=UTC jest -c ../../jest.config.js",
|
|
44
44
|
"typecheck:src": "tsc -p . --noEmit --incremental false"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "22edab09ef68d510665f53a4b167b55a905d802b"
|
|
47
47
|
}
|