https://github.com/openlayers/codemod
Codemods to assist with upgrades
https://github.com/openlayers/codemod
Last synced: 7 months ago
JSON representation
Codemods to assist with upgrades
- Host: GitHub
- URL: https://github.com/openlayers/codemod
- Owner: openlayers
- Created: 2024-12-13T22:32:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-20T23:01:03.000Z (8 months ago)
- Last Synced: 2025-05-21T00:21:54.972Z (8 months ago)
- Language: JavaScript
- Size: 1.05 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# @openlayers/codemod
Automated code modifications to assist with OpenLayers upgrades.
## replace-barrel-imports
Rewrite imports from ["barrel files"](https://www.google.com/search?q=barrel+files).
```bash
# rewrite imports in all .js and .mjs files in the path/to/files directory
npx @openlayers/codemod@latest replace-barrel-imports path/to/files
```
See additional options with the `help` command (or `--help` flag).
```bash
# see options for the command
npx @openlayers/codemod@latest help replace-barrel-imports
```
## Development
Run tests with `npm test`. Debug the tests with `npx vitest --inspect-brk --no-file-parallelism` (then visit `chrome://inspect/#devices`).
To run the codemod directly from this repo, so something like `node ./codemod.js replace-barrel-imports --consider-relative-paths ../path/to/other/files`.