Npm Factory

API

The init package exports its core functions for programmatic use.

import { runInit, type InitConfig, type ResolvedConfig } from "@npm-factory/init";

runInit(config: InitConfig): Promise<ResolvedConfig>

Runs the full scaffolding process. Creates all files, patches root configs.

InitConfig

type InitConfig = {
  projectId: string;        // kebab-case project name
  scope: string;            // npm scope (e.g. "@my-org")
  modules: ModuleInput[];   // at least one module
  playgroundMode: "none" | "single" | "per-module";
  cwd: string;              // working directory
};

ModuleInput

type ModuleInput = {
  moduleId: string;            // e.g. "core", "react"
  packageNameSuffix: string;   // appended to project name
  title: string;
  description: string;
  kind: "core" | "integration" | "plugin" | "sdk" | "cli";
  platforms: ModulePlatform[];
  stability: "experimental" | "beta" | "stable" | "deprecated";
};

See the JSDoc reference for the full API surface.

On this page