0.1.1 • Published 3 years ago
ember-named-service-codemod v0.1.1
ember-named-service-codemod
A codemod to transform your service injection to include service name argument.
Before @inject myService
After @inject('my-service') myService
Also supports the case when your inject
import is aliased to another name (import { inject as service } from '@ember/service'
)
The service name argument is not required by Ember. This transform is solely for the purpose of more explicit and consistent service injection pattern.
Usage
To run this codemod, you would run the following:
npx ember-named-service-codemod named-service-injection path/of/files/ or/some**/*glob.js
# or
yarn global add ember-named-service-codemod
ember-named-service-codemod named-service-injection path/of/files/ or/some**/*glob.js
Local Usage
node ./bin/cli.js named-service-injection path/of/files/ or/some**/*glob.js
Options
Option | Value | Default | Details |
---|---|---|---|
--double-quote | boolean | false | If the output string arg should use double quote @inject("my-service") |
Transforms
Contributing
Installation
- clone the repo
- change into the repo directory
yarn
Running tests
yarn test
Update Documentation
yarn update-docs