@@ -8,6 +8,7 @@ import { pathToFileURL } from "node:url";
88
99const WORKSPACE_DIRS_ENV = "OPENCLAW_OCM_WORKSPACE_DEPENDENCY_DIRS" ;
1010const REAL_NPM_ENV = "OPENCLAW_OCM_REAL_NPM_BIN" ;
11+ const ALLOW_UNRELEASED_CHANGELOG_ENV = "OPENCLAW_PREPACK_ALLOW_UNRELEASED_CHANGELOG" ;
1112
1213export function parseWorkspaceDependencyDirs (
1314 raw = process . env [ WORKSPACE_DIRS_ENV ] ,
@@ -55,15 +56,25 @@ export function buildInstallManifest(rootArchive, workspacePackages) {
5556
5657function runNpm ( npm , args , options = { } ) {
5758 const result = spawnSync ( npm , args , {
58- ...options ,
5959 env : process . env ,
60+ ...options ,
6061 } ) ;
6162 if ( result . error ) {
6263 throw result . error ;
6364 }
6465 return result ;
6566}
6667
68+ export function resolveNpmEnvironment ( args , env = process . env ) {
69+ if ( args [ 0 ] !== "pack" ) {
70+ return env ;
71+ }
72+ return {
73+ ...env ,
74+ [ ALLOW_UNRELEASED_CHANGELOG_ENV ] : "1" ,
75+ } ;
76+ }
77+
6778function runTar ( args ) {
6879 const result = spawnSync ( "tar" , args , {
6980 env : process . env ,
@@ -162,7 +173,10 @@ function main() {
162173 const workspaceDirs = parseWorkspaceDependencyDirs ( ) ;
163174 const plan = resolveWorkspaceInstallPlan ( args , workspaceDirs ) ;
164175 if ( ! plan ) {
165- const result = runNpm ( npm , args , { stdio : "inherit" } ) ;
176+ const result = runNpm ( npm , args , {
177+ env : resolveNpmEnvironment ( args ) ,
178+ stdio : "inherit" ,
179+ } ) ;
166180 return result . status ?? 1 ;
167181 }
168182
0 commit comments