@vibe-validate/utils 0.19.0-rc.6 → 0.19.0-rc.9
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 +129 -0
- package/dist/dependency-lock-check.d.ts.map +1 -0
- package/dist/dependency-lock-check.js +295 -0
- package/dist/dependency-lock-check.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
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 = 'npm-link' | '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
|
+
/** List of linked packages (if npm link detected) */
|
|
26
|
+
linkedPackages?: string[];
|
|
27
|
+
/** Error message if check failed */
|
|
28
|
+
error?: string;
|
|
29
|
+
/** Package manager used for check */
|
|
30
|
+
packageManager?: PackageManager;
|
|
31
|
+
/** Command executed for verification */
|
|
32
|
+
command?: string;
|
|
33
|
+
/** Duration of check in milliseconds */
|
|
34
|
+
duration: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Detect package manager from git root directory
|
|
38
|
+
*
|
|
39
|
+
* Detection strategy:
|
|
40
|
+
* 1. Check config override first (if provided)
|
|
41
|
+
* 2. Read package.json for packageManager field
|
|
42
|
+
* 3. Check for lock files in priority order (bun → yarn → pnpm → npm)
|
|
43
|
+
*
|
|
44
|
+
* @param gitRoot - Git repository root path
|
|
45
|
+
* @param configPackageManager - Optional package manager from config
|
|
46
|
+
* @returns Detected package manager or null if none found
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* const pm = detectPackageManager('/path/to/repo');
|
|
50
|
+
* console.log(pm); // 'pnpm' or 'npm' or null
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // With config override
|
|
54
|
+
* const pm = detectPackageManager('/path/to/repo', 'yarn');
|
|
55
|
+
* console.log(pm); // 'yarn'
|
|
56
|
+
*/
|
|
57
|
+
export declare function detectPackageManager(gitRoot: string, configPackageManager?: PackageManager): PackageManager | null;
|
|
58
|
+
/**
|
|
59
|
+
* Detect linked packages (npm link) in node_modules
|
|
60
|
+
*
|
|
61
|
+
* Uses lstatSync to check for symlinks (cross-platform, works on Windows).
|
|
62
|
+
* Checks both top-level entries and scoped packages (@org/package).
|
|
63
|
+
*
|
|
64
|
+
* @param gitRoot - Git repository root path
|
|
65
|
+
* @returns Array of linked package names
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* const linked = detectLinkedPackages('/path/to/repo');
|
|
69
|
+
* console.log(linked); // ['my-package', '@org/other-package']
|
|
70
|
+
*/
|
|
71
|
+
export declare function detectLinkedPackages(gitRoot: string): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Build install command for package manager
|
|
74
|
+
*
|
|
75
|
+
* If custom command provided, parses into array format.
|
|
76
|
+
* Otherwise, returns appropriate frozen lockfile command:
|
|
77
|
+
* - npm: npm ci
|
|
78
|
+
* - pnpm: pnpm install --frozen-lockfile
|
|
79
|
+
* - yarn: yarn install --immutable
|
|
80
|
+
* - bun: bun install --frozen-lockfile
|
|
81
|
+
*
|
|
82
|
+
* @param packageManager - Package manager to build command for
|
|
83
|
+
* @param customCommand - Optional custom command string
|
|
84
|
+
* @returns Command array [command, ...args]
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* const cmd = buildInstallCommand('npm');
|
|
88
|
+
* console.log(cmd); // ['npm', 'ci']
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* const cmd = buildInstallCommand('npm', 'npm ci --legacy-peer-deps');
|
|
92
|
+
* console.log(cmd); // ['npm', 'ci', '--legacy-peer-deps']
|
|
93
|
+
*/
|
|
94
|
+
export declare function buildInstallCommand(packageManager: PackageManager, customCommand?: string): string[];
|
|
95
|
+
/**
|
|
96
|
+
* Run dependency lock file verification
|
|
97
|
+
*
|
|
98
|
+
* Checks that lock file is in sync with package.json by running
|
|
99
|
+
* the package manager's install command with frozen lockfile flag.
|
|
100
|
+
*
|
|
101
|
+
* Skip conditions:
|
|
102
|
+
* - VV_SKIP_DEPENDENCY_CHECK env var is set
|
|
103
|
+
* - npm link detected (linked packages present)
|
|
104
|
+
*
|
|
105
|
+
* @param gitRoot - Git repository root path
|
|
106
|
+
* @param config - Configuration object
|
|
107
|
+
* @param config.packageManager - Optional package manager override
|
|
108
|
+
* @param config.command - Optional custom verification command
|
|
109
|
+
* @param verbose - Enable verbose output
|
|
110
|
+
* @returns Dependency check result
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* const result = await runDependencyCheck('/path/to/repo', {}, false);
|
|
114
|
+
* if (!result.passed) {
|
|
115
|
+
* console.error(result.error);
|
|
116
|
+
* }
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* // With custom command
|
|
120
|
+
* const result = await runDependencyCheck('/path/to/repo', {
|
|
121
|
+
* packageManager: 'npm',
|
|
122
|
+
* command: 'npm ci --legacy-peer-deps'
|
|
123
|
+
* }, true);
|
|
124
|
+
*/
|
|
125
|
+
export declare function runDependencyCheck(gitRoot: string, config: {
|
|
126
|
+
packageManager?: PackageManager;
|
|
127
|
+
command?: string;
|
|
128
|
+
}, verbose: boolean): Promise<DependencyCheckResult>;
|
|
129
|
+
//# 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,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;AAEjE;;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,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,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;AAkCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA+B9D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,cAAc,EAC9B,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,EAAE,CAiBV;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;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,CA0FhC"}
|
|
@@ -0,0 +1,295 @@
|
|
|
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, lstatSync, readdirSync, 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
|
+
* Check if path is a symlink (safe, ignores errors)
|
|
77
|
+
*/
|
|
78
|
+
function isSymlink(path) {
|
|
79
|
+
try {
|
|
80
|
+
return lstatSync(path).isSymbolicLink();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Find linked packages in scoped directory (@org/*)
|
|
88
|
+
*/
|
|
89
|
+
function findScopedLinkedPackages(scopePath, scopeName) {
|
|
90
|
+
const linked = [];
|
|
91
|
+
try {
|
|
92
|
+
const scopedEntries = readdirSync(scopePath, { withFileTypes: true });
|
|
93
|
+
for (const scopedEntry of scopedEntries) {
|
|
94
|
+
const scopedPath = join(scopePath, scopedEntry.name);
|
|
95
|
+
if (isSymlink(scopedPath)) {
|
|
96
|
+
linked.push(`${scopeName}/${scopedEntry.name}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// Ignore readdir errors for scoped directory
|
|
102
|
+
}
|
|
103
|
+
return linked;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Detect linked packages (npm link) in node_modules
|
|
107
|
+
*
|
|
108
|
+
* Uses lstatSync to check for symlinks (cross-platform, works on Windows).
|
|
109
|
+
* Checks both top-level entries and scoped packages (@org/package).
|
|
110
|
+
*
|
|
111
|
+
* @param gitRoot - Git repository root path
|
|
112
|
+
* @returns Array of linked package names
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* const linked = detectLinkedPackages('/path/to/repo');
|
|
116
|
+
* console.log(linked); // ['my-package', '@org/other-package']
|
|
117
|
+
*/
|
|
118
|
+
export function detectLinkedPackages(gitRoot) {
|
|
119
|
+
const nodeModulesPath = join(gitRoot, 'node_modules');
|
|
120
|
+
if (!existsSync(nodeModulesPath)) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
const linkedPackages = [];
|
|
124
|
+
try {
|
|
125
|
+
const entries = readdirSync(nodeModulesPath, { withFileTypes: true });
|
|
126
|
+
for (const entry of entries) {
|
|
127
|
+
const entryPath = join(nodeModulesPath, entry.name);
|
|
128
|
+
// Check if top-level entry is a symlink
|
|
129
|
+
if (isSymlink(entryPath)) {
|
|
130
|
+
linkedPackages.push(entry.name);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
// Check scoped packages (@org/package)
|
|
134
|
+
if (entry.name.startsWith('@') && entry.isDirectory()) {
|
|
135
|
+
const scopedLinked = findScopedLinkedPackages(entryPath, entry.name);
|
|
136
|
+
linkedPackages.push(...scopedLinked);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// Ignore readdir errors for node_modules
|
|
142
|
+
}
|
|
143
|
+
return linkedPackages;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Build install command for package manager
|
|
147
|
+
*
|
|
148
|
+
* If custom command provided, parses into array format.
|
|
149
|
+
* Otherwise, returns appropriate frozen lockfile command:
|
|
150
|
+
* - npm: npm ci
|
|
151
|
+
* - pnpm: pnpm install --frozen-lockfile
|
|
152
|
+
* - yarn: yarn install --immutable
|
|
153
|
+
* - bun: bun install --frozen-lockfile
|
|
154
|
+
*
|
|
155
|
+
* @param packageManager - Package manager to build command for
|
|
156
|
+
* @param customCommand - Optional custom command string
|
|
157
|
+
* @returns Command array [command, ...args]
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* const cmd = buildInstallCommand('npm');
|
|
161
|
+
* console.log(cmd); // ['npm', 'ci']
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* const cmd = buildInstallCommand('npm', 'npm ci --legacy-peer-deps');
|
|
165
|
+
* console.log(cmd); // ['npm', 'ci', '--legacy-peer-deps']
|
|
166
|
+
*/
|
|
167
|
+
export function buildInstallCommand(packageManager, customCommand) {
|
|
168
|
+
// Parse custom command if provided
|
|
169
|
+
if (customCommand) {
|
|
170
|
+
return customCommand.trim().split(/\s+/);
|
|
171
|
+
}
|
|
172
|
+
// Return frozen lockfile command for package manager
|
|
173
|
+
switch (packageManager) {
|
|
174
|
+
case 'npm':
|
|
175
|
+
return ['npm', 'ci'];
|
|
176
|
+
case 'pnpm':
|
|
177
|
+
return ['pnpm', 'install', '--frozen-lockfile'];
|
|
178
|
+
case 'yarn':
|
|
179
|
+
return ['yarn', 'install', '--immutable'];
|
|
180
|
+
case 'bun':
|
|
181
|
+
return ['bun', 'install', '--frozen-lockfile'];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Run dependency lock file verification
|
|
186
|
+
*
|
|
187
|
+
* Checks that lock file is in sync with package.json by running
|
|
188
|
+
* the package manager's install command with frozen lockfile flag.
|
|
189
|
+
*
|
|
190
|
+
* Skip conditions:
|
|
191
|
+
* - VV_SKIP_DEPENDENCY_CHECK env var is set
|
|
192
|
+
* - npm link detected (linked packages present)
|
|
193
|
+
*
|
|
194
|
+
* @param gitRoot - Git repository root path
|
|
195
|
+
* @param config - Configuration object
|
|
196
|
+
* @param config.packageManager - Optional package manager override
|
|
197
|
+
* @param config.command - Optional custom verification command
|
|
198
|
+
* @param verbose - Enable verbose output
|
|
199
|
+
* @returns Dependency check result
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* const result = await runDependencyCheck('/path/to/repo', {}, false);
|
|
203
|
+
* if (!result.passed) {
|
|
204
|
+
* console.error(result.error);
|
|
205
|
+
* }
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* // With custom command
|
|
209
|
+
* const result = await runDependencyCheck('/path/to/repo', {
|
|
210
|
+
* packageManager: 'npm',
|
|
211
|
+
* command: 'npm ci --legacy-peer-deps'
|
|
212
|
+
* }, true);
|
|
213
|
+
*/
|
|
214
|
+
export async function runDependencyCheck(gitRoot, config, verbose) {
|
|
215
|
+
const startTime = Date.now();
|
|
216
|
+
// Check for skip env var
|
|
217
|
+
if (process.env.VV_SKIP_DEPENDENCY_CHECK) {
|
|
218
|
+
return {
|
|
219
|
+
passed: true,
|
|
220
|
+
skipped: true,
|
|
221
|
+
skipReason: 'env-var',
|
|
222
|
+
duration: Date.now() - startTime,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// Detect linked packages
|
|
226
|
+
const linkedPackages = detectLinkedPackages(gitRoot);
|
|
227
|
+
if (linkedPackages.length > 0) {
|
|
228
|
+
if (verbose) {
|
|
229
|
+
console.warn(`⚠️ npm link detected (${linkedPackages.length} packages), skipping lock file check`);
|
|
230
|
+
console.warn(` Linked: ${linkedPackages.join(', ')}`);
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
passed: true,
|
|
234
|
+
skipped: true,
|
|
235
|
+
skipReason: 'npm-link',
|
|
236
|
+
linkedPackages,
|
|
237
|
+
duration: Date.now() - startTime,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
// Detect package manager
|
|
241
|
+
const packageManager = detectPackageManager(gitRoot, config.packageManager);
|
|
242
|
+
if (!packageManager) {
|
|
243
|
+
return {
|
|
244
|
+
passed: false,
|
|
245
|
+
skipped: false,
|
|
246
|
+
error: 'No package manager detected (no lock file found)',
|
|
247
|
+
duration: Date.now() - startTime,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
// Verify lock file exists
|
|
251
|
+
const lockFile = join(gitRoot, LOCK_FILES[packageManager]);
|
|
252
|
+
if (!existsSync(lockFile)) {
|
|
253
|
+
return {
|
|
254
|
+
passed: false,
|
|
255
|
+
skipped: false,
|
|
256
|
+
error: `No lock file found for detected package manager (${packageManager})`,
|
|
257
|
+
packageManager,
|
|
258
|
+
duration: Date.now() - startTime,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
// Build and execute install command
|
|
262
|
+
const commandArray = buildInstallCommand(packageManager, config.command);
|
|
263
|
+
const commandString = commandArray.join(' ');
|
|
264
|
+
if (verbose) {
|
|
265
|
+
console.log(`🔍 Verifying lock file with: ${commandString}`);
|
|
266
|
+
}
|
|
267
|
+
const result = safeExecResult(commandArray[0], commandArray.slice(1), {
|
|
268
|
+
cwd: gitRoot,
|
|
269
|
+
encoding: 'utf8',
|
|
270
|
+
});
|
|
271
|
+
const duration = Date.now() - startTime;
|
|
272
|
+
if (result.status === 0) {
|
|
273
|
+
if (verbose) {
|
|
274
|
+
console.log('✅ Lock file verification passed');
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
passed: true,
|
|
278
|
+
skipped: false,
|
|
279
|
+
packageManager,
|
|
280
|
+
command: commandString,
|
|
281
|
+
duration,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
// Command failed - lock file out of sync
|
|
285
|
+
const stderr = typeof result.stderr === 'string' ? result.stderr : result.stderr.toString();
|
|
286
|
+
return {
|
|
287
|
+
passed: false,
|
|
288
|
+
skipped: false,
|
|
289
|
+
error: `Lock file verification failed: ${stderr.trim()}`,
|
|
290
|
+
packageManager,
|
|
291
|
+
command: commandString,
|
|
292
|
+
duration,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
//# 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,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkChD;;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;;;;;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Tmpdir, mkdirSyncReal, normalizePath, toForwardSlash } from './path-helpers.js';
|
|
11
11
|
export { isProcessRunning } from './process-check.js';
|
|
12
12
|
export { getPackageVersion, getLatestVersion, packageExists, publishPackage, addDistTag, unpublishPackage, deprecatePackage, installPackage, executePnpmCommand, type PackageManagerOptions } from './package-manager.js';
|
|
13
|
+
export { detectPackageManager, detectLinkedPackages, buildInstallCommand, runDependencyCheck, type PackageManager, type DependencyCheckResult } from './dependency-lock-check.js';
|
|
13
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;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"}
|
|
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,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,4 +14,6 @@ export { normalizedTmpdir, mkdirSyncReal, normalizePath, toForwardSlash } from '
|
|
|
14
14
|
export { isProcessRunning } from './process-check.js';
|
|
15
15
|
// Package management (npm/pnpm commands)
|
|
16
16
|
export { getPackageVersion, getLatestVersion, packageExists, publishPackage, addDistTag, unpublishPackage, deprecatePackage, installPackage, executePnpmCommand } from './package-manager.js';
|
|
17
|
+
// Dependency lock file verification
|
|
18
|
+
export { detectPackageManager, detectLinkedPackages, buildInstallCommand, runDependencyCheck } from './dependency-lock-check.js';
|
|
17
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;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"}
|
|
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,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAGnB,MAAM,4BAA4B,CAAC"}
|
package/package.json
CHANGED