Skip to content

Commit 928522c

Browse files
authored
Merge pull request #201 from rwjblue/migrate-to-npm
2 parents dcbc11c + e57cd1a commit 928522c

File tree

10 files changed

+25802
-7520
lines changed

10 files changed

+25802
-7520
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
with:
2323
node-version: 14.x
2424
- name: install dependencies
25-
run: yarn install
25+
run: npm ci
2626
- name: linting
27-
run: yarn lint
27+
run: npm run lint
2828

2929
test:
3030
name: Tests
@@ -41,9 +41,9 @@ jobs:
4141
with:
4242
node-version: ${{ matrix.node }}
4343
- name: install dependencies
44-
run: yarn
44+
run: npm ci
4545
- name: test
46-
run: yarn test
46+
run: npm test
4747

4848
floating-test:
4949
name: Floating dependencies
@@ -55,6 +55,6 @@ jobs:
5555
with:
5656
node-version: '14.x'
5757
- name: install dependencies
58-
run: yarn install --no-lockfile
58+
run: npm install --no-shrinkwrap
5959
- name: test
60-
run: yarn test
60+
run: npm test

README.md

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,14 @@
22

33
codemod-cli is a command line tool for generating, testing, and publishing codemods.
44

5-
## Installation
6-
7-
```
8-
npm install --global codemod-cli
9-
10-
# OR
11-
12-
yarn global add codemod-cli
13-
```
14-
155
## Usage
166

177
The `codemod-cli` workflow is focused on managing a group of codemods.
188

199
To get started you first need a project. You can generate a new codemod-cli project via:
2010

2111
```
22-
codemod-cli new <project-name>
12+
npx codemod-cli new <project-name>
2313
```
2414

2515
This will create a small project structure (`README.md`, `package.json`, etc) which is
@@ -28,8 +18,8 @@ ready to help you manage your codemods.
2818
Once you have a project, you can generate a new codemod:
2919

3020
```
31-
codemod-cli generate codemod <name of codemod> // jscodeshift js codemod
32-
codemod-cli generate codemod <name of codemod> -t=hbs // ember-template-recast hbs codemod
21+
npx codemod-cli generate codemod <name of codemod> // jscodeshift js codemod
22+
npx codemod-cli generate codemod <name of codemod> -t=hbs // ember-template-recast hbs codemod
3323
```
3424

3525
This will setup a new codemod within your project at `transforms/<name of codemod>/index.js`
@@ -38,14 +28,14 @@ along with a test harness, README, fixture directory, and an initial set of inpu
3828
Once you have tweaked your codemod and its fixtures to your liking, it is time to run your tests:
3929

4030
```
41-
codemod-cli test
31+
npx codemod-cli test
4232
```
4333

4434
As you develop your codemod you may need additional fixtures (e.g. to test various combinations of
4535
inputs). To generate a new fixture, run the following:
4636

4737
```
48-
codemod-cli generate fixture <name of codemod> <name of fixture>
38+
npx codemod-cli generate fixture <name of codemod> <name of fixture>
4939
```
5040

5141
This sets up two new files in `transforms/<name of codemod>/__testfixtures__/` using the fixture name
@@ -55,7 +45,7 @@ Once you have things just how you like them with your new codemod (and your test
5545
can update your project's README and your transforms README via:
5646

5747
```
58-
codemod-cli update-docs
48+
npx codemod-cli update-docs
5949
```
6050

6151
### File Types
@@ -134,16 +124,15 @@ Contributing
134124
135125
* `git clone git@github.com:rwjblue/codemod-cli.git`
136126
* `cd codemod-cli`
137-
* `yarn`
127+
* `npm ci`
138128
139129
### Linting
140130
141-
* `yarn lint:js`
142-
* `yarn lint:js --fix`
131+
* `npm run lint`
143132
144133
### Running tests
145134
146-
* `yarn test`
135+
* `npm test`
147136
148137
## License
149138

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Once the prep work is completed, the actual release is straight forward:
3131
* First, ensure that you have installed your projects dependencies:
3232

3333
```sh
34-
yarn install
34+
npm ci
3535
```
3636

3737
* Second, ensure that you have obtained a

commands/global/new.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ module.exports.handler = async function handler(options) {
3232
\`\`\`
3333
npx ${projectName} <TRANSFORM NAME> path/of/files/ or/some**/*glob.js
3434
35-
# or
36-
37-
yarn global add ${projectName}
38-
${projectName} <TRANSFORM NAME> path/of/files/ or/some**/*glob.js
39-
\`\`\`
40-
4135
## Local Usage
4236
\`\`\`
4337
node .${cliPath} <TRANSFORM NAME> path/of/files/ or/some**/*glob.js
@@ -54,15 +48,15 @@ module.exports.handler = async function handler(options) {
5448
5549
* clone the repo
5650
* change into the repo directory
57-
* \`yarn\`
51+
* \`npm ci\`
5852
5953
### Running tests
6054
61-
* \`yarn test\`
55+
* \`npm test\`
6256
6357
### Update Documentation
6458
65-
* \`yarn update-docs\`
59+
* \`npm run update-docs\`
6660
`,
6761
'utf8'
6862
);
@@ -173,9 +167,9 @@ module.exports.handler = async function handler(options) {
173167
with:
174168
node-version: 12.x
175169
- name: install dependencies
176-
run: yarn install --frozen-lockfile
170+
run: npm ci
177171
- name: linting
178-
run: yarn lint
172+
run: npm run lint
179173
180174
test:
181175
name: Tests
@@ -191,9 +185,9 @@ module.exports.handler = async function handler(options) {
191185
with:
192186
node-version: \${{ matrix.node }}
193187
- name: install dependencies
194-
run: yarn install --frozen-lockfile
188+
run: npm ci
195189
- name: test
196-
run: yarn test
190+
run: npm test
197191
198192
floating-test:
199193
name: Floating dependencies
@@ -205,9 +199,9 @@ module.exports.handler = async function handler(options) {
205199
with:
206200
node-version: '12.x'
207201
- name: install dependencies
208-
run: yarn install --no-lockfile
202+
run: npm install --no-shrinkwrap
209203
- name: test
210-
run: yarn test
204+
run: npm test
211205
`
212206
);
213207
fs.outputFileSync(

commands/local/generate/codemod.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ function jsHandler(options) {
7979
8080
\`\`\`
8181
npx ${projectName} ${codemodName} path/of/files/ or/some**/*glob.js
82-
83-
# or
84-
85-
yarn global add ${projectName}
86-
${projectName} ${codemodName} path/of/files/ or/some**/*glob.js
8782
\`\`\`
8883
8984
## Local Usage
@@ -163,11 +158,6 @@ function hbsHandler(options) {
163158
164159
\`\`\`
165160
npx ${projectName} ${codemodName} path/of/files/ or/some**/*glob.hbs
166-
167-
# or
168-
169-
yarn global add ${projectName}
170-
${projectName} ${codemodName} path/of/files/ or/some**/*glob.hbs
171161
\`\`\`
172162
173163
## Local Usage

commands/local/update-docs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ function updateTransformREADME(transformName) {
8484
let transformREADMEPath = `transforms/${transformName}/README.md`;
8585

8686
let FIXTURES_TOC_PLACE_HOLDER = /<!--FIXTURES_TOC_START-->[\s\S]*<!--FIXTURES_TOC_END-->/;
87-
let FIXTURES_CONTENT_PLACE_HOLDER = /<!--FIXTURES_CONTENT_START-->[\s\S]*<!--FIXTURE[S]?_CONTENT_END-->/;
87+
let FIXTURES_CONTENT_PLACE_HOLDER =
88+
/<!--FIXTURES_CONTENT_START-->[\s\S]*<!--FIXTURE[S]?_CONTENT_END-->/;
8889

8990
fs.writeFileSync(
9091
transformREADMEPath,

0 commit comments

Comments
 (0)