@i-santos/create-package-starter 1.4.0 → 1.5.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +210 -1
- package/lib/run.js +4034 -443
- package/package.json +1 -1
- package/template/.github/PULL_REQUEST_TEMPLATE.md +5 -10
- package/template/.github/workflows/auto-retarget-pr.yml +57 -0
- package/template/.github/workflows/ci.yml +15 -0
- package/template/.github/workflows/promote-stable.yml +103 -0
- package/template/.github/workflows/release.yml +9 -1
- package/template/CONTRIBUTING.md +8 -0
- package/template/README.md +11 -0
- package/template/gitignore +24 -0
- package/template/package.json +6 -1
package/package.json
CHANGED
|
@@ -2,14 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
-
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Checklist
|
|
6
6
|
|
|
7
|
-
- [ ] `npm run check`
|
|
8
|
-
- [ ]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- [ ] No release impact
|
|
13
|
-
- [ ] Patch
|
|
14
|
-
- [ ] Minor
|
|
15
|
-
- [ ] Major
|
|
7
|
+
- [ ] I ran `npm run check`
|
|
8
|
+
- [ ] I added/updated tests when needed
|
|
9
|
+
- [ ] I updated docs/README if behavior changed
|
|
10
|
+
- [ ] I added a changeset for publishable changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Auto Retarget PR Base
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- reopened
|
|
8
|
+
- synchronize
|
|
9
|
+
- edited
|
|
10
|
+
- ready_for_review
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
pull-requests: write
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: pr-retarget-${{ github.event.pull_request.number }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
retarget:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Retarget pull request base branch
|
|
24
|
+
uses: actions/github-script@v7
|
|
25
|
+
with:
|
|
26
|
+
script: |
|
|
27
|
+
const pr = context.payload.pull_request;
|
|
28
|
+
if (!pr) {
|
|
29
|
+
core.info('No pull_request payload. Skipping.');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const head = pr.head.ref;
|
|
34
|
+
const currentBase = pr.base.ref;
|
|
35
|
+
const stableBase = '__DEFAULT_BRANCH__';
|
|
36
|
+
const betaBase = '__BETA_BRANCH__';
|
|
37
|
+
|
|
38
|
+
let desiredBase = currentBase;
|
|
39
|
+
if (head === betaBase) {
|
|
40
|
+
desiredBase = stableBase;
|
|
41
|
+
} else {
|
|
42
|
+
desiredBase = betaBase;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (desiredBase === currentBase) {
|
|
46
|
+
core.info(`No retarget needed for #${pr.number} (head: ${head}, base: ${currentBase}).`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
await github.rest.pulls.update({
|
|
51
|
+
owner: context.repo.owner,
|
|
52
|
+
repo: context.repo.repo,
|
|
53
|
+
pull_number: pr.number,
|
|
54
|
+
base: desiredBase
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
core.notice(`Retargeted PR #${pr.number} base from "${currentBase}" to "${desiredBase}".`);
|
|
@@ -5,6 +5,7 @@ on:
|
|
|
5
5
|
push:
|
|
6
6
|
branches:
|
|
7
7
|
- __DEFAULT_BRANCH__
|
|
8
|
+
- __BETA_BRANCH__
|
|
8
9
|
|
|
9
10
|
jobs:
|
|
10
11
|
check:
|
|
@@ -27,3 +28,17 @@ jobs:
|
|
|
27
28
|
|
|
28
29
|
- name: Check
|
|
29
30
|
run: npm run check
|
|
31
|
+
|
|
32
|
+
required-check:
|
|
33
|
+
name: required-check
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
needs:
|
|
36
|
+
- check
|
|
37
|
+
if: ${{ always() }}
|
|
38
|
+
steps:
|
|
39
|
+
- name: Validate matrix result
|
|
40
|
+
run: |
|
|
41
|
+
if [ "${{ needs.check.result }}" != "success" ]; then
|
|
42
|
+
echo "check matrix failed"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name: Promote Stable
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
promote_type:
|
|
7
|
+
description: Promotion bump type
|
|
8
|
+
required: true
|
|
9
|
+
default: patch
|
|
10
|
+
type: choice
|
|
11
|
+
options:
|
|
12
|
+
- patch
|
|
13
|
+
- minor
|
|
14
|
+
- major
|
|
15
|
+
summary:
|
|
16
|
+
description: Promotion changeset summary
|
|
17
|
+
required: true
|
|
18
|
+
default: Promote beta track to stable release.
|
|
19
|
+
target_beta_branch:
|
|
20
|
+
description: Target beta branch
|
|
21
|
+
required: true
|
|
22
|
+
default: __BETA_BRANCH__
|
|
23
|
+
|
|
24
|
+
permissions:
|
|
25
|
+
contents: write
|
|
26
|
+
pull-requests: write
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
promote:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
outputs:
|
|
32
|
+
promotion_branch: ${{ steps.prepare.outputs.promotion_branch }}
|
|
33
|
+
promotion_pr_number: ${{ steps.pr.outputs.pull-request-number }}
|
|
34
|
+
promotion_pr_url: ${{ steps.pr.outputs.pull-request-url }}
|
|
35
|
+
steps:
|
|
36
|
+
__RELEASE_AUTH_APP_STEP__
|
|
37
|
+
|
|
38
|
+
- name: Checkout
|
|
39
|
+
uses: actions/checkout@v4
|
|
40
|
+
with:
|
|
41
|
+
fetch-depth: 0
|
|
42
|
+
token: __RELEASE_AUTH_CHECKOUT_TOKEN__
|
|
43
|
+
ref: ${{ github.event.inputs.target_beta_branch }}
|
|
44
|
+
|
|
45
|
+
- name: Setup Node.js
|
|
46
|
+
uses: actions/setup-node@v4
|
|
47
|
+
with:
|
|
48
|
+
node-version: 22
|
|
49
|
+
cache: npm
|
|
50
|
+
|
|
51
|
+
- name: Install
|
|
52
|
+
run: npm ci
|
|
53
|
+
|
|
54
|
+
- name: Prepare promotion branch
|
|
55
|
+
id: prepare
|
|
56
|
+
run: |
|
|
57
|
+
promotion_branch="promote/stable-$(date +%s)"
|
|
58
|
+
echo "promotion_branch=$promotion_branch" >> "$GITHUB_OUTPUT"
|
|
59
|
+
git checkout -b "$promotion_branch"
|
|
60
|
+
|
|
61
|
+
- name: Exit prerelease mode
|
|
62
|
+
run: npm run beta:exit
|
|
63
|
+
|
|
64
|
+
- name: Create promotion changeset
|
|
65
|
+
run: |
|
|
66
|
+
mkdir -p .changeset
|
|
67
|
+
file=".changeset/promote-stable-${{ github.run_id }}.md"
|
|
68
|
+
cat > "$file" <<EOF
|
|
69
|
+
---
|
|
70
|
+
"__PACKAGE_NAME__": ${{ github.event.inputs.promote_type }}
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
${{ github.event.inputs.summary }}
|
|
74
|
+
EOF
|
|
75
|
+
|
|
76
|
+
- name: Commit and push
|
|
77
|
+
run: |
|
|
78
|
+
git config user.name "github-actions[bot]"
|
|
79
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
80
|
+
git add .changeset
|
|
81
|
+
git commit -m "chore: promote beta to stable"
|
|
82
|
+
git push --set-upstream origin "${{ steps.prepare.outputs.promotion_branch }}"
|
|
83
|
+
|
|
84
|
+
- name: Open promotion PR
|
|
85
|
+
id: pr
|
|
86
|
+
uses: peter-evans/create-pull-request@v6
|
|
87
|
+
with:
|
|
88
|
+
token: __RELEASE_AUTH_GITHUB_TOKEN__
|
|
89
|
+
base: ${{ github.event.inputs.target_beta_branch }}
|
|
90
|
+
branch: ${{ steps.prepare.outputs.promotion_branch }}
|
|
91
|
+
title: "chore: promote beta to stable"
|
|
92
|
+
body: |
|
|
93
|
+
## Summary
|
|
94
|
+
- Exit prerelease mode (`changeset pre exit`)
|
|
95
|
+
- Add stable promotion changeset
|
|
96
|
+
- Prepare stable release flow from `${{ github.event.inputs.target_beta_branch }}`
|
|
97
|
+
draft: false
|
|
98
|
+
|
|
99
|
+
- name: Enable auto-merge
|
|
100
|
+
if: steps.pr.outputs.pull-request-number != ''
|
|
101
|
+
run: gh pr merge "${{ steps.pr.outputs.pull-request-number }}" --repo "${{ github.repository }}" --squash --auto
|
|
102
|
+
env:
|
|
103
|
+
GH_TOKEN: __RELEASE_AUTH_GITHUB_TOKEN__
|
|
@@ -4,6 +4,7 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- __DEFAULT_BRANCH__
|
|
7
|
+
- __BETA_BRANCH__
|
|
7
8
|
|
|
8
9
|
permissions:
|
|
9
10
|
contents: write
|
|
@@ -14,10 +15,13 @@ jobs:
|
|
|
14
15
|
release:
|
|
15
16
|
runs-on: ubuntu-latest
|
|
16
17
|
steps:
|
|
18
|
+
__RELEASE_AUTH_APP_STEP__
|
|
19
|
+
|
|
17
20
|
- name: Checkout
|
|
18
21
|
uses: actions/checkout@v4
|
|
19
22
|
with:
|
|
20
23
|
fetch-depth: 0
|
|
24
|
+
token: __RELEASE_AUTH_CHECKOUT_TOKEN__
|
|
21
25
|
|
|
22
26
|
- name: Setup Node.js
|
|
23
27
|
uses: actions/setup-node@v4
|
|
@@ -26,6 +30,9 @@ jobs:
|
|
|
26
30
|
cache: npm
|
|
27
31
|
registry-url: https://registry.npmjs.org
|
|
28
32
|
|
|
33
|
+
- name: Setup npm (latest)
|
|
34
|
+
run: npm install -g npm@latest
|
|
35
|
+
|
|
29
36
|
- name: Install
|
|
30
37
|
run: npm ci
|
|
31
38
|
|
|
@@ -40,4 +47,5 @@ jobs:
|
|
|
40
47
|
title: "chore: release packages"
|
|
41
48
|
commit: "chore: release packages"
|
|
42
49
|
env:
|
|
43
|
-
GITHUB_TOKEN:
|
|
50
|
+
GITHUB_TOKEN: __RELEASE_AUTH_GITHUB_TOKEN__
|
|
51
|
+
NODE_AUTH_TOKEN: ""
|
package/template/CONTRIBUTING.md
CHANGED
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
3. `.github/workflows/release.yml` opens/updates `chore: release packages`.
|
|
13
13
|
4. Merge the release PR to publish.
|
|
14
14
|
|
|
15
|
+
## Beta process
|
|
16
|
+
|
|
17
|
+
1. Use branch `__BETA_BRANCH__` for prereleases.
|
|
18
|
+
2. Run `npm run beta:enter` once on `__BETA_BRANCH__`.
|
|
19
|
+
3. Publish beta versions via `.github/workflows/release.yml` on `__BETA_BRANCH__`.
|
|
20
|
+
4. Run `npm run beta:promote` to exit prerelease mode and create stable promotion changeset.
|
|
21
|
+
5. Open PR from `__BETA_BRANCH__` to `__DEFAULT_BRANCH__`.
|
|
22
|
+
|
|
15
23
|
## Trusted Publishing
|
|
16
24
|
|
|
17
25
|
If the package does not exist on npm yet, the first publish can be manual:
|
package/template/README.md
CHANGED
|
@@ -8,6 +8,10 @@ Package created by `@i-santos/create-package-starter`.
|
|
|
8
8
|
- `npm run changeset`
|
|
9
9
|
- `npm run version-packages`
|
|
10
10
|
- `npm run release`
|
|
11
|
+
- `npm run beta:enter`
|
|
12
|
+
- `npm run beta:exit`
|
|
13
|
+
- `npm run beta:publish`
|
|
14
|
+
- `npm run beta:promote`
|
|
11
15
|
|
|
12
16
|
## Release flow
|
|
13
17
|
|
|
@@ -16,6 +20,13 @@ Package created by `@i-santos/create-package-starter`.
|
|
|
16
20
|
3. `.github/workflows/release.yml` creates or updates `chore: release packages`.
|
|
17
21
|
4. Merge the release PR to publish.
|
|
18
22
|
|
|
23
|
+
## Beta release flow
|
|
24
|
+
|
|
25
|
+
1. Create `__BETA_BRANCH__` from `__DEFAULT_BRANCH__`.
|
|
26
|
+
2. Run `npm run beta:enter` once on `__BETA_BRANCH__`.
|
|
27
|
+
3. Push updates to `__BETA_BRANCH__` and let `.github/workflows/release.yml` publish beta versions.
|
|
28
|
+
4. When ready for stable, run `npm run beta:promote`, open PR from `__BETA_BRANCH__` to `__DEFAULT_BRANCH__`, and merge.
|
|
29
|
+
|
|
19
30
|
## Trusted Publishing
|
|
20
31
|
|
|
21
32
|
If this package does not exist on npm yet, first publish can be manual:
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
dist/
|
|
3
|
+
build/
|
|
4
|
+
coverage/
|
|
5
|
+
.turbo/
|
|
6
|
+
.cache/
|
|
7
|
+
tmp/
|
|
8
|
+
temp/
|
|
9
|
+
|
|
10
|
+
.DS_Store
|
|
11
|
+
Thumbs.db
|
|
12
|
+
|
|
13
|
+
*.log
|
|
14
|
+
npm-debug.log*
|
|
15
|
+
yarn-debug.log*
|
|
16
|
+
yarn-error.log*
|
|
17
|
+
pnpm-debug.log*
|
|
18
|
+
|
|
19
|
+
.env
|
|
20
|
+
.env.*
|
|
21
|
+
!.env.example
|
|
22
|
+
!.env.*.example
|
|
23
|
+
|
|
24
|
+
.npmrc
|
package/template/package.json
CHANGED
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
"check": "node scripts/check.js",
|
|
7
7
|
"changeset": "changeset",
|
|
8
8
|
"version-packages": "changeset version",
|
|
9
|
-
"release": "npm run check && changeset publish"
|
|
9
|
+
"release": "npm run check && changeset publish",
|
|
10
|
+
"beta:enter": "changeset pre enter beta",
|
|
11
|
+
"beta:exit": "changeset pre exit",
|
|
12
|
+
"beta:version": "changeset version",
|
|
13
|
+
"beta:publish": "changeset publish",
|
|
14
|
+
"beta:promote": "create-package-starter promote-stable --dir ."
|
|
10
15
|
},
|
|
11
16
|
"devDependencies": {
|
|
12
17
|
"@changesets/cli": "^2.29.7"
|