Repository navigation
Adding durable dependency if not present in package.json for node - #5495
Merged
Merged
Conversation
sarah (satvu)
left a comment
Member
There was a problem hiding this comment.
Can this be added to the release notes for tracking?
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Node.js v4 template experience for Durable Functions by ensuring the durable-functions npm dependency is added to package.json when creating Durable orchestrator/entity functions, and (when possible) attempting to run npm install. It also adds E2E coverage to validate dependency injection behavior for durable vs non-durable templates.
Changes:
- Add
EnsureDurableFunctionsNpmPackageto updatepackage.jsonfor Node v4 Durable orchestrator/entity templates and optionally runnpm install. - Introduce constants for the durable npm package name/version and relevant trigger types.
- Add E2E tests verifying the dependency is added for durable templates and not added for non-durable templates.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/Cli/Func.E2ETests/Commands/FuncNew/NodeTests.cs | Adds E2E tests asserting durable-functions is injected (or not) into package.json depending on template type. |
| src/Cli/func/Common/TemplatesManager.cs | Implements durable dependency injection into package.json for Node v4 templates and triggers an npm install attempt. |
| src/Cli/func/Common/Constants.cs | Adds constants for durable package/version and durable trigger-type identifiers. |
Address PR #5495 review feedback: NpmHelper.Install/RunNpmCommand now return the npm exit code so EnsureDurableFunctionsNpmPackage can warn the user when 'npm install' fails (previously swallowed due to ignoreError=true), while keeping the behavior best-effort. Added a release note entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7ba7065d-e60a-4c7e-91d1-ebdf627969d9
sarah (satvu)
approved these changes
Jul 28, 2026
Rohit Ranjan (RohitRanjanMS)
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for automatically managing the
durable-functionsnpm package dependency when creating Node.js v4 (JavaScript/TypeScript) Azure Functions using Durable Functions templates. Now, when a user creates an orchestrator or entity function, the CLI ensures that the correct dependency is added topackage.jsonand attempts to install it, improving the developer experience and reducing manual setup steps. The changes also include comprehensive end-to-end tests to verify this behavior.Enhancements to Durable Functions dependency management:
EnsureDurableFunctionsNpmPackageinTemplatesManager.csthat checks if the selected template is a Durable Functions orchestrator or entity, and if so, adds thedurable-functionsdependency (version^3.x) topackage.jsonand runsnpm installunless in offline mode or if npm is not available. [1] [2]Constants.csfor the Durable Functions npm package name, version, and trigger types for orchestration and entity.Testing improvements:
NodeTests.csto verify:durable-functionsdependency is added for JavaScript orchestrator and TypeScript entity templates.Code quality:
Newtonsoft.Json.Linqimport for working with JSON objects inTemplatesManager.cs.Issue describing the changes in this PR
resolves #5492
Pull request checklist
release_notes.mdAdditional information
Additional PR information