fg-devkit
v1.7.7
Published
Shared configs, scripts, and DX tooling for Vue / TypeScript frontend repos
Readme
fg-devkit
Shared settings and tools to improve the developer experience for Vue and TypeScript projects in the npm ecosystem.
Quick command alias (zsh)
To run fgd instead of pnpm exec fg-devkit, add this alias:
echo "alias fgd='pnpm exec fg-devkit'" >> ~/.zshrc && source ~/.zshrcThis works in repos where fg-devkit is installed.
Bundled ESLint stack
fg-devkit ships its own ESLint stack (core + parser + plugins), so consuming repos do not need to install ESLint packages just to lint with the shared config.
Run lint via CLI:
pnpm exec fgd lint .
pnpm exec fgd lint-fix .Bundled Prettier
fg-devkit also ships Prettier, so consuming repos can format using the bundled package.
Run formatting via CLI:
pnpm exec fgd format
pnpm exec fgd format-checkBundled TypeScript
fg-devkit ships vue-tsc and typescript, so consuming repos can run Vue typecheck without installing local TS tooling.
Run typecheck via CLI:
pnpm exec fgd typecheck
pnpm exec fgd typecheck-watchBundled Fallow (dead code analysis)
fg-devkit also ships Fallow for dead code analysis in consuming repos.
Run dead code analysis via CLI:
pnpm exec fgd dead-codeOr run Fallow directly with custom args:
pnpm exec fgd fallow dead-code --jsonWhen you run fgd sync-tooling-configs (or fgd sync-project-configs), fg-devkit also writes a shared .fallowrc.json to the consuming repo.
To remove redundant tooling dependencies from a consuming repo:
pnpm exec fgd prune-consumer-deps
pnpm installTo sync standard consumer scripts to fgd commands:
pnpm exec fgd sync-consumer-scriptsTo migrate from Husky + lint-staged to Lefthook:
pnpm exec fgd setup-lefthookRun full consumer setup in one command:
pnpm exec fgd full-consumer-setupDependency policy update workflow
Check outdated policy versions:
pnpm exec fgd policy-outdatedCheck vulnerabilities for all policy packages together (including transitive dependencies):
pnpm exec fgd policy-vulnsCheck vulnerabilities for all dependencies in the current repo:
pnpm exec fgd repo-vulnsCheck vulnerabilities across all Vue repositories under the projects root:
pnpm exec fgd fleet-vulnsFor summary-only mode (no full per-repo pnpm audit output):
pnpm exec fgd fleet-vulns --summary-onlyIf npm audit is rate-limited (429), slow the scan down:
pnpm exec fgd fleet-vulns --delay-ms=8000Upgrade policy versions interactively:
pnpm exec fgd policy-upgradetsconfig in consuming repos
Use fgd sync-project-configs (or fgd sync-tooling-configs) to write the local tsconfig.json template from fg-devkit.
Do not use an extends-only tsconfig.json to fg-devkit/tsconfig.app.sync.json in consuming repos.
TypeScript resolves include/exclude relative to the extended config file location in node_modules,
which can cause No inputs were found.
The supported approach is: keep a local tsconfig.json file in each consuming repo and let sync overwrite
it with the shared app template.
Minimal local Prettier config for consuming repos
Use this as your local prettier.config.js to inherit defaults from fg-devkit:
import basePrettierConfig from 'fg-devkit/prettier.config.js'
export default {
...basePrettierConfig,
}Local development with pnpm link
Use this flow to test local fg-devkit changes in a consuming repo.
In this repo (fg-devkit):
pnpm install
pnpm link --globalIn the consuming repo:
pnpm link --global fg-devkit
pnpm install
pnpm exec fgd --helpTo remove the global link in a consuming repo:
pnpm unlink fg-devkit
pnpm installInstall CLI in this repo
- Add this to your shell config (
~/.zshrc) and updateFGD_DEVKIT_PATH:
cat <<'EOF' >> ~/.zshrc
# Smart fgd: use local project binary when available, otherwise fg-devkit script
unalias fgd 2>/dev/null
export FGD_DEVKIT_PATH="/Users/username/projects/fg-devkit"
fgd() {
if [ -x "./node_modules/.bin/fgd" ]; then
pnpm exec fgd "$@"
else
node "$FGD_DEVKIT_PATH/scripts/fg-devkit.mjs" "$@"
fi
}
EOF- Reload shell config:
source ~/.zshrc