cue

Pick the features of a TypeScript package. See the files that cue-config generate writes, and the feature that gave each line.

Feature playground

1. Start from a preset
2. Turn features on or off
    3. The commands

    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

    1. You list features

      dependencies.json lists the features of the package. cue-config init, add and remove change the list.

    2. The features resolve

      Each feature brings the features that it needs, from features.json. For example, node brings ts, npm and git.

    3. CUE unifies the files

      CUE unifies base.cue with the file of each feature. npm/package/ gives package.json, and git/ignore/ gives .gitignore. tsconfig.json extends the most specific preset of ts/config/.

    4. The result merges

      generate merges the result into your package.json. Your name, version, entry points and scripts stay.

    FeatureNeedsCUE filesWhat it adds alone
    The CUE file

    The CLI

    The package has the binary cue-config. Start each command in the folder of the package.

    CommandWhat 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.
    generateWrites package.json, tsconfig.json, .gitignore and, with the test feature, tsconfig.test.json. With the cue feature, it also writes cue.mod/.
    validateExamines 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-generateWrites 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.