diff --git a/docs/getting-started.en-US.md b/docs/getting-started.en-US.md index 8b25c59c8f..861c52d1a1 100644 --- a/docs/getting-started.en-US.md +++ b/docs/getting-started.en-US.md @@ -39,6 +39,18 @@ yarn start # Or use HMR mode by: yarn run hmr ``` +**Multiple projects** + +```bash +yarn global add @angular/cli +ng new my-workspace --no-create-application --package-manager yarn +cd my-workspace +ng g application mgr --style less --routing +ng add ng-alain +yarn mgr:start +# Or use HMR mode by: yarn run mgr:hmr +``` + > Please refer to [Schematics](/cli) for more details. ### Clone the Git Repository diff --git a/docs/getting-started.zh-CN.md b/docs/getting-started.zh-CN.md index ef9646f3ed..939aa63a98 100644 --- a/docs/getting-started.zh-CN.md +++ b/docs/getting-started.zh-CN.md @@ -46,6 +46,11 @@ NG-ALAIN 必须先创建一个全新的 Angular 项目,可以通过终端窗 ```bash ng new my-project --style less --routing --package-manager yarn +cd my-project +# 或多重项目 +ng new my-workspace --no-create-application --package-manager yarn +cd my-workspace +ng g application mgr --style less --routing ``` > 如果你想了解 `--style`、`--routing` 参数,请参考 [ng new](https://angular.io/cli/new#options) 文档。 @@ -53,10 +58,11 @@ ng new my-project --style less --routing --package-manager yarn 接下来只需要将 NG-ALAIN 添加到 `my-project` 项目中即可,在 `my-project` 目录下通过终端窗口中运行: ```bash -cd my-project ng add ng-alain ``` +> 若多重项目时,需要提供具体的项目名称。 + NG-ALAIN 会询问是否需要一些额外的插件,一开始完全可以一路回车,这些插件都是可插拔,后期可以自行添加与移除。 > 以上只会生成干净的项目,可以直接用于生产环境中。你可能在[预览](https://ng-alain.gitee.io/)上看到许多示例页,它们全都可以在 [Github](https://github.com/ng-alain/ng-alain) 查看到源代码,当然也可以通过 Git 克隆代码的形式获得: diff --git a/schematics/ng-add/index.ts b/schematics/ng-add/index.ts index ba48b3e644..720aabc171 100644 --- a/schematics/ng-add/index.ts +++ b/schematics/ng-add/index.ts @@ -103,11 +103,6 @@ export default function (options: NgAddOptions): Rule { if (pkg.devDependencies['ng-alain']) { throw new SchematicsException(`Already an NG-ALAIN project and can't be executed again: ng add ng-alain`); } - if (!tree.exists('src/index.html')) { - throw new SchematicsException( - `NG-ALAIN must be attached to a new Angular project, so you need to use 'ng new projectName' to build a new Angular project, or specify the project name to be attached` - ); - } } let ngCoreVersion = pkg.dependencies['@angular/core'] as string;