Possibility to read in config at debug instance creation instead of at first (version) require/ import?
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 20/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- tooling
調査の方向性
Start by reading the NodeJS implementation and tracing when configuration is read during require/import versus debugger creation. Compare the two examples in the issue, then define the intended behavior for independently loaded debug versions and programmatic environment changes before determining what tests are needed.
索引モデルが issue の本文から書いたものです。
説明
I love debug's simplicity, but it bugs me that it is so tightly coupled to environment variables (NodeJS impl)
I would like to integrate it in Metalsmith along with an abstraction of env.
Basically, as soon as a package where debug is used, is require'd, or perhaps with some NPM-derivatives, if multiple packages use the same version, debug reads its defaults from the environment.
const pkgContainingDebug = require('pkg-with-debug') // debug config set according to DEBUG_COLORS= (not defined)
process.env.DEBUG_COLORS = false
const localDebug = require('debug') // debug config takes into account dynamically set process.env.DEBUG_COLORS
const localDebugger= localDebug('app') // nothing happens here config-wise
localDebugger('Hello world')
pkgContainingDebug() // different config from localDebugger
This makes it impossible (in my case for metalsmith) to provide a user with a programmatic way of setting debug values, unless the current package + all its dependencies use the same debug dependency (other typical use case: expressjs)
If the env reading was done at debugger creation instead of require, this would provide a window to decouple the tight coupling of debug configuration and env vars across debug dependencies
const pkgContainingDebug = require('pkg-with-debug') // debug config not initialized unless dependency instantiates it at inclusion
const localDebug = require('debug') // does nothing yet
process.env.DEBUG_COLORS = false
const localDebugger= localDebug('app') // reads in env
localDebugger('Hello world')
pkgContainingDebug() // same config as localDebugger if the dependency's debugger only happens when the dep is first run
Hope this makes sense.
I haven't had the time to dive into the codebase for this yet
- 主要言語
- JavaScript
- スター
- 11.5k
- フォーク
- 992
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
debug-js/debug のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
Debug as JSON オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 28/100
似ている issue
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#3692 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
-
Add: BuyPass TV オープンchannels:add check:passed
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
S: triage
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
apache/cloudstack#14222 ·