@eljs/create-preset-base-package
v1.0.0-beta.1
Published
Base package scaffold preset powered by @eljs/generator.
Readme
@eljs/create-preset-base-package
English | 简体中文
Shared repository structure and tooling preset for the official npm-package and project templates.
Composition
Use the preset in a template configuration together with a project-specific plugin:
import { defineConfig } from '@eljs/generator'
export default defineConfig({
presets: ['@eljs/create-preset-base-package'],
plugins: ['./src/index.ts'],
})The preset is a composition building block. Generate projects through @eljs/create-plugin-npm-package or @eljs/create-plugin-project.
Responsibilities
| Area | Contract | | --------- | ------------------------------------------------------------------------------------------------- | | Questions | Select monorepo or polyrepo before project-specific questions | | Prompts | Derive environment and site flags; sanitize text and prepare context-specific escaping | | Tooling | Configure TypeScript, lint, tests, bilingual documentation, build, and applicable release scripts | | Rendering | Render shared files, repository layouts, library builds, and optional CLI fragments |
Generated library builds produce ESM, CJS, and declarations. In a monorepo, package environment is selected explicitly with package:create --env node|web.
Plugin Contract
Shared plugins register hooks before application data is available. Read prompts and application data inside hooks. Keep plugin source compatible with CommonJS transpilation; generated ESM source may use import.meta.
TEMPLATES_DIR exposes the absolute template directory for cooperating template packages. Source TypeScript, shared plugin modules, utility modules, and templates are included in the published package.
Development
Use Node.js >=22.18.0 and @eljs/generator starting at 2.0.0-beta.6.
pnpm test
pnpm package:checkCheck the affected Node/Web and monorepo/polyrepo branches when modifying shared rendering.
