Skip to content

Commit b05fc3b

Browse files
committed
Rename community scripts
1 parent ad521fa commit b05fc3b

File tree

6 files changed

+13
-70
lines changed

6 files changed

+13
-70
lines changed

.github/workflows/release-all-codemods.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
- run: yarn install --frozen-lockfile
2323
- run: yarn validate
2424
- run: yarn test
25-
- run: yarn validate:codemods
26-
- run: yarn release-all:codemods
25+
- run: yarn community:validate
26+
- run: yarn community:release-all
2727
env:
2828
CI: true
2929
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release-codemods.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
- run: yarn install --frozen-lockfile
2525
- run: yarn validate
2626
- run: yarn test
27-
- run: yarn validate:codemods
28-
- run: yarn release:codemods
27+
- run: yarn community:validate
28+
- run: yarn community:release
2929
env:
3030
CI: true
3131
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/validate-codmods.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
node-version: ${{ matrix.node-version }}
2121
- run: yarn install --frozen-lockfile
22-
- run: yarn validate:codemods
22+
- run: yarn community:validate
2323
env:
2424
CI: true
2525
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"cli:validate": "node packages/cli/bin/codeshift-cli.js validate",
2727
"cli:init": "node packages/cli/bin/codeshift-cli.js init",
2828
"cli:list": "node packages/cli/bin/codeshift-cli.js list",
29-
"init:codemods": "ts-node scripts/initialize.ts",
30-
"validate:codemods": "ts-node scripts/validate.ts ./community",
31-
"release:codemods": "ts-node scripts/publish.ts ./community .tmp",
32-
"release-all:codemods": "ts-node scripts/publish-all.ts ./community .tmp",
33-
"release-all-dry:codemods": "ts-node scripts/publish-all-dry.ts ./community .tmp",
29+
"community:init": "ts-node scripts/initialize.ts",
30+
"community:validate": "ts-node scripts/validate.ts ./community",
31+
"community:release": "ts-node scripts/publish.ts ./community .tmp",
32+
"community:release-all": "ts-node scripts/publish-all.ts ./community .tmp",
33+
"community:release-all-dry": "ts-node scripts/publish-all-dry.ts ./community .tmp",
3434
"prerelease": "yarn validate && yarn test",
3535
"release": "yarn changeset publish"
3636
},

packages/validator/src/index.spec.ts

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
jest.mock('fs-extra');
22
jest.mock('@codeshift/fetcher');
33

4-
import fs from 'fs-extra';
5-
64
import { fetchConfig } from '@codeshift/fetcher';
75

8-
import {
9-
isValidPackageName,
10-
isValidConfig,
11-
isValidConfigAtPath,
12-
isValidPackageJson,
13-
} from '.';
6+
import { isValidPackageName, isValidConfig, isValidConfigAtPath } from '.';
147

158
describe('validator', () => {
169
describe('isValidPackageName', () => {
@@ -173,54 +166,4 @@ Please make sure all presets are kebab case and contain no spaces or special cha
173166
);
174167
});
175168
});
176-
177-
describe('isValidPackageJson', () => {
178-
afterEach(() => jest.resetAllMocks());
179-
180-
it('should detect valid package.json', async () => {
181-
(fs.readFile as jest.Mock).mockReturnValue(`{
182-
"name": "codeshift-package",
183-
"main": "dist/index.js",
184-
"version": "0.0.1"
185-
}`);
186-
187-
const result = await isValidPackageJson('path/to/');
188-
expect(result).toEqual(true);
189-
expect(fs.readFile).toHaveBeenCalledWith('path/to/package.json', 'utf8');
190-
});
191-
192-
it('should detect invalid package.json', async () => {
193-
expect.assertions(2);
194-
195-
{
196-
(fs.readFile as jest.Mock).mockReturnValue(`{
197-
"name": "codeshift-package"
198-
}`);
199-
200-
try {
201-
await isValidPackageJson('path/to/');
202-
} catch (error) {
203-
// @ts-ignore
204-
expect(error.message).toMatch(
205-
'No main entrypoint provided in package.json',
206-
);
207-
}
208-
}
209-
210-
{
211-
(fs.readFile as jest.Mock).mockReturnValue(`{
212-
"main": "dist/index.js"
213-
}`);
214-
215-
try {
216-
await isValidPackageJson('path/to/');
217-
} catch (error) {
218-
// @ts-ignore
219-
expect(error.message).toMatch(
220-
'No package name provided in package.json',
221-
);
222-
}
223-
}
224-
});
225-
});
226169
});

website/docs/contribution.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Finally, run `yarn` to install the dependencies.
2323

2424
Create a new codeshift package automatically by running: `yarn codeshift:init -p [package-name] -v [version]`
2525

26-
For example: `yarn init:codemods react-cool-library 10.0.0`
26+
For example: `yarn community:init react-cool-library 10.0.0`
2727

28-
And for scoped packages: `yarn init:codemods @scope/react-cool-library 10.0.0`
28+
And for scoped packages: `yarn community:init @scope/react-cool-library 10.0.0`
2929

3030
You should now see a new folder within the `/community` directory for you to implement your codemod(s).
3131

0 commit comments

Comments
 (0)