woovibr / codemods

Node.js/Javascript codemods used at @entria

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@entria/js-codemods CircleCI

Collection of codemods for Node.js / Javascript used here at @entria.

How to run

npm i -g jscodeshift
git clone https://github.com/entria/js-codemods.git && cd js-codemods
jscodeshift -t transforms/<codemod-script> <file-to-transform>

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

import MyLoaderA from './loader/MyLoaderA';
import MyLoaderB from './loader/MyLoaderB';

to

import { MyLoaderA, MyLoaderB } from './loader';
jscodeshift -t transforms/graphql-server/import-loaders-from-index.js <file>

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).

jscodeshift -t transforms/graphql-server/move-static-loader-methods-to-direct-export.js <file>

About

Node.js/Javascript codemods used at @entria


Languages

Language:TypeScript 97.6%Language:JavaScript 2.4%Language:Shell 0.0%