@bobfrankston/npmglobalize 1.0.200 → 1.0.202
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/cli.js +5 -0
- package/lib.js +71 -61
- package/package.json +3 -3
- package/lib/config.d.ts +0 -23
- package/lib/config.js +0 -163
- package/lib/deps.d.ts +0 -42
- package/lib/deps.js +0 -298
- package/lib/git.d.ts +0 -91
- package/lib/git.js +0 -748
- package/lib/ignore.d.ts +0 -24
- package/lib/ignore.js +0 -346
- package/lib/npm.d.ts +0 -33
- package/lib/npm.js +0 -306
- package/lib/types.d.ts +0 -135
- package/lib/types.js +0 -80
package/cli.js
CHANGED
|
@@ -112,6 +112,7 @@ Other Options:
|
|
|
112
112
|
-force Continue despite git errors
|
|
113
113
|
-dry-run Preview what would happen
|
|
114
114
|
-quiet Suppress npm warnings (default)
|
|
115
|
+
-noquiet Show npm warnings (without -verbose's extra detail)
|
|
115
116
|
-verbose Show detailed output
|
|
116
117
|
-conform Update .gitignore/.npmignore to best practices
|
|
117
118
|
(noEmit projects: removes TS ignores from .npmignore)
|
|
@@ -268,6 +269,10 @@ function parseArgs(args) {
|
|
|
268
269
|
case '-quiet':
|
|
269
270
|
options.quiet = true;
|
|
270
271
|
break;
|
|
272
|
+
case '-noquiet':
|
|
273
|
+
options.quiet = false;
|
|
274
|
+
options.explicitKeys.add('quiet');
|
|
275
|
+
break;
|
|
271
276
|
case '-verbose':
|
|
272
277
|
options.verbose = true;
|
|
273
278
|
options.quiet = false;
|
package/lib.js
CHANGED
|
@@ -219,6 +219,33 @@ export function readConfig(dir) {
|
|
|
219
219
|
return {};
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
+
/** Inline comments for boolean settings in .globalize.json5. Value-aware: a
|
|
223
|
+
* negated setting must not read as though it still does the thing (a
|
|
224
|
+
* `"quiet": false` line saying "Suppress npm warnings" describes the
|
|
225
|
+
* opposite of what it does). */
|
|
226
|
+
const BOOL_COMMENTS = {
|
|
227
|
+
install: { on: 'Auto-install globally after publish (from registry)', off: 'Do NOT auto-install globally after publish' },
|
|
228
|
+
link: { on: 'Install globally via symlink (npm install -g .)', off: 'Do NOT install globally via symlink' },
|
|
229
|
+
wsl: { on: 'Also install in WSL', off: 'Do NOT install in WSL' },
|
|
230
|
+
files: { on: 'Restore file: paths after publish', off: 'Leave npm versions in package.json after publish' },
|
|
231
|
+
force: { on: 'Continue despite git errors', off: 'Stop on git errors' },
|
|
232
|
+
quiet: { on: 'Suppress npm warnings', off: 'Show npm warnings' },
|
|
233
|
+
verbose: { on: 'Show detailed output', off: 'Normal output detail' },
|
|
234
|
+
fix: { on: 'Auto-run npm audit fix', off: 'Do NOT run npm audit fix' },
|
|
235
|
+
local: { on: 'Local install only (skip transform/publish)', off: 'Normal transform/publish flow' },
|
|
236
|
+
noPublish: { on: 'Transform but don\'t publish', off: 'Publish normally' },
|
|
237
|
+
freeze: { on: 'Freeze node_modules (replace symlinks with real copies)', off: 'Leave node_modules symlinks as-is' },
|
|
238
|
+
usePaths: { on: 'Resolve file: deps from sibling checkouts', off: 'Resolve file: deps from npm, not siblings (standalone package)' },
|
|
239
|
+
allowTs: { on: 'Keep .ts source (and *.map, tsconfig.json) in the published npm tarball', off: 'Strip .ts source from the published npm tarball' },
|
|
240
|
+
importgen: { on: 'Regenerate browser import maps', off: 'Never ask about importgen here' }
|
|
241
|
+
};
|
|
242
|
+
/** Inline comments for settings whose value isn't a plain boolean. */
|
|
243
|
+
const VALUE_COMMENTS = {
|
|
244
|
+
gitVisibility: 'private (default) or public',
|
|
245
|
+
npmVisibility: 'private (default) or public',
|
|
246
|
+
bump: 'patch (default), minor, or major',
|
|
247
|
+
subProjects: 'Sub-dirs with their own tsconfig that build must compile (false = never ask)'
|
|
248
|
+
};
|
|
222
249
|
/** Write .globalize.json5 config file */
|
|
223
250
|
export function writeConfig(dir, config, explicitKeys) {
|
|
224
251
|
const configPath = path.join(dir, '.globalize.json5');
|
|
@@ -284,68 +311,51 @@ export function writeConfig(dir, config, explicitKeys) {
|
|
|
284
311
|
}
|
|
285
312
|
const jsonValue = typeof value === 'string' ? `"${value}"` : JSON.stringify(value);
|
|
286
313
|
const comma = ','; // JSON5 allows trailing commas
|
|
287
|
-
// Add inline comment for clarity
|
|
314
|
+
// Add inline comment for clarity, keyed off the actual value so a
|
|
315
|
+
// negated boolean doesn't describe the behaviour it turns off.
|
|
288
316
|
let comment = '';
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
else if (key
|
|
294
|
-
comment =
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
comment =
|
|
299
|
-
|
|
300
|
-
comment = ' // Suppress npm warnings';
|
|
301
|
-
else if (key === 'verbose')
|
|
302
|
-
comment = ' // Show detailed output';
|
|
303
|
-
else if (key === 'gitVisibility')
|
|
304
|
-
comment = ' // private (default) or public';
|
|
305
|
-
else if (key === 'npmVisibility')
|
|
306
|
-
comment = ' // private (default) or public';
|
|
307
|
-
else if (key === 'bump')
|
|
308
|
-
comment = ' // patch (default), minor, or major';
|
|
309
|
-
else if (key === 'fix')
|
|
310
|
-
comment = ' // Auto-run npm audit fix';
|
|
311
|
-
else if (key === 'local')
|
|
312
|
-
comment = ' // Local install only (skip transform/publish)';
|
|
313
|
-
else if (key === 'noPublish')
|
|
314
|
-
comment = ' // Transform but don\'t publish';
|
|
315
|
-
else if (key === 'freeze')
|
|
316
|
-
comment = ' // Freeze node_modules (replace symlinks with real copies)';
|
|
317
|
-
else if (key === 'usePaths')
|
|
318
|
-
comment = ' // Resolve file: deps from sibling checkouts (set false for standalone packages)';
|
|
319
|
-
else if (key === 'allowTs')
|
|
320
|
-
comment = ' // Keep .ts source (and *.map, tsconfig.json) in the published npm tarball';
|
|
321
|
-
else if (key === 'importgen')
|
|
322
|
-
comment = ' // Regenerate browser import maps (false = never ask about importgen here)';
|
|
323
|
-
else if (key === 'subProjects')
|
|
324
|
-
comment = ' // Sub-dirs with their own tsconfig that build must compile (false = never ask)';
|
|
317
|
+
const boolComment = BOOL_COMMENTS[key];
|
|
318
|
+
if (boolComment && typeof value === 'boolean') {
|
|
319
|
+
comment = ` // ${value ? boolComment.on : boolComment.off}`;
|
|
320
|
+
}
|
|
321
|
+
else if (VALUE_COMMENTS[key]) {
|
|
322
|
+
comment = ` // ${VALUE_COMMENTS[key]}`;
|
|
323
|
+
}
|
|
324
|
+
else if (boolComment) {
|
|
325
|
+
// Non-boolean value for a normally-boolean key (e.g. subProjects: ["Sw"])
|
|
326
|
+
comment = ` // ${boolComment.on}`;
|
|
327
|
+
}
|
|
325
328
|
lines.push(` "${key}": ${jsonValue}${comma}${comment}`);
|
|
326
329
|
});
|
|
327
330
|
lines.push('');
|
|
328
331
|
}
|
|
329
|
-
// Add commented reference for all options
|
|
332
|
+
// Add commented reference for all options. Booleans are phrased "true = ..."
|
|
333
|
+
// so the description reads correctly next to a default of false.
|
|
330
334
|
lines.push(' // Defaults (omitted above):');
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
335
|
+
const reference = [
|
|
336
|
+
['"bump": "patch"', 'Version bump: patch, minor, major'],
|
|
337
|
+
['"install": false', 'true = auto-install globally after publish (from registry)'],
|
|
338
|
+
['"link": false', 'true = install globally via symlink (npm install -g .)'],
|
|
339
|
+
['"wsl": false', 'true = also install in WSL'],
|
|
340
|
+
['"files": true', 'true = restore file: paths after publish; false = leave npm versions in package.json'],
|
|
341
|
+
['"force": false', 'true = continue despite git errors'],
|
|
342
|
+
['"quiet": true', 'true = suppress npm warnings'],
|
|
343
|
+
['"verbose": false', 'true = show detailed output'],
|
|
344
|
+
['"gitVisibility": "private"', 'Git repo: private or public'],
|
|
345
|
+
['"npmVisibility": "private"', 'npm package: private or public'],
|
|
346
|
+
['"fix": false', 'true = auto-run npm audit fix'],
|
|
347
|
+
['"local": false', 'true = local install only (skip transform/publish)'],
|
|
348
|
+
['"noPublish": false', 'true = transform but don\'t publish'],
|
|
349
|
+
['"freeze": false', 'true = freeze node_modules (replace symlinks with real copies)'],
|
|
350
|
+
['"usePaths": true', 'true = resolve file: deps from siblings; false = use latest npm version (standalone)'],
|
|
351
|
+
['"allowTs": false', 'true = include .ts source in npm tarball (auto-true for noEmit projects)'],
|
|
352
|
+
['"importgen": auto', 'Detected from .vscode/tasks.json / import map in HTML; false = never ask'],
|
|
353
|
+
['"subProjects": auto', 'Sub-dirs with their own tsconfig (e.g. ["Sw"]); detected from .vscode/tasks.json; false = never ask']
|
|
354
|
+
];
|
|
355
|
+
const refWidth = Math.max(...reference.map(([decl]) => decl.length));
|
|
356
|
+
for (const [decl, note] of reference) {
|
|
357
|
+
lines.push(` // ${decl.padEnd(refWidth)} // ${note}`);
|
|
358
|
+
}
|
|
349
359
|
lines.push('}');
|
|
350
360
|
fs.writeFileSync(configPath, lines.join('\n') + '\n');
|
|
351
361
|
}
|
|
@@ -5334,9 +5344,9 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
5334
5344
|
if (configOptions.link)
|
|
5335
5345
|
settings.push('--link');
|
|
5336
5346
|
if (configOptions.npmVisibility)
|
|
5337
|
-
settings.push(
|
|
5347
|
+
settings.push(`-npm ${configOptions.npmVisibility}`);
|
|
5338
5348
|
if (configOptions.gitVisibility)
|
|
5339
|
-
settings.push(
|
|
5349
|
+
settings.push(`-git ${configOptions.gitVisibility}`);
|
|
5340
5350
|
if (configOptions.conform)
|
|
5341
5351
|
settings.push('--conform');
|
|
5342
5352
|
if (configOptions.asis)
|
|
@@ -5358,15 +5368,15 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
5358
5368
|
if (configOptions.dryRun)
|
|
5359
5369
|
settings.push('--dry-run');
|
|
5360
5370
|
if (configOptions.bump)
|
|
5361
|
-
settings.push(
|
|
5371
|
+
settings.push(`-${configOptions.bump}`);
|
|
5362
5372
|
if (configOptions.cleanup)
|
|
5363
5373
|
settings.push('--cleanup');
|
|
5364
5374
|
if (configOptions.wsl)
|
|
5365
5375
|
settings.push('--wsl');
|
|
5366
5376
|
if (configOptions.files === false)
|
|
5367
|
-
settings.push('
|
|
5377
|
+
settings.push('-nofiles');
|
|
5368
5378
|
if (configOptions.quiet === false)
|
|
5369
|
-
settings.push('
|
|
5379
|
+
settings.push('-noquiet');
|
|
5370
5380
|
if (configOptions.publishDeps === false)
|
|
5371
5381
|
settings.push('--no-publish-deps');
|
|
5372
5382
|
if (configOptions.forcePublish)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/npmglobalize",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.202",
|
|
4
4
|
"description": "Transform file: dependencies to npm versions for publishing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@bobfrankston/freezepak": "^0.1.9",
|
|
35
|
-
"@bobfrankston/importgen": "^0.1.
|
|
35
|
+
"@bobfrankston/importgen": "^0.1.40",
|
|
36
36
|
"@bobfrankston/themecolors": "^0.1.8",
|
|
37
37
|
"@bobfrankston/userconfig": "^1.0.10",
|
|
38
38
|
"@npmcli/package-json": "^7.0.4",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
".transformedSnapshot": {
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@bobfrankston/freezepak": "^0.1.9",
|
|
63
|
-
"@bobfrankston/importgen": "^0.1.
|
|
63
|
+
"@bobfrankston/importgen": "^0.1.40",
|
|
64
64
|
"@bobfrankston/themecolors": "^0.1.8",
|
|
65
65
|
"@bobfrankston/userconfig": "^1.0.10",
|
|
66
66
|
"@npmcli/package-json": "^7.0.4",
|
package/lib/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type NpmCommonConfig } from '@bobfrankston/userconfig';
|
|
2
|
-
import { type GlobalizeOptions } from './types.js';
|
|
3
|
-
/** Read and parse package.json from a directory */
|
|
4
|
-
export declare function readPackageJson(dir: string): any;
|
|
5
|
-
/** Global npm config from %USERPROFILE%\.userconfig\npm.json5 — via @bobfrankston/userconfig */
|
|
6
|
-
export type UserNpmConfig = NpmCommonConfig;
|
|
7
|
-
/** Get the .userconfig directory path (%USERPROFILE%\.userconfig) */
|
|
8
|
-
export declare function getUserConfigDir(): string;
|
|
9
|
-
/** Read global npm config from %USERPROFILE%\.userconfig\npm.json5 */
|
|
10
|
-
export declare function readUserNpmConfig(): UserNpmConfig;
|
|
11
|
-
/** Write global npm config to %USERPROFILE%\.userconfig\npm.json5 */
|
|
12
|
-
export declare function writeUserNpmConfig(config: UserNpmConfig): void;
|
|
13
|
-
/** Read .globalize.json5 config file */
|
|
14
|
-
export declare function readConfig(dir: string): Partial<GlobalizeOptions>;
|
|
15
|
-
/** Write .globalize.json5 config file */
|
|
16
|
-
export declare function writeConfig(dir: string, config: Partial<GlobalizeOptions>, explicitKeys?: Set<string>): void;
|
|
17
|
-
/** Write package.json to a directory */
|
|
18
|
-
export declare function writePackageJson(dir: string, pkg: any): void;
|
|
19
|
-
/** Resolve a file: path to absolute path */
|
|
20
|
-
export declare function resolveFilePath(fileRef: string, baseDir: string): string;
|
|
21
|
-
/** Check if a dependency value is a file: reference */
|
|
22
|
-
export declare function isFileRef(value: string): boolean;
|
|
23
|
-
//# sourceMappingURL=config.d.ts.map
|
package/lib/config.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import JSON5 from 'json5';
|
|
4
|
-
import { readConfig as readUserConfig, writeConfig as writeUserConfig, configDir } from '@bobfrankston/userconfig';
|
|
5
|
-
/** Read and parse package.json from a directory */
|
|
6
|
-
export function readPackageJson(dir) {
|
|
7
|
-
const pkgPath = path.join(dir, 'package.json');
|
|
8
|
-
if (!fs.existsSync(pkgPath)) {
|
|
9
|
-
throw new Error(`package.json not found: ${pkgPath}`);
|
|
10
|
-
}
|
|
11
|
-
try {
|
|
12
|
-
return JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
throw new Error(`Failed to parse ${pkgPath}: ${error.message}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/** Get the .userconfig directory path (%USERPROFILE%\.userconfig) */
|
|
19
|
-
export function getUserConfigDir() {
|
|
20
|
-
return configDir;
|
|
21
|
-
}
|
|
22
|
-
/** Read global npm config from %USERPROFILE%\.userconfig\npm.json5 */
|
|
23
|
-
export function readUserNpmConfig() {
|
|
24
|
-
return readUserConfig();
|
|
25
|
-
}
|
|
26
|
-
/** Write global npm config to %USERPROFILE%\.userconfig\npm.json5 */
|
|
27
|
-
export function writeUserNpmConfig(config) {
|
|
28
|
-
const existing = readUserConfig();
|
|
29
|
-
const merged = { ...existing, ...config };
|
|
30
|
-
writeUserConfig(merged);
|
|
31
|
-
}
|
|
32
|
-
/** Read .globalize.json5 config file */
|
|
33
|
-
export function readConfig(dir) {
|
|
34
|
-
const configPath = path.join(dir, '.globalize.json5');
|
|
35
|
-
if (!fs.existsSync(configPath)) {
|
|
36
|
-
return {};
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
const content = fs.readFileSync(configPath, 'utf-8');
|
|
40
|
-
return JSON5.parse(content);
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
console.warn(`Warning: Could not parse .globalize.json5 config: ${error.message}`);
|
|
44
|
-
return {};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/** Write .globalize.json5 config file */
|
|
48
|
-
export function writeConfig(dir, config, explicitKeys) {
|
|
49
|
-
const configPath = path.join(dir, '.globalize.json5');
|
|
50
|
-
// Define defaults to omit
|
|
51
|
-
const defaults = {
|
|
52
|
-
bump: 'patch',
|
|
53
|
-
files: true,
|
|
54
|
-
quiet: true,
|
|
55
|
-
gitVisibility: 'private',
|
|
56
|
-
npmVisibility: 'private',
|
|
57
|
-
install: false,
|
|
58
|
-
wsl: false,
|
|
59
|
-
force: false,
|
|
60
|
-
verbose: false,
|
|
61
|
-
freeze: false,
|
|
62
|
-
usePaths: true
|
|
63
|
-
};
|
|
64
|
-
// Read existing config to preserve values
|
|
65
|
-
const existing = readConfig(dir);
|
|
66
|
-
// Filter out temporary flags and default values (unless explicitly set)
|
|
67
|
-
const filtered = {};
|
|
68
|
-
const omitKeys = new Set(['cleanup', 'init', 'dryRun', 'message', 'conform', 'asis', 'help', 'error', 'updateDeps', 'updateMajor', 'publishDeps', 'publicDeps', 'forcePublish', 'once', 'cleanNestedModules']);
|
|
69
|
-
for (const [key, value] of Object.entries(config)) {
|
|
70
|
-
if (omitKeys.has(key))
|
|
71
|
-
continue;
|
|
72
|
-
// Keep if: already in config, explicitly set via CLI, or differs from default
|
|
73
|
-
const isExplicit = explicitKeys?.has(key);
|
|
74
|
-
const wasInConfig = key in existing;
|
|
75
|
-
const differsFromDefault = defaults[key] !== value;
|
|
76
|
-
if (isExplicit || wasInConfig || differsFromDefault) {
|
|
77
|
-
filtered[key] = value;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// Build content with comments
|
|
81
|
-
const lines = [
|
|
82
|
-
'{',
|
|
83
|
-
' // npmglobalize configuration (JSON5 format - trailing commas OK)',
|
|
84
|
-
' // Explicitly set values are preserved here',
|
|
85
|
-
''
|
|
86
|
-
];
|
|
87
|
-
// Add configured values
|
|
88
|
-
const entries = Object.entries(filtered);
|
|
89
|
-
if (entries.length > 0) {
|
|
90
|
-
entries.forEach(([key, value]) => {
|
|
91
|
-
const jsonValue = typeof value === 'string' ? `"${value}"` : JSON.stringify(value);
|
|
92
|
-
const comma = ','; // JSON5 allows trailing commas
|
|
93
|
-
// Add inline comment for clarity
|
|
94
|
-
let comment = '';
|
|
95
|
-
if (key === 'install')
|
|
96
|
-
comment = ' // Auto-install globally after publish (from registry)';
|
|
97
|
-
else if (key === 'link')
|
|
98
|
-
comment = ' // Install globally via symlink (npm install -g .)';
|
|
99
|
-
else if (key === 'wsl')
|
|
100
|
-
comment = ' // Also install in WSL';
|
|
101
|
-
else if (key === 'files')
|
|
102
|
-
comment = ' // Keep file: paths after publish';
|
|
103
|
-
else if (key === 'force')
|
|
104
|
-
comment = ' // Continue despite git errors';
|
|
105
|
-
else if (key === 'quiet')
|
|
106
|
-
comment = ' // Suppress npm warnings';
|
|
107
|
-
else if (key === 'verbose')
|
|
108
|
-
comment = ' // Show detailed output';
|
|
109
|
-
else if (key === 'gitVisibility')
|
|
110
|
-
comment = ' // private (default) or public';
|
|
111
|
-
else if (key === 'npmVisibility')
|
|
112
|
-
comment = ' // private (default) or public';
|
|
113
|
-
else if (key === 'bump')
|
|
114
|
-
comment = ' // patch (default), minor, or major';
|
|
115
|
-
else if (key === 'fix')
|
|
116
|
-
comment = ' // Auto-run npm audit fix';
|
|
117
|
-
else if (key === 'local')
|
|
118
|
-
comment = ' // Local install only (skip transform/publish)';
|
|
119
|
-
else if (key === 'noPublish')
|
|
120
|
-
comment = ' // Transform but don\'t publish';
|
|
121
|
-
else if (key === 'freeze')
|
|
122
|
-
comment = ' // Freeze node_modules (replace symlinks with real copies)';
|
|
123
|
-
else if (key === 'usePaths')
|
|
124
|
-
comment = ' // Resolve file: deps from sibling checkouts (set false for standalone packages)';
|
|
125
|
-
lines.push(` "${key}": ${jsonValue}${comma}${comment}`);
|
|
126
|
-
});
|
|
127
|
-
lines.push('');
|
|
128
|
-
}
|
|
129
|
-
// Add commented reference for all options
|
|
130
|
-
lines.push(' // Defaults (omitted above):');
|
|
131
|
-
lines.push(' // "bump": "patch" // Version bump: patch, minor, major');
|
|
132
|
-
lines.push(' // "install": false // Auto-install globally after publish (from registry)');
|
|
133
|
-
lines.push(' // "link": false // Install globally via symlink (npm install -g .)');
|
|
134
|
-
lines.push(' // "wsl": false // Also install in WSL');
|
|
135
|
-
lines.push(' // "files": true // Keep file: paths after publish');
|
|
136
|
-
lines.push(' // "force": false // Continue despite git errors');
|
|
137
|
-
lines.push(' // "quiet": true // Suppress npm warnings');
|
|
138
|
-
lines.push(' // "verbose": false // Show detailed output');
|
|
139
|
-
lines.push(' // "gitVisibility": "private" // Git repo: private or public');
|
|
140
|
-
lines.push(' // "npmVisibility": "private" // npm package: private or public');
|
|
141
|
-
lines.push(' // "fix": false // Auto-run npm audit fix');
|
|
142
|
-
lines.push(' // "local": false // Local install only (skip transform/publish)');
|
|
143
|
-
lines.push(' // "noPublish": false // Transform but don\'t publish');
|
|
144
|
-
lines.push(' // "freeze": false // Freeze node_modules (replace symlinks with real copies)');
|
|
145
|
-
lines.push(' // "usePaths": true // Resolve file: deps from siblings; false = use latest npm version (standalone)');
|
|
146
|
-
lines.push('}');
|
|
147
|
-
fs.writeFileSync(configPath, lines.join('\n') + '\n');
|
|
148
|
-
}
|
|
149
|
-
/** Write package.json to a directory */
|
|
150
|
-
export function writePackageJson(dir, pkg) {
|
|
151
|
-
const pkgPath = path.join(dir, 'package.json');
|
|
152
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
153
|
-
}
|
|
154
|
-
/** Resolve a file: path to absolute path */
|
|
155
|
-
export function resolveFilePath(fileRef, baseDir) {
|
|
156
|
-
const relativePath = fileRef.replace(/^file:/, '');
|
|
157
|
-
return path.resolve(baseDir, relativePath);
|
|
158
|
-
}
|
|
159
|
-
/** Check if a dependency value is a file: reference */
|
|
160
|
-
export function isFileRef(value) {
|
|
161
|
-
return typeof value === 'string' && value.startsWith('file:');
|
|
162
|
-
}
|
|
163
|
-
//# sourceMappingURL=config.js.map
|
package/lib/deps.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* npmglobalize dependency analysis, transformation, and restoration.
|
|
3
|
-
* Handles file: ref discovery, workspace graphs, topological sorting,
|
|
4
|
-
* and transforming file: deps to npm versions for publishing.
|
|
5
|
-
*/
|
|
6
|
-
/** Get all file: dependencies from package.json */
|
|
7
|
-
export declare function getFileRefs(pkg: any): Map<string, {
|
|
8
|
-
key: string;
|
|
9
|
-
name: string;
|
|
10
|
-
value: string;
|
|
11
|
-
}>;
|
|
12
|
-
/** Resolve workspace entries to package info. Skips dirs without package.json or with private:true. */
|
|
13
|
-
export declare function resolveWorkspacePackages(rootDir: string): Array<{
|
|
14
|
-
name: string;
|
|
15
|
-
dir: string;
|
|
16
|
-
pkg: any;
|
|
17
|
-
}>;
|
|
18
|
-
/** Build a dependency graph among workspace packages. Returns Map<name, Set<depName>>. */
|
|
19
|
-
export declare function buildDependencyGraph(packages: Array<{
|
|
20
|
-
name: string;
|
|
21
|
-
dir: string;
|
|
22
|
-
pkg: any;
|
|
23
|
-
}>): Map<string, Set<string>>;
|
|
24
|
-
/** Topological sort with cycle detection. Returns package names in dependency order. */
|
|
25
|
-
export declare function topologicalSort(graph: Map<string, Set<string>>): string[];
|
|
26
|
-
/** Transform file: dependencies to npm versions */
|
|
27
|
-
export declare function transformDeps(pkg: any, baseDir: string, verbose?: boolean, forcePublish?: boolean): {
|
|
28
|
-
transformed: boolean;
|
|
29
|
-
unpublished: Array<{
|
|
30
|
-
name: string;
|
|
31
|
-
version: string;
|
|
32
|
-
path: string;
|
|
33
|
-
}>;
|
|
34
|
-
};
|
|
35
|
-
/** Build and print a dependency tree of file: references.
|
|
36
|
-
* Recursively walks file: deps showing the full hierarchy with indentation. */
|
|
37
|
-
export declare function printDepTree(baseDir: string, indent?: number, visited?: Set<string>): void;
|
|
38
|
-
/** Restore file: dependencies from .dependencies */
|
|
39
|
-
export declare function restoreDeps(pkg: any, verbose?: boolean): boolean;
|
|
40
|
-
/** Check if .dependencies exist (already transformed) */
|
|
41
|
-
export declare function hasBackup(pkg: any): boolean;
|
|
42
|
-
//# sourceMappingURL=deps.d.ts.map
|