loopbackio / loopbackio/loopback-next

lb4 repository tool error if datasource is using injection

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

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

bug CLI
主要言語
TypeScript
スター
5.1k
フォーク
1.1k
平均マージ
2日 21時間
マージ済み PR(30日)
27

説明

I have a simple data source, whos config is loaded via injection:

export class MainDataSource extends juggler.DataSource
  implements LifeCycleObserver {
  static dataSourceName = 'Main';

  constructor(
    @config()
    dsConfig: object,
  ) {
    super(dsConfig);
  }
}

Application.ts:
this.configure('datasources.Main').to(options.datasources?.Main || {});

When running the repository scaffolding tool the following error occurs:
(node:24064) UnhandledPromiseRejectionWarning: Error: Cannot load C:\lb4\src\datasources\main.datasource.config.json: ENOENT: no such file or directory, open 'C:\lb4\src\datasources\main.datasource.config.json'

I am temporarily suppressing the error by adding a main.datasource.config.json file in the source directory.

However, this scaffolding tool should not require a fully configured data source to generate simple repositories. If the configuration cannot be found, it should just emit a warning, but still allow the tool to run and generate a non-customized class using the basic boilerplate.

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

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

はじめの一歩

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

調査の方向性

Application.ts の注入された datasource のセットアップから始め、存在しない src/datasources/main.datasource.config.json パスを使用して repository scaffolding コマンドを再現します。ツールが不足している設定をどのように処理するかを追跡し、その後、警告を出し、ファイルを必要とせずに基本的な repository class を引き続き生成することを確認します。

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

評価

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

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

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