Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

258
Vistas
How to add variable in npm script inside the path?

I have a monorepo application with a few sub-apps. I want to run the linter only for a specific app and not for the whole repo. This is the folder structure.

├── apps
│   ├── app-1
│   ├── app-2

And this is the npm scripts.

"scripts": {
    "lint": "eslint --fix 'apps/$APP_NAME/**/*.{ts,tsx}' --ignore-pattern 'node_modules/'",
 },

As you can see, I am trying to add some variable inside the path by command line

npm run lint APP_NAME=app-1

but it throws an error like

No files matching the pattern "apps/$APP_NAME/**/*.{ts,tsx}" were found.

What's wrong with this approach?

P.S. In an ideal world, I would like to just run npm run lint app-1.

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

Use cross-env.

Install the cross-env.

npm i -D cross-env

Modify package.json to:

"scripts" {
    "lint:app1": "cross-env APP_NAME=app-1 npm run lint",
    "lint": "cross-env-shell eslint --fix 'apps/$APP_NAME/**/*.{ts,tsx}' --ignore-pattern 'node_modules/'"
}

Then run npm run lint:app1

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda