Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated blueprints #144

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/small-shoes-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codemod-utils/cli": minor
---

Updated blueprints
24 changes: 13 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,28 @@ Here are some guidelines to help you and everyone else.

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

1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled.
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.

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

```sh
# From the workspace root
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:prepare
```

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.
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.

```
# Highest version formula
workspace root version = max(
max(all package versions),
workspace root version + 0.0.1,
);
1. Review the file changes. Commit them in a branch, then open a pull request to merge the changes to the `main` branch.

```sh
# From the workspace root
git checkout -b tag-0.1.2
git add .
git commit -m "Tagged 0.1.2"
git push origin tag-0.1.2
```

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.
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`).

1. Publish the packages.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lint": "pnpm --filter \"*\" lint",
"lint:fix": "pnpm --filter \"*\" lint:fix",
"prepare": "pnpm build",
"release:changelog": "changeset version; update-workspace-root-version",
"release:prepare": "changeset version; update-workspace-root-version",
"release:publish": "pnpm build && changeset publish",
"test": "pnpm --filter \"*\" test"
},
Expand Down
5 changes: 0 additions & 5 deletions packages/cli/src/blueprints/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

env:
NODE_VERSION: 18
PNPM_VERSION: 9

jobs:
lint:
Expand All @@ -21,8 +20,6 @@ jobs:

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

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

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

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
Expand Down
21 changes: 17 additions & 4 deletions packages/cli/src/blueprints/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,28 @@ Here are some guidelines to help you and everyone else.

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

1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled.
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.

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

```sh
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
# From the workspace root
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:prepare
```

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.
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.

1. Review the file changes. Commit them in a branch, then open a pull request to merge the changes to the `main` branch.

```sh
# From the workspace root
git checkout -b tag-0.1.2
git add .
git commit -m "Tagged 0.1.2"
git push origin tag-0.1.2
```

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`).

1. Publish the package.

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/blueprints/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2024
Copyright (c) 2025

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:

Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/blueprints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
],
"scripts": {
"build": "./build.sh --production",
"lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"lint:types": "tsc --noEmit",
"prepare": "pnpm build",
"release:changelog": "changeset version",
"release:prepare": "changeset version",
"release:publish": "pnpm build && changeset publish",
"test": "./build.sh --test && mt dist-for-testing --quiet"
},
Expand Down Expand Up @@ -61,11 +61,11 @@
"src"
],
"scripts": {
"lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"release:changelog": "changeset version",
"release:prepare": "changeset version",
"release:publish": "changeset publish",
"test": "mt tests --quiet"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/src/steps/update-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ function updateDevDependencies(
packageJson['devDependencies'] = convertToObject(devDependencies);
}

function addPackageManager(packageJson: PackageJson): void {
const version = getVersion('pnpm').replace(/^\^/, '');

packageJson['packageManager'] = `pnpm@${version}`;
}

function addPnpmOverrides(packageJson: PackageJson, options: Options): void {
const { codemod } = options;

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

updateDependencies(packageJson, options);
updateDevDependencies(packageJson, options);
addPackageManager(packageJson);
addPnpmOverrides(packageJson, options);

const destination = join(projectRoot, codemod.name, 'package.json');
Expand Down
39 changes: 20 additions & 19 deletions packages/cli/src/utils/blueprints/get-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,35 @@ import { decideVersion } from '@codemod-utils/blueprints';

const latestVersions = new Map([
['@babel/core', '7.26.0'],
['@babel/eslint-parser', '7.25.9'],
['@changesets/cli', '2.27.10'],
['@babel/eslint-parser', '7.26.5'],
['@changesets/cli', '2.27.11'],
['@changesets/get-github-info', '0.6.0'],
['@codemod-utils/ast-javascript', '1.2.9'],
['@codemod-utils/ast-template', '1.1.5'],
['@codemod-utils/blueprints', '1.1.6'],
['@codemod-utils/ember', '2.0.1'],
['@codemod-utils/files', '2.0.5'],
['@codemod-utils/json', '1.1.10'],
['@codemod-utils/tests', '1.1.8'],
['@codemod-utils/ast-javascript', '1.2.10'],
['@codemod-utils/ast-template', '1.1.6'],
['@codemod-utils/blueprints', '1.1.7'],
['@codemod-utils/ember', '2.0.2'],
['@codemod-utils/files', '2.0.6'],
['@codemod-utils/json', '1.1.11'],
['@codemod-utils/tests', '1.1.9'],
['@sondr3/minitest', '0.1.2'],
['@tsconfig/node18', '18.2.4'],
['@tsconfig/strictest', '2.0.5'],
['@types/node', '18.19.67'],
['@types/node', '18.19.70'],
['@types/yargs', '17.0.33'],
['@typescript-eslint/eslint-plugin', '8.16.0'],
['@typescript-eslint/parser', '8.16.0'],
['concurrently', '9.1.0'],
['@typescript-eslint/eslint-plugin', '8.20.0'],
['@typescript-eslint/parser', '8.20.0'],
['concurrently', '9.1.2'],
['eslint', '8.57.1'],
['eslint-config-prettier', '9.1.0'],
['eslint-import-resolver-typescript', '3.6.3'],
['eslint-config-prettier', '10.0.1'],
['eslint-import-resolver-typescript', '3.7.0'],
['eslint-plugin-import', '2.31.0'],
['eslint-plugin-n', '17.14.0'],
['eslint-plugin-prettier', '5.2.1'],
['eslint-plugin-n', '17.15.1'],
['eslint-plugin-prettier', '5.2.2'],
['eslint-plugin-simple-import-sort', '12.1.1'],
['eslint-plugin-typescript-sort-keys', '3.3.0'],
['prettier', '3.4.1'],
['typescript', '5.7.2'],
['pnpm', '9.15.4'],
['prettier', '3.4.2'],
['typescript', '5.7.3'],
['yargs', '17.7.2'],
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

env:
NODE_VERSION: 18
PNPM_VERSION: 9

jobs:
lint:
Expand All @@ -21,8 +20,6 @@ jobs:

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

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

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

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,28 @@ Here are some guidelines to help you and everyone else.

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

1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with `repo` and `read:user` scopes enabled.
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.

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

```sh
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
# From the workspace root
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:prepare
```

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.
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.

1. Review the file changes. Commit them in a branch, then open a pull request to merge the changes to the `main` branch.

```sh
# From the workspace root
git checkout -b tag-0.1.2
git add .
git commit -m "Tagged 0.1.2"
git push origin tag-0.1.2
```

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`).

1. Publish the package.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2024
Copyright (c) 2025

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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,41 @@
"src"
],
"scripts": {
"lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"release:changelog": "changeset version",
"release:prepare": "changeset version",
"release:publish": "changeset publish",
"test": "mt tests --quiet"
},
"dependencies": {
"@codemod-utils/ast-javascript": "^1.2.9",
"@codemod-utils/ast-template": "^1.1.5",
"@codemod-utils/blueprints": "^1.1.6",
"@codemod-utils/ember": "^2.0.1",
"@codemod-utils/files": "^2.0.5",
"@codemod-utils/json": "^1.1.10",
"@codemod-utils/ast-javascript": "^1.2.10",
"@codemod-utils/ast-template": "^1.1.6",
"@codemod-utils/blueprints": "^1.1.7",
"@codemod-utils/ember": "^2.0.2",
"@codemod-utils/files": "^2.0.6",
"@codemod-utils/json": "^1.1.11",
"yargs": "^17.7.2"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.25.9",
"@changesets/cli": "^2.27.10",
"@babel/eslint-parser": "^7.26.5",
"@changesets/cli": "^2.27.11",
"@changesets/get-github-info": "^0.6.0",
"@codemod-utils/tests": "^1.1.8",
"@codemod-utils/tests": "^1.1.9",
"@sondr3/minitest": "^0.1.2",
"concurrently": "^9.1.0",
"concurrently": "^9.1.2",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-n": "^17.15.1",
"eslint-plugin-prettier": "^5.2.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.4.1"
"prettier": "^3.4.2"
},
"engines": {
"node": "18.* || >= 20"
}
},
"packageManager": "pnpm@9.15.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

env:
NODE_VERSION: 18
PNPM_VERSION: 9

jobs:
lint:
Expand All @@ -21,8 +20,6 @@ jobs:

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

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

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

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
Expand Down
Loading
Loading