Package Exports
- extra-build
Readme
Common build tools for extra-* packages.
📦 NPM,
📜 Files,
📰 Docs.
Stability: Experimental.
const build = require('extra-build');
// 1. Set version and publish package.
var m = build.readMetadata('.');
// → {name, version, description, ...}
m.version = '2.0.0';
build.writeMetadata('.', m);
build.publish('.');
build.publishGithub('.', 'owner');
// 2. Publish next version, update github details.
var m = build.readMetadata('.');
var ver = build.nextUnpublishedVersion(m.name, m.version);
m.version = ver;
build.writeMetadata('.', m);
build.publish('.');
build.publishGithub('.', 'owner');
build.updateGithubRepoDetails();
// 3. Update keywords for package.
var m = build.readMetadata('.');
var p = build.loadDocs(['src/index.ts']);
var ds = p.children.map(build.docsDetails);
var s = new Set([...m.keywords, ...ds.map(d => d.name)]);
m.keywords = Array.from(s);
build.writeMetadata('.', m);
// 4. Restore package.json after publishing with updated version.
var _package = build.readDocument('package.json');
var m = build.readMetadata('.');
m.version = '2.0.0';
build.writeMetadata('.', m);
build.publish('.');
build.writeDocument(_package);
// 5. Update README index table.
var owner = 'owner', repo = 'repo';
var p = build.loadDocs(['src/index.ts']);
var ds = p.children.map(build.docsDetails);
var re = /namespace|function/i;
var dm = new Map(ds.map(d => [d.name, d]));
var txt = build.readFileText('README.md');
txt = build.wikiUpdateIndex(txt, dm, d => re.test(d.kind));
txt = build.wikiUpdateLinkReferences(txt, dm, {owner, repo});
build.writeFileText('README.md', txt);Index
| Property | Description |
|---|---|
| symbolname | Get symbol name for file. |
| keywordname | Get keyword name for file. |
| error | Print error message to stderr with newline. |
| warn | Print warning message to stderr with newline. |
| log | Print log message to stdout with newline. |
| info | Print info message to stdout with newline. |
| exec | Execute command with output, and print the command. |
| execStr | Execute command and get its output as string. |
| readFileText | Read file text with Unix EOL. |
| writeFileText | Write file text with system EOL. |
| readJson | Read JSON file as object. |
| writeJson | Write object to JSON file. |
| readDocument | Read document. |
| writeDocument | Write document. |
| gitCommitPush | Commit new changes and push to remote. |
| gitSetupBranch | Setup new branch and push to remote. |
| addBanner | Add banner (header comment) to script text. |
| bundleScript | Bundle a script file with config. |
| webifyScript | Webify an script file. |
| parseGithubUrl | Get details from GitHub URL. |
| updateGithubRepoDetails | Update GitHub repository details. |
| readMetadata | Read package.json data. |
| writeMetadata | Write package.json data. |
| registry | Get current registry. |
| setRegistry | Set current registry. |
| latestVersion | Get latest package version. |
| nextUnpublishedVersion | Get next unpublished version for package. |
| publishGithub | Publish package to GitHub. |
| generateDocs | Generate docs using typedoc. |
| publishDocs | Publish docs to gh-pages. |
| docsRefer | Get the reflection that is referred to. |
| docsName | Get name of a reflection. |
| docsLocation | Get location of reflection. |
| docsFlags | Get flags of a reflection. |
| docsKind | Get kind name of a reflection. |
| docsChildCount | Get child count of a reflection. |
| docsParameterCount | Get parameter count of a reflection (function). |
| docsSignatureCount | Get signature count of a reflection. |
| docsType | Get type name of a reflection. |
| docsDescription | Get description of a reflection. |
| docsReturns | Get returns description of a reflection (function). |
| docsDetails | Get details of a reflection. |
| docsReferDetails | Get details of a reflection, referring the necessary details. |
| loadDocs | Load docs from source file. |
| wikiCodeReference | Get reference code block for wiki. |
| wikiCodeExample | Get example code block for wiki. |
| wikiMarkdown | Get markdown text for wiki. |
| wikiUpdateIndex | Update the "Index" (property, description) table in markdown text. |
| wikiUpdateLinkReferences | Update link references in markdown text. |
| publish | Publish package to NPM. |
