Подтвердить что ты не робот

Что делает --minimal делать в angular -cli `ng new`?

Angular CLI имеет опцию --minimal. Что он делает и где документируется? Команда ng help new говорит об этом очень мало.

--minimal (Boolean) (Default: false) Should create a minimal app.
  aliases: --minimal
4b9b3361

Ответ 1

Текущее на 31 июля 2017 г.. Обычное приложение angular создает 5 каталогов и 26 файлов. A --minimal генерирует 4 directories, 13 files. Разница? --minimal исключает генерацию нескольких файлов, включив некоторые другие параметры.

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

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

Ответ 2

В настоящее время по состоянию на декабрь 2018 года и с Angular Cli 7.0.7, минимальная опция была добавлена обратно. Это означает Create a barebones project without any testing frameworks.

Вы можете проверить угловой документ версии 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.

Начиная с Angular Cli 6.0.8, минимальная опция, кажется, была удалена. Возможно, вам придется запустить --skip-tests, --inline-style и --inline-template, как и в другом ответе, чтобы получить минимальный проект.

Согласно угловой странице вики, эти опции доступны
пробный прогон
сила
многословная коллекция
рядный стиль
рядный шаблон
вид-инкапсуляция
маршрутизация
префикс
стиль
пропуск тестов
пропуск пакет-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.