什么--minimal做的角度cli` ng new`?

Eva*_*oll 22 angular-cli

Angular CLI有一个名为的选项--minimal.它做了什么以及在哪里记录?该命令ng help new对此几乎没有说明

--minimal (Boolean) (Default: false) Should create a minimal app.
  aliases: --minimal
Run Code Online (Sandbox Code Playgroud)

Eva*_*oll 37

当前截至2017年7月31日常规角度应用程序生成5个目录,26个文件.A --minimal生成4 directories, 13 files.区别? --minimal通过启用其他一些选项来排除生成多个文件.

  • 你可以在这里代码中看到这一点
    • --skip-tests:停止测试的生成(即E2E, ,karma.conf.js,protractor.conf.js*.spec.文件)包括tsconfig.spec.json,app.component.spec.ts
    • --inline-style:停止生成外部css存根,而不是在.ts文件中保留空字符串.
    • --inline-template:停止生成外部html,而不是将其保存template.ts文件中的变量中.
  • 停止生成以下文件,此处为代码
    • README.md
    • tsconfig和tslint
    • favicon.ico的

以下是没有生成的示例 --minimal

my-app/
??? e2e
?   ??? app.e2e-spec.ts
?   ??? app.po.ts
?   ??? tsconfig.e2e.json
??? karma.conf.js
??? package.json
??? package-lock.json
??? protractor.conf.js
??? README.md
??? src
?   ??? app
?   ?   ??? app.component.css
?   ?   ??? app.component.html
?   ?   ??? app.component.spec.ts
?   ?   ??? app.component.ts
?   ?   ??? app.module.ts
?   ??? assets
?   ??? environments
?   ?   ??? environment.prod.ts
?   ?   ??? environment.ts
?   ??? favicon.ico
?   ??? index.html
?   ??? main.ts
?   ??? polyfills.ts
?   ??? styles.css
?   ??? test.ts
?   ??? tsconfig.app.json
?   ??? tsconfig.spec.json
?   ??? typings.d.ts
??? tsconfig.json
??? tslint.json
Run Code Online (Sandbox Code Playgroud)

--minimal 做以下事情

??? package.json
??? package-lock.json
??? src
?   ??? app
?   ?   ??? app.component.ts
?   ?   ??? app.module.ts
?   ??? assets
?   ??? environments
?   ?   ??? environment.prod.ts
?   ?   ??? environment.ts
?   ??? index.html
?   ??? main.ts
?   ??? polyfills.ts
?   ??? styles.css
?   ??? tsconfig.app.json
?   ??? typings.d.ts
??? tsconfig.json
Run Code Online (Sandbox Code Playgroud)


Jun*_*711 6

目前,截至2018 年 12 月,在Angular cli 7.0.7 中,最小选项已被添加回来。它的意思是Create a barebones project without any testing frameworks

您可以查看angular cli version 7 文档以获取选项列表。

下面是 ng new --help 命令返回的选项列表。

ng new --help 
arguments:
  name
    The name of the workspace.

options:
  --collection (-c)
    Schematics collection to use.
  --commit 
    Initial repository commit information.
  --create-application 
    Flag to toggle creation of an application in the new workspace.
  --defaults 
    When true, disables interactive input prompts for options with a default.
  --directory 
    The directory name to create the workspace in.
  --dry-run (-d)
    When true, run through and report activity without writing out results.
  --experimental-ivy 
    EXPERIMENTAL: Specifies whether to create a new application which uses the Ivy rendering engine.
  --force (-f)
    When true, force overwriting of existing files.
  --help 
    Shows a help message for this command in the console.
  --inline-style (-s)
    Specifies if the style will be in the ts file.
  --inline-template (-t)
    Specifies if the template will be in the ts file.
  --interactive 
    When false, disables interactive input prompts.
  --minimal 
    Create a barebones project without any testing frameworks
  --new-project-root 
    The path where new projects will be created.
  --prefix (-p)
    The prefix to apply to generated selectors.
  --routing 
    Generates a routing module.
  --skip-git (-g)
    Skip initializing a git repository.
  --skip-install 
    Skip installing dependency packages.
  --skip-tests (-S)
    Skip creating spec files.
  --style 
    The file extension to be used for style files.
  --verbose (-v)
    Adds more details to output logging.
  --view-encapsulation 
    Specifies the view encapsulation strategy.
Run Code Online (Sandbox Code Playgroud)

从 Angular cli 6.0.8 开始,最小选项似乎已被删除。您可能必须像其他答案建议的那样运行 --skip-tests、--inline-style 和 --inline-template 以获得最小的项目。

根据angular cli wiki页面,这些是可用的选项
干运行
强制
详细集合
内联样式
内联模板
视图封装
路由
前缀
样式
跳过测试
skip-package-json

如果您运行此命令:ng new --help,您可以看到 Angular cli 6.0.8 可用的选项

usage: ng new <name> [options]  
options:  
  --collection (-c)  
    Schematics collection to use.  

--directory   
    The directory name to create the workspace in.  

--dryRun (-d)  
    Run through without making any changes.  

--force (-f)  
    Forces overwriting of files.  

--inline-style (-s)  
    Specifies if the style will be in the ts file.  

--inline-template (-t)  
    Specifies if the template will be in the ts file.  

--new-project-root   
    The path where new projects will be created.  

--prefix (-p)  
    The prefix to apply to generated selectors.  

--routing   
    Generates a routing module.  

--skip-git (-g)  
    Skip initializing a git repository.  

--skip-install   
    Skip installing dependency packages.  

--skip-tests (-S)  
    Skip creating spec files.  

--style   
    The file extension to be used for style files.  

--verbose (-v)  
    Adds more details to output logging.  

--view-encapsulation   
    Specifies the view encapsulation strategy. 
Run Code Online (Sandbox Code Playgroud)