不同的Aurelia CLI项目结构比aurelia / skeleton-navigation

时间:2016-08-17 08:48:59

标签: aurelia

在Aurelia从这里发布之前,我使用启动工具包来构建我的应用程序: https://github.com/aurelia/skeleton-navigation

但是当Aurelia发布时,我想检查au new --myApp,它有不同的结构和构建方法而不是骨架。

最好的方法是什么,继续使用骨架模板或转到CLI模板。

...谢谢

2 个答案:

答案 0 :(得分:2)

这个问题的答案很晚(但是正确的时间)。 Aurelia CLI现在非常稳定,支持使用Javascript和Typescript生成应用程序,可选择RequireJS或System.js(Webpack支持即将推出)。

骨架和CLI项目之间的区别如下:

骨架

骷髅是厨房水槽示例,展示了测试,路由,使用API​​以及其他库,如Bootstrap和Font Awesome。如果你想使用Webpack,骨架也是目前唯一的选择(截至2017年7月),但CLI将在以后支持Webpack。

Aurelia CLI

CLI是一个干净的起始基础,让您自己做出选择;如果你想测试,你使用什么代码编辑器等等。生成的项目结构没有配置路由,也没有从API获取数据的示例或您在骨架中获得的任何其他内容。首次运行它时,CLI项目将只显示“Hello world”,仅此而已。

如果您对使用文档充满信心,并且想从无需构建应用程序,那么CLI就适合您。您还可以获得生成器功能的便利,这些功能允许您快速引导新的自定义元素,组件,值转换器等。

答案 1 :(得分:0)

aurelia-cli的最新版本非常完整,因此我认为,如果您不需要非常自定义的结构,应通过CLI生成项目。这是生成基础项目时必须使用的一些当前选项:

Global aurelia-cli v1.3.1
                      _ _          ____ _     ___
  __ _ _   _ _ __ ___| (_) __ _   / ___| |   |_ _|
 / _` | | | | '__/ _ \ | |/ _` | | |   | |    | |
| (_| | |_| | | |  __/ | | (_| | | |___| |___ | |
 \__,_|\__,_|_|  \___|_|_|\__,_|  \____|_____|___|

? Would you like to use the default setup or customize your choices? … 
❯ Default ESNext App 
  A basic app with Babel and Webpack.
  Default TypeScript App 
  A basic app with TypeScript and Webpack.
  Custom App 
  Select bundler, loader, transpiler, CSS pre-processor and more.

当然,您也可以通过CLI自定义首选项:

✔ Would you like to use the default setup or customize your choices? · Custom App
? Which bundler would you like to use? … 
❯ Webpack 
  A powerful and popular bundler for JavaScript.
  CLI's built-in bundler with an AMD module loader 
  Provides similar capabilities but with a much simpler configuration.

在简历中,即使您需要Dockerfile,也可以配置加载器,CSS处理器,测试框架。

✔ Would you like to use the default setup or customize your choices? · Custom App
✔ Which bundler would you like to use? · Webpack
✔ Which HTTP Protocol do you wish the outputted Webpack bundle to be optimised for? · HTTP/1.1
✔ What platform are you targeting? · Web
✔ What transpiler would you like to use? · Babel
✔ How would you like to setup your HTML template? · None
✔ What css preprocessor would you like to use? · Sass
✔ Do you want to add PostCSS processing · Basic
✔ Which unit test runner would you like to use? · Karma + Jasmine
✔ Would you like to configure integration testing? · Cypress
✔ What is your default code editor? · None
✔ Which features do you want scaffolded into your project? · Navigation App
✔ Would you like to add a Dockerfile? · Sure, yes