1.0.0 • Published 4 years ago

autumnjs-cli v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

autumnjs

npm config set registry https://registry.npmjs.org/

npm config set registry http://registry.npm.taobao.org/

npm.io

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 -g

Check the --help command.

autumnjs --help
Usage: 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 project

Just follow the FAQs and you will know how to use it.

  • Add a template

    npm.io

    npm.io

  • List all templates

    npm.io

  • Delete a template

    npm.io

  • Init a new project

    npm.io

  • 文件读取

# 简单地说,您可以使用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