frontpl
v0.6.4
Published
Interactive CLI to scaffold standardized frontend project templates.
Maintainers
Readme
frontpl
Interactive CLI to scaffold standardized frontend project templates (with optional CI/Release workflows).
Node.js >= 22
Install
# If published on npm:
npm i -g frontpl
# or
pnpm add -g frontpl
# Or run once via npx:
npx frontpl --helpQuick start
frontpl my-frontend
# or
frontpl init my-frontendFollow the prompts to choose:
- Package manager (
npm/pnpm/yarn/bun/deno) - Optional
pnpm workspacemode (monorepo skeleton) - Optional tooling:
oxlint,oxfmt,vitest,tsdown
When oxlint is enabled, generated projects use @kingsword/lint-config via oxlint.config.ts.
Generated lint-related dependencies (oxlint, oxlint-tsgolint, oxfmt, @kingsword/lint-config) default to latest in scaffolded package.json.
- Git init
- GitHub Actions workflows:
- CI only
- CI + release (release supports tag/commit/both)
Commands
frontpl [name] / frontpl init [name]
Scaffold a new project into ./<name> (or prompt for a name when omitted).
Project names support letters (including uppercase/camel case), numbers, ., _, - (cannot start with . or _).
Generated output includes (based on options):
.editorconfig,.gitignore,.gitattributespackage.json(+ scripts like optionallint,format:check,test,build)tsconfig.json,src/index.ts- Generated
tsconfig.jsonenablesallowImportingTsExtensionsfor.tsimport paths - Relative TypeScript imports use explicit
.tsextensions (e.g. generatedsrc/index.test.ts) - Optional configs:
oxlint.config.ts,.oxfmtrc.json,tsdown.config.ts - Optional GitHub Actions workflows in
.github/workflows/
When pnpm workspace mode is enabled:
- Root contains
pnpm-workspace.yamland the workspacepackage.json - Workspace root
package.jsonincludes"type": "module" oxlint/oxfmtscripts, dependencies, and config files are generated at the workspace root- App/library package is scaffolded under
packages/<name>/with its ownpackage.json,src, andtsconfig.json - If root
oxlintis enabled, packagepackage.jsondoes not add redundanttypecheck: tsc --noEmit
frontpl add [name]
Add a new package under packages/<name>/ in an existing pnpm workspace.
What it does:
- Requires workspace root (
pnpm-workspace.yaml) andpnpmpackage manager - Generates package baseline files:
packages/<name>/package.jsonpackages/<name>/README.mdpackages/<name>/src/index.tspackages/<name>/tsconfig.json
- Optionally adds
vitest(src/index.test.ts) andtsdown(tsdown.config.ts) - Reuses root toolchain strategy:
- package does not scaffold
oxlint/oxfmtscripts - if root
oxlintexists, package does not scaffoldtypecheck: tsc --noEmit
- package does not scaffold
Use --yes (or -y) to skip confirmations and use defaults inferred from root scripts.
frontpl pkg
Normalize current directory package.json for npm publishing (requires github.com git remote).
What it does:
- Requires current directory to contain
package.json - Requires git repository with
remote.origin.urlongithub.com - Updates publish metadata:
homepagebugs.urlrepository(type,url, anddirectorywhen run in monorepo subfolder)
- Applies publish defaults when missing:
private: false,version: "0.0.0"license:- interactive select on each run (
MIT/Apache-2.0) - with
--yes, keeps existing license; defaults toMITonly when missing - option keys aligned with GitHub Licenses API:
mit/apache-2.0
- interactive select on each run (
type: "module",files: ["dist"]main,types, andexportspointing todist/indexpublishConfig.access: "public"engines.node: ">=22.0.0"scripts.prepublishOnlyfrom existingscripts.build
Use --yes (or -y) to skip confirmation.
frontpl bump [target]
Update current package.json#version without opening an editor.
Interactive mode (frontpl bump):
- Shows concrete candidate versions for
patch/minor/major- e.g. current
1.2.3->1.2.4/1.3.0/2.0.0
- e.g. current
custom: set explicit version text
Direct mode (frontpl bump <target>):
frontpl bump patchfrontpl bump minorfrontpl bump majorfrontpl bump 1.8.0
When using minor/major, trailing segments are reset to 0.
Use --dry-run to preview from/to version without writing package.json.
frontpl ci
Add or update CI/Release workflows for an existing project (run it in your repo root).
What it does:
- Detects the package manager via
package.json#packageManageror lockfiles - Suggests a
workingDirectory(supports monorepo layouts likepackages/*/apps/*) - Detects Node.js major version from
.nvmrc,.node-version, orpackage.json#engines.node(defaults to22) - Generates
.github/workflows/ci.yml - Optionally generates
.github/workflows/release.yml(tag/commit/both) - Optionally generates
.github/dependabot.ymlwith grouped updates (dependencies,github-actions)
frontpl oxlint
Add/migrate linting in the current project to oxlint.
What it does:
- Asks mode interactively:
- Initialize
oxlint.config.tsonly - Migrate gradually (keep existing ESLint assets)
- Replace ESLint directly (current mode)
- Initialize
- Ensures
package.jsonscripts use:lint:oxlint --type-aware --type-checklint:fix:oxlint --type-aware --type-check --fix
- Removes
typecheck: tsc --noEmitwhen confirmed (or by default with--yes) - Ensures devDependencies exist:
oxlintoxlint-tsgolint@kingsword/lint-config
- Creates or updates
oxlint.config.tsusing@kingsword/lint-config - In replace mode, removes ESLint deps/configs (
eslint*,@eslint/*,@typescript-eslint/*,eslintConfig,.eslintrc*,eslint.config.*) - Optionally installs dependencies with detected package manager
Use --yes (or -y) to skip confirmations and apply default choices.
With --yes, strategy defaults to replace.
When selecting initialize mode, only oxlint.config.ts is created/updated; package.json, scripts, and dependencies stay unchanged.
That means existing lint scripts are kept as-is in initialize mode; only migrate/replace mode may update them.
frontpl oxfmt
Add/migrate formatting in the current project to oxfmt.
What it does:
- Asks mode interactively:
- Initialize
.oxfmtrc.jsononly - Migrate from Prettier (
oxfmt --migrate=prettier) - Rebuild
.oxfmtrc.json(current mode)
- Initialize
- Ensures
package.jsonscripts use:format:oxfmtformat:check:oxfmt --check
- Ensures
devDependencies.oxfmtexists (defaults tolatestwhen missing) - Creates or updates
.oxfmtrc.json - Rebuild mode writes baseline formatter options:
$schema: "./node_modules/oxfmt/configuration_schema.json"useTabs: false,indentWidth: 2,lineWidth: 100trailingComma: "all",semi: true,singleQuote: false,arrowParens: "always"
- Optionally removes
prettier/prettier-plugin-*/@prettier/plugin-*dependencies,package.json#prettier, and Prettier config files (.prettierrc*,prettier.config.*) - Optionally installs dependencies with detected package manager
Use --yes (or -y) to skip confirmations and apply default choices.
With --yes, config strategy defaults to rebuild .oxfmtrc.json.
When selecting initialize mode, only .oxfmtrc.json is created/updated; package.json, scripts, and dependencies stay unchanged.
That means existing fmt / format scripts are kept as-is in initialize mode; only migrate/rebuild mode may update standard scripts.
GitHub Actions (CI + Release)
frontpl generates workflows that call reusable workflows from kingsword09/workflows (pinned to commit SHA + # vX.Y.Z comment by default):
- CI:
cli-ci.yml - Release (tag, recommended):
cli-release-tag.yml - Release (commit, legacy):
cli-release.yml
Release modes
- Tag (recommended): trigger on tag push (
vX.Y.Z), validatepackage.json#versionmatches the tag. - Commit (legacy): trigger on
mainpush, publish only when the commit message matcheschore(release): vX.Y.Z(also supportschore: release vX.Y.Z), and the workflow will create/push the tag. - Both: a single
release.ymllistens to bothmainandtags, and routes to the corresponding reusable workflow.
Publishing auth
- Trusted publishing (OIDC): enable
trustedPublishing: true(noNPM_TOKENrequired). Your repo must be configured on npm as a trusted publisher for the calling workflow. - NPM token: set
trustedPublishing: falseand provideNPM_TOKENin GitHub secrets.
Dependabot (optional)
When CI workflows are enabled, frontpl can also generate .github/dependabot.yml:
- Keeps
github-actionsupdates enabled - Adds grouped dependencies updates (
groups.dependencies) - Uses the selected
workingDirectory(.->/, monorepo package ->/packages/<name>) - In
frontpl init+pnpm workspace mode, defaultworkingDirectoryis workspace root (/) - Maps JavaScript package managers (
npm/pnpm/yarn/bun) to Dependabotpackage-ecosystem: "npm"
Development
pnpm install
pnpm run lint
pnpm run build
node dist/cli.mjs --help
node dist/cli.mjs ci
node dist/cli.mjs oxlint --help
node dist/cli.mjs oxfmt --helpLint preset
This repository itself uses @kingsword/lint-config (see oxlint.config.ts).
