Skip to content

Commit 88632e4

Browse files
committed
🔧 Bump jscodeshift + cli stuff
1 parent f8cb070 commit 88632e4

File tree

7 files changed

+168
-48
lines changed

7 files changed

+168
-48
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"monorepo:check": "manypkg check",
2323
"monorepo:fix": "manypkg fix && preconstruct fix",
2424
"init:codemods": "ts-node packages/initializer/src/index.ts",
25+
"start:codemods": "ts-node packages/cli/src/index.ts",
2526
"validate:codemods": "ts-node packages/validator/src/index.ts ./community",
2627
"release:codemods": "ts-node packages/publisher/src/index.ts ./community ./.tmp",
2728
"prerelease": "yarn validate && yarn test",
@@ -49,7 +50,7 @@
4950
"jest": "^26.6.0",
5051
"jest-serializer-html-string": "^1.0.1",
5152
"jest-watch-typeahead": "^0.4.2",
52-
"jscodeshift": "^0.11.0",
53+
"jscodeshift": "^0.12.0",
5354
"prettier": "^1.16.4",
5455
"rimraf": "^2.6.3",
5556
"semver": "^7.3.5",

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"chalk": "^4.1.0",
17-
"jscodeshift": "^0.11.0",
17+
"jscodeshift": "^0.12.0",
1818
"live-plugin-manager": "^0.15.1",
1919
"meow": "^9.0.0",
2020
"ts-node": "^9.1.1"

packages/cli/src/main.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,25 @@ export default async function main(
2828
}
2929

3030
if (flags.packages) {
31-
// Parse package string
32-
// fetch transform from npm
33-
// assign transform(s) to var
31+
const rawPackageName = flags.packages.replace('@', '').replace('/', '__');
32+
const packageName = `@codeshift/mod-${rawPackageName}`;
33+
console.log(rawPackageName, packageName);
3434

35-
// TODO: consider using https://www.npmjs.com/package/npm-registry-client instead
3635
const packageManager = new PluginManager();
37-
await packageManager.install('moment');
36+
await packageManager.install(packageName);
3837

39-
const moment = packageManager.require('moment');
40-
console.log(moment().format());
38+
const codemod = packageManager.require(packageName);
4139

42-
await packageManager.uninstall('moment');
40+
console.log(
41+
// codemod,
42+
codemod.transform18_0_0,
43+
codemod.transform19_0_0,
44+
// packageManager.list(),
45+
// packageManager.getInfo(packageName),
46+
);
47+
48+
// TODO: We'll have to uninstall the mod at some point
49+
// await packageManager.uninstall('codemod');
4350
}
4451

4552
if (!transforms.length) {

packages/publisher/src/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function getPackageJson(packageName: string, version: string) {
3636
repository: 'https://github.com/CodeshiftCommunity/CodeshiftCommunity/',
3737
scripts: {},
3838
dependencies: {
39-
jscodeshift: '^0.11.0',
39+
jscodeshift: '^0.12.0',
4040
'@codeshift/utils': '*',
4141
},
4242
},

packages/test-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"license": "MIT",
88
"repository": "https://github.com/CodeshiftCommunity/CodeshiftCommunity/tree/master/packages/test-utils",
99
"dependencies": {
10-
"jscodeshift": "^0.11.0"
10+
"jscodeshift": "^0.12.0"
1111
}
1212
}

website/docs/guides/prompting-for-human-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Comments are also helpful because when a PR is raised, these prompts can easily
2020
Let's say your component now requires an additional prop `securityToken` to function safely, but you need a user to manually enter the token.
2121
This is a great candidate for prompting for user input.
2222

23-
Let's right a transform to do that:
23+
Let's write a transform to do that:
2424

2525
```javascript
2626
export default function transformer(file, { jscodeshift: j }, options) {

0 commit comments

Comments
 (0)