Feature playground
Merge into your own package.json
generate keeps your name, version, entry points and scripts. Paste a package.json, and the playground merges it as the CLI does.
How it works
-
You list features
dependencies.jsonlists the features of the package.cue-config init,addandremovechange the list. -
The features resolve
Each feature brings the features that it needs, from
features.json. For example,nodebringsts,npmandgit. -
CUE unifies the files
CUE unifies
base.cuewith the file of each feature.npm/package/givespackage.json, andgit/ignore/gives.gitignore.tsconfig.jsonextends the most specific preset ofts/config/. -
The result merges
generatemerges the result into yourpackage.json. Your name, version, entry points and scripts stay.
| Feature | Needs | CUE files | What it adds alone |
|---|
The CUE file
The CLI
The package has the binary cue-config. Start each command in the folder of the package.
| Command | What it does |
|---|---|
init [--preset NAME] [--force] | Writes dependencies.json with the features of a preset (lib is the default), and src/index.ts. |
add <feature> | Adds a feature to dependencies.json. |
remove <feature> | Removes a feature from dependencies.json. |
generate | Writes package.json, tsconfig.json, .gitignore and, with the test feature, tsconfig.test.json. With the cue feature, it also writes cue.mod/. |
validate | Examines dependencies.json with its CUE schema. |
validate-manifest [--path PATH] | Examines an ecosystem.manifest.json with its CUE schema. |
validate-structure [--path PATH] | Examines the files and the folders of a project. |
self-generate | Writes the package.json of the cue package with its own features. |
Install
generate also needs the CUE CLI on the PATH.
pnpm add -D @mark1russell7/cue
npx cue-config init --preset lib
npx cue-config generate
import { presetFeatures, tsconfigPresetPath } from "@mark1russell7/cue";
import { generateTsconfigFiles, resolveFeatures } from "@mark1russell7/cue/core";
presetFeatures("lib"); // ["ts", "cue", "vitest", "npm", "git"]
tsconfigPresetPath("node"); // .../@mark1russell7/cue/ts/config/node.json
generateTsconfigFiles(["ts", "node"]); // { "tsconfig.json": ... }
The entry point @mark1russell7/cue/core has no Node.js module. This page bundles it.