Skip to content

Commit 1d0cec8

Browse files
committed
feat: refactor project setup and release configuration
* Added a new GitHub Action for project setup, including Node.js and pnpm installation. * Updated CI workflow to utilize the new setup action. * Enhanced release workflow to support multiple branches and integrated semantic release. * Updated ESLint configuration to disable specific rules. * Changed package name from `@antfu/eslint-config` to `@pixpilot/eslint-config`. * Removed obsolete version generation script.
1 parent 2e56cfc commit 1d0cec8

9 files changed

Lines changed: 171 additions & 99 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Setup project
2+
description: 'Setup Node.js, install pnpm, install dependencies, and build the project'
3+
4+
inputs:
5+
node-version:
6+
description: Node.js version to use
7+
required: false
8+
default: '20'
9+
pnpm-version:
10+
description: pnpm version to use
11+
required: false
12+
registry-url:
13+
description: npm registry URL
14+
required: false
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: ${{ inputs.pnpm-version }}
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ inputs.node-version }}
28+
cache: pnpm
29+
registry-url: ${{ inputs.registry-url }}
30+
31+
- name: Setup
32+
run: npm i -g @antfu/ni
33+
shell: bash
34+
35+
- name: Install dependencies
36+
run: pnpm install
37+
shell: bash
38+
39+
- name: Build package
40+
run: pnpm run build
41+
shell: bash

.github/workflows/ci.yml

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
1+
# .github/workflows/ci.yml
2+
13
name: CI
24

35
on:
4-
push:
5-
branches:
6-
- main
7-
6+
# push:
7+
# branches: [main]
8+
# NOTE: The 'push' trigger above is commented out to prevent this CI workflow
9+
# from running a second time. The 'release.yml' workflow already calls this
10+
# workflow on pushes to main, making this trigger redundant.
811
pull_request:
9-
branches:
10-
- main
12+
branches: [main]
13+
workflow_call:
1114

1215
jobs:
1316
lint:
1417
runs-on: ubuntu-latest
1518
steps:
1619
- uses: actions/checkout@v4
17-
18-
- name: Install pnpm
19-
uses: pnpm/action-setup@v4
20-
21-
- name: Set node
22-
uses: actions/setup-node@v4
20+
- name: Setup Project
21+
uses: ./.github/actions/setup-project
2322
with:
2423
node-version: lts/*
2524

26-
- name: Setup
27-
run: npm i -g @antfu/ni
28-
29-
- name: Install
30-
run: nci
31-
32-
- name: Build
33-
run: nr build
34-
3525
- name: Lint
3626
run: nr lint
3727

@@ -44,28 +34,15 @@ jobs:
4434
strategy:
4535
matrix:
4636
node: [lts/*]
47-
os: [ubuntu-latest, windows-latest, macos-latest]
37+
os: [ubuntu-latest]
4838
fail-fast: false
4939

5040
steps:
5141
- uses: actions/checkout@v4
52-
53-
- name: Install pnpm
54-
uses: pnpm/action-setup@v4
55-
56-
- name: Set node ${{ matrix.node }}
57-
uses: actions/setup-node@v4
42+
- name: Setup Project
43+
uses: ./.github/actions/setup-project
5844
with:
5945
node-version: ${{ matrix.node }}
6046

61-
- name: Setup
62-
run: npm i -g @antfu/ni
63-
64-
- name: Install
65-
run: nci
66-
67-
- name: Build
68-
run: nr build
69-
7047
- name: Test
7148
run: nr test

.github/workflows/release.yml

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,62 @@
1-
name: Release
1+
# .github/workflows/release.yml
2+
3+
name: Release Package
24

35
on:
46
push:
5-
tags:
6-
- 'v*'
7+
branches:
8+
- main
9+
- master
10+
- next
11+
workflow_dispatch:
712

813
jobs:
9-
release:
10-
permissions:
11-
contents: write
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
fetch-depth: 0
17-
18-
- uses: actions/setup-node@v4
19-
with:
20-
node-version: lts/*
21-
22-
- run: npx changelogithub
23-
env:
24-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
14+
ci:
15+
name: Run CI Checks
16+
# Supported: Calling a reusable workflow in the same repo is valid per https://docs.github.com/en/actions/how-tos/sharing-automations/reusing-workflows#calling-a-reusable-workflow
17+
uses: ./.github/workflows/ci.yml
18+
19+
# ======================================================================
20+
# If your branch PR is protected, remove the jobs below and use this one instead.
21+
# Additional setup:
22+
# - See the following gist for detailed instructions:
23+
# https://gist.github.com/0xernesto/a8065cce55940e6ccc523664a87ee9bc
24+
# - You must set up a GitHub App and add the following repository secrets:
25+
# RELEASER_ID: The App ID of your GitHub App
26+
# RELEASER_PRIVATE_KEY: The private key for your GitHub App
27+
# NPM_TOKEN: Your npm publish token
28+
# ======================================================================
29+
release-protected:
30+
uses: pixpilot/dev-config/.github/workflows/semantic-release-protected-branch.yml@main
31+
needs: ci
32+
secrets:
33+
RELEASER_ID: ${{ secrets.RELEASER_ID }}
34+
RELEASER_PRIVATE_KEY: ${{ secrets.RELEASER_PRIVATE_KEY }}
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
37+
# release:
38+
# if: ${{ !endsWith(github.repository, 'ts-npm-package-template') }}
39+
# name: Create Release and Publish
40+
# runs-on: ubuntu-latest
41+
# needs: ci
42+
# permissions:
43+
# contents: write
44+
# pull-requests: write
45+
# id-token: write
46+
47+
# steps:
48+
# - name: Checkout repository
49+
# uses: actions/checkout@v4
50+
# with:
51+
# fetch-depth: 0
52+
53+
# - name: Setup project
54+
# uses: ./.github/actions/setup-project
55+
# with:
56+
# registry-url: 'https://registry.npmjs.org'
57+
58+
# - name: Release with semantic-release
59+
# env:
60+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
62+
# run: pnpm run release

eslint.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ export default antfu(
2828
'perfectionist/sort-objects': 'error',
2929
},
3030
},
31+
{
32+
rules: {
33+
'@next/next/no-html-link-for-pages': 'off',
34+
},
35+
},
3136
)

package.json

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
{
2-
"name": "@antfu/eslint-config",
2+
"name": "@pixpilot/eslint-config",
33
"type": "module",
44
"version": "5.0.0",
55
"packageManager": "pnpm@10.13.1",
66
"description": "Anthony's ESLint config",
77
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
88
"license": "MIT",
9-
"funding": "https://github.com/sponsors/antfu",
10-
"homepage": "https://github.com/antfu/eslint-config",
9+
"homepage": "https://github.com/pixpilot/eslint-config",
1110
"repository": {
1211
"type": "git",
13-
"url": "git+https://github.com/antfu/eslint-config.git"
14-
},
15-
"bugs": {
16-
"url": "https://github.com/antfu/eslint-config/issues"
12+
"url": "git+https://github.com/pixpilot/eslint-config.git"
1713
},
1814
"keywords": [
1915
"eslint-config"
@@ -35,10 +31,10 @@
3531
"build:inspector": "pnpm build && npx @eslint/config-inspector build",
3632
"watch": "tsdown --watch",
3733
"lint": "eslint",
38-
"gen": "tsx scripts/typegen.ts && tsx scripts/versiongen.ts",
34+
"gen": "tsx scripts/typegen.ts",
3935
"prepack": "nr build",
40-
"release": "bumpp && pnpm publish",
41-
"test": "vitest",
36+
"release": "semantic-release",
37+
"test": "vitest --run",
4238
"typecheck": "tsc --noEmit",
4339
"prepare": "simple-git-hooks"
4440
},
@@ -55,10 +51,13 @@
5551
"eslint-plugin-react-refresh": "^0.4.19",
5652
"eslint-plugin-solid": "^0.14.3",
5753
"eslint-plugin-svelte": ">=2.35.1",
54+
"eslint-plugin-vue": "catalog:prod",
5855
"eslint-plugin-vuejs-accessibility": "^2.4.1",
56+
"eslint-processor-vue-blocks": "catalog:prod",
5957
"prettier-plugin-astro": "^0.14.0",
6058
"prettier-plugin-slidev": "^1.0.5",
61-
"svelte-eslint-parser": ">=0.37.0"
59+
"svelte-eslint-parser": ">=0.37.0",
60+
"vue-eslint-parser": "catalog:prod"
6261
},
6362
"peerDependenciesMeta": {
6463
"@eslint-react/eslint-plugin": {
@@ -94,9 +93,15 @@
9493
"eslint-plugin-svelte": {
9594
"optional": true
9695
},
96+
"eslint-plugin-vue": {
97+
"optional": true
98+
},
9799
"eslint-plugin-vuejs-accessibility": {
98100
"optional": true
99101
},
102+
"eslint-processor-vue-blocks": {
103+
"optional": true
104+
},
100105
"prettier-plugin-astro": {
101106
"optional": true
102107
},
@@ -105,6 +110,9 @@
105110
},
106111
"svelte-eslint-parser": {
107112
"optional": true
113+
},
114+
"vue-eslint-parser": {
115+
"optional": true
108116
}
109117
},
110118
"dependencies": {
@@ -134,19 +142,15 @@
134142
"eslint-plugin-toml": "catalog:prod",
135143
"eslint-plugin-unicorn": "catalog:prod",
136144
"eslint-plugin-unused-imports": "catalog:prod",
137-
"eslint-plugin-vue": "catalog:prod",
138145
"eslint-plugin-yml": "catalog:prod",
139-
"eslint-processor-vue-blocks": "catalog:prod",
140146
"globals": "catalog:prod",
141147
"jsonc-eslint-parser": "catalog:prod",
142148
"local-pkg": "catalog:prod",
143149
"parse-gitignore": "catalog:prod",
144150
"toml-eslint-parser": "catalog:prod",
145-
"vue-eslint-parser": "catalog:prod",
146151
"yaml-eslint-parser": "catalog:prod"
147152
},
148153
"devDependencies": {
149-
"@antfu/eslint-config": "workspace:*",
150154
"@antfu/ni": "catalog:dev",
151155
"@eslint-react/eslint-plugin": "catalog:peer",
152156
"@eslint/config-inspector": "catalog:dev",

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release.config.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export default {
2+
branches: [
3+
// Production branch for stable releases (e.g., 1.5.0)
4+
'main',
5+
// Pre-release branch for release candidates (e.g., 1.6.0-rc.1)
6+
{
7+
name: 'next',
8+
prerelease: 'rc',
9+
channel: 'next',
10+
},
11+
],
12+
plugins: [
13+
'@semantic-release/commit-analyzer',
14+
'@semantic-release/release-notes-generator',
15+
[
16+
'@semantic-release/changelog',
17+
{
18+
changelogFile: 'CHANGELOG.md',
19+
},
20+
],
21+
'@semantic-release/npm',
22+
[
23+
'@semantic-release/git',
24+
{
25+
assets: ['package.json', 'CHANGELOG.md'],
26+
message:
27+
// eslint-disable-next-line no-template-curly-in-string
28+
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
29+
},
30+
],
31+
'@semantic-release/github',
32+
],
33+
}

scripts/versiongen.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/cli/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { run } from './run'
99

1010
function header(): void {
1111
console.log('\n')
12-
p.intro(`${c.green`@antfu/eslint-config `}${c.dim`v${version}`}`)
12+
p.intro(`${c.green`@pixpilot/eslint-config `}${c.dim`v${version}`}`)
1313
}
1414

15-
const cli = cac('@antfu/eslint-config')
15+
const cli = cac('@pixpilot/eslint-config')
1616

1717
cli
1818
.command('', 'Run the initialization or migration')

0 commit comments

Comments
 (0)