1.0.0 • Published 5 years ago
autumnjs-cli v1.0.0
autumnjs
npm config set registry https://registry.npmjs.org/
npm config set registry http://registry.npm.taobao.org/

autumnjs is a scaffold for initiating new projects from a given template.
Template
A template is a sample folder with many files. You could place a template to GitHub, GitLab, Bitbucket or any other code repository, even in your local mechine!
Usage
Install autumnjs globaly.
npm install autumnjs-cli -gCheck the --help command.
autumnjs --helpUsage: autumnjs <command>
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
add|a Add a new template
list|l List all templates
delete|d Delete a template
init|i Generate a new projectJust follow the FAQs and you will know how to use it.
Add a template


List all templates

Delete a template

Init a new project

文件读取
# 简单地说,您可以使用ajax调用加载它并解析json:
function levelRequestListener () {
var levels = JSON.parse(this.responseText);
console.log(levels);
}
var request = new XMLHttpRequest();
request.onload = levelRequestListener;
request.open("get", "level.json", true);
request.send();
# 可以编写一个接口来描述levels结构,这样就可以对levels变量进行类型检查和自动完成……
interface Level {
id: number;
name: string;
}
function levelRequestListener () {
var levels: Level[] = JSON.parse(this.responseText);
console.log(levels[0].name);
}License
MIT
1.0.0
5 years ago