0.26.3 • Published 10 months ago

@atlaskit/codemod-cli v0.26.3

Weekly downloads
5
License
Apache-2.0
Repository
bitbucket
Last release
10 months ago

Codemods

To easily download and run codemods associated with atlassian-frontend components and services, we provide a CLI tool called @atlaskit/codemod-cli.

The idea is that upgrading major versions can be assisted by codemods, reducing upgrade-pain, improving adoption and giving component authors the flexibility to improve API and component design.

Note: Codemods will be designed to do the heavy lifting, but they'll often not be perfect so some manual work may still be required in order to successfully migrate.


Usage

$ npx @atlaskit/codemod-cli /project/src/file.js

Options

--preset, -n

Select which transform to run from existing transform list by providing the preset name. This will allow you run the transfrom without any interaction.

example:

  • npx @atlaskit/codemod-cli -n theme-to-design-tokens --extensions tsx,ts,js --parser tsx /project/src

--transform, -t

The transform to run, transforms can be either a single file or directory with an index.

example:

  • npx @atlaskit/codemod-cli --transform codemods/my-special-mod /project/src/file.js
  • npx @atlaskit/codemod-cli --transform codemods/my-special-mod/index.ts /project/src/file.js

--since-ref

Determines changed packages since the specified git ref and runs all codemods for them. The automatic version of --packages. The ref can be any valid git ref, e.g. a commit hash, HEAD etc.

example:

  • npx @atlaskit/codemod-cli --since-ref HEAD /project/src
  • npx @atlaskit/codemod-cli --since-ref abcdef123 /project/src

--packages

Runs transforms for the specified comma separated list of packages, optionally include a version for each package to run all transforms since that version

example:

  • npx @atlaskit/codemod-cli --packages @atlaskit/button /project/src
  • npx @atlaskit/codemod-cli --packages @atlaskit/button@3.0.0,@atlaskit/range@4.0.0 /project/src

--parser, -p

Parser to use for parsing the source files you are code modding.

options:

  • babel (default)
  • babylon
  • flow
  • ts
  • tsx

example:

  • npx @atlaskit/codemod-cli --parser tsx /project/src/file.js
  • npx @atlaskit/codemod-cli -p babel /project/src/file.js

--extensions, -e

Transform files with these file extensions (comma separated list) (default: js)

example:

  • npx @atlaskit/codemod-cli --extensions ts,tsx /project/src/file.js
  • npx @atlaskit/codemod-cli -e js /project/src/file.js

--ignore-pattern

Ignore files that match a provided glob expression

example:

  • @atlaskit/codemod-cli --ignore-pattern node_modules /project/src/file.js

--no-filter-paths

The codemod CLI filters supplied file paths by default, improving runtime by preventing codemods from running in non-dependent packages. Add this flag if there are problems with the filtering logic.

example:

  • npx @atlaskit/codemod-cli --no-filter-paths ./packages

--version, -v

Get current version number

example:

  • @atlaskit/codemod-cli --version
  • @atlaskit/codemod-cli -v

--help

Print all help text to the command line

example:

  • @atlaskit/codemod-cli --help

Custom options

All options are passed to the transformer, which means you can supply custom options that are not listed here.

examples:

  • npx @atlaskit/codemod-cli --foo bar /project/src/file.js

Testing locally

When wanting to run the CLI before it has been published you can run the start command.

yarn start [commands]

For a list of commands run it with -h or refer to the documentation above.


For internal Atlassians

Internal Atlassians can access additional documentation on Confluence.

0.26.3

10 months ago

0.26.2

10 months ago

0.26.1

10 months ago

0.26.0

10 months ago

0.25.2

12 months ago

0.25.1

12 months ago

0.25.0

1 year ago

0.24.4

1 year ago

0.24.3

1 year ago

0.24.2

1 year ago

0.24.1

1 year ago

0.24.0

1 year ago

0.23.1

1 year ago

0.23.0

1 year ago

0.22.0

1 year ago

0.21.1

1 year ago

0.21.0

1 year ago

0.20.1

1 year ago

0.20.0

1 year ago

0.19.0

1 year ago

0.18.0

1 year ago

0.17.10

1 year ago

0.17.9

1 year ago

0.17.8

2 years ago

0.17.7

2 years ago

0.17.6

2 years ago

0.17.5

2 years ago

0.17.4

2 years ago

0.17.3

2 years ago

0.17.2

2 years ago

0.17.0

2 years ago

0.17.1

2 years ago

0.16.0

2 years ago

0.15.0

2 years ago

0.13.3

2 years ago

0.13.4

2 years ago

0.14.0

2 years ago

0.13.0

2 years ago

0.13.1

2 years ago

0.13.2

2 years ago

0.12.0

2 years ago

0.12.1

2 years ago

0.12.2

2 years ago

0.12.3

2 years ago

0.11.5

2 years ago

0.11.0

3 years ago

0.11.1

3 years ago

0.11.2

3 years ago

0.11.3

2 years ago

0.11.4

2 years ago

0.10.4

3 years ago

0.10.5

3 years ago

0.10.3

3 years ago

0.10.2

3 years ago

0.10.1

3 years ago

0.10.0

3 years ago

0.9.7

3 years ago

0.9.6

3 years ago

0.9.5

3 years ago

0.9.4

3 years ago

0.9.3

3 years ago

0.9.0

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.8.7

3 years ago

0.8.6

3 years ago

0.8.5

3 years ago

0.8.4

3 years ago

0.8.3

4 years ago

0.8.1

4 years ago

0.8.2

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.7

4 years ago

0.6.6

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.5

4 years ago

0.6.4

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.4

5 years ago

0.3.2

5 years ago

0.3.3

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago