Skip to content

feat(ir): add typed helper for Npm@1#1077

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
feat/ir-npm-v1-typed-helper-880253a28c2106a3
Draft

feat(ir): add typed helper for Npm@1#1077
github-actions[bot] wants to merge 1 commit into
mainfrom
feat/ir-npm-v1-typed-helper-880253a28c2106a3

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Adds a typed factory function for Npm@1 to the ado-aw IR (src/compile/ir/tasks.rs).

Motivation

Previously, any code that needed to emit an Npm@1 pipeline step had to hand-craft
TaskStep::new("Npm@1", ...) with raw string inputs. This PR introduces a well-typed
npm_step() helper that makes the required/optional input boundary explicit and self-documenting,
consistent with the existing typed helpers for UseNode@1, DotNetCoreCLI@2, etc.

Changes

  • src/compile/ir/tasks.rs: npm_step(command) factory function + 6 unit tests

ADO Task Reference

Function signature

pub fn npm_step(command: impl Into<String>) -> TaskStep

Required input is positional; optional inputs are applied via .with_input(...) on the returned TaskStep:

// npm install
let step = npm_step("install");

// npm ci in a subdirectory
let step = npm_step("ci").with_input("workingDir", "$(Build.SourcesDirectory)/app");

// publish to an Azure Artifacts feed
let step = npm_step("publish")
    .with_input("publishRegistry", "useFeed")
    .with_input("publishFeed", "my-org/my-feed");

// custom command
let step = npm_step("custom")
    .with_input("customCommand", "run build -- --production");

Validation

  • cargo build --all-targets
  • cargo test (2038 unit + 127 integration tests pass)
  • cargo clippy --all-targets --all-features --workspace -- -D warnings

Created by the ado-task-ir-contributor workflow.

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com
  • spsprodweu4.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"
    - "spsprodweu4.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by ADO Task IR Contributor · 687.7 AIC · ⌖ 19.8 AIC · ⊞ 36.6K ·

Adds npm_step() factory function to src/compile/ir/tasks.rs for the
Npm@1 ADO built-in task. Required input (command) is positional;
optional inputs (workingDir, verbose, customCommand, customRegistry,
customFeed, publishRegistry, publishFeed, etc.) are applied via
.with_input(…) on the returned TaskStep.

Six unit tests cover install, ci, publish, custom with workingDir,
publish with Azure Artifacts feed, and install with a custom feed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot mentioned this pull request Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants