@nuofe/ndk-generator
v8.2.6
Published
Generate package by scaffold.
Downloads
13
Readme
NDK Generator
Generate package by scaffold.
Install
yarn add @nuofe/ndk-generator --dev
Usage
ndk-generator [--dist <distPath>] [--ignore <ignorePath[,ignorePath]>] [--scaffold <scaffoldPath>] [--scope <scope>] [--type <type>] [name]
First, add scripts in package.json, like this:
{
"scripts": {
"generate": "ndk-generator --dist ./packages"
}
}
Second, run command to generate project.
yarn generate
Scaffold
@nuofe/scaffolds is standard scaffold of app/web/component/library/tool/config/none. You can use --scaffold <scaffoldPath> [--type <type>]
arguments to use other scaffolds, like this:
{
"scripts": {
"generate": "ndk-generator --scaffold ./scaffolds"
}
}
Scaffold base on mustache template system. The structure
should be this:
./
|---[type]/
| |
| \---[...scaffold files]
|
\---types.json
types.json content:
{
"[type]": "[scaffold description]",
}
The scaffold files will transform by mustache.render(fileContent, view)
. The view
will be this:
interface View: {
type: string; // from types.json
name: string; // name-value
nAME: string; // nameValue
Name: string; // NameValue
NAME: string; // NAME_VALUE
scope: string;
description: string;
author: string;
command: string; // for tool
keywords: string[];
title: string;
};