Skip to content

Commit e3a648f

Browse files
author
Daniel Del Core
committed
Remove references to Codeshift
1 parent 997c4d1 commit e3a648f

File tree

26 files changed

+171
-185
lines changed

26 files changed

+171
-185
lines changed

.changeset/cool-snails-visit.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@hypermod/initializer': patch
3+
'@hypermod/validator': patch
4+
'@hypermod/fetcher': patch
5+
'@hypermod/cli': patch
6+
---
7+
8+
Remove references to Codeshift

packages/cli/src/index.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const program = new Command();
1414
program
1515
.enablePositionalOptions()
1616
.version(packageJson.version, '-v, --version')
17-
.name('codeshift')
17+
.name('hypermod')
1818
.argument('[path...]')
1919
.usage('[global options] <file-paths>...')
2020
.option(
@@ -74,16 +74,16 @@ program
7474
`
7575
Examples:
7676
# Run a transform for "@mylib/button" version 3.0.0 only
77-
$ codeshift --packages @mylib/button@3.0.0 /project/src
77+
$ hypermod --packages @mylib/button@3.0.0 /project/src
7878
7979
# Run all transforms for "@mylib/button" greater than version 3.0.0 and @mylib/range greater than 4.0.0
80-
$ codeshift --sequence --packages @mylib/button@3.0.0,@mylib/range@4.0.0 /project/src
80+
$ hypermod --sequence --packages @mylib/button@3.0.0,@mylib/range@4.0.0 /project/src
8181
8282
# Run the "my-custom-transform" transform
83-
$ codeshift -t path/to/my-custom-transform /project/src
83+
$ hypermod -t path/to/my-custom-transform /project/src
8484
85-
# Display a prompt with a list of codemods from my local \`codeshift.config.js\` file(s).
86-
$ codeshift /project/src`,
85+
# Display a prompt with a list of codemods from my local \`hypermod.config.js\` file(s).
86+
$ hypermod /project/src`,
8787
)
8888
.action((path, options) => main(path, options));
8989

@@ -96,15 +96,15 @@ program
9696
`
9797
Examples:
9898
# Print a list of available codemods for a single package
99-
$ codeshift list mylib
99+
$ hypermod list mylib
100100
101101
# Print a list of available codemods for multiple packages
102-
$ codeshift list @atlaskit/avatar @emotion/monorepo`,
102+
$ hypermod list @atlaskit/avatar @emotion/monorepo`,
103103
);
104104

105105
program
106106
.command('init [path]')
107-
.description('creates a new codeshift package')
107+
.description('creates a new hypermod package')
108108
.option('-c, --config-only', 'Output only a configuration file')
109109
.option('-t, --transform <value>', 'Transform version')
110110
.option('-p, --preset <value>', 'Preset transfrom')
@@ -115,32 +115,32 @@ program
115115
'after',
116116
`
117117
Examples:
118-
# Initializes an empty codeshift package at the current directory
119-
$ codeshift init --transform 10.0.0 my-codemod-package
118+
# Initializes an empty hypermod package at the current directory
119+
$ hypermod init --transform 10.0.0 my-codemod-package
120120
121-
# Initializes an empty codeshift package at the current directory
122-
$ codeshift init --transform 10.0.0 .
121+
# Initializes an empty hypermod package at the current directory
122+
$ hypermod init --transform 10.0.0 .
123123
124-
# Initializes a new codeshift package with a transform for 10.0.0 at the foobar dir
125-
$ codeshift init --transform 10.0.0 ~/foobar
124+
# Initializes a new hypermod package with a transform for 10.0.0 at the foobar dir
125+
$ hypermod init --transform 10.0.0 ~/foobar
126126
127-
# Initializes a new codeshift package with a preset "update-imports"
128-
$ codeshift init --package-name foobar --preset update-imports foobar
127+
# Initializes a new hypermod package with a preset "update-imports"
128+
$ hypermod init --package-name foobar --preset update-imports foobar
129129
130130
# Initializes a configuration file only
131-
$ codeshift init --config-only --preset update-imports path/to/src`,
131+
$ hypermod init --config-only --preset update-imports path/to/src`,
132132
);
133133

134134
program
135135
.command('validate [path]')
136-
.description('validates if a codeshift package is publishable')
136+
.description('validates if a hypermod package is publishable')
137137
.action(path => validate(path))
138138
.addHelpText(
139139
'after',
140140
`
141141
Examples:
142-
$ codeshift validate
143-
$ codeshift validate ./codemods/my-codemods`,
142+
$ hypermod validate
143+
$ hypermod validate ./codemods/my-codemods`,
144144
);
145145

146146
(async function () {

packages/cli/src/init.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default async function init(
1313
targetPath = '.',
1414
) {
1515
const packageName =
16-
targetPath !== '.' ? path.basename(targetPath) : 'codeshift-community';
16+
targetPath !== '.' ? path.basename(targetPath) : 'Hypermod';
1717

1818
if (configOnly) {
1919
initConfig(packageName, targetPath);
@@ -33,13 +33,13 @@ export default async function init(
3333
Inside that directory, you can run the following commands:
3434
3535
${chalk.blueBright('npm run dev')}
36-
Starts the Codeshift cli
36+
Starts the Hypermod CLI
3737
3838
${chalk.blueBright('npm run test')}
3939
Launches the test runner in watch mode.
4040
4141
${chalk.blueBright('npm run validate')}
42-
Checks the validity of your \`codeshift.config.js\` file
42+
Checks the validity of your \`hypermod.config.js\` file
4343
4444
${chalk.blueBright('npm run build')}
4545
Builds the app for production to the \`dist\` folder.
@@ -55,6 +55,6 @@ export default async function init(
5555
}
5656

5757
console.log(
58-
chalk.green(`🚚 New codeshift.config.js created at: ${targetPath}`),
58+
chalk.green(`🚚 New hypermod.config.js created at: ${targetPath}`),
5959
);
6060
}

packages/cli/src/list.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ${chalk.bold('@foo/bar')}
111111
await list(['bar']);
112112

113113
expect(console.warn).toHaveBeenCalledWith(
114-
chalk.red(`Unable to find codeshift package: ${chalk.bold('bar')}.`),
114+
chalk.red(`Unable to find Hypermod package: ${chalk.bold('bar')}.`),
115115
);
116116
expect(console.warn).toHaveBeenCalledTimes(1);
117117
});
@@ -126,10 +126,10 @@ ${chalk.bold('@foo/bar')}
126126
await list(['bar', '@foo/bar']);
127127

128128
expect(console.warn).toHaveBeenCalledWith(
129-
chalk.red(`Unable to find codeshift package: ${chalk.bold('bar')}.`),
129+
chalk.red(`Unable to find Hypermod package: ${chalk.bold('bar')}.`),
130130
);
131131
expect(console.warn).toHaveBeenCalledWith(
132-
chalk.red(`Unable to find codeshift package: ${chalk.bold('@foo/bar')}.`),
132+
chalk.red(`Unable to find Hypermod package: ${chalk.bold('@foo/bar')}.`),
133133
);
134134
expect(console.warn).toHaveBeenCalledTimes(2);
135135
});
@@ -183,10 +183,10 @@ ${chalk.bold('found2')}
183183
└─ sort-imports`);
184184

185185
expect(console.warn).toHaveBeenCalledWith(
186-
chalk.red(`Unable to find codeshift package: ${chalk.bold('unknown')}.`),
186+
chalk.red(`Unable to find Hypermod package: ${chalk.bold('unknown')}.`),
187187
);
188188
expect(console.warn).toHaveBeenCalledWith(
189-
chalk.red(`Unable to find codeshift package: ${chalk.bold('dunno')}.`),
189+
chalk.red(`Unable to find Hypermod package: ${chalk.bold('dunno')}.`),
190190
);
191191
expect(console.warn).toHaveBeenCalledTimes(2);
192192
});

packages/cli/src/list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import chalk from 'chalk';
22
import { PluginManager } from 'live-plugin-manager';
33

44
import { fetchPackages } from './utils/fetch-package';
5-
import { getCodeshiftPackageName } from './utils/package-names';
5+
import { getHypermodPackageName } from './utils/package-names';
66

77
export default async function list(packages: string[]) {
88
const packageManager = new PluginManager();
@@ -16,14 +16,14 @@ export default async function list(packages: string[]) {
1616
);
1717
community &&
1818
configs.push({
19-
packageName: getCodeshiftPackageName(packageName),
19+
packageName: getHypermodPackageName(packageName),
2020
config: community.config,
2121
});
2222
remote && configs.push({ packageName, config: remote.config });
2323
} catch (error) {
2424
console.warn(
2525
chalk.red(
26-
`Unable to find codeshift package: ${chalk.bold(packageName)}.`,
26+
`Unable to find Hypermod package: ${chalk.bold(packageName)}.`,
2727
),
2828
);
2929

packages/cli/src/main.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default async function main(
4848
if (!flags.transform && !flags.packages) {
4949
console.log(
5050
chalk.green(
51-
'No transforms specified, attempting to find local codeshift.config file(s)',
51+
'No transforms specified, attempting to find local hypermod.config file(s)',
5252
),
5353
);
5454

@@ -115,6 +115,15 @@ export default async function main(
115115
* Otherwise, locate any config files in parent directories
116116
*/
117117
const configFilePath = await findUp([
118+
'hypermod.config.js',
119+
'hypermod.config.ts',
120+
'hypermod.config.tsx',
121+
'src/hypermod.config.js',
122+
'src/hypermod.config.ts',
123+
'src/hypermod.config.tsx',
124+
'codemods/hypermod.config.js',
125+
'codemods/hypermod.config.ts',
126+
'codemods/hypermod.config.tsx',
118127
'codeshift.config.js',
119128
'codeshift.config.ts',
120129
'codeshift.config.tsx',
@@ -133,7 +142,7 @@ export default async function main(
133142
}
134143

135144
console.log(
136-
chalk.green('Found local codeshift.config file at:'),
145+
chalk.green('Found local hypermod.config file at:'),
137146
configFilePath,
138147
);
139148

packages/cli/src/utils/fetch-package.ts

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,36 @@ import {
99
} from '@hypermod/fetcher';
1010
import { isValidConfig } from '@hypermod/validator';
1111

12-
import { getCodeshiftPackageName } from './package-names';
12+
import { getHypermodPackageName } from './package-names';
1313

1414
export async function fetchPackages(
1515
packageName: string,
1616
packageManager: PluginManager,
1717
) {
18-
const codeshiftPackageName = getCodeshiftPackageName(packageName);
19-
let codeshiftPackage: ConfigMeta | undefined;
18+
const hypermodPackageName = getHypermodPackageName(packageName);
19+
let hypermodPackage: ConfigMeta | undefined;
2020
let remotePackage: ConfigMeta | undefined;
2121

2222
const spinner = ora(
23-
`${chalk.green(
24-
'Attempting to download CodeshiftCommunity package:',
25-
)} ${packageName}`,
23+
`${chalk.green('Attempting to download Hypermod package:')} ${packageName}`,
2624
).start();
2725

2826
try {
29-
codeshiftPackage = await fetchPackage(codeshiftPackageName, packageManager);
27+
hypermodPackage = await fetchPackage(hypermodPackageName, packageManager);
3028
spinner.succeed(
31-
`${chalk.green(
32-
'Found CodeshiftCommunity package:',
33-
)} ${codeshiftPackageName}`,
29+
`${chalk.green('Found Hypermod package:')} ${hypermodPackageName}`,
3430
);
3531
} catch (error) {
3632
spinner.warn(
3733
`${chalk.yellow(
38-
`Unable to locate CodeshiftCommunity package:`,
39-
)} ${codeshiftPackageName}`,
34+
`Unable to locate Hypermod package:`,
35+
)} ${hypermodPackageName}`,
4036
);
4137
}
4238

43-
if (codeshiftPackage && !isValidConfig(codeshiftPackage.config)) {
39+
if (hypermodPackage && !isValidConfig(hypermodPackage.config)) {
4440
throw new Error(
45-
`Unable to locate a valid codeshift.config for Community package: ${packageName}`,
41+
`Unable to locate a valid hypermod.config for community package: ${packageName}`,
4642
);
4743
}
4844

@@ -51,30 +47,28 @@ export async function fetchPackages(
5147
`${chalk.green(`Attempting to download npm package:`)} ${packageName}`,
5248
);
5349
remotePackage = await fetchRemotePackage(packageName, packageManager);
54-
spinner.succeed(
55-
`${chalk.green('Found codeshift package:')} ${packageName}`,
56-
);
50+
spinner.succeed(`${chalk.green('Found hypermod package:')} ${packageName}`);
5751
} catch (error) {
5852
spinner.warn(
59-
`${chalk.yellow('Unable to locate codeshift package:')} ${packageName}`,
53+
`${chalk.yellow('Unable to locate hypermod package:')} ${packageName}`,
6054
);
6155
}
6256

6357
if (remotePackage && !isValidConfig(remotePackage.config)) {
6458
throw new Error(
65-
`Unable to locate a valid codeshift.config for remote package: ${packageName}`,
59+
`Unable to locate a valid hypermod.config for remote package: ${packageName}`,
6660
);
6761
}
6862

69-
if (!codeshiftPackage && !remotePackage) {
63+
if (!hypermodPackage && !remotePackage) {
7064
throw new Error(
71-
`Unable to locate package from codeshift-community or NPM.
65+
`Unable to locate package from Hypermod community or NPM.
7266
Make sure the package name "${packageName}" is correct and try again.`,
7367
);
7468
}
7569

7670
return {
77-
community: codeshiftPackage,
71+
community: hypermodPackage,
7872
remote: remotePackage,
7973
};
8074
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export function getCodeshiftPackageName(packageName: string) {
1+
export function getHypermodPackageName(packageName: string) {
22
return `@hypermod/mod-${packageName.replace('@', '').replace('/', '__')}`;
33
}

0 commit comments

Comments
 (0)