@kitschpatrol/create-project 1.2.8 → 1.3.0
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/dist/index.js +1 -1
- package/package.json +16 -14
- package/readme.md +1 -2
- package/templates/cli/.gitattributes +2 -0
- package/templates/cli/.github/workflows/ci.yml +51 -0
- package/templates/cli/.github/workflows/github-release.yml +18 -6
- package/templates/cli/.github/workflows/set-github-metadata.yml +6 -3
- package/templates/cli/.prettierignore +1 -0
- package/templates/cli/.vscode/settings.json +3 -3
- package/templates/cli/mdat.config.ts +1 -3
- package/templates/cli/package.json +13 -10
- package/templates/cli/readme.md +0 -2
- package/templates/cli/src/index.ts +1 -1
- package/templates/cli/test/cli.test.ts +2 -1
- package/templates/cli/test/index.bench.ts +7 -0
- package/templates/cli/tsdown.config.ts +0 -2
- package/templates/cli+library/.gitattributes +2 -0
- package/templates/cli+library/.github/workflows/ci.yml +51 -0
- package/templates/cli+library/.github/workflows/github-release.yml +18 -6
- package/templates/cli+library/.github/workflows/set-github-metadata.yml +6 -3
- package/templates/cli+library/.prettierignore +1 -0
- package/templates/cli+library/.vscode/settings.json +3 -3
- package/templates/cli+library/mdat.config.ts +1 -3
- package/templates/cli+library/package.json +13 -10
- package/templates/cli+library/readme.md +0 -2
- package/templates/cli+library/src/lib/log.ts +2 -1
- package/templates/cli+library/test/cli.test.ts +3 -1
- package/templates/cli+library/test/index.bench.ts +7 -0
- package/templates/electron/.gitattributes +2 -0
- package/templates/electron/.github/workflows/ci.yml +51 -0
- package/templates/electron/.github/workflows/github-release.yml +18 -6
- package/templates/electron/.github/workflows/set-github-metadata.yml +6 -3
- package/templates/electron/.prettierignore +1 -0
- package/templates/electron/.vscode/settings.json +3 -3
- package/templates/electron/knip.config.ts +1 -0
- package/templates/electron/package.json +14 -11
- package/templates/electron/readme.md +0 -2
- package/templates/electron/test/index.bench.ts +7 -0
- package/templates/library/.gitattributes +2 -0
- package/templates/library/.github/workflows/ci.yml +51 -0
- package/templates/library/.github/workflows/github-release.yml +18 -6
- package/templates/library/.github/workflows/set-github-metadata.yml +6 -3
- package/templates/library/.prettierignore +1 -0
- package/templates/library/.vscode/settings.json +3 -3
- package/templates/library/package.json +12 -9
- package/templates/library/readme.md +0 -2
- package/templates/library/src/log.ts +2 -1
- package/templates/library/test/index.bench.ts +7 -0
- package/templates/minimal/.gitattributes +2 -0
- package/templates/minimal/.github/workflows/ci.yml +51 -0
- package/templates/minimal/.github/workflows/github-release.yml +18 -6
- package/templates/minimal/.github/workflows/set-github-metadata.yml +6 -3
- package/templates/minimal/.vscode/settings.json +3 -3
- package/templates/minimal/package.json +12 -5
- package/templates/minimal/readme.md +0 -2
- package/templates/unplugin/.gitattributes +2 -0
- package/templates/unplugin/.github/workflows/ci.yml +51 -0
- package/templates/unplugin/.github/workflows/github-release.yml +18 -6
- package/templates/unplugin/.github/workflows/set-github-metadata.yml +6 -3
- package/templates/unplugin/.prettierignore +1 -0
- package/templates/unplugin/.vscode/settings.json +3 -3
- package/templates/unplugin/eslint.config.ts +24 -7
- package/templates/unplugin/knip.config.ts +13 -1
- package/templates/unplugin/package.json +53 -11
- package/templates/unplugin/playground/env.d.ts +4 -0
- package/templates/unplugin/playground/index.html +23 -0
- package/templates/unplugin/playground/main.ts +1 -0
- package/templates/unplugin/playground/package.json +16 -0
- package/templates/unplugin/playground/readme.md +11 -0
- package/templates/unplugin/playground/vite.config.ts +16 -0
- package/templates/unplugin/pnpm-workspace.yaml +5 -1
- package/templates/unplugin/readme.md +0 -2
- package/templates/unplugin/src/bun.ts +20 -0
- package/templates/unplugin/src/core/options.ts +6 -4
- package/templates/unplugin/src/index.ts +10 -7
- package/templates/unplugin/test/index.bench.ts +7 -0
- package/templates/web/.gitattributes +2 -0
- package/templates/web/.github/workflows/ci.yml +51 -0
- package/templates/web/.github/workflows/github-release.yml +18 -6
- package/templates/web/.github/workflows/set-github-metadata.yml +6 -3
- package/templates/web/.prettierignore +2 -0
- package/templates/web/.vscode/settings.json +3 -3
- package/templates/web/package.json +20 -11
- package/templates/web/readme.md +0 -2
- package/templates/web/test/index.bench.ts +7 -0
- package/templates/cli/.npmrc +0 -2
- package/templates/cli+library/.npmrc +0 -2
- package/templates/electron/.npmrc +0 -2
- package/templates/library/.npmrc +0 -2
- package/templates/minimal/.npmrc +0 -2
- package/templates/unplugin/.npmrc +0 -2
- package/templates/web/.npmrc +0 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request: {}
|
|
7
|
+
workflow_dispatch: {}
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
14
|
+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
ci:
|
|
18
|
+
runs-on: ${{ matrix.os }}
|
|
19
|
+
timeout-minutes: 20
|
|
20
|
+
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
29
|
+
with:
|
|
30
|
+
persist-credentials: false
|
|
31
|
+
|
|
32
|
+
- name: Install pnpm
|
|
33
|
+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
34
|
+
|
|
35
|
+
- name: Setup Node.js
|
|
36
|
+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
|
37
|
+
with:
|
|
38
|
+
node-version: 24
|
|
39
|
+
cache: 'pnpm'
|
|
40
|
+
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: pnpm install --frozen-lockfile
|
|
43
|
+
|
|
44
|
+
- name: Build
|
|
45
|
+
run: pnpm run build
|
|
46
|
+
|
|
47
|
+
- name: Lint
|
|
48
|
+
run: pnpm run lint
|
|
49
|
+
|
|
50
|
+
- name: Test
|
|
51
|
+
run: pnpm run test
|
|
@@ -4,6 +4,10 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
tags:
|
|
6
6
|
- 'v[0-9]*'
|
|
7
|
+
- '[0-9]*'
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
7
11
|
|
|
8
12
|
jobs:
|
|
9
13
|
build:
|
|
@@ -16,13 +20,17 @@ jobs:
|
|
|
16
20
|
|
|
17
21
|
steps:
|
|
18
22
|
- name: Checkout
|
|
19
|
-
uses: actions/checkout@v6
|
|
23
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
20
24
|
with:
|
|
21
25
|
fetch-depth: 0
|
|
26
|
+
persist-credentials: false
|
|
22
27
|
|
|
23
28
|
- name: Log Token Type
|
|
29
|
+
env:
|
|
30
|
+
TOKEN: ${{ env.ACCESS_TOKEN }}
|
|
31
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
24
32
|
run: |
|
|
25
|
-
if [ $
|
|
33
|
+
if [ "$TOKEN" = "$GH_TOKEN" ]; then
|
|
26
34
|
echo "🗝️ Authenticated with GitHub Token"
|
|
27
35
|
else
|
|
28
36
|
echo "🔑 Authenticated with Personal Access token"
|
|
@@ -31,7 +39,7 @@ jobs:
|
|
|
31
39
|
- name: Validate Tag and Branch
|
|
32
40
|
id: validation
|
|
33
41
|
run: |
|
|
34
|
-
TAG=$(git tag --contains HEAD | grep '^v[0-9]' | head -n 1)
|
|
42
|
+
TAG=$(git tag --contains HEAD | grep -E '^v?[0-9]' | head -n 1)
|
|
35
43
|
echo "🏷️ Tag for commit is: $TAG"
|
|
36
44
|
BRANCH=$(git branch -r --contains tags/${GITHUB_REF_NAME} | grep 'origin/main' | xargs)
|
|
37
45
|
if [[ -z "$BRANCH" ]]; then
|
|
@@ -75,7 +83,11 @@ jobs:
|
|
|
75
83
|
|
|
76
84
|
- name: Log Release Details
|
|
77
85
|
if: env.IS_VALID_COMMIT == 'true'
|
|
86
|
+
env:
|
|
87
|
+
TAG: ${{ env.TAG_NAME }}
|
|
88
|
+
RELEASE_URL: ${{ steps.release.outputs.url }}
|
|
89
|
+
RELEASE_ID: ${{ steps.release.outputs.id }}
|
|
78
90
|
run: |
|
|
79
|
-
echo "📦 Successfully released: $
|
|
80
|
-
echo "🔗 Release URL: $
|
|
81
|
-
echo "🪪 Release ID: $
|
|
91
|
+
echo "📦 Successfully released: $TAG"
|
|
92
|
+
echo "🔗 Release URL: $RELEASE_URL"
|
|
93
|
+
echo "🪪 Release ID: $RELEASE_ID"
|
|
@@ -4,6 +4,9 @@ on:
|
|
|
4
4
|
branches: [main]
|
|
5
5
|
workflow_dispatch: {}
|
|
6
6
|
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
7
10
|
jobs:
|
|
8
11
|
build:
|
|
9
12
|
name: Set GitHub Metadata
|
|
@@ -11,11 +14,11 @@ jobs:
|
|
|
11
14
|
|
|
12
15
|
steps:
|
|
13
16
|
- name: Checkout
|
|
14
|
-
uses: actions/checkout@v6
|
|
17
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
15
18
|
with:
|
|
16
|
-
|
|
19
|
+
persist-credentials: false
|
|
17
20
|
|
|
18
21
|
- name: Sync Package info to GitHub
|
|
19
|
-
uses: kitschpatrol/github-action-repo-sync@
|
|
22
|
+
uses: kitschpatrol/github-action-repo-sync@v5
|
|
20
23
|
with:
|
|
21
24
|
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
".env": ".env.*, .template.env",
|
|
51
51
|
"*.js": "${basename}.ts.map, ${basename}.js.map, ${basename}.d.ts, ${basename}.d.ts.map, ${basename}.d.js.map",
|
|
52
52
|
"*.ts": "${basename}.ts.map, ${basename}.d.ts, ${basename}.d.ts.map",
|
|
53
|
-
"package.json": ".*.cjs, .*.cts, .*.js, .*.json, .*.json5, .*.jsonc, .*.mjs, .*.mts, .*.toml, .*.ts, .*.yaml, .*.yml, .*ignore, .*rc, .node-version, *config.cjs, *config.cts, *config.js, *config.json, *config.json5, *config.jsonc, *config.mjs, *config.mts, *config.toml, *config.ts, *config.yaml, *config.yml, tsconfig.*.json, lerna.json, netlify.toml, package-lock.json, pnpm*, turbo.json, vercel.json, workspace*, wrangler.toml, wrangler.json, wrangler.jsonc, yarn.lock, yarn*",
|
|
53
|
+
"package.json": ".*.cjs, .*.cts, .*.js, .*.json, .*.json5, .*.jsonc, .*.mjs, .*.mts, .*.toml, .*.ts, .*.yaml, .*.yml, .*attributes, .*ignore, .*rc, .node-version, *config.cjs, *config.cts, *config.js, *config.json, *config.json5, *config.jsonc, *config.mjs, *config.mts, *config.toml, *config.ts, *config.yaml, *config.yml, tsconfig.*.json, lerna.json, netlify.toml, package-lock.json, pnpm*, skills-lock.json, turbo.json, vercel.json, workspace*, wrangler.toml, wrangler.json, wrangler.jsonc, yarn.lock, yarn*",
|
|
54
54
|
"readme.md": "authors*, backers*, changelog*, citation*, code_of_conduct*, contributing*, contributors*, copying*, credits*, governance*, history*, license*, maintainers*, release_notes*, security*, sponsors*"
|
|
55
55
|
},
|
|
56
56
|
"prettier.documentSelectors": [
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
"prettier.enable": true,
|
|
66
66
|
"stylelint.enable": true,
|
|
67
67
|
"stylelint.validate": ["css", "html", "svelte", "astro"],
|
|
68
|
-
"
|
|
69
|
-
"
|
|
68
|
+
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
|
|
69
|
+
"js/ts.tsdk.path": "node_modules/typescript/lib"
|
|
70
70
|
}
|
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
import { eslintConfig } from '@kitschpatrol/eslint-config'
|
|
2
2
|
|
|
3
|
-
export default eslintConfig(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export default eslintConfig(
|
|
4
|
+
{
|
|
5
|
+
html: {
|
|
6
|
+
overrides: {
|
|
7
|
+
'html/no-inline-styles': 'off',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
ignores: ['/test/fixtures/**'],
|
|
11
|
+
ts: {
|
|
12
|
+
overrides: {
|
|
13
|
+
'jsdoc/require-description': 'off',
|
|
14
|
+
'jsdoc/require-jsdoc': 'off',
|
|
15
|
+
'ts/consistent-type-definitions': 'off',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
type: 'lib',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
files: ['playground/package.json'],
|
|
22
|
+
rules: {
|
|
23
|
+
'json-package/require-author': 'off',
|
|
24
|
+
'json-package/require-keywords': 'off',
|
|
25
|
+
'json-package/require-version': 'off',
|
|
8
26
|
},
|
|
9
27
|
},
|
|
10
|
-
|
|
11
|
-
})
|
|
28
|
+
)
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { knipConfig } from '@kitschpatrol/knip-config'
|
|
2
2
|
|
|
3
3
|
export default knipConfig({
|
|
4
|
-
ignore: ['
|
|
4
|
+
ignore: ['test/fixtures/**', 'playground/env.d.ts'],
|
|
5
|
+
ignoreDependencies: [
|
|
6
|
+
'@farmfe/core',
|
|
7
|
+
'@kitschpatrol/aphex',
|
|
8
|
+
'@nuxt/kit',
|
|
9
|
+
'@nuxt/schema',
|
|
10
|
+
'@sxzz/test-utils',
|
|
11
|
+
'esbuild',
|
|
12
|
+
'rollup',
|
|
13
|
+
'tsx',
|
|
14
|
+
'vite',
|
|
15
|
+
'webpack',
|
|
16
|
+
],
|
|
5
17
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "{{{github-repository}}}",
|
|
3
3
|
"version": "0.0.0",
|
|
4
|
-
"description": "An unplugin project",
|
|
4
|
+
"description": "An unplugin project.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unplugin",
|
|
7
7
|
"vite",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"rolldown",
|
|
12
12
|
"esbuild",
|
|
13
13
|
"farm",
|
|
14
|
+
"bun",
|
|
14
15
|
"transform",
|
|
15
16
|
"npm-package"
|
|
16
17
|
],
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
".": "./dist/index.js",
|
|
33
34
|
"./*": "./*",
|
|
34
35
|
"./api": "./dist/api.js",
|
|
36
|
+
"./bun": "./dist/bun.js",
|
|
35
37
|
"./esbuild": "./dist/esbuild.js",
|
|
36
38
|
"./farm": "./dist/farm.js",
|
|
37
39
|
"./rolldown": "./dist/rolldown.js",
|
|
@@ -55,28 +57,68 @@
|
|
|
55
57
|
"dist"
|
|
56
58
|
],
|
|
57
59
|
"scripts": {
|
|
60
|
+
"bench": "vitest bench --run --compare test/benchmarks/baseline.json",
|
|
61
|
+
"bench:baseline": "vitest bench --run --outputJson test/benchmarks/baseline.json",
|
|
58
62
|
"build": "tsdown",
|
|
59
|
-
"clean": "
|
|
63
|
+
"clean": "shx rm -f pnpm-lock.yaml && git clean -fdX -e !.claude/",
|
|
60
64
|
"dev": "tsdown --watch",
|
|
61
65
|
"fix": "ksc fix",
|
|
62
66
|
"lint": "ksc lint",
|
|
63
|
-
"
|
|
67
|
+
"play": "poptab && pnpm -C playground run dev",
|
|
68
|
+
"release": "bumpp --commit 'Release: %s' && pnpm build && NPM_AUTH_TOKEN=$({{{npm-auth-command}}}) && pnpm publish",
|
|
64
69
|
"test": "vitest run"
|
|
65
70
|
},
|
|
66
71
|
"dependencies": {
|
|
67
72
|
"@types/node": "~22.16.5",
|
|
68
|
-
"unplugin": "^
|
|
69
|
-
"unplugin-utils": "^0.3.1"
|
|
73
|
+
"unplugin": "^3.0.0"
|
|
70
74
|
},
|
|
71
75
|
"devDependencies": {
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
+
"@farmfe/core": ">=1.7.11",
|
|
77
|
+
"@kitschpatrol/shared-config": "^7.2.0",
|
|
78
|
+
"@sxzz/test-utils": "^0.5.16",
|
|
79
|
+
"@vitest/browser-playwright": "^4.1.4",
|
|
80
|
+
"bumpp": "^11.0.1",
|
|
81
|
+
"esbuild": "*",
|
|
82
|
+
"poptab": "^1.1.0",
|
|
83
|
+
"rollup": "^4.60.1",
|
|
84
|
+
"shx": "^0.4.0",
|
|
85
|
+
"tsdown": "^0.21.7",
|
|
76
86
|
"typescript": "~5.9.3",
|
|
77
|
-
"
|
|
87
|
+
"vite": "^7.3.2",
|
|
88
|
+
"vitest": "^4.1.4",
|
|
89
|
+
"webpack": "^5.106.0"
|
|
78
90
|
},
|
|
79
|
-
"
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"@farmfe/core": ">=1",
|
|
93
|
+
"esbuild": "*",
|
|
94
|
+
"rollup": "^4.1",
|
|
95
|
+
"vite": ">=3",
|
|
96
|
+
"webpack": "^4 || ^5"
|
|
97
|
+
},
|
|
98
|
+
"peerDependenciesMeta": {
|
|
99
|
+
"@farmfe/core": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"@nuxt/kit": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"@nuxt/schema": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"esbuild": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"rollup": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"vite": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
117
|
+
"webpack": {
|
|
118
|
+
"optional": true
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"packageManager": "pnpm@10.33.0",
|
|
80
122
|
"engines": {
|
|
81
123
|
"node": ">=22.18.0"
|
|
82
124
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>{{{github-repository}}} Demo</title>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<link rel="icon" href="/favicon.ico" />
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
|
+
</head>
|
|
9
|
+
<style>
|
|
10
|
+
a.inspect {
|
|
11
|
+
display: block;
|
|
12
|
+
margin-top: 10px;
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
<body>
|
|
17
|
+
<div id="app"></div>
|
|
18
|
+
<a href="/__inspect/#/module?id=./main.ts&index=2" target="_blank" class="inspect"
|
|
19
|
+
>visit /__inspect/ to inspect the intermediate state</a
|
|
20
|
+
>
|
|
21
|
+
<script type="module" src="./main.ts"></script>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('Your exercises here!')
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{{github-repository}}}-playground",
|
|
3
|
+
"private": true,
|
|
4
|
+
"description": "Local playground for evaluating {{{github-repository}}}.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"dev": "nodemon -w '../src/**/*.ts' -e .ts -x vite"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"nodemon": "^3.1.14",
|
|
12
|
+
"vite": "^7.3.1",
|
|
13
|
+
"vite-plugin-inspect": "^11.3.3",
|
|
14
|
+
"vite-plugin-mkcert": "^1.17.12"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import inspect from 'vite-plugin-inspect'
|
|
3
|
+
import mkcert from 'vite-plugin-mkcert'
|
|
4
|
+
|
|
5
|
+
process.env.BROWSER = 'chromium'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [mkcert(), inspect()],
|
|
9
|
+
server: {
|
|
10
|
+
hmr: {
|
|
11
|
+
host: 'localhost',
|
|
12
|
+
protocol: 'wss',
|
|
13
|
+
},
|
|
14
|
+
open: true,
|
|
15
|
+
},
|
|
16
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This entry file is for Bun plugin.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { starter } from './index'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Bun plugin
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // Build with Bun
|
|
13
|
+
* import starter from '{{{github-repository}}}/bun'
|
|
14
|
+
*
|
|
15
|
+
* Bun.build({ plugins: [starter()] })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const { bun } = starter
|
|
19
|
+
export default bun
|
|
20
|
+
export { bun as 'module.exports' }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { FilterPattern } from 'unplugin
|
|
1
|
+
import type { FilterPattern } from 'unplugin'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type Options = {
|
|
7
7
|
enforce?: 'post' | 'pre' | undefined
|
|
8
8
|
exclude?: FilterPattern
|
|
9
9
|
include?: FilterPattern
|
|
@@ -16,13 +16,15 @@ type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U
|
|
|
16
16
|
*/
|
|
17
17
|
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, 'enforce'>>
|
|
18
18
|
|
|
19
|
+
const NODE_MODULES_REGEX = /node_modules/
|
|
20
|
+
const CODE_EXTENSIONS_REGEX = /\.[cm]?[jt]sx?$/
|
|
19
21
|
/**
|
|
20
22
|
* Resolve and normalize user options.
|
|
21
23
|
*/
|
|
22
24
|
export function resolveOptions(options: Options): OptionsResolved {
|
|
23
25
|
return {
|
|
24
26
|
enforce: 'enforce' in options ? options.enforce : 'pre',
|
|
25
|
-
exclude: options.exclude ?? [
|
|
26
|
-
include: options.include ?? [
|
|
27
|
+
exclude: options.exclude ?? [NODE_MODULES_REGEX],
|
|
28
|
+
include: options.include ?? [CODE_EXTENSIONS_REGEX],
|
|
27
29
|
}
|
|
28
30
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { UnpluginInstance } from 'unplugin'
|
|
2
2
|
import { createUnplugin } from 'unplugin'
|
|
3
|
-
import { createFilter } from 'unplugin-utils'
|
|
4
3
|
import type { Options } from './core/options'
|
|
5
4
|
import { resolveOptions } from './core/options'
|
|
6
5
|
|
|
@@ -10,17 +9,21 @@ import { resolveOptions } from './core/options'
|
|
|
10
9
|
export const starter: UnpluginInstance<Options | undefined, false> = createUnplugin(
|
|
11
10
|
(rawOptions = {}) => {
|
|
12
11
|
const options = resolveOptions(rawOptions)
|
|
13
|
-
const filter = createFilter(options.include, options.exclude)
|
|
14
12
|
|
|
15
13
|
const name = '{{{github-repository}}}'
|
|
16
14
|
return {
|
|
17
15
|
enforce: options.enforce,
|
|
18
16
|
name,
|
|
19
|
-
transform
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
transform: {
|
|
18
|
+
filter: {
|
|
19
|
+
id: {
|
|
20
|
+
exclude: options.exclude,
|
|
21
|
+
include: options.include,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
handler(code, _id) {
|
|
25
|
+
return `// {{{github-repository}}} injected\n${code}`
|
|
26
|
+
},
|
|
24
27
|
},
|
|
25
28
|
}
|
|
26
29
|
},
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request: {}
|
|
7
|
+
workflow_dispatch: {}
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
14
|
+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
ci:
|
|
18
|
+
runs-on: ${{ matrix.os }}
|
|
19
|
+
timeout-minutes: 20
|
|
20
|
+
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
29
|
+
with:
|
|
30
|
+
persist-credentials: false
|
|
31
|
+
|
|
32
|
+
- name: Install pnpm
|
|
33
|
+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
34
|
+
|
|
35
|
+
- name: Setup Node.js
|
|
36
|
+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
|
37
|
+
with:
|
|
38
|
+
node-version: 24
|
|
39
|
+
cache: 'pnpm'
|
|
40
|
+
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: pnpm install --frozen-lockfile
|
|
43
|
+
|
|
44
|
+
- name: Build
|
|
45
|
+
run: pnpm run build
|
|
46
|
+
|
|
47
|
+
- name: Lint
|
|
48
|
+
run: pnpm run lint
|
|
49
|
+
|
|
50
|
+
- name: Test
|
|
51
|
+
run: pnpm run test
|
|
@@ -4,6 +4,10 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
tags:
|
|
6
6
|
- 'v[0-9]*'
|
|
7
|
+
- '[0-9]*'
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
7
11
|
|
|
8
12
|
jobs:
|
|
9
13
|
build:
|
|
@@ -16,13 +20,17 @@ jobs:
|
|
|
16
20
|
|
|
17
21
|
steps:
|
|
18
22
|
- name: Checkout
|
|
19
|
-
uses: actions/checkout@v6
|
|
23
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
20
24
|
with:
|
|
21
25
|
fetch-depth: 0
|
|
26
|
+
persist-credentials: false
|
|
22
27
|
|
|
23
28
|
- name: Log Token Type
|
|
29
|
+
env:
|
|
30
|
+
TOKEN: ${{ env.ACCESS_TOKEN }}
|
|
31
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
24
32
|
run: |
|
|
25
|
-
if [ $
|
|
33
|
+
if [ "$TOKEN" = "$GH_TOKEN" ]; then
|
|
26
34
|
echo "🗝️ Authenticated with GitHub Token"
|
|
27
35
|
else
|
|
28
36
|
echo "🔑 Authenticated with Personal Access token"
|
|
@@ -31,7 +39,7 @@ jobs:
|
|
|
31
39
|
- name: Validate Tag and Branch
|
|
32
40
|
id: validation
|
|
33
41
|
run: |
|
|
34
|
-
TAG=$(git tag --contains HEAD | grep '^v[0-9]' | head -n 1)
|
|
42
|
+
TAG=$(git tag --contains HEAD | grep -E '^v?[0-9]' | head -n 1)
|
|
35
43
|
echo "🏷️ Tag for commit is: $TAG"
|
|
36
44
|
BRANCH=$(git branch -r --contains tags/${GITHUB_REF_NAME} | grep 'origin/main' | xargs)
|
|
37
45
|
if [[ -z "$BRANCH" ]]; then
|
|
@@ -75,7 +83,11 @@ jobs:
|
|
|
75
83
|
|
|
76
84
|
- name: Log Release Details
|
|
77
85
|
if: env.IS_VALID_COMMIT == 'true'
|
|
86
|
+
env:
|
|
87
|
+
TAG: ${{ env.TAG_NAME }}
|
|
88
|
+
RELEASE_URL: ${{ steps.release.outputs.url }}
|
|
89
|
+
RELEASE_ID: ${{ steps.release.outputs.id }}
|
|
78
90
|
run: |
|
|
79
|
-
echo "📦 Successfully released: $
|
|
80
|
-
echo "🔗 Release URL: $
|
|
81
|
-
echo "🪪 Release ID: $
|
|
91
|
+
echo "📦 Successfully released: $TAG"
|
|
92
|
+
echo "🔗 Release URL: $RELEASE_URL"
|
|
93
|
+
echo "🪪 Release ID: $RELEASE_ID"
|
|
@@ -4,6 +4,9 @@ on:
|
|
|
4
4
|
branches: [main]
|
|
5
5
|
workflow_dispatch: {}
|
|
6
6
|
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
7
10
|
jobs:
|
|
8
11
|
build:
|
|
9
12
|
name: Set GitHub Metadata
|
|
@@ -11,11 +14,11 @@ jobs:
|
|
|
11
14
|
|
|
12
15
|
steps:
|
|
13
16
|
- name: Checkout
|
|
14
|
-
uses: actions/checkout@v6
|
|
17
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
15
18
|
with:
|
|
16
|
-
|
|
19
|
+
persist-credentials: false
|
|
17
20
|
|
|
18
21
|
- name: Sync Package info to GitHub
|
|
19
|
-
uses: kitschpatrol/github-action-repo-sync@
|
|
22
|
+
uses: kitschpatrol/github-action-repo-sync@v5
|
|
20
23
|
with:
|
|
21
24
|
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|