Ng generate always assumes an `app` folder

オープン
#9,370 コメント 15 件 リアクション 10 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
angular, typescript
領域
cli

調査の方向性

まず、示されている .angular-cli.json を使って ng g c form-inputs/mike --skip-import --dry-run --app=client コマンドを再現します。設定された root が生成されたコンポーネントのパスとどのように結合されるかを追跡し、選択した設定によって app フォルダーを前提とせず、意図した場所にファイルが作成されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

area: @schematics/angular feature feature: insufficient votes workaround1: obvious

Our project setup doesn't have an immediate sub-folder of app, however, it appears that running ng generate always assume that you have an app folder under the app root folder you specified in .angular-cli.json

Versions
Angular CLI: 1.6.0
Node: 7.0.0
OS: darwin x64
Angular:
...
Repro steps
  • Setup a simple .angular-cli.json with:
{
  "apps": [
    {
      "name": "client",
      "root": "projects/client"
    }
  ]
}
  • Run:
ng g c form-inputs/mike --skip-import --dry-run --app=client
Observed behavior

You'll see the output path always assumes an app folder:

  create projects/client/app/form-inputs/mike/mike.component.css (0 bytes)
  create projects/client/app/form-inputs/mike/mike.component.html (23 bytes)
  create projects/client/app/form-inputs/mike/mike.component.spec.ts (614 bytes)
  create projects/client/app/form-inputs/mike/mike.component.ts (261 bytes)
Desired behavior

I'd like an option to be able to configure whether your project has the app folder or not. Or maybe an option to configure the whole path the component gets created in.

主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
16時間 35分
マージ済み PR(30日)
176

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angular-cli のほかの issue

angular/angular-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。