frontpl 0.1.1 → 0.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/README.md +86 -1
- package/dist/cli.mjs +3 -1
- package/dist/index.d.mts +39 -1
- package/dist/index.mjs +2 -2
- package/dist/init-CQKT_mPD.mjs +858 -0
- package/package.json +6 -5
- package/dist/init-Cva-s-yN.mjs +0 -380
package/README.md
CHANGED
|
@@ -1,11 +1,96 @@
|
|
|
1
1
|
# frontpl
|
|
2
2
|
|
|
3
|
-
Interactive CLI to scaffold standardized frontend project templates.
|
|
3
|
+
Interactive CLI to scaffold standardized frontend project templates (with optional CI/Release workflows).
|
|
4
|
+
|
|
5
|
+
> Node.js >= 22
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
# If published on npm:
|
|
11
|
+
npm i -g frontpl
|
|
12
|
+
# or
|
|
13
|
+
pnpm add -g frontpl
|
|
14
|
+
|
|
15
|
+
# Or run once via npx:
|
|
16
|
+
npx frontpl --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
frontpl my-frontend
|
|
23
|
+
# or
|
|
24
|
+
frontpl init my-frontend
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Follow the prompts to choose:
|
|
28
|
+
|
|
29
|
+
- Package manager (`npm`/`pnpm`/`yarn`/`bun`/`deno`)
|
|
30
|
+
- Optional tooling: `oxlint`, `oxfmt`, `vitest`, `tsdown`
|
|
31
|
+
|
|
32
|
+
When `oxlint` is enabled, generated projects use `@kingsword/lint-config` via `oxlint.config.ts`.
|
|
33
|
+
|
|
34
|
+
- Git init
|
|
35
|
+
- GitHub Actions workflows:
|
|
36
|
+
- CI only
|
|
37
|
+
- CI + release (release supports tag/commit/both)
|
|
38
|
+
|
|
39
|
+
## Commands
|
|
40
|
+
|
|
41
|
+
### `frontpl [name]` / `frontpl init [name]`
|
|
42
|
+
|
|
43
|
+
Scaffold a new project into `./<name>` (or prompt for a name when omitted).
|
|
44
|
+
|
|
45
|
+
Generated output includes (based on options):
|
|
46
|
+
|
|
47
|
+
- `.editorconfig`, `.gitignore`, `.gitattributes`
|
|
48
|
+
- `package.json` (+ scripts like optional `lint`, `format:check`, `test`, `build`)
|
|
49
|
+
- `tsconfig.json`, `src/index.ts`
|
|
50
|
+
- Optional configs: `oxlint.config.ts`, `.oxfmtrc.json`, `tsdown.config.ts`
|
|
51
|
+
- Optional GitHub Actions workflows in `.github/workflows/`
|
|
52
|
+
|
|
53
|
+
### `frontpl ci`
|
|
54
|
+
|
|
55
|
+
Add or update CI/Release workflows for an existing project (run it in your repo root).
|
|
56
|
+
|
|
57
|
+
What it does:
|
|
58
|
+
|
|
59
|
+
- Detects the package manager via `package.json#packageManager` or lockfiles
|
|
60
|
+
- Suggests a `workingDirectory` (supports monorepo layouts like `packages/*` / `apps/*`)
|
|
61
|
+
- Detects Node.js major version from `.nvmrc`, `.node-version`, or `package.json#engines.node` (defaults to `22`)
|
|
62
|
+
- Generates `.github/workflows/ci.yml`
|
|
63
|
+
- Optionally generates `.github/workflows/release.yml` (tag/commit/both)
|
|
64
|
+
|
|
65
|
+
## GitHub Actions (CI + Release)
|
|
66
|
+
|
|
67
|
+
frontpl generates workflows that call reusable workflows from `kingsword09/workflows` (pinned to `@v1` by default):
|
|
68
|
+
|
|
69
|
+
- CI: `cli-ci.yml`
|
|
70
|
+
- Release (tag, recommended): `cli-release-tag.yml`
|
|
71
|
+
- Release (commit, legacy): `cli-release.yml`
|
|
72
|
+
|
|
73
|
+
### Release modes
|
|
74
|
+
|
|
75
|
+
- **Tag (recommended)**: trigger on tag push (`vX.Y.Z`), validate `package.json#version` matches the tag.
|
|
76
|
+
- **Commit (legacy)**: trigger on `main` push, publish only when the commit message matches `chore(release): vX.Y.Z` (also supports `chore: release vX.Y.Z`), and the workflow will create/push the tag.
|
|
77
|
+
- **Both**: a single `release.yml` listens to both `main` and `tags`, and routes to the corresponding reusable workflow.
|
|
78
|
+
|
|
79
|
+
### Publishing auth
|
|
80
|
+
|
|
81
|
+
- **Trusted publishing (OIDC)**: enable `trustedPublishing: true` (no `NPM_TOKEN` required). Your repo must be configured on npm as a trusted publisher for the calling workflow.
|
|
82
|
+
- **NPM token**: set `trustedPublishing: false` and provide `NPM_TOKEN` in GitHub secrets.
|
|
4
83
|
|
|
5
84
|
## Development
|
|
6
85
|
|
|
7
86
|
```sh
|
|
8
87
|
pnpm install
|
|
88
|
+
pnpm run lint
|
|
9
89
|
pnpm run build
|
|
10
90
|
node dist/cli.mjs --help
|
|
91
|
+
node dist/cli.mjs ci
|
|
11
92
|
```
|
|
93
|
+
|
|
94
|
+
## Lint preset
|
|
95
|
+
|
|
96
|
+
This repository itself uses `@kingsword/lint-config` (see `oxlint.config.ts`).
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as runInit } from "./init-
|
|
2
|
+
import { n as runCi, t as runInit } from "./init-CQKT_mPD.mjs";
|
|
3
3
|
import bin from "tiny-bin";
|
|
4
4
|
|
|
5
5
|
//#region src/cli.ts
|
|
@@ -8,6 +8,8 @@ async function main() {
|
|
|
8
8
|
await runInit({ nameArg: args[0] });
|
|
9
9
|
}).command("init", "Scaffold a new project").argument("[name]", "Project name (directory name)").action(async (_options, args) => {
|
|
10
10
|
await runInit({ nameArg: args[0] });
|
|
11
|
+
}).command("ci", "Add CI/release workflows to an existing project").action(async () => {
|
|
12
|
+
await runCi();
|
|
11
13
|
}).run();
|
|
12
14
|
}
|
|
13
15
|
main();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
//#region src/commands/ci.d.ts
|
|
2
|
+
declare function runCi(): Promise<undefined>;
|
|
3
|
+
//#endregion
|
|
1
4
|
//#region src/commands/init.d.ts
|
|
2
5
|
declare function runInit({
|
|
3
6
|
nameArg
|
|
@@ -5,4 +8,39 @@ declare function runInit({
|
|
|
5
8
|
nameArg?: string;
|
|
6
9
|
}): Promise<void>;
|
|
7
10
|
//#endregion
|
|
8
|
-
|
|
11
|
+
//#region src/lib/templates.d.ts
|
|
12
|
+
declare function oxlintConfigTemplate({
|
|
13
|
+
useVitest
|
|
14
|
+
}: {
|
|
15
|
+
useVitest: boolean;
|
|
16
|
+
}): string;
|
|
17
|
+
declare function packageJsonTemplate(opts: {
|
|
18
|
+
name: string;
|
|
19
|
+
packageManager: string;
|
|
20
|
+
typescriptVersion: string;
|
|
21
|
+
useOxlint: boolean;
|
|
22
|
+
oxlintVersion?: string;
|
|
23
|
+
oxlintTsgolintVersion?: string;
|
|
24
|
+
kingswordLintConfigVersion?: string;
|
|
25
|
+
useOxfmt: boolean;
|
|
26
|
+
oxfmtVersion?: string;
|
|
27
|
+
useVitest: boolean;
|
|
28
|
+
vitestVersion?: string;
|
|
29
|
+
useTsdown: boolean;
|
|
30
|
+
tsdownVersion?: string;
|
|
31
|
+
}): string;
|
|
32
|
+
declare function githubCliCiWorkflowTemplate(opts: {
|
|
33
|
+
packageManager: "npm" | "pnpm" | "yarn" | "bun" | "deno";
|
|
34
|
+
nodeVersion: number;
|
|
35
|
+
workingDirectory: string;
|
|
36
|
+
runLint: boolean;
|
|
37
|
+
runFormatCheck: boolean;
|
|
38
|
+
runTests: boolean;
|
|
39
|
+
installCommand?: string;
|
|
40
|
+
lintCommand?: string;
|
|
41
|
+
formatCheckCommand?: string;
|
|
42
|
+
testCommand?: string;
|
|
43
|
+
workflowsRef?: string;
|
|
44
|
+
}): string;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { githubCliCiWorkflowTemplate, oxlintConfigTemplate, packageJsonTemplate, runCi, runInit };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as runInit } from "./init-
|
|
1
|
+
import { a as packageJsonTemplate, i as oxlintConfigTemplate, n as runCi, r as githubCliCiWorkflowTemplate, t as runInit } from "./init-CQKT_mPD.mjs";
|
|
2
2
|
|
|
3
|
-
export { runInit };
|
|
3
|
+
export { githubCliCiWorkflowTemplate, oxlintConfigTemplate, packageJsonTemplate, runCi, runInit };
|