我想使用 angular-cli 生成一个新的工作区
目前唯一的方法是运行:
ng new asdf
cd asdf
ng g application whatever
但是所有src/
文件都保留下来(以及现在不一致存储的项目的原始 angular.json 信息)。没有src
文件夹就无法创建新的存储库......当我使用自定义原理图通过基本上复制 angular-cling-new
并删除https://github.com/angular/angular-cli/blob/6449a753641340d8fc19a752e1a1ced75f974efa/packages来执行此操作时/schematics/angular/ng-new/index.ts#L61 schematic('application', applicationOptions),
每当我运行它...
$ ng new asdf -c=my-schematic
$ cd asdf
$ ng g application whatever
{"inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","style":"css","skipTests":false,"skipPackageJson":false,"name":"whatever"}
CREATE projects/whatever-e2e/protractor.conf.js (752 bytes)
CREATE projects/whatever-e2e/src/app.e2e-spec.ts (304 bytes)
CREATE projects/whatever-e2e/src/app.po.ts (208 bytes)
CREATE projects/whatever-e2e/tsconfig.e2e.json (219 bytes)
只有 e2e 文件被放入projects/
并且angular.json
文件大部分保持为空:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {},
"cli": {
"defaultCollection": "my-schematic"
}
}
我怀疑这与应用程序示意图中的一些静默失败或路径关闭有关......但我想首先检查是否有更简单/更首选的方式。
$ ng --version
Angular CLI: 6.1.0-rc.0
Node: 10.1.0
OS: win32 x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.7.0-rc.0
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cdk 6.3.1
@angular/cli 6.1.0-rc.0
@angular/material 6.3.1
@schematics/angular 0.6.8
@schematics/update 0.7.0-rc.0
rxjs 6.2.1
typescript 2.7.2
编辑注意我熟悉 3rd-party 库(例如 Nrwl/Nx),但我试图避免这些。我也将此问题发布到 GitHub:https ://github.com/angular/angular-cli/issues/11402