Skip to content

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

Merged
jamesadevine merged 2 commits into
mainfrom
feat/ir-npm-v1-typed-helper-880253a28c2106a3
Jun 18, 2026
Merged

feat(ir): add typed helper for Npm@1#1077
jamesadevine merged 2 commits 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
@jamesadevine

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

…helper-880253a28c2106a3

# Conflicts:
#	src/compile/ir/tasks.rs

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in 165d6a5.

Copilot AI requested a review from jamesadevine June 18, 2026 09:04
@jamesadevine jamesadevine marked this pull request as ready for review June 18, 2026 09:05
@jamesadevine jamesadevine merged commit 19a8532 into main Jun 18, 2026
@jamesadevine jamesadevine deleted the feat/ir-npm-v1-typed-helper-880253a28c2106a3 branch June 18, 2026 09:05
jamesadevine added a commit that referenced this pull request Jun 18, 2026
Resolve the modify/delete conflict on src/compile/ir/tasks.rs: main added
a free-function Npm@1 helper (npm_step, #1077) to the file this branch
deletes. Port it to the new builder-struct convention as
src/compile/ir/tasks/npm.rs — an Npm builder with an NpmCommand enum
(install/ci/publish/custom) carrying per-command optional inputs and
typed registry enums, matching the docker.rs template. No npm_step call
sites existed to migrate.
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.

2 participants