@vibe-validate/utils 0.19.0-rc.1 → 0.19.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dependency-lock-check.d.ts +112 -0
- package/dist/dependency-lock-check.d.ts.map +1 -0
- package/dist/dependency-lock-check.js +209 -0
- package/dist/dependency-lock-check.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/package-manager.d.ts +146 -0
- package/dist/package-manager.d.ts.map +1 -0
- package/dist/package-manager.js +187 -0
- package/dist/package-manager.js.map +1 -0
- package/dist/safe-exec.js +2 -2
- package/dist/safe-exec.js.map +1 -1
- package/package.json +1 -2
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Lock File Check
|
|
3
|
+
*
|
|
4
|
+
* Verifies that lock files are in sync with package.json to prevent cache poisoning.
|
|
5
|
+
* Supports npm, pnpm, yarn, and bun package managers with auto-detection.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Supported package managers
|
|
9
|
+
*/
|
|
10
|
+
export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
|
|
11
|
+
/**
|
|
12
|
+
* Skip reasons for dependency check
|
|
13
|
+
*/
|
|
14
|
+
export type SkipReason = 'env-var' | 'no-lock-file';
|
|
15
|
+
/**
|
|
16
|
+
* Result of dependency lock file check
|
|
17
|
+
*/
|
|
18
|
+
export interface DependencyCheckResult {
|
|
19
|
+
/** Whether the check passed (lock file in sync) */
|
|
20
|
+
passed: boolean;
|
|
21
|
+
/** Whether the check was skipped */
|
|
22
|
+
skipped: boolean;
|
|
23
|
+
/** Reason for skipping the check */
|
|
24
|
+
skipReason?: SkipReason;
|
|
25
|
+
/** Error message if check failed */
|
|
26
|
+
error?: string;
|
|
27
|
+
/** Package manager used for check */
|
|
28
|
+
packageManager?: PackageManager;
|
|
29
|
+
/** Command executed for verification */
|
|
30
|
+
command?: string;
|
|
31
|
+
/** Duration of check in milliseconds */
|
|
32
|
+
duration: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Detect package manager from git root directory
|
|
36
|
+
*
|
|
37
|
+
* Detection strategy:
|
|
38
|
+
* 1. Check config override first (if provided)
|
|
39
|
+
* 2. Read package.json for packageManager field
|
|
40
|
+
* 3. Check for lock files in priority order (bun → yarn → pnpm → npm)
|
|
41
|
+
*
|
|
42
|
+
* @param gitRoot - Git repository root path
|
|
43
|
+
* @param configPackageManager - Optional package manager from config
|
|
44
|
+
* @returns Detected package manager or null if none found
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const pm = detectPackageManager('/path/to/repo');
|
|
48
|
+
* console.log(pm); // 'pnpm' or 'npm' or null
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // With config override
|
|
52
|
+
* const pm = detectPackageManager('/path/to/repo', 'yarn');
|
|
53
|
+
* console.log(pm); // 'yarn'
|
|
54
|
+
*/
|
|
55
|
+
export declare function detectPackageManager(gitRoot: string, configPackageManager?: PackageManager): PackageManager | null;
|
|
56
|
+
/**
|
|
57
|
+
* Build install command for package manager
|
|
58
|
+
*
|
|
59
|
+
* If custom command provided, parses into array format.
|
|
60
|
+
* Otherwise, returns appropriate frozen lockfile command:
|
|
61
|
+
* - npm: npm ci
|
|
62
|
+
* - pnpm: pnpm install --frozen-lockfile
|
|
63
|
+
* - yarn: yarn install --immutable
|
|
64
|
+
* - bun: bun install --frozen-lockfile
|
|
65
|
+
*
|
|
66
|
+
* @param packageManager - Package manager to build command for
|
|
67
|
+
* @param customCommand - Optional custom command string
|
|
68
|
+
* @returns Command array [command, ...args]
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* const cmd = buildInstallCommand('npm');
|
|
72
|
+
* console.log(cmd); // ['npm', 'ci']
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* const cmd = buildInstallCommand('npm', 'npm ci --legacy-peer-deps');
|
|
76
|
+
* console.log(cmd); // ['npm', 'ci', '--legacy-peer-deps']
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildInstallCommand(packageManager: PackageManager, customCommand?: string): string[];
|
|
79
|
+
/**
|
|
80
|
+
* Run dependency lock file verification
|
|
81
|
+
*
|
|
82
|
+
* Checks that lock file is in sync with package.json by running
|
|
83
|
+
* the package manager's install command with frozen lockfile flag.
|
|
84
|
+
*
|
|
85
|
+
* Skip conditions:
|
|
86
|
+
* - VV_SKIP_DEPENDENCY_CHECK env var is set
|
|
87
|
+
*
|
|
88
|
+
* @param gitRoot - Git repository root path
|
|
89
|
+
* @param config - Configuration object
|
|
90
|
+
* @param config.packageManager - Optional package manager override
|
|
91
|
+
* @param config.command - Optional custom verification command
|
|
92
|
+
* @param verbose - Enable verbose output
|
|
93
|
+
* @returns Dependency check result
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* const result = await runDependencyCheck('/path/to/repo', {}, false);
|
|
97
|
+
* if (!result.passed) {
|
|
98
|
+
* console.error(result.error);
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // With custom command
|
|
103
|
+
* const result = await runDependencyCheck('/path/to/repo', {
|
|
104
|
+
* packageManager: 'npm',
|
|
105
|
+
* command: 'npm ci --legacy-peer-deps'
|
|
106
|
+
* }, true);
|
|
107
|
+
*/
|
|
108
|
+
export declare function runDependencyCheck(gitRoot: string, config: {
|
|
109
|
+
packageManager?: PackageManager;
|
|
110
|
+
command?: string;
|
|
111
|
+
}, verbose: boolean): Promise<DependencyCheckResult>;
|
|
112
|
+
//# sourceMappingURL=dependency-lock-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-lock-check.d.ts","sourceRoot":"","sources":["../src/dependency-lock-check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mDAAmD;IACnD,MAAM,EAAE,OAAO,CAAC;IAChB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAiBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,oBAAoB,CAAC,EAAE,cAAc,GACpC,cAAc,GAAG,IAAI,CAgCvB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,cAAc,EAC9B,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,EAAE,CAiBV;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE;IACN,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,EACD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC,CA0EhC"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Lock File Check
|
|
3
|
+
*
|
|
4
|
+
* Verifies that lock files are in sync with package.json to prevent cache poisoning.
|
|
5
|
+
* Supports npm, pnpm, yarn, and bun package managers with auto-detection.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { safeExecResult } from './safe-exec.js';
|
|
10
|
+
/**
|
|
11
|
+
* Lock file names for each package manager
|
|
12
|
+
*/
|
|
13
|
+
const LOCK_FILES = {
|
|
14
|
+
bun: 'bun.lockb',
|
|
15
|
+
yarn: 'yarn.lock',
|
|
16
|
+
pnpm: 'pnpm-lock.yaml',
|
|
17
|
+
npm: 'package-lock.json',
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Priority order for lock file detection (most specific first)
|
|
21
|
+
*/
|
|
22
|
+
const DETECTION_PRIORITY = ['bun', 'yarn', 'pnpm', 'npm'];
|
|
23
|
+
/**
|
|
24
|
+
* Detect package manager from git root directory
|
|
25
|
+
*
|
|
26
|
+
* Detection strategy:
|
|
27
|
+
* 1. Check config override first (if provided)
|
|
28
|
+
* 2. Read package.json for packageManager field
|
|
29
|
+
* 3. Check for lock files in priority order (bun → yarn → pnpm → npm)
|
|
30
|
+
*
|
|
31
|
+
* @param gitRoot - Git repository root path
|
|
32
|
+
* @param configPackageManager - Optional package manager from config
|
|
33
|
+
* @returns Detected package manager or null if none found
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* const pm = detectPackageManager('/path/to/repo');
|
|
37
|
+
* console.log(pm); // 'pnpm' or 'npm' or null
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // With config override
|
|
41
|
+
* const pm = detectPackageManager('/path/to/repo', 'yarn');
|
|
42
|
+
* console.log(pm); // 'yarn'
|
|
43
|
+
*/
|
|
44
|
+
export function detectPackageManager(gitRoot, configPackageManager) {
|
|
45
|
+
// 1. Config override takes precedence
|
|
46
|
+
if (configPackageManager) {
|
|
47
|
+
return configPackageManager;
|
|
48
|
+
}
|
|
49
|
+
// 2. Check package.json packageManager field
|
|
50
|
+
const packageJsonPath = join(gitRoot, 'package.json');
|
|
51
|
+
if (existsSync(packageJsonPath)) {
|
|
52
|
+
try {
|
|
53
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
54
|
+
if (packageJson.packageManager) {
|
|
55
|
+
// Format: "pnpm@8.6.0" or "npm@9.0.0"
|
|
56
|
+
const match = packageJson.packageManager.match(/^(npm|pnpm|yarn|bun)@/);
|
|
57
|
+
if (match) {
|
|
58
|
+
return match[1];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Ignore parse errors, fall through to lock file detection
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// 3. Check for lock files in priority order
|
|
67
|
+
for (const pm of DETECTION_PRIORITY) {
|
|
68
|
+
const lockFile = join(gitRoot, LOCK_FILES[pm]);
|
|
69
|
+
if (existsSync(lockFile)) {
|
|
70
|
+
return pm;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build install command for package manager
|
|
77
|
+
*
|
|
78
|
+
* If custom command provided, parses into array format.
|
|
79
|
+
* Otherwise, returns appropriate frozen lockfile command:
|
|
80
|
+
* - npm: npm ci
|
|
81
|
+
* - pnpm: pnpm install --frozen-lockfile
|
|
82
|
+
* - yarn: yarn install --immutable
|
|
83
|
+
* - bun: bun install --frozen-lockfile
|
|
84
|
+
*
|
|
85
|
+
* @param packageManager - Package manager to build command for
|
|
86
|
+
* @param customCommand - Optional custom command string
|
|
87
|
+
* @returns Command array [command, ...args]
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* const cmd = buildInstallCommand('npm');
|
|
91
|
+
* console.log(cmd); // ['npm', 'ci']
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* const cmd = buildInstallCommand('npm', 'npm ci --legacy-peer-deps');
|
|
95
|
+
* console.log(cmd); // ['npm', 'ci', '--legacy-peer-deps']
|
|
96
|
+
*/
|
|
97
|
+
export function buildInstallCommand(packageManager, customCommand) {
|
|
98
|
+
// Parse custom command if provided
|
|
99
|
+
if (customCommand) {
|
|
100
|
+
return customCommand.trim().split(/\s+/);
|
|
101
|
+
}
|
|
102
|
+
// Return frozen lockfile command for package manager
|
|
103
|
+
switch (packageManager) {
|
|
104
|
+
case 'npm':
|
|
105
|
+
return ['npm', 'ci'];
|
|
106
|
+
case 'pnpm':
|
|
107
|
+
return ['pnpm', 'install', '--frozen-lockfile'];
|
|
108
|
+
case 'yarn':
|
|
109
|
+
return ['yarn', 'install', '--immutable'];
|
|
110
|
+
case 'bun':
|
|
111
|
+
return ['bun', 'install', '--frozen-lockfile'];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Run dependency lock file verification
|
|
116
|
+
*
|
|
117
|
+
* Checks that lock file is in sync with package.json by running
|
|
118
|
+
* the package manager's install command with frozen lockfile flag.
|
|
119
|
+
*
|
|
120
|
+
* Skip conditions:
|
|
121
|
+
* - VV_SKIP_DEPENDENCY_CHECK env var is set
|
|
122
|
+
*
|
|
123
|
+
* @param gitRoot - Git repository root path
|
|
124
|
+
* @param config - Configuration object
|
|
125
|
+
* @param config.packageManager - Optional package manager override
|
|
126
|
+
* @param config.command - Optional custom verification command
|
|
127
|
+
* @param verbose - Enable verbose output
|
|
128
|
+
* @returns Dependency check result
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* const result = await runDependencyCheck('/path/to/repo', {}, false);
|
|
132
|
+
* if (!result.passed) {
|
|
133
|
+
* console.error(result.error);
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* // With custom command
|
|
138
|
+
* const result = await runDependencyCheck('/path/to/repo', {
|
|
139
|
+
* packageManager: 'npm',
|
|
140
|
+
* command: 'npm ci --legacy-peer-deps'
|
|
141
|
+
* }, true);
|
|
142
|
+
*/
|
|
143
|
+
export async function runDependencyCheck(gitRoot, config, verbose) {
|
|
144
|
+
const startTime = Date.now();
|
|
145
|
+
// Check for skip env var
|
|
146
|
+
if (process.env.VV_SKIP_DEPENDENCY_CHECK) {
|
|
147
|
+
return {
|
|
148
|
+
passed: true,
|
|
149
|
+
skipped: true,
|
|
150
|
+
skipReason: 'env-var',
|
|
151
|
+
duration: Date.now() - startTime,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
// Detect package manager
|
|
155
|
+
const packageManager = detectPackageManager(gitRoot, config.packageManager);
|
|
156
|
+
if (!packageManager) {
|
|
157
|
+
return {
|
|
158
|
+
passed: false,
|
|
159
|
+
skipped: false,
|
|
160
|
+
error: 'No package manager detected (no lock file found)',
|
|
161
|
+
duration: Date.now() - startTime,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
// Verify lock file exists
|
|
165
|
+
const lockFile = join(gitRoot, LOCK_FILES[packageManager]);
|
|
166
|
+
if (!existsSync(lockFile)) {
|
|
167
|
+
return {
|
|
168
|
+
passed: false,
|
|
169
|
+
skipped: false,
|
|
170
|
+
error: `No lock file found for detected package manager (${packageManager})`,
|
|
171
|
+
packageManager,
|
|
172
|
+
duration: Date.now() - startTime,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// Build and execute install command
|
|
176
|
+
const commandArray = buildInstallCommand(packageManager, config.command);
|
|
177
|
+
const commandString = commandArray.join(' ');
|
|
178
|
+
if (verbose) {
|
|
179
|
+
console.log(`🔍 Verifying lock file with: ${commandString}`);
|
|
180
|
+
}
|
|
181
|
+
const result = safeExecResult(commandArray[0], commandArray.slice(1), {
|
|
182
|
+
cwd: gitRoot,
|
|
183
|
+
encoding: 'utf8',
|
|
184
|
+
});
|
|
185
|
+
const duration = Date.now() - startTime;
|
|
186
|
+
if (result.status === 0) {
|
|
187
|
+
if (verbose) {
|
|
188
|
+
console.log('✅ Lock file verification passed');
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
passed: true,
|
|
192
|
+
skipped: false,
|
|
193
|
+
packageManager,
|
|
194
|
+
command: commandString,
|
|
195
|
+
duration,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
// Command failed - lock file out of sync
|
|
199
|
+
const stderr = typeof result.stderr === 'string' ? result.stderr : result.stderr.toString();
|
|
200
|
+
return {
|
|
201
|
+
passed: false,
|
|
202
|
+
skipped: false,
|
|
203
|
+
error: `Lock file verification failed: ${stderr.trim()}`,
|
|
204
|
+
packageManager,
|
|
205
|
+
command: commandString,
|
|
206
|
+
duration,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=dependency-lock-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-lock-check.js","sourceRoot":"","sources":["../src/dependency-lock-check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAgChD;;GAEG;AACH,MAAM,UAAU,GAAmC;IACjD,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,gBAAgB;IACtB,GAAG,EAAE,mBAAmB;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,kBAAkB,GAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,oBAAqC;IAErC,sCAAsC;IACtC,IAAI,oBAAoB,EAAE,CAAC;QACzB,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,6CAA6C;IAC7C,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACtD,IAAI,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC;Y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AC,CAAC;IAE7C,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,gCAAgC,aAAa,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACpE,GAAG,EAAE,OAAO;QACZ,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IAExC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QACjD,CAAC;QACD,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,KAAK;YACd,cAAc;YACd,OAAO,EAAE,aAAa;YACtB,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,yCAAyC;IACzC,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC5F,OAAO;QACL,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,kCAAkC,MAAM,CAAC,IAAI,EAAE,EAAE;QACxD,cAAc;QACd,OAAO,EAAE,aAAa;QACtB,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,6 @@
|
|
|
9
9
|
export { safeExecSync, safeExecFromString, safeExecResult, isToolAvailable, getToolVersion, hasShellSyntax, CommandExecutionError, type SafeExecOptions, type SafeExecResult } from './safe-exec.js';
|
|
10
10
|
export { normalizedTmpdir, mkdirSyncReal, normalizePath, toForwardSlash } from './path-helpers.js';
|
|
11
11
|
export { isProcessRunning } from './process-check.js';
|
|
12
|
+
export { getPackageVersion, getLatestVersion, packageExists, publishPackage, addDistTag, unpublishPackage, deprecatePackage, installPackage, executePnpmCommand, type PackageManagerOptions } from './package-manager.js';
|
|
13
|
+
export { detectPackageManager, buildInstallCommand, runDependencyCheck, type PackageManager, type DependencyCheckResult } from './dependency-lock-check.js';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,4 +12,8 @@ export { safeExecSync, safeExecFromString, safeExecResult, isToolAvailable, getT
|
|
|
12
12
|
export { normalizedTmpdir, mkdirSyncReal, normalizePath, toForwardSlash } from './path-helpers.js';
|
|
13
13
|
// Process checking (cross-platform)
|
|
14
14
|
export { isProcessRunning } from './process-check.js';
|
|
15
|
+
// Package management (npm/pnpm commands)
|
|
16
|
+
export { getPackageVersion, getLatestVersion, packageExists, publishPackage, addDistTag, unpublishPackage, deprecatePackage, installPackage, executePnpmCommand } from './package-manager.js';
|
|
17
|
+
// Dependency lock file verification
|
|
18
|
+
export { detectPackageManager, buildInstallCommand, runDependencyCheck } from './dependency-lock-check.js';
|
|
15
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6CAA6C;AAC7C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EAGtB,MAAM,gBAAgB,CAAC;AAExB,gEAAgE;AAChE,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B,oCAAoC;AACpC,OAAO,EACL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6CAA6C;AAC7C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EAGtB,MAAM,gBAAgB,CAAC;AAExB,gEAAgE;AAChE,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B,oCAAoC;AACpC,OAAO,EACL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAE5B,yCAAyC;AACzC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAE9B,oCAAoC;AACpC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAGnB,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package Manager Operations
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for npm/pnpm command execution.
|
|
5
|
+
* Centralizes all package registry and publishing operations.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT call npm/pnpm via safeExecSync/safeExecResult directly.
|
|
8
|
+
* Use these functions instead for:
|
|
9
|
+
* - Consistent error handling
|
|
10
|
+
* - Better testability (easy mocking)
|
|
11
|
+
* - Architectural consistency
|
|
12
|
+
*/
|
|
13
|
+
export interface PackageManagerOptions {
|
|
14
|
+
cwd?: string;
|
|
15
|
+
timeout?: number;
|
|
16
|
+
stdio?: 'pipe' | 'ignore' | Array<'pipe' | 'ignore' | 'inherit'>;
|
|
17
|
+
env?: NodeJS.ProcessEnv;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get package version from npm registry
|
|
21
|
+
*
|
|
22
|
+
* @param packageName - Package name (e.g., 'vibe-validate')
|
|
23
|
+
* @param versionOrTag - Version or tag (e.g., '0.19.0', 'latest')
|
|
24
|
+
* @returns Version string or null if not found
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const version = getPackageVersion('vibe-validate', 'latest');
|
|
28
|
+
* console.log(version); // '0.19.0'
|
|
29
|
+
*/
|
|
30
|
+
export declare function getPackageVersion(packageName: string, versionOrTag: string): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Get latest version of a package from npm registry
|
|
33
|
+
*
|
|
34
|
+
* @param packageName - Package name (e.g., 'vibe-validate')
|
|
35
|
+
* @returns Latest version string
|
|
36
|
+
* @throws Error if package not found or registry unreachable
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const version = getLatestVersion('vibe-validate');
|
|
40
|
+
* console.log(version); // '0.19.0'
|
|
41
|
+
*/
|
|
42
|
+
export declare function getLatestVersion(packageName: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Check if a package version exists in npm registry
|
|
45
|
+
*
|
|
46
|
+
* @param packageName - Package name
|
|
47
|
+
* @param version - Version to check
|
|
48
|
+
* @returns True if package version exists
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* if (packageExists('vibe-validate', '0.19.0')) {
|
|
52
|
+
* console.log('Package already published');
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
55
|
+
export declare function packageExists(packageName: string, version: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Publish package to npm registry using pnpm
|
|
58
|
+
*
|
|
59
|
+
* @param options - Publishing options
|
|
60
|
+
* @param options.cwd - Package directory to publish from
|
|
61
|
+
* @param options.tag - Dist tag (e.g., 'latest', 'rc', 'dev')
|
|
62
|
+
* @param options.stdio - How to handle stdio streams
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* publishPackage({
|
|
66
|
+
* cwd: '/path/to/package',
|
|
67
|
+
* tag: 'latest',
|
|
68
|
+
* stdio: 'inherit'
|
|
69
|
+
* });
|
|
70
|
+
*/
|
|
71
|
+
export declare function publishPackage(options: {
|
|
72
|
+
cwd: string;
|
|
73
|
+
tag: string;
|
|
74
|
+
stdio?: 'pipe' | 'ignore' | Array<'pipe' | 'ignore' | 'inherit'>;
|
|
75
|
+
}): void;
|
|
76
|
+
/**
|
|
77
|
+
* Add dist tag to published package
|
|
78
|
+
*
|
|
79
|
+
* @param packageName - Full package name (e.g., '@vibe-validate/core')
|
|
80
|
+
* @param version - Version to tag
|
|
81
|
+
* @param tag - Tag name (e.g., 'latest', 'rc')
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* addDistTag('@vibe-validate/core', '0.19.0', 'latest');
|
|
85
|
+
*/
|
|
86
|
+
export declare function addDistTag(packageName: string, version: string, tag: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Unpublish package version from npm registry
|
|
89
|
+
*
|
|
90
|
+
* @param packageName - Full package name
|
|
91
|
+
* @param version - Version to unpublish
|
|
92
|
+
* @returns True if successful, false if failed
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* if (unpublishPackage('@vibe-validate/core', '0.19.0-rc.1')) {
|
|
96
|
+
* console.log('Successfully unpublished');
|
|
97
|
+
* }
|
|
98
|
+
*/
|
|
99
|
+
export declare function unpublishPackage(packageName: string, version: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Deprecate package version on npm registry
|
|
102
|
+
*
|
|
103
|
+
* @param packageName - Full package name
|
|
104
|
+
* @param version - Version to deprecate
|
|
105
|
+
* @param message - Deprecation message
|
|
106
|
+
* @returns True if successful, false if failed
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* deprecatePackage(
|
|
110
|
+
* '@vibe-validate/core',
|
|
111
|
+
* '0.19.0-rc.1',
|
|
112
|
+
* 'Use 0.19.0 instead'
|
|
113
|
+
* );
|
|
114
|
+
*/
|
|
115
|
+
export declare function deprecatePackage(packageName: string, version: string, message: string): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Install npm package from tarball
|
|
118
|
+
*
|
|
119
|
+
* @param tarballPath - Path to tarball file
|
|
120
|
+
* @param targetDir - Directory to install into
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* installPackage(
|
|
124
|
+
* '/tmp/vibe-validate-0.19.0.tgz',
|
|
125
|
+
* '/tmp/test-install'
|
|
126
|
+
* );
|
|
127
|
+
*/
|
|
128
|
+
export declare function installPackage(tarballPath: string, targetDir: string): void;
|
|
129
|
+
/**
|
|
130
|
+
* Execute pnpm command with arguments
|
|
131
|
+
*
|
|
132
|
+
* Use this for pnpm commands not covered by specific functions above.
|
|
133
|
+
*
|
|
134
|
+
* @param args - Command arguments
|
|
135
|
+
* @param options - Execution options
|
|
136
|
+
* @returns Command output
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* // Run pnpm validate
|
|
140
|
+
* executePnpmCommand(['validate'], {
|
|
141
|
+
* cwd: projectRoot,
|
|
142
|
+
* stdio: 'inherit'
|
|
143
|
+
* });
|
|
144
|
+
*/
|
|
145
|
+
export declare function executePnpmCommand(args: string[], options?: PackageManagerOptions): string;
|
|
146
|
+
//# sourceMappingURL=package-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../src/package-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW1F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;CAClE,GAAG,IAAI,CAKP;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAIlF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAK9E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAK/F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAK3E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAU1F"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package Manager Operations
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for npm/pnpm command execution.
|
|
5
|
+
* Centralizes all package registry and publishing operations.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT call npm/pnpm via safeExecSync/safeExecResult directly.
|
|
8
|
+
* Use these functions instead for:
|
|
9
|
+
* - Consistent error handling
|
|
10
|
+
* - Better testability (easy mocking)
|
|
11
|
+
* - Architectural consistency
|
|
12
|
+
*/
|
|
13
|
+
import { safeExecResult, safeExecSync } from './safe-exec.js';
|
|
14
|
+
/**
|
|
15
|
+
* Get package version from npm registry
|
|
16
|
+
*
|
|
17
|
+
* @param packageName - Package name (e.g., 'vibe-validate')
|
|
18
|
+
* @param versionOrTag - Version or tag (e.g., '0.19.0', 'latest')
|
|
19
|
+
* @returns Version string or null if not found
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const version = getPackageVersion('vibe-validate', 'latest');
|
|
23
|
+
* console.log(version); // '0.19.0'
|
|
24
|
+
*/
|
|
25
|
+
export function getPackageVersion(packageName, versionOrTag) {
|
|
26
|
+
const result = safeExecResult('npm', ['view', `${packageName}@${versionOrTag}`, 'version'], {
|
|
27
|
+
encoding: 'utf8',
|
|
28
|
+
stdio: 'pipe',
|
|
29
|
+
});
|
|
30
|
+
if (result.status !== 0) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return result.stdout.trim();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get latest version of a package from npm registry
|
|
37
|
+
*
|
|
38
|
+
* @param packageName - Package name (e.g., 'vibe-validate')
|
|
39
|
+
* @returns Latest version string
|
|
40
|
+
* @throws Error if package not found or registry unreachable
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const version = getLatestVersion('vibe-validate');
|
|
44
|
+
* console.log(version); // '0.19.0'
|
|
45
|
+
*/
|
|
46
|
+
export function getLatestVersion(packageName) {
|
|
47
|
+
const version = safeExecSync('npm', ['view', packageName, 'version'], {
|
|
48
|
+
encoding: 'utf8',
|
|
49
|
+
stdio: 'pipe',
|
|
50
|
+
});
|
|
51
|
+
return version.trim();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Check if a package version exists in npm registry
|
|
55
|
+
*
|
|
56
|
+
* @param packageName - Package name
|
|
57
|
+
* @param version - Version to check
|
|
58
|
+
* @returns True if package version exists
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* if (packageExists('vibe-validate', '0.19.0')) {
|
|
62
|
+
* console.log('Package already published');
|
|
63
|
+
* }
|
|
64
|
+
*/
|
|
65
|
+
export function packageExists(packageName, version) {
|
|
66
|
+
return getPackageVersion(packageName, version) !== null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Publish package to npm registry using pnpm
|
|
70
|
+
*
|
|
71
|
+
* @param options - Publishing options
|
|
72
|
+
* @param options.cwd - Package directory to publish from
|
|
73
|
+
* @param options.tag - Dist tag (e.g., 'latest', 'rc', 'dev')
|
|
74
|
+
* @param options.stdio - How to handle stdio streams
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* publishPackage({
|
|
78
|
+
* cwd: '/path/to/package',
|
|
79
|
+
* tag: 'latest',
|
|
80
|
+
* stdio: 'inherit'
|
|
81
|
+
* });
|
|
82
|
+
*/
|
|
83
|
+
export function publishPackage(options) {
|
|
84
|
+
safeExecSync('pnpm', ['publish', '--no-git-checks', '--tag', options.tag], {
|
|
85
|
+
stdio: options.stdio ?? 'pipe',
|
|
86
|
+
cwd: options.cwd,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Add dist tag to published package
|
|
91
|
+
*
|
|
92
|
+
* @param packageName - Full package name (e.g., '@vibe-validate/core')
|
|
93
|
+
* @param version - Version to tag
|
|
94
|
+
* @param tag - Tag name (e.g., 'latest', 'rc')
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* addDistTag('@vibe-validate/core', '0.19.0', 'latest');
|
|
98
|
+
*/
|
|
99
|
+
export function addDistTag(packageName, version, tag) {
|
|
100
|
+
safeExecSync('npm', ['dist-tag', 'add', `${packageName}@${version}`, tag], {
|
|
101
|
+
stdio: 'pipe',
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Unpublish package version from npm registry
|
|
106
|
+
*
|
|
107
|
+
* @param packageName - Full package name
|
|
108
|
+
* @param version - Version to unpublish
|
|
109
|
+
* @returns True if successful, false if failed
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* if (unpublishPackage('@vibe-validate/core', '0.19.0-rc.1')) {
|
|
113
|
+
* console.log('Successfully unpublished');
|
|
114
|
+
* }
|
|
115
|
+
*/
|
|
116
|
+
export function unpublishPackage(packageName, version) {
|
|
117
|
+
const result = safeExecResult('npm', ['unpublish', `${packageName}@${version}`, '--force'], {
|
|
118
|
+
stdio: 'pipe',
|
|
119
|
+
});
|
|
120
|
+
return result.status === 0;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Deprecate package version on npm registry
|
|
124
|
+
*
|
|
125
|
+
* @param packageName - Full package name
|
|
126
|
+
* @param version - Version to deprecate
|
|
127
|
+
* @param message - Deprecation message
|
|
128
|
+
* @returns True if successful, false if failed
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* deprecatePackage(
|
|
132
|
+
* '@vibe-validate/core',
|
|
133
|
+
* '0.19.0-rc.1',
|
|
134
|
+
* 'Use 0.19.0 instead'
|
|
135
|
+
* );
|
|
136
|
+
*/
|
|
137
|
+
export function deprecatePackage(packageName, version, message) {
|
|
138
|
+
const result = safeExecResult('npm', ['deprecate', `${packageName}@${version}`, message], {
|
|
139
|
+
stdio: 'pipe',
|
|
140
|
+
});
|
|
141
|
+
return result.status === 0;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Install npm package from tarball
|
|
145
|
+
*
|
|
146
|
+
* @param tarballPath - Path to tarball file
|
|
147
|
+
* @param targetDir - Directory to install into
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* installPackage(
|
|
151
|
+
* '/tmp/vibe-validate-0.19.0.tgz',
|
|
152
|
+
* '/tmp/test-install'
|
|
153
|
+
* );
|
|
154
|
+
*/
|
|
155
|
+
export function installPackage(tarballPath, targetDir) {
|
|
156
|
+
safeExecSync('npm', ['install', tarballPath], {
|
|
157
|
+
cwd: targetDir,
|
|
158
|
+
stdio: 'pipe',
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Execute pnpm command with arguments
|
|
163
|
+
*
|
|
164
|
+
* Use this for pnpm commands not covered by specific functions above.
|
|
165
|
+
*
|
|
166
|
+
* @param args - Command arguments
|
|
167
|
+
* @param options - Execution options
|
|
168
|
+
* @returns Command output
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* // Run pnpm validate
|
|
172
|
+
* executePnpmCommand(['validate'], {
|
|
173
|
+
* cwd: projectRoot,
|
|
174
|
+
* stdio: 'inherit'
|
|
175
|
+
* });
|
|
176
|
+
*/
|
|
177
|
+
export function executePnpmCommand(args, options) {
|
|
178
|
+
const execOptions = {
|
|
179
|
+
encoding: 'utf8',
|
|
180
|
+
stdio: options?.stdio ?? 'pipe',
|
|
181
|
+
cwd: options?.cwd,
|
|
182
|
+
timeout: options?.timeout,
|
|
183
|
+
env: options?.env,
|
|
184
|
+
};
|
|
185
|
+
return safeExecSync('pnpm', args, execOptions);
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=package-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../src/package-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,YAAoB;IACzE,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,GAAG,WAAW,IAAI,YAAY,EAAE,EAAE,SAAS,CAAC,EAAE;QAC1F,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,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AAG,WAAW,IAAI,OAAO,EAAE,EAAE,SAAS,CAAC,EAAE;QAC1F,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB,EAAE,OAAe,EAAE,OAAe;IACpF,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,GAAG,WAAW,IAAI,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE;QACxF,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,WAAmB,EAAE,SAAiB;IACnE,YAAY,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE;QAC5C,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAc,EAAE,OAA+B;IAChF,MAAM,WAAW,GAAG;QAClB,QAAQ,EAAE,MAAe;QACzB,KAAK,EAAE,OAAO,EAAE,KAAK,IAAK,MAAgB;QAC1C,GAAG,EAAE,OAAO,EAAE,GAAG;QACjB,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,GAAG,EAAE,OAAO,EAAE,GAAG;KAClB,CAAC;IAEF,OAAO,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAW,CAAC;AAC3D,CAAC"}
|
package/dist/safe-exec.js
CHANGED
|
@@ -371,10 +371,10 @@ export function safeExecFromString(commandString, options = {}) {
|
|
|
371
371
|
// This prevents subtle bugs where shell features are expected but not executed
|
|
372
372
|
const check = hasShellSyntax(commandString);
|
|
373
373
|
if (check.hasShellSyntax) {
|
|
374
|
-
throw new Error(`safeExecFromString does not support ${check.pattern}.\n` +
|
|
374
|
+
throw new Error(`safeExecFromString does not support ${check.pattern ?? 'shell syntax'}.\n` +
|
|
375
375
|
`Found in: ${commandString}\n\n` +
|
|
376
376
|
`Use safeExecSync() with explicit argument array instead:\n` +
|
|
377
|
-
` // Bad: safeExecFromString('${check.example}')\n` +
|
|
377
|
+
` // Bad: safeExecFromString('${check.example ?? commandString}')\n` +
|
|
378
378
|
` // Good: safeExecSync('command', ['arg1', 'arg2'], options)\n\n` +
|
|
379
379
|
`This ensures no shell interpreter is used and arguments are explicit.`);
|
|
380
380
|
}
|
package/dist/safe-exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-exec.js","sourceRoot":"","sources":["../src/safe-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAkC1B;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9B,MAAM,CAAS;IACf,MAAM,CAAkB;IACxB,MAAM,CAAkB;IAExC,YACE,OAAe,EACf,MAAc,EACd,MAAuB,EACvB,MAAuB;QAEvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAS,cAAc,CAAC,WAAmB;IACzC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yFAAyF;IACzF,4FAA4F;IAC5F,yDAAyD;IACzD,2EAA2E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AC1E,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE5B,OAAO,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-validate/utils",
|
|
3
|
-
"version": "0.19.0-rc.
|
|
3
|
+
"version": "0.19.0-rc.10",
|
|
4
4
|
"description": "Common utilities for vibe-validate packages (command execution, path normalization)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsc",
|
|
53
|
-
"clean": "rm -rf dist",
|
|
54
53
|
"test": "vitest run",
|
|
55
54
|
"test:watch": "vitest"
|
|
56
55
|
}
|