This is a scaffolding tool for xqlib.
- Install scaffolding
npm install xqlib-cli -g- View version
xqlib-cli -v- View information
xqlib-cli -i- Build library command
xqlib-cli -l <library name>- Build umd command
xqlib-cli -u <umd name>- Help Center
xqlib-cli -hThe name you pass is used as the directory name and as the name field of the generated
package.json. It must be a valid npm package name: lowercase letters, digits, ., - or _,
starting with a letter or digit, at most 214 characters. Anything containing a path separator is
rejected, so the scaffold never writes outside the current directory.
-l and -u are mutually exclusive; pass only one of them. Every failure path exits with a
non-zero code, so the command can be used in scripts.
-l <name>generates a webpack library:index.js+lib/index.js,webpack.config.js,babel.config.js, a jest spec, and anexample/demo page.npm testbuildsdist/first and then runs jest.-u <name>generates a UMD / ES module library with four committed builds (lib/example.js,lib/example.min.js,lib/example-esm.js,lib/example-esm.min.js), bilingual docs, and a self-checking page suite undertest/.
Both templates ship a README.md, a zh.md, and a .gitignore.
cd <library name>
npm test # node check
npm run test:browser # static server for the test/ pages (UMD template)The UMD template's test/ pages show a visible PASS/FAIL list for the global, CommonJS, AMD and
ES module consumption paths. The ES module page must be opened over HTTP, because browsers block
type="module" on file:// URLs.
The package ships agent-readable metadata, declared in package.json and included in the
published tarball:
llms.txt("llms") — compact CLI reference: flags, name rules, exit codes, and what each template generates.skills/xqlib-cli-scaffold/SKILL.md("agents") — when to pick-lvs-u, the order to run things in, common failure modes, and a link toreferences/templates.mdwith the exact generated file contracts.
An assistant should load SKILL.md before generating a library and use llms.txt when it only
needs the command surface. npm test asserts that both targets resolve, that they are covered by
the files whitelist, and that the flags named in llms.txt match xqlib-cli -h exactly.
npm install
npm testnpm test runs node --test over tests/*.test.js. The suite scaffolds both templates into a
temporary directory, asserts the file contract, and executes all four committed builds of the UMD
template inside a vm context.
Husky installs two hooks on npm install (prepare):
pre-commitrunslint-staged, which syntax-checks staged*.jsfiles withnode --check.commit-msgrunscommitlint. Messages must follow Conventional Commits (feat:,fix:,docs:,style:,refactor:,perf:,test:,build:,ci:,revert:,chore:), e.g.feat: support agent metadata.
Bump version in package.json before publishing. Follow semver: patch for fixes, minor for
backward-compatible features, major for breaking changes.
For example, if I want to generate a test js library, I can follow the steps below.
xqlib-cli -l test