Use self nf path to run sub commands

Abierto
#100 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
54/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
node.js, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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?
Lenguaje dominante
TypeScript
Estrellas
2
Forks
2
Merge medio
2 d 18 h
PR fusionados (30 d)
17

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NanoForge-dev/CLI

Todos los issues de NanoForge-dev/CLI

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.