Use self nf path to run sub commands

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
54/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
node.js, typescript

調査の方向性

Start by checking the CLI entry point and existing command dispatch for how nf subcommands are invoked. The request proposes using the local nf executable through npm exec for development; confirm which development command should change and verify it runs the requested build --watch subcommand.

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

説明

command:dev enhancement
Which package is this feature request for?

@nanoforge-dev/cli

Which command is this feature request for?

dev

Feature

nf dev starts build --watch and start --watch through the package manager: <pm> exec nf <command> --watch (dev.action.ts#L40-L42, package-manager.ts#L131-L141). So the package manager decides which nf runs, not the CLI that is running (process.argv[1]). As confirmed in the comments, the sub-commands can end up running the global nf binary instead of the project's local one.

Related: the local CLI is looked up from process.cwd(), not from --directory (local-binaries.ts#L6), so nf dev --directory <dir> run from another folder doesn't find the project's local CLI either.

Ideal solution or implementation

The sub-commands spawn process.execPath with the entry of the CLI that is running (process.argv[1]), followed by the sub-command and its flags, in directory, instead of <pm> exec nf.

Acceptance criteria:

  • With a local CLI in the project and a different global nf, nf dev never runs the global one for build or start.
  • A test checks the command nf dev spawns (it uses the running CLI's entry, not <pm> exec nf).
  • --editor and the other flags still reach the build sub-command.
Alternative solutions or implementations

Keep <pm> exec, but pass the local binary's path (<pm> exec <project>/node_modules/.bin/nf -- build --watch, as in the original request).

Other context

Open questions (not recorded, ask the team):

  • Should the local CLI lookup use --directory instead of process.cwd() in the same change, or in its own issue?
主要言語
TypeScript
スター
2
フォーク
2
平均マージ
2日 18時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

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

NanoForge-dev/CLI のほかの issue

NanoForge-dev/CLI の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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