new library public-api.ts file not using component type declared on angular.json's schematics

オープン
#26,981 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

まず、angular.json@schematics/angular:componenttype 設定を使用して ng generate library foo-library を再現し、その後、生成された projects/foo-library/src/lib/foo-library.cmp.tsprojects/foo-library/src/public-api.ts を確認します。public-api.ts.component ではなく、設定されたファイル名サフィックスを使用して生成されたコンポーネントをエクスポートすれば完了です。

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

説明

area: @schematics/angular freq1: low severity3: broken type: bug/fix
Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

No

Description

When I create a new library the default component inside of the lib folder takes its type from the component schematic declared on angular.json. If for example my angular.json looks like this:

{
    //...
    "newProjectRoot": "projects",
    //...
    "schematics": {
        "@schematics/angular:application": {
          "style": "scss",
          "inlineTemplate": true,
          "inlineStyle": true,
          "ssr": false
        },
        "@schematics/angular:component": {
          "changeDetection": "OnPush",
          "type": "Cmp",
          "inlineStyle": true,
          "inlineTemplate": true,
          "style": "scss"
        }
    }
}

After creating a library using ng generate library foo-library, the new library includes an empty dummy FooLibraryCmp inside the projects/foo-library/src/lib/foo-library.cmp.ts. However, the contents of projects/foo-library/src/public-api.ts look like this:

/*
 * Public API Surface of foo-library
 */

export * from './lib/foo-library.service';
export * from './lib/foo-library.component'; // uses .component instead of .cmp
Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 17.1.1
Node: 18.18.0
Package Manager: npm 9.6.6
OS: win32 x64

Angular: 17.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.1
@angular-devkit/build-angular   17.1.1
@angular-devkit/core            17.1.1
@angular-devkit/schematics      17.1.1
@schematics/angular             17.1.1
ng-packagr                      17.1.2
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.3
Anything else?

No response

主要言語
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 を短くまとめたダイジェスト。