Open
Conversation
|
Add NODE_API app mode (ordinal 20, name "node-api") to AppModes registry and add TypedDicts for the Node.js manifest section (ManifestDataNode, ManifestDataNodePackageManager, ManifestDataPackage) matching the format expected by Connect PR #37892.
Add NodeEnvironment class that detects Node.js/npm versions, reads package.json, parses dependencies into manifest packages format, and warns when package-lock.json is missing. Includes tests and test fixtures.
…hase 3) Add node_modules/ to the global directory ignore list. Add get_default_node_entrypoint() that checks package.json main field, scripts.start, then common filenames (app.js, index.js, etc.). Add validate_node_entry_point() for user-specified entry point validation.
Add make_nodejs_manifest() and make_nodejs_bundle() functions that produce manifests matching the format expected by Connect (node section with version and package_manager, packages section with npm dependency metadata). Fix circular import between bundle.py and environment_node.py using TYPE_CHECKING guard.
Add deploy nodejs subcommand with --entrypoint, --exclude, --node, --image, and --disable-env-management-node options. Auto-detects entry point from package.json when not specified.
Add tests for make_nodejs_manifest(), make_nodejs_bundle(), get_default_node_entrypoint(), and validate_node_entry_point(). Covers manifest structure, package metadata, node_modules exclusion, lock file inclusion, entry point auto-detection, and error cases.
Add TestDeployNodeJS class with tests for help output, no-args behavior, missing directory, missing package.json, and bad entrypoint error cases.
Document the new rsconnect deploy nodejs command in the unreleased section of the changelog.
Add node-ts-express test fixture with TypeScript entry point (app.ts) and @types/express devDependency. Add TestNodeJSTypeScriptBundle tests covering TS manifest structure, bundle contents, entry point detection, and devDependencies exclusion from packages section.
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
4b5444b to
a00172f
Compare
Add rsconnect write-manifest nodejs command following the Python write-manifest pattern, with --overwrite, --entrypoint, --node, --image, and --disable-env-management-node options. Remove test_no_args_shows_help test that failed on py3.10+ due to Click version differences in no_args_is_help exit codes. No Python deploy command tests this behavior either.
mconflitti-pbc
commented
Mar 20, 2026
Connect doesn't consume a `packages` section for Node.js deployments — it runs `npm install` against package.json directly. Remove the ManifestDataPackage types, _parse_packages(), and related tests.
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.
Intent
Add client-side support for deploying Node.js API applications (Express, Fastify, etc.) to Posit Connect via
rsconnect deploy nodejs. This is the rsconnect-python counterpart to the Connect server-side Node.js runtime support that is in-progress.Type of Change
Approach
Follows the existing Python API deployment patterns throughout:
App Mode — Added
NODE_API(ordinal 20, name"node-api") toAppModesinmodels.py, matching Connect'sNodeAPIMode.Environment Detection (
environment_node.py) — NewNodeEnvironmentclass that:package.jsonfor dependency metadatapackage-lock.jsonis missing (not required, matching Python's precedent with requirements.txt)Entry Point Detection (
bundle.py) — Auto-detects entry point from:package.jsonmainfieldpackage.jsonscripts.start(parsesnode <file>pattern)app.js,index.js,server.js,main.js(+.tsvariants)Bundle Creation (
bundle.py) —make_nodejs_manifest()andmake_nodejs_bundle()produce manifests matching Connect's expected format:nodesection with version and package_managerpackagessection with npm dependency metadatanode_modules/always excluded from bundlesCLI Command (
main.py) —rsconnect deploy nodejswith options:--entrypoint/-e— JS/TS entry point file--node— path to Node.js executable--exclude/-x— glob patterns--disable-env-management-nodeKey decisions
package-lock.jsonincluded when present, not required — Connect'sbuild_environment.jshandles both paths (npm ciwith lock file,npm installwithout). Matches Python precedent.packagessection — only production dependencies are declared..tsfiles directly.Automated Tests
165 tests pass across 3 test files:
tests/test_environment_node.py(17 tests) — Version detection, package.json parsing, error handling, lock file detection, custom executabletests/test_bundle.py(50 new tests) — Manifest structure, package metadata, node_modules exclusion, lock file inclusion, entry point auto-detection (JS + TS), bundle contentstests/test_main.py(5 new tests) — CLI help, no-args, missing directory, missing package.json, bad entrypointTest fixtures:
tests/testdata/node-express/— JavaScript Express APItests/testdata/node-ts-express/— TypeScript Express APIDirections for Reviewers
rsconnect deploy nodejs --help— verify options and descriptionrsconnect deploy nodejs -s https://connect.example.com -k $API_KEY tests/testdata/node-express/rsconnect deploy nodejs -s https://connect.example.com -k $API_KEY tests/testdata/node-ts-express/--entrypoint— should detectapp.js/app.tsfrom package.jsonmainManual verification with local connect instance
Checklist
rsconnect-python-tests-at-nightworkflow in Connect against this feature branch.