This package consumes the following services:
atom-javascript-refactor package
Atom JavaScript ES6 Module and CommonJS refactoring support
atom-javascript-refactor simplifies ES6 Module and CommonJS refactoring, by allowing you to rename or move any file within your project and have all references updated automatically.
atom-javascript-refactor allows you to rename a file, and all referencing Modules will be updated with new path.
For example, given the following file:
src/animals.js
import cat from './meow';
Let's rename the file src/meow.js to src/kitten.js.
src/animals.js is transformed to
import cat from './kitten';
atom-javascript-refactor also updates all locally referenced Modules inside of the moved file.
For example, given the following files:
src/meow.js
import { RAINBOW } from '../constants';
src/animals.js
import cat from './meow';
Let's move the file src/meow.js to src/city-kitty/meow.js.
src/city-kitty/meow.js is transformed to
import { RAINBOW } from '../../constants';
src/animals.js is transformed to
import cat from './city-kitty/meow';
Usage
Using the TreeView, Right click on any .js file or directory to expose the Rename (with refactor support) option. Selecting this option will open a modal that will allow you to update the file name or path. Pressing Enter Key will apply the file rename/move and then run a codemod on the root folder.
Note: there currently is no support for Drag and Drop.
Install
apm i javascript-refactor
Develop
> cd atom-javascript-refactor
> npm i
> apm link
Contribute
- Please open an issue before submitting a PR
- All PR's should be accompanied wth tests 🚀