Skip to content

Commit 8c47a2e

Browse files
authored
Updated blueprints (#144)
* chore: Renamed script * chore: Updated blueprints * chore: Updated blueprints * chore: Updated latestVersions * chore: Updated fixtures * chore: Added changeset --------- Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
1 parent fdb57d2 commit 8c47a2e

File tree

25 files changed

+214
-155
lines changed

25 files changed

+214
-155
lines changed

.changeset/small-shoes-beg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@codemod-utils/cli": minor
3+
---
4+
5+
Updated blueprints

CONTRIBUTING.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,28 @@ Here are some guidelines to help you and everyone else.
8787

8888
<summary>Publish packages (for admins)</summary>
8989

90-
1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled.
90+
1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled. This token will be used to retrieve pull request information.
9191

92-
1. Run the `release:changelog` script. This removes changesets, updates the package versions, and updates the `CHANGELOG`'s.
92+
1. Run the `release:prepare` script. This removes changesets, updates package versions, and updates `CHANGELOG`s.
9393

9494
```sh
9595
# From the workspace root
96-
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
96+
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:prepare
9797
```
9898

99-
The `release:changelog` script also updated the workspace root's version (by following the highest version formula). We will use it to name the tag that will be published.
99+
Note, `release:prepare` also updated the workspace root's version (e.g. from `0.1.1` to `0.1.2`). We will use it to name the tag that will be published.
100100
101-
```
102-
# Highest version formula
103-
workspace root version = max(
104-
max(all package versions),
105-
workspace root version + 0.0.1,
106-
);
101+
1. Review the file changes. Commit them in a branch, then open a pull request to merge the changes to the `main` branch.
102+
103+
```sh
104+
# From the workspace root
105+
git checkout -b tag-0.1.2
106+
git add .
107+
git commit -m "Tagged 0.1.2"
108+
git push origin tag-0.1.2
107109
```
108110
109-
1. [Create a tag](https://github.com/ijlee2/codemod-utils/releases/new) and provide release notes. The tag name should match the workspace root's version.
111+
1. [Create a tag](https://github.com/ijlee2/codemod-utils/releases/new) and provide release notes. The tag name should match the workspace root's version (e.g. `0.1.2`).
110112

111113
1. Publish the packages.
112114

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint": "pnpm --filter \"*\" lint",
1616
"lint:fix": "pnpm --filter \"*\" lint:fix",
1717
"prepare": "pnpm build",
18-
"release:changelog": "changeset version; update-workspace-root-version",
18+
"release:prepare": "changeset version; update-workspace-root-version",
1919
"release:publish": "pnpm build && changeset publish",
2020
"test": "pnpm --filter \"*\" test"
2121
},

packages/cli/src/blueprints/.github/workflows/ci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88

99
env:
1010
NODE_VERSION: 18
11-
PNPM_VERSION: 9
1211

1312
jobs:
1413
lint:
@@ -21,8 +20,6 @@ jobs:
2120

2221
- name: Set up pnpm
2322
uses: pnpm/action-setup@v4
24-
with:
25-
version: ${{ env.PNPM_VERSION }}
2623

2724
- name: Use Node.js ${{ env.NODE_VERSION }}
2825
uses: actions/setup-node@v4
@@ -47,8 +44,6 @@ jobs:
4744

4845
- name: Set up pnpm
4946
uses: pnpm/action-setup@v4
50-
with:
51-
version: ${{ env.PNPM_VERSION }}
5247

5348
- name: Use Node.js ${{ env.NODE_VERSION }}
5449
uses: actions/setup-node@v4

packages/cli/src/blueprints/CONTRIBUTING.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,28 @@ Here are some guidelines to help you and everyone else.
8383

8484
<summary>Publish package (for admins)</summary>
8585

86-
1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled.
86+
1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled. This token will be used to retrieve pull request information.
8787

88-
1. Run the `release:changelog` script. This removes changesets, updates the package version, and updates the `CHANGELOG`.
88+
1. Run the `release:prepare` script. This removes changesets, updates package versions, and updates `CHANGELOG`s.
8989

9090
```sh
91-
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
91+
# From the workspace root
92+
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:prepare
9293
```
9394

94-
1. [Create a tag](https://github.com/<your-github-handle>/<%= options.codemod.name %>/releases/new) and provide release notes. The tag name should match the package version.
95+
Note, `release:prepare` also updated the workspace root's version (e.g. from `0.1.1` to `0.1.2`). We will use it to name the tag that will be published.
96+
97+
1. Review the file changes. Commit them in a branch, then open a pull request to merge the changes to the `main` branch.
98+
99+
```sh
100+
# From the workspace root
101+
git checkout -b tag-0.1.2
102+
git add .
103+
git commit -m "Tagged 0.1.2"
104+
git push origin tag-0.1.2
105+
```
106+
107+
1. [Create a tag](https://github.com/<your-github-handle>/<%= options.codemod.name %>/releases/new) and provide release notes. The tag name should match the workspace root's version (e.g. `0.1.2`).
95108

96109
1. Publish the package.
97110

packages/cli/src/blueprints/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2024
3+
Copyright (c) 2025
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

packages/cli/src/blueprints/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
],
2323
"scripts": {
2424
"build": "./build.sh --production",
25-
"lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
26-
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
25+
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
26+
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
2727
"lint:js": "eslint . --cache",
2828
"lint:js:fix": "eslint . --fix",
2929
"lint:types": "tsc --noEmit",
3030
"prepare": "pnpm build",
31-
"release:changelog": "changeset version",
31+
"release:prepare": "changeset version",
3232
"release:publish": "pnpm build && changeset publish",
3333
"test": "./build.sh --test && mt dist-for-testing --quiet"
3434
},
@@ -61,11 +61,11 @@
6161
"src"
6262
],
6363
"scripts": {
64-
"lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
65-
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
64+
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
65+
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
6666
"lint:js": "eslint . --cache",
6767
"lint:js:fix": "eslint . --fix",
68-
"release:changelog": "changeset version",
68+
"release:prepare": "changeset version",
6969
"release:publish": "changeset publish",
7070
"test": "mt tests --quiet"
7171
},

packages/cli/src/steps/update-package-json.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ function updateDevDependencies(
7878
packageJson['devDependencies'] = convertToObject(devDependencies);
7979
}
8080

81+
function addPackageManager(packageJson: PackageJson): void {
82+
const version = getVersion('pnpm').replace(/^\^/, '');
83+
84+
packageJson['packageManager'] = `pnpm@${version}`;
85+
}
86+
8187
function addPnpmOverrides(packageJson: PackageJson, options: Options): void {
8288
const { codemod } = options;
8389

@@ -103,6 +109,7 @@ export function updatePackageJson(options: Options): void {
103109

104110
updateDependencies(packageJson, options);
105111
updateDevDependencies(packageJson, options);
112+
addPackageManager(packageJson);
106113
addPnpmOverrides(packageJson, options);
107114

108115
const destination = join(projectRoot, codemod.name, 'package.json');

packages/cli/src/utils/blueprints/get-version.ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,35 @@ import { decideVersion } from '@codemod-utils/blueprints';
22

33
const latestVersions = new Map([
44
['@babel/core', '7.26.0'],
5-
['@babel/eslint-parser', '7.25.9'],
6-
['@changesets/cli', '2.27.10'],
5+
['@babel/eslint-parser', '7.26.5'],
6+
['@changesets/cli', '2.27.11'],
77
['@changesets/get-github-info', '0.6.0'],
8-
['@codemod-utils/ast-javascript', '1.2.9'],
9-
['@codemod-utils/ast-template', '1.1.5'],
10-
['@codemod-utils/blueprints', '1.1.6'],
11-
['@codemod-utils/ember', '2.0.1'],
12-
['@codemod-utils/files', '2.0.5'],
13-
['@codemod-utils/json', '1.1.10'],
14-
['@codemod-utils/tests', '1.1.8'],
8+
['@codemod-utils/ast-javascript', '1.2.10'],
9+
['@codemod-utils/ast-template', '1.1.6'],
10+
['@codemod-utils/blueprints', '1.1.7'],
11+
['@codemod-utils/ember', '2.0.2'],
12+
['@codemod-utils/files', '2.0.6'],
13+
['@codemod-utils/json', '1.1.11'],
14+
['@codemod-utils/tests', '1.1.9'],
1515
['@sondr3/minitest', '0.1.2'],
1616
['@tsconfig/node18', '18.2.4'],
1717
['@tsconfig/strictest', '2.0.5'],
18-
['@types/node', '18.19.67'],
18+
['@types/node', '18.19.70'],
1919
['@types/yargs', '17.0.33'],
20-
['@typescript-eslint/eslint-plugin', '8.16.0'],
21-
['@typescript-eslint/parser', '8.16.0'],
22-
['concurrently', '9.1.0'],
20+
['@typescript-eslint/eslint-plugin', '8.20.0'],
21+
['@typescript-eslint/parser', '8.20.0'],
22+
['concurrently', '9.1.2'],
2323
['eslint', '8.57.1'],
24-
['eslint-config-prettier', '9.1.0'],
25-
['eslint-import-resolver-typescript', '3.6.3'],
24+
['eslint-config-prettier', '10.0.1'],
25+
['eslint-import-resolver-typescript', '3.7.0'],
2626
['eslint-plugin-import', '2.31.0'],
27-
['eslint-plugin-n', '17.14.0'],
28-
['eslint-plugin-prettier', '5.2.1'],
27+
['eslint-plugin-n', '17.15.1'],
28+
['eslint-plugin-prettier', '5.2.2'],
2929
['eslint-plugin-simple-import-sort', '12.1.1'],
3030
['eslint-plugin-typescript-sort-keys', '3.3.0'],
31-
['prettier', '3.4.1'],
32-
['typescript', '5.7.2'],
31+
['pnpm', '9.15.4'],
32+
['prettier', '3.4.2'],
33+
['typescript', '5.7.3'],
3334
['yargs', '17.7.2'],
3435
]);
3536

packages/cli/tests/fixtures/javascript-with-addons/output/ember-codemod-args-to-signature/.github/workflows/ci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88

99
env:
1010
NODE_VERSION: 18
11-
PNPM_VERSION: 9
1211

1312
jobs:
1413
lint:
@@ -21,8 +20,6 @@ jobs:
2120

2221
- name: Set up pnpm
2322
uses: pnpm/action-setup@v4
24-
with:
25-
version: ${{ env.PNPM_VERSION }}
2623

2724
- name: Use Node.js ${{ env.NODE_VERSION }}
2825
uses: actions/setup-node@v4
@@ -47,8 +44,6 @@ jobs:
4744

4845
- name: Set up pnpm
4946
uses: pnpm/action-setup@v4
50-
with:
51-
version: ${{ env.PNPM_VERSION }}
5247

5348
- name: Use Node.js ${{ env.NODE_VERSION }}
5449
uses: actions/setup-node@v4

packages/cli/tests/fixtures/javascript-with-addons/output/ember-codemod-args-to-signature/CONTRIBUTING.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,28 @@ Here are some guidelines to help you and everyone else.
8383

8484
<summary>Publish package (for admins)</summary>
8585

86-
1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled.
86+
1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled. This token will be used to retrieve pull request information.
8787

88-
1. Run the `release:changelog` script. This removes changesets, updates the package version, and updates the `CHANGELOG`.
88+
1. Run the `release:prepare` script. This removes changesets, updates package versions, and updates `CHANGELOG`s.
8989

9090
```sh
91-
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
91+
# From the workspace root
92+
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:prepare
9293
```
9394

94-
1. [Create a tag](https://github.com/<your-github-handle>/ember-codemod-args-to-signature/releases/new) and provide release notes. The tag name should match the package version.
95+
Note, `release:prepare` also updated the workspace root's version (e.g. from `0.1.1` to `0.1.2`). We will use it to name the tag that will be published.
96+
97+
1. Review the file changes. Commit them in a branch, then open a pull request to merge the changes to the `main` branch.
98+
99+
```sh
100+
# From the workspace root
101+
git checkout -b tag-0.1.2
102+
git add .
103+
git commit -m "Tagged 0.1.2"
104+
git push origin tag-0.1.2
105+
```
106+
107+
1. [Create a tag](https://github.com/<your-github-handle>/ember-codemod-args-to-signature/releases/new) and provide release notes. The tag name should match the workspace root's version (e.g. `0.1.2`).
95108

96109
1. Publish the package.
97110

packages/cli/tests/fixtures/javascript-with-addons/output/ember-codemod-args-to-signature/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2024
3+
Copyright (c) 2025
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

packages/cli/tests/fixtures/javascript-with-addons/output/ember-codemod-args-to-signature/package.json

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,41 @@
2222
"src"
2323
],
2424
"scripts": {
25-
"lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
26-
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
25+
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
26+
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
2727
"lint:js": "eslint . --cache",
2828
"lint:js:fix": "eslint . --fix",
29-
"release:changelog": "changeset version",
29+
"release:prepare": "changeset version",
3030
"release:publish": "changeset publish",
3131
"test": "mt tests --quiet"
3232
},
3333
"dependencies": {
34-
"@codemod-utils/ast-javascript": "^1.2.9",
35-
"@codemod-utils/ast-template": "^1.1.5",
36-
"@codemod-utils/blueprints": "^1.1.6",
37-
"@codemod-utils/ember": "^2.0.1",
38-
"@codemod-utils/files": "^2.0.5",
39-
"@codemod-utils/json": "^1.1.10",
34+
"@codemod-utils/ast-javascript": "^1.2.10",
35+
"@codemod-utils/ast-template": "^1.1.6",
36+
"@codemod-utils/blueprints": "^1.1.7",
37+
"@codemod-utils/ember": "^2.0.2",
38+
"@codemod-utils/files": "^2.0.6",
39+
"@codemod-utils/json": "^1.1.11",
4040
"yargs": "^17.7.2"
4141
},
4242
"devDependencies": {
4343
"@babel/core": "^7.26.0",
44-
"@babel/eslint-parser": "^7.25.9",
45-
"@changesets/cli": "^2.27.10",
44+
"@babel/eslint-parser": "^7.26.5",
45+
"@changesets/cli": "^2.27.11",
4646
"@changesets/get-github-info": "^0.6.0",
47-
"@codemod-utils/tests": "^1.1.8",
47+
"@codemod-utils/tests": "^1.1.9",
4848
"@sondr3/minitest": "^0.1.2",
49-
"concurrently": "^9.1.0",
49+
"concurrently": "^9.1.2",
5050
"eslint": "^8.57.1",
51-
"eslint-config-prettier": "^9.1.0",
51+
"eslint-config-prettier": "^10.0.1",
5252
"eslint-plugin-import": "^2.31.0",
53-
"eslint-plugin-n": "^17.14.0",
54-
"eslint-plugin-prettier": "^5.2.1",
53+
"eslint-plugin-n": "^17.15.1",
54+
"eslint-plugin-prettier": "^5.2.2",
5555
"eslint-plugin-simple-import-sort": "^12.1.1",
56-
"prettier": "^3.4.1"
56+
"prettier": "^3.4.2"
5757
},
5858
"engines": {
5959
"node": "18.* || >= 20"
60-
}
60+
},
61+
"packageManager": "pnpm@9.15.4"
6162
}

packages/cli/tests/fixtures/javascript/output/ember-codemod-pod-to-octane/.github/workflows/ci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88

99
env:
1010
NODE_VERSION: 18
11-
PNPM_VERSION: 9
1211

1312
jobs:
1413
lint:
@@ -21,8 +20,6 @@ jobs:
2120

2221
- name: Set up pnpm
2322
uses: pnpm/action-setup@v4
24-
with:
25-
version: ${{ env.PNPM_VERSION }}
2623

2724
- name: Use Node.js ${{ env.NODE_VERSION }}
2825
uses: actions/setup-node@v4
@@ -47,8 +44,6 @@ jobs:
4744

4845
- name: Set up pnpm
4946
uses: pnpm/action-setup@v4
50-
with:
51-
version: ${{ env.PNPM_VERSION }}
5247

5348
- name: Use Node.js ${{ env.NODE_VERSION }}
5449
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)