Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/woovibr/codemods
Node.js/Javascript codemods used at @entria
https://github.com/woovibr/codemods
codemod
Last synced: 6 days ago
JSON representation
Node.js/Javascript codemods used at @entria
- Host: GitHub
- URL: https://github.com/woovibr/codemods
- Owner: woovibr
- Created: 2017-08-08T14:58:01.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-11-29T12:08:50.000Z (12 months ago)
- Last Synced: 2024-05-21T13:56:35.343Z (6 months ago)
- Topics: codemod
- Language: TypeScript
- Size: 1.25 MB
- Stars: 41
- Watchers: 14
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-codemods - js-codemods - Node.js/JavaScript codemods used at @entria. (Misc / ant-design)
README
## @entria/js-codemods [![CircleCI](https://circleci.com/gh/entria/js-codemods.svg?style=svg&circle-token=b3e5c2c1c155d0e044b02bf79fb0236ca92a2feb)](https://circleci.com/gh/entria/js-codemods)
Collection of codemods for Node.js / Javascript used here at [@entria](https://github.com/entria).
### How to run
```bash
npm i -g jscodeshift
git clone https://github.com/entria/js-codemods.git && cd js-codemods
jscodeshift -t transforms/
```Use the `-d` option for a dry-run and use `-p` to print the output for
comparison.### Included Transforms
#### GraphQL Server based on entria boilerplate
##### import-loaders-from-index
Changes from
```js
import MyLoaderA from './loader/MyLoaderA';
import MyLoaderB from './loader/MyLoaderB';
```to
```js
import { MyLoaderA, MyLoaderB } from './loader';
``````bash
jscodeshift -t transforms/graphql-server/import-loaders-from-index.js
```#### move-static-loader-methods-to-direct-export
Convert from old boilerplate format (where the loader functions were static methods of the Loader class) to the new format (where each loader function is exported individually).
```bash
jscodeshift -t transforms/graphql-server/move-static-loader-methods-to-direct-export.js
```