Run NPM Exec

Action ID: npm:exec
NPM Package:

@mdude2314/backstage-plugin-scaffolder-npm-actions

Description

Runs npm exec with the given arguments in the task workspace directory

Input Schema

PropertyTypeDescriptionRequired
argumentsarrayThe arguments to pass to the npm exec command

Output Schema

No output schema defined for this action.

Usage Examples

Lint and fix code with ESLint after fetching a template

Fetch a project template with fetch:template, install dependencies, then run ESLint via npm exec to lint and auto-fix issues in a specified source directory. Use this to ensure code quality during scaffolding.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        name: ${{ parameters.componentId }}

  - id: install-deps
    action: npm:exec
    input:
      arguments:
        - npm
        - ci

  - id: eslint-fix
    action: npm:exec
    input:
      arguments:
        - eslint
        - ${{ parameters.sourceDir }}
        - --ext
        - .ts,.tsx,.js
        - --fix

Generate TypeScript types from an OpenAPI spec using an ephemeral CLI

Fetch a base template with fetch:template, then use npm exec to run openapi-typescript without adding it to dependencies. This generates types directly from a remote OpenAPI URL.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        name: ${{ parameters.componentId }}

  - id: generate-openapi-types
    action: npm:exec
    input:
      arguments:
        - --yes
        - openapi-typescript@7.0.0
        - ${{ parameters.openapiUrl }}
        - --output
        - src/generated/types.ts