@bpmn-io/codemods
v0.3.1
Published
A collection of codemods for the bpmn.io ecosystem.
Maintainers
Keywords
Readme
@bpmn-io/codemods
A collection of codemods for the bpmn.io ecosystem, exposed via CLI.
Usage
npx @bpmn-io/codemods <mod> [options]
# e.g.
npx @bpmn-io/codemods esm --dry-run srcRun a mod with --help for its options.
Available mods
| Mod | Purpose |
| --- | --- |
| esm | Append explicit extensions to imports so they resolve under native ES module resolution (e.g. migrating to "ESM only" packages such as diagram-js). |
Development
npm install
npm testnpm test runs the tests of every mod (*/test/**/*.spec.js).
Adding a mod
[!NOTE] Each mod lives in its own sub-folder with its own library API and tests and is run through a single CLI.
Create a new sub-folder mirroring esm:
<mod>/
lib/cli.js # exports `run(argv)` — the CLI handler
lib/ # library implementation
test/ # *.spec.js + fixtures
README.mdThen register it in bin/codemods.js:
import { run as myMod } from '../<mod>/lib/cli.js';
const MODS = {
esm,
myMod
};Add a row to the table above and list <mod>/lib in the files field of the
root package.json. Shared dev dependencies (@babel/parser,
mocha, chai) live at the root.
