@bobfrankston/npmglobalize 1.0.154 → 1.0.155
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/README.md +30 -3
- package/cli.js +37 -7
- package/lib/config.js +5 -1
- package/lib/types.d.ts +5 -0
- package/lib.d.ts +10 -1
- package/lib.js +55 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -301,6 +301,8 @@ Publishing requires being on a branch so commits and tags can be properly tracke
|
|
|
301
301
|
-force-publish Republish dependencies even if version exists
|
|
302
302
|
-fix Run npm audit fix after transformation
|
|
303
303
|
-no-fix Don't run npm audit
|
|
304
|
+
-no-use-paths, -nup Declare package standalone; do not resolve file: deps
|
|
305
|
+
from sibling checkouts (see Configuration File)
|
|
304
306
|
```
|
|
305
307
|
|
|
306
308
|
### Install Options
|
|
@@ -323,10 +325,21 @@ Publishing requires being on a branch so commits and tags can be properly tracke
|
|
|
323
325
|
-git private Set GitHub repo to private (default for new repos)
|
|
324
326
|
-git public Set GitHub repo to public (requires confirmation)
|
|
325
327
|
Works on both new and existing repos
|
|
326
|
-
-npm
|
|
327
|
-
|
|
328
|
+
-npm <values> Comma-separated list of npm options:
|
|
329
|
+
private (default) | public — package visibility
|
|
330
|
+
ts — keep .ts source (and *.map,
|
|
331
|
+
tsconfig.json) in npm tarball
|
|
332
|
+
nts — exclude .ts source
|
|
333
|
+
(default for non-noEmit projects)
|
|
334
|
+
Example: -npm public,ts
|
|
328
335
|
```
|
|
329
336
|
|
|
337
|
+
`ts` is already the default on git (source is tracked). Pass `-npm ts` to ship
|
|
338
|
+
the same files to npm — useful for debugging installed packages or "source on
|
|
339
|
+
demand" packages. `noEmit` projects automatically ship `.ts` files (they *are*
|
|
340
|
+
the runtime); pass `-npm nts` to override. `allowTs` persists to
|
|
341
|
+
`.globalize.json5`.
|
|
342
|
+
|
|
330
343
|
### Workspace Options
|
|
331
344
|
```
|
|
332
345
|
-w, -workspace <pkg> Filter to specific package (repeatable)
|
|
@@ -400,12 +413,26 @@ Settings can be saved in `.globalize.json5`:
|
|
|
400
413
|
"fix": true, // Auto-run npm audit fix
|
|
401
414
|
"verbose": false, // Show detailed output
|
|
402
415
|
"gitVisibility": "private",
|
|
403
|
-
"npmVisibility": "public"
|
|
416
|
+
"npmVisibility": "public",
|
|
417
|
+
"usePaths": true // Resolve file: deps from sibling checkouts (see below)
|
|
404
418
|
}
|
|
405
419
|
```
|
|
406
420
|
|
|
407
421
|
Configuration persists across runs. CLI flags override config file.
|
|
408
422
|
|
|
423
|
+
### `usePaths` — Standalone packages
|
|
424
|
+
|
|
425
|
+
Default: `true`. Set to `false` (or pass `-no-use-paths` / `-nup`) to mark a
|
|
426
|
+
package as **standalone** — one that should be publishable/installable on a
|
|
427
|
+
machine that does not have sibling `file:` dep checkouts available. Example:
|
|
428
|
+
a backup/recovery utility you want to `npm install -g` on any host.
|
|
429
|
+
|
|
430
|
+
Currently this setting is **declarative** — it is parsed, persisted to
|
|
431
|
+
`.globalize.json5`, and surfaced in the settings banner, but the tool does
|
|
432
|
+
not yet change its behavior based on it. Behavior wiring (e.g. resolving
|
|
433
|
+
`file:` deps to the latest published npm version instead of walking siblings)
|
|
434
|
+
is planned.
|
|
435
|
+
|
|
409
436
|
## Common Workflows
|
|
410
437
|
|
|
411
438
|
### Standard Release
|
package/cli.js
CHANGED
|
@@ -37,6 +37,9 @@ Dependency Options:
|
|
|
37
37
|
-no-prescan, -nps Skip upfront dep-graph prescan
|
|
38
38
|
-force-publish Republish dependencies even if version exists
|
|
39
39
|
-fix Run npm audit fix after transformation
|
|
40
|
+
-no-use-paths, -nup Declare this package standalone — file: deps shouldn't
|
|
41
|
+
be resolved from sibling checkouts (persisted as
|
|
42
|
+
usePaths:false in .globalize.json5; FYI for now)
|
|
40
43
|
|
|
41
44
|
Install Options:
|
|
42
45
|
-install, -i Global install after publish (from registry)
|
|
@@ -57,8 +60,12 @@ Git/npm Visibility:
|
|
|
57
60
|
-git private Set GitHub repo to private (default for new repos)
|
|
58
61
|
-git public Set GitHub repo to public (requires confirmation)
|
|
59
62
|
Works on both new and existing repos
|
|
60
|
-
-npm
|
|
61
|
-
|
|
63
|
+
-npm <values> Comma-separated list of npm options:
|
|
64
|
+
private (default) | public — package visibility
|
|
65
|
+
ts — keep .ts source in npm tarball
|
|
66
|
+
nts — exclude .ts source (default for
|
|
67
|
+
non-noEmit projects)
|
|
68
|
+
Example: -npm public,ts
|
|
62
69
|
|
|
63
70
|
Workspace Options:
|
|
64
71
|
-w, -workspace <pkg> Filter to specific package (repeatable)
|
|
@@ -214,12 +221,30 @@ function parseArgs(args) {
|
|
|
214
221
|
break;
|
|
215
222
|
case '-npm':
|
|
216
223
|
i++;
|
|
217
|
-
if (args[i]
|
|
218
|
-
options.
|
|
219
|
-
|
|
224
|
+
if (!args[i]) {
|
|
225
|
+
options.error = `-npm requires a value (private|public, ts, nts — comma-separated)`;
|
|
226
|
+
break;
|
|
220
227
|
}
|
|
221
|
-
|
|
222
|
-
|
|
228
|
+
{
|
|
229
|
+
const tokens = args[i].split(',').map(t => t.trim()).filter(t => t);
|
|
230
|
+
for (const tok of tokens) {
|
|
231
|
+
if (tok === 'private' || tok === 'public') {
|
|
232
|
+
options.npmVisibility = tok;
|
|
233
|
+
options.explicitKeys.add('npmVisibility');
|
|
234
|
+
}
|
|
235
|
+
else if (tok === 'ts') {
|
|
236
|
+
options.allowTs = true;
|
|
237
|
+
options.explicitKeys.add('allowTs');
|
|
238
|
+
}
|
|
239
|
+
else if (tok === 'nts') {
|
|
240
|
+
options.allowTs = false;
|
|
241
|
+
options.explicitKeys.add('allowTs');
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
options.error = `-npm: unknown value '${tok}' (expected private|public|ts|nts)`;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
223
248
|
}
|
|
224
249
|
break;
|
|
225
250
|
case '-message':
|
|
@@ -266,6 +291,11 @@ function parseArgs(args) {
|
|
|
266
291
|
case '-npd':
|
|
267
292
|
options.publishDeps = false; // Disable auto-publishing
|
|
268
293
|
break;
|
|
294
|
+
case '-no-use-paths':
|
|
295
|
+
case '-nup':
|
|
296
|
+
options.usePaths = false; // Skip sibling-path resolution; use latest npm version for file: deps
|
|
297
|
+
options.explicitKeys.add('usePaths');
|
|
298
|
+
break;
|
|
269
299
|
case '-no-prescan':
|
|
270
300
|
case '-nps':
|
|
271
301
|
options.noPrescan = true;
|
package/lib/config.js
CHANGED
|
@@ -58,7 +58,8 @@ export function writeConfig(dir, config, explicitKeys) {
|
|
|
58
58
|
wsl: false,
|
|
59
59
|
force: false,
|
|
60
60
|
verbose: false,
|
|
61
|
-
freeze: false
|
|
61
|
+
freeze: false,
|
|
62
|
+
usePaths: true
|
|
62
63
|
};
|
|
63
64
|
// Read existing config to preserve values
|
|
64
65
|
const existing = readConfig(dir);
|
|
@@ -119,6 +120,8 @@ export function writeConfig(dir, config, explicitKeys) {
|
|
|
119
120
|
comment = ' // Transform but don\'t publish';
|
|
120
121
|
else if (key === 'freeze')
|
|
121
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)';
|
|
122
125
|
lines.push(` "${key}": ${jsonValue}${comma}${comment}`);
|
|
123
126
|
});
|
|
124
127
|
lines.push('');
|
|
@@ -139,6 +142,7 @@ export function writeConfig(dir, config, explicitKeys) {
|
|
|
139
142
|
lines.push(' // "local": false // Local install only (skip transform/publish)');
|
|
140
143
|
lines.push(' // "noPublish": false // Transform but don\'t publish');
|
|
141
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)');
|
|
142
146
|
lines.push('}');
|
|
143
147
|
fs.writeFileSync(configPath, lines.join('\n') + '\n');
|
|
144
148
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -78,6 +78,11 @@ export interface GlobalizeOptions {
|
|
|
78
78
|
once?: boolean;
|
|
79
79
|
/** Run importgen to update import maps before publishing */
|
|
80
80
|
importgen?: boolean;
|
|
81
|
+
/** Use filesystem paths for `file:` deps (default true). Set false to
|
|
82
|
+
* mark a package as publishable/installable even when sibling checkouts
|
|
83
|
+
* are absent. Currently declarative (recorded in config and displayed);
|
|
84
|
+
* the actual conversion path is TODO. */
|
|
85
|
+
usePaths?: boolean;
|
|
81
86
|
/** Local install only — skip transform/publish, just npm install -g . */
|
|
82
87
|
local?: boolean;
|
|
83
88
|
/** Freeze node_modules: replace symlinks/junctions with real copies for network share use */
|
package/lib.d.ts
CHANGED
|
@@ -55,6 +55,10 @@ export interface GlobalizeOptions {
|
|
|
55
55
|
gitVisibility?: 'private' | 'public';
|
|
56
56
|
/** npm visibility: private (default) or public */
|
|
57
57
|
npmVisibility?: 'private' | 'public';
|
|
58
|
+
/** Allow .ts source files (and *.map, tsconfig.json) in the published npm tarball.
|
|
59
|
+
* undefined: follow noEmit detection (noEmit → allow). true: always allow.
|
|
60
|
+
* false: always exclude via .npmignore. Set via `-npm ts` / `-npm nts`. */
|
|
61
|
+
allowTs?: boolean;
|
|
58
62
|
/** Custom commit message */
|
|
59
63
|
message?: string;
|
|
60
64
|
/** Check and update ignore files to conform to best practices */
|
|
@@ -91,6 +95,11 @@ export interface GlobalizeOptions {
|
|
|
91
95
|
once?: boolean;
|
|
92
96
|
/** Run importgen to update import maps before publishing */
|
|
93
97
|
importgen?: boolean;
|
|
98
|
+
/** Use filesystem paths for `file:` deps (default true). Set false to
|
|
99
|
+
* mark a package as publishable/installable even when sibling checkouts
|
|
100
|
+
* are absent. Currently declarative (recorded in config and displayed);
|
|
101
|
+
* the actual conversion path is TODO. */
|
|
102
|
+
usePaths?: boolean;
|
|
94
103
|
/** Local install only — skip transform/publish, just npm install -g . */
|
|
95
104
|
local?: boolean;
|
|
96
105
|
/** Freeze node_modules: replace symlinks/junctions with real copies for network share use */
|
|
@@ -278,7 +287,7 @@ export declare function promptText(message: string, defaultValue?: string): Prom
|
|
|
278
287
|
/** Prompt user for multiple choice */
|
|
279
288
|
export declare function promptChoice(message: string, choices: string[]): Promise<string | null>;
|
|
280
289
|
/** Initialize git repository */
|
|
281
|
-
export declare function initGit(cwd: string, visibility: 'private' | 'public', dryRun: boolean): Promise<boolean>;
|
|
290
|
+
export declare function initGit(cwd: string, visibility: 'private' | 'public', dryRun: boolean, allowTs?: boolean): Promise<boolean>;
|
|
282
291
|
/** Main globalize function */
|
|
283
292
|
/** Run npm audit and optionally fix vulnerabilities */
|
|
284
293
|
export declare function runNpmAudit(cwd: string, fix?: boolean, verbose?: boolean): {
|
package/lib.js
CHANGED
|
@@ -230,7 +230,8 @@ export function writeConfig(dir, config, explicitKeys) {
|
|
|
230
230
|
wsl: false,
|
|
231
231
|
force: false,
|
|
232
232
|
verbose: false,
|
|
233
|
-
freeze: false
|
|
233
|
+
freeze: false,
|
|
234
|
+
usePaths: true
|
|
234
235
|
};
|
|
235
236
|
// Read existing config to preserve values
|
|
236
237
|
const existing = readConfig(dir);
|
|
@@ -291,6 +292,10 @@ export function writeConfig(dir, config, explicitKeys) {
|
|
|
291
292
|
comment = ' // Transform but don\'t publish';
|
|
292
293
|
else if (key === 'freeze')
|
|
293
294
|
comment = ' // Freeze node_modules (replace symlinks with real copies)';
|
|
295
|
+
else if (key === 'usePaths')
|
|
296
|
+
comment = ' // Resolve file: deps from sibling checkouts (set false for standalone packages)';
|
|
297
|
+
else if (key === 'allowTs')
|
|
298
|
+
comment = ' // Keep .ts source (and *.map, tsconfig.json) in the published npm tarball';
|
|
294
299
|
lines.push(` "${key}": ${jsonValue}${comma}${comment}`);
|
|
295
300
|
});
|
|
296
301
|
lines.push('');
|
|
@@ -311,6 +316,8 @@ export function writeConfig(dir, config, explicitKeys) {
|
|
|
311
316
|
lines.push(' // "local": false // Local install only (skip transform/publish)');
|
|
312
317
|
lines.push(' // "noPublish": false // Transform but don\'t publish');
|
|
313
318
|
lines.push(' // "freeze": false // Freeze node_modules (replace symlinks with real copies)');
|
|
319
|
+
lines.push(' // "usePaths": true // Resolve file: deps from siblings; false = use latest npm version (standalone)');
|
|
320
|
+
lines.push(' // "allowTs": false // Include .ts source in npm tarball (auto-true for noEmit projects)');
|
|
314
321
|
lines.push('}');
|
|
315
322
|
fs.writeFileSync(configPath, lines.join('\n') + '\n');
|
|
316
323
|
}
|
|
@@ -1858,9 +1865,16 @@ function isNoEmitProject(cwd) {
|
|
|
1858
1865
|
return false;
|
|
1859
1866
|
}
|
|
1860
1867
|
}
|
|
1861
|
-
/**
|
|
1862
|
-
|
|
1863
|
-
|
|
1868
|
+
/** Resolve whether .ts source files should be kept in the published tarball.
|
|
1869
|
+
* Explicit allowTs wins; otherwise noEmit projects default to including .ts. */
|
|
1870
|
+
function resolveAllowTs(cwd, allowTs) {
|
|
1871
|
+
if (allowTs !== undefined)
|
|
1872
|
+
return allowTs;
|
|
1873
|
+
return isNoEmitProject(cwd);
|
|
1874
|
+
}
|
|
1875
|
+
/** Get applicable npmignore patterns, excluding TS patterns when .ts files should ship */
|
|
1876
|
+
function getApplicableNpmignorePatterns(cwd, allowTs) {
|
|
1877
|
+
if (resolveAllowTs(cwd, allowTs)) {
|
|
1864
1878
|
return ALL_NPMIGNORE.filter(p => !TS_NPMIGNORE_PATTERNS.has(p));
|
|
1865
1879
|
}
|
|
1866
1880
|
return ALL_NPMIGNORE;
|
|
@@ -2223,7 +2237,7 @@ function checkIgnoreFiles(cwd, options) {
|
|
|
2223
2237
|
if (fs.existsSync(npmignorePath)) {
|
|
2224
2238
|
const content = fs.readFileSync(npmignorePath, 'utf-8');
|
|
2225
2239
|
const lines = content.split('\n').map(l => l.trim());
|
|
2226
|
-
const applicableNpm = getApplicableNpmignorePatterns(cwd);
|
|
2240
|
+
const applicableNpm = getApplicableNpmignorePatterns(cwd, options.allowTs);
|
|
2227
2241
|
for (const pattern of applicableNpm) {
|
|
2228
2242
|
if (!lineHasPattern(lines, pattern)) {
|
|
2229
2243
|
if (securityNpm.has(pattern)) {
|
|
@@ -2234,13 +2248,21 @@ function checkIgnoreFiles(cwd, options) {
|
|
|
2234
2248
|
}
|
|
2235
2249
|
}
|
|
2236
2250
|
}
|
|
2251
|
+
// If .ts should ship, flag TS patterns already in .npmignore for removal
|
|
2252
|
+
if (resolveAllowTs(cwd, options.allowTs)) {
|
|
2253
|
+
for (const ts of TS_NPMIGNORE_PATTERNS) {
|
|
2254
|
+
if (lineHasPattern(lines, ts)) {
|
|
2255
|
+
changes.push(` .npmignore has (should remove): ${ts}`);
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2237
2259
|
}
|
|
2238
2260
|
const needsUpdate = changes.length > 0 || securityChanges.length > 0;
|
|
2239
2261
|
return { needsUpdate, changes, securityChanges };
|
|
2240
2262
|
}
|
|
2241
2263
|
/** Update ignore files to conform to best practices.
|
|
2242
2264
|
* securityOnly: if true, only add security patterns (auto-fix without prompting). */
|
|
2243
|
-
function conformIgnoreFiles(cwd, securityOnly = false) {
|
|
2265
|
+
function conformIgnoreFiles(cwd, securityOnly = false, allowTs) {
|
|
2244
2266
|
if (!securityOnly) {
|
|
2245
2267
|
// Ensure .gitattributes for LF line endings (use proper helper)
|
|
2246
2268
|
ensureGitattributes(cwd);
|
|
@@ -2259,8 +2281,8 @@ function conformIgnoreFiles(cwd, securityOnly = false) {
|
|
|
2259
2281
|
}
|
|
2260
2282
|
}
|
|
2261
2283
|
const patternsGit = securityOnly ? getSecurityGitignorePatterns() : getApplicableGitignorePatterns(cwd);
|
|
2262
|
-
const patternsNpm = securityOnly ? getSecurityNpmignorePatterns() : getApplicableNpmignorePatterns(cwd);
|
|
2263
|
-
const
|
|
2284
|
+
const patternsNpm = securityOnly ? getSecurityNpmignorePatterns() : getApplicableNpmignorePatterns(cwd, allowTs);
|
|
2285
|
+
const shipTs = resolveAllowTs(cwd, allowTs);
|
|
2264
2286
|
// Update .gitignore
|
|
2265
2287
|
const gitignorePath = path.join(cwd, '.gitignore');
|
|
2266
2288
|
if (fs.existsSync(gitignorePath)) {
|
|
@@ -2287,8 +2309,8 @@ function conformIgnoreFiles(cwd, securityOnly = false) {
|
|
|
2287
2309
|
const lines = content.split('\n').map(l => l.trim());
|
|
2288
2310
|
const newLines = new Set(lines.filter(l => l));
|
|
2289
2311
|
let updated = false;
|
|
2290
|
-
if (!securityOnly && !
|
|
2291
|
-
// Add TypeScript exclusions (only in full conform, skip
|
|
2312
|
+
if (!securityOnly && !shipTs) {
|
|
2313
|
+
// Add TypeScript exclusions (only in full conform, skip when .ts should ship)
|
|
2292
2314
|
for (const ts of ['*.ts', '!*.d.ts', '*.map']) {
|
|
2293
2315
|
if (!newLines.has(ts)) {
|
|
2294
2316
|
newLines.add(ts);
|
|
@@ -2296,8 +2318,8 @@ function conformIgnoreFiles(cwd, securityOnly = false) {
|
|
|
2296
2318
|
}
|
|
2297
2319
|
}
|
|
2298
2320
|
}
|
|
2299
|
-
//
|
|
2300
|
-
if (
|
|
2321
|
+
// When .ts should ship (noEmit or allowTs=true), remove TS patterns
|
|
2322
|
+
if (shipTs) {
|
|
2301
2323
|
for (const ts of TS_NPMIGNORE_PATTERNS) {
|
|
2302
2324
|
if (newLines.has(ts)) {
|
|
2303
2325
|
newLines.delete(ts);
|
|
@@ -2314,8 +2336,9 @@ function conformIgnoreFiles(cwd, securityOnly = false) {
|
|
|
2314
2336
|
if (updated) {
|
|
2315
2337
|
const newContent = Array.from(newLines).join('\n') + '\n';
|
|
2316
2338
|
fs.writeFileSync(npmignorePath, newContent);
|
|
2317
|
-
if (
|
|
2318
|
-
|
|
2339
|
+
if (shipTs) {
|
|
2340
|
+
const reason = allowTs === true ? 'allowTs' : 'noEmit';
|
|
2341
|
+
console.log(colors.cyan(` ✓ .npmignore updated (${reason}: kept *.ts files)`));
|
|
2319
2342
|
}
|
|
2320
2343
|
else {
|
|
2321
2344
|
console.log(colors.cyan(' ✓ Auto-added security patterns to .npmignore'));
|
|
@@ -2374,11 +2397,11 @@ function ensureGitignore(cwd) {
|
|
|
2374
2397
|
}
|
|
2375
2398
|
}
|
|
2376
2399
|
/** Ensure .npmignore exists with recommended patterns */
|
|
2377
|
-
function ensureNpmignore(cwd) {
|
|
2400
|
+
function ensureNpmignore(cwd, allowTs) {
|
|
2378
2401
|
const npmignorePath = path.join(cwd, '.npmignore');
|
|
2379
2402
|
if (!fs.existsSync(npmignorePath)) {
|
|
2380
2403
|
console.log(' Creating .npmignore...');
|
|
2381
|
-
const patterns = getApplicableNpmignorePatterns(cwd);
|
|
2404
|
+
const patterns = getApplicableNpmignorePatterns(cwd, allowTs);
|
|
2382
2405
|
const content = patterns.join('\n') + '\n';
|
|
2383
2406
|
fs.writeFileSync(npmignorePath, content);
|
|
2384
2407
|
console.log(colors.green(' ✓ .npmignore created'));
|
|
@@ -2405,7 +2428,7 @@ function ensureGitattributes(cwd) {
|
|
|
2405
2428
|
}
|
|
2406
2429
|
}
|
|
2407
2430
|
/** Initialize git repository */
|
|
2408
|
-
export async function initGit(cwd, visibility, dryRun) {
|
|
2431
|
+
export async function initGit(cwd, visibility, dryRun, allowTs) {
|
|
2409
2432
|
const pkg = readPackageJson(cwd);
|
|
2410
2433
|
const repoName = pkg.name.replace(/^@[^/]+\//, ''); // Remove scope
|
|
2411
2434
|
console.log('Initializing git repository...');
|
|
@@ -2428,7 +2451,7 @@ export async function initGit(cwd, visibility, dryRun) {
|
|
|
2428
2451
|
// Ensure .gitignore exists and includes node_modules
|
|
2429
2452
|
ensureGitignore(cwd);
|
|
2430
2453
|
// Ensure .npmignore exists with recommended patterns
|
|
2431
|
-
ensureNpmignore(cwd);
|
|
2454
|
+
ensureNpmignore(cwd, allowTs);
|
|
2432
2455
|
// Ensure .gitattributes exists for LF line endings
|
|
2433
2456
|
ensureGitattributes(cwd);
|
|
2434
2457
|
// git init
|
|
@@ -2693,7 +2716,7 @@ async function doLocalInstall(cwd, options) {
|
|
|
2693
2716
|
export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
2694
2717
|
const { bump = 'patch', noPublish = false, cleanup = false, install = false, link = false, wsl = false, force = false, files = true, dryRun = false, quiet = true, verbose = false, init = false, gitVisibility = 'private', npmVisibility = 'private', message, conform = false, asis = false, updateDeps = false, updateMajor = false, publishDeps = true, // Default to publishing deps for safety
|
|
2695
2718
|
publishDepsYes = false, // -pd: auto-yes to dep-cascade prompts (private only)
|
|
2696
|
-
noPrescan = false, forcePublish = false, fix = true, fixTags = false, rebase = false, show = false, local = false, freeze = false } = options;
|
|
2719
|
+
noPrescan = false, forcePublish = false, fix = true, fixTags = false, rebase = false, show = false, local = false, freeze = false, usePaths = true, allowTs } = options;
|
|
2697
2720
|
// Show tool version only for recursive dep calls (CLI already prints it at startup)
|
|
2698
2721
|
const toolVersion = getToolVersion();
|
|
2699
2722
|
if (!options._fromWorkspace && !options._fromCli) {
|
|
@@ -2752,6 +2775,12 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2752
2775
|
settings.push('-local');
|
|
2753
2776
|
if (configOptions.freeze)
|
|
2754
2777
|
settings.push('-freeze');
|
|
2778
|
+
if (configOptions.usePaths === false)
|
|
2779
|
+
settings.push('--no-use-paths');
|
|
2780
|
+
if (configOptions.allowTs === true)
|
|
2781
|
+
settings.push('-npm ts');
|
|
2782
|
+
if (configOptions.allowTs === false)
|
|
2783
|
+
settings.push('-npm nts');
|
|
2755
2784
|
if (settings.length > 0) {
|
|
2756
2785
|
console.log(colors.dim(`Settings from .globalize.json5: ${settings.join(', ')}`));
|
|
2757
2786
|
}
|
|
@@ -2832,7 +2861,7 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2832
2861
|
}
|
|
2833
2862
|
// Check ignore files first (unless cleanup mode)
|
|
2834
2863
|
if (!cleanup && !asis) {
|
|
2835
|
-
const checkResult = checkIgnoreFiles(cwd, { conform, asis, verbose });
|
|
2864
|
+
const checkResult = checkIgnoreFiles(cwd, { conform, asis, verbose, allowTs });
|
|
2836
2865
|
// Auto-add security patterns without prompting
|
|
2837
2866
|
if (checkResult.securityChanges.length > 0) {
|
|
2838
2867
|
const secGit = [];
|
|
@@ -2845,7 +2874,7 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2845
2874
|
secNpm.push(change.replace(' .npmignore missing: ', '').trim());
|
|
2846
2875
|
}
|
|
2847
2876
|
}
|
|
2848
|
-
conformIgnoreFiles(cwd, true);
|
|
2877
|
+
conformIgnoreFiles(cwd, true, allowTs);
|
|
2849
2878
|
if (secGit.length > 0) {
|
|
2850
2879
|
console.log(colors.cyan(' .gitignore: auto-added ') + secGit.join(', '));
|
|
2851
2880
|
}
|
|
@@ -2876,7 +2905,7 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2876
2905
|
console.log('');
|
|
2877
2906
|
if (conform) {
|
|
2878
2907
|
console.log('Applying changes (--conform)...');
|
|
2879
|
-
conformIgnoreFiles(cwd);
|
|
2908
|
+
conformIgnoreFiles(cwd, false, allowTs);
|
|
2880
2909
|
console.log('');
|
|
2881
2910
|
}
|
|
2882
2911
|
else {
|
|
@@ -2888,7 +2917,7 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2888
2917
|
const choice = await promptChoice('Your choice [ok/asis/abort]:', ['ok', 'asis', 'abort']);
|
|
2889
2918
|
if (choice === 'ok') {
|
|
2890
2919
|
console.log('Applying changes...');
|
|
2891
|
-
conformIgnoreFiles(cwd);
|
|
2920
|
+
conformIgnoreFiles(cwd, false, allowTs);
|
|
2892
2921
|
console.log(colors.green('✓ Ignore files updated'));
|
|
2893
2922
|
console.log('');
|
|
2894
2923
|
}
|
|
@@ -2946,13 +2975,13 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2946
2975
|
options.autoInit = true;
|
|
2947
2976
|
}
|
|
2948
2977
|
// choice is '1', 'a', or '' (default)
|
|
2949
|
-
const success = await initGit(cwd, gitVisibility, dryRun);
|
|
2978
|
+
const success = await initGit(cwd, gitVisibility, dryRun, allowTs);
|
|
2950
2979
|
if (!success)
|
|
2951
2980
|
return false;
|
|
2952
2981
|
justInitialized = true;
|
|
2953
2982
|
}
|
|
2954
2983
|
else {
|
|
2955
|
-
const success = await initGit(cwd, gitVisibility, dryRun);
|
|
2984
|
+
const success = await initGit(cwd, gitVisibility, dryRun, allowTs);
|
|
2956
2985
|
if (!success)
|
|
2957
2986
|
return false;
|
|
2958
2987
|
justInitialized = true;
|
|
@@ -2975,7 +3004,7 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2975
3004
|
options.autoInit = true;
|
|
2976
3005
|
}
|
|
2977
3006
|
}
|
|
2978
|
-
const success = await initGit(cwd, gitVisibility, dryRun);
|
|
3007
|
+
const success = await initGit(cwd, gitVisibility, dryRun, allowTs);
|
|
2979
3008
|
if (!success)
|
|
2980
3009
|
return false;
|
|
2981
3010
|
justInitialized = true;
|