inup 1.6.7 → 1.6.8
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 +9 -2
- package/dist/app/interactive-ui.js +17 -15
- package/dist/app/upgrade-runner.js +11 -16
- package/dist/cli.js +12 -13
- package/dist/features/audit/headless-audit.js +4 -11
- package/dist/features/audit/index.js +9 -9
- package/dist/features/audit/presenter.js +0 -2
- package/dist/features/audit/vulnerability-audit-controller.js +3 -3
- package/dist/features/audit/vulnerability-checker.js +1 -5
- package/dist/features/changelog/clients/github-client.js +9 -7
- package/dist/features/changelog/index.js +1 -1
- package/dist/features/changelog/services/package-metadata-service.js +1 -1
- package/dist/features/changelog/services/release-notes-service.js +3 -2
- package/dist/features/debug/index.js +2 -2
- package/dist/features/debug/perf-logger.js +14 -14
- package/dist/features/headless/headless-runner.js +22 -9
- package/dist/features/headless/index.js +1 -1
- package/dist/features/interactive/index.js +10 -10
- package/dist/features/interactive/input-handler.js +3 -3
- package/dist/features/interactive/modal/index.js +1 -1
- package/dist/features/interactive/modal/layout.js +3 -3
- package/dist/features/interactive/modal/package-info-sections/index.js +1 -1
- package/dist/features/interactive/modal/package-info-sections/release-notes.js +1 -1
- package/dist/features/interactive/modal/package-info-sections/sections.js +5 -5
- package/dist/features/interactive/modal/package-info-sections/text.js +1 -1
- package/dist/features/interactive/modal/package-info.js +15 -18
- package/dist/features/interactive/renderer/confirmation.js +6 -3
- package/dist/features/interactive/renderer/help-modal.js +3 -3
- package/dist/features/interactive/renderer/index.js +3 -3
- package/dist/features/interactive/renderer/package-list/index.js +1 -1
- package/dist/features/interactive/renderer/package-list/interface.js +9 -9
- package/dist/features/interactive/renderer/package-list/rows.js +8 -9
- package/dist/features/interactive/renderer/performance-modal.js +2 -2
- package/dist/features/interactive/renderer/version-format.js +4 -4
- package/dist/features/interactive/session/action-dispatcher.js +2 -2
- package/dist/features/interactive/session/index.js +4 -4
- package/dist/features/interactive/session/interactive-session.js +9 -8
- package/dist/features/interactive/session/selection-state-builder.js +5 -4
- package/dist/features/interactive/state/filter-manager.js +1 -1
- package/dist/features/interactive/state/index.js +7 -7
- package/dist/features/interactive/state/state-manager.js +4 -4
- package/dist/features/interactive/state/theme-manager.js +4 -6
- package/dist/features/interactive/themes-colors.js +4 -5
- package/dist/features/upgrade/package-detector.js +30 -12
- package/dist/features/upgrade/upgrader.js +28 -37
- package/dist/shared/config/project-config.js +10 -11
- package/dist/shared/config/user-config.js +8 -8
- package/dist/shared/debug-logger.js +9 -9
- package/dist/shared/exec.js +4 -4
- package/dist/shared/fs/index.js +1 -1
- package/dist/shared/fs/io.js +3 -4
- package/dist/shared/fs/paths.js +4 -4
- package/dist/shared/fs/scan.js +21 -21
- package/dist/shared/git.js +3 -3
- package/dist/shared/http/resizable-semaphore.js +3 -1
- package/dist/shared/local-env.js +7 -7
- package/dist/shared/package-manager.js +25 -24
- package/dist/shared/registry/npm-registry.js +12 -10
- package/dist/shared/registry/version-checker.js +1 -1
- package/dist/shared/terminal/cursor.js +1 -1
- package/dist/shared/terminal/index.js +5 -5
- package/dist/shared/terminal/terminal-input.js +6 -2
- package/dist/shared/terminal/text.js +1 -1
- package/dist/shared/types/index.js +1 -1
- package/dist/shared/versions.js +37 -33
- package/package.json +10 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StateManager = void 0;
|
|
4
|
-
const navigation_manager_1 = require("./navigation-manager");
|
|
5
|
-
const modal_manager_1 = require("./modal-manager");
|
|
6
4
|
const filter_manager_1 = require("./filter-manager");
|
|
5
|
+
const modal_manager_1 = require("./modal-manager");
|
|
6
|
+
const navigation_manager_1 = require("./navigation-manager");
|
|
7
7
|
const theme_manager_1 = require("./theme-manager");
|
|
8
8
|
class StateManager {
|
|
9
9
|
navigationManager;
|
|
@@ -99,7 +99,7 @@ class StateManager {
|
|
|
99
99
|
return;
|
|
100
100
|
const currentRow = this.navigationManager.getCurrentRow();
|
|
101
101
|
const currentState = states[currentRow];
|
|
102
|
-
if (
|
|
102
|
+
if (currentState?.loadState !== 'ready')
|
|
103
103
|
return;
|
|
104
104
|
if (direction === 'left') {
|
|
105
105
|
// Move selection left with wraparound: latest -> range -> none -> latest
|
|
@@ -187,7 +187,7 @@ class StateManager {
|
|
|
187
187
|
if (states.length === 0)
|
|
188
188
|
return;
|
|
189
189
|
const currentState = states[this.navigationManager.getCurrentRow()];
|
|
190
|
-
if (
|
|
190
|
+
if (currentState?.loadState !== 'ready')
|
|
191
191
|
return;
|
|
192
192
|
if (currentState.selectedOption !== 'none') {
|
|
193
193
|
currentState.selectedOption = 'none';
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ThemeManager = void 0;
|
|
4
4
|
exports.getThemeColors = getThemeColors;
|
|
5
5
|
exports.getCurrentThemeName = getCurrentThemeName;
|
|
6
|
-
const themes_1 = require("../themes");
|
|
7
6
|
const user_config_1 = require("../../../shared/config/user-config");
|
|
7
|
+
const themes_1 = require("../themes");
|
|
8
8
|
// Global theme state for renderers to access
|
|
9
9
|
let globalCurrentTheme = themes_1.defaultTheme;
|
|
10
10
|
class ThemeManager {
|
|
@@ -79,11 +79,9 @@ class ThemeManager {
|
|
|
79
79
|
exports.ThemeManager = ThemeManager;
|
|
80
80
|
// Helper function for renderers to get current theme colors
|
|
81
81
|
function getThemeColors() {
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
return themes_1.themes[globalCurrentTheme]?.colors || themes_1.themes[themes_1.defaultTheme].colors;
|
|
86
|
-
/* v8 ignore stop */
|
|
82
|
+
// globalCurrentTheme is only ever assigned a name validated against
|
|
83
|
+
// themeNames, so the lookup always resolves.
|
|
84
|
+
return themes_1.themes[globalCurrentTheme].colors;
|
|
87
85
|
}
|
|
88
86
|
// Helper function to get current theme name
|
|
89
87
|
function getCurrentThemeName() {
|
|
@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.themeColors = void 0;
|
|
7
7
|
exports.getThemeColor = getThemeColor;
|
|
8
8
|
exports.getThemeBgColor = getThemeBgColor;
|
|
9
|
+
exports.hexToRgb = hexToRgb;
|
|
9
10
|
exports.getTerminalBgColorCode = getTerminalBgColorCode;
|
|
10
11
|
exports.getTerminalResetCode = getTerminalResetCode;
|
|
11
12
|
exports.coloredInupLogo = coloredInupLogo;
|
|
12
13
|
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
-
const theme_manager_1 = require("./state/theme-manager");
|
|
14
14
|
const config_1 = require("../../shared/config");
|
|
15
|
+
const theme_manager_1 = require("./state/theme-manager");
|
|
15
16
|
// Centralized theme color definitions - single source of truth
|
|
16
17
|
const themeColorDefinitions = {
|
|
17
18
|
default: {
|
|
@@ -173,16 +174,14 @@ function getThemeBgColor() {
|
|
|
173
174
|
*/
|
|
174
175
|
function hexToRgb(hex) {
|
|
175
176
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
177
|
+
// Malformed input falls back to black — a safe default for a color parser.
|
|
176
178
|
return result
|
|
177
179
|
? {
|
|
178
180
|
r: parseInt(result[1], 16),
|
|
179
181
|
g: parseInt(result[2], 16),
|
|
180
182
|
b: parseInt(result[3], 16),
|
|
181
183
|
}
|
|
182
|
-
:
|
|
183
|
-
// black is the safe answer if a malformed value ever slips in.
|
|
184
|
-
/* v8 ignore next */
|
|
185
|
-
{ r: 0, g: 0, b: 0 };
|
|
184
|
+
: { r: 0, g: 0, b: 0 };
|
|
186
185
|
}
|
|
187
186
|
/**
|
|
188
187
|
* Get ANSI escape code to set terminal background color.
|
|
@@ -39,13 +39,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.PackageDetector = void 0;
|
|
40
40
|
const chalk_1 = __importDefault(require("chalk"));
|
|
41
41
|
const semver = __importStar(require("semver"));
|
|
42
|
+
const config_1 = require("../../shared/config");
|
|
43
|
+
const debug_logger_1 = require("../../shared/debug-logger");
|
|
42
44
|
const fs_1 = require("../../shared/fs");
|
|
43
|
-
const versions_1 = require("../../shared/versions");
|
|
44
45
|
const pnpm_catalogs_1 = require("../../shared/pnpm-catalogs");
|
|
45
46
|
const npm_registry_1 = require("../../shared/registry/npm-registry");
|
|
46
|
-
const config_1 = require("../../shared/config");
|
|
47
47
|
const terminal_1 = require("../../shared/terminal");
|
|
48
|
-
const
|
|
48
|
+
const versions_1 = require("../../shared/versions");
|
|
49
49
|
const debug_1 = require("../debug");
|
|
50
50
|
class PackageDetector {
|
|
51
51
|
packageJsonPath = null;
|
|
@@ -215,6 +215,9 @@ class PackageDetector {
|
|
|
215
215
|
// pnpm-workspace.yaml. Each catalog entry becomes ONE upgradable dependency
|
|
216
216
|
// sourced from that file, no matter how many workspace packages reference it.
|
|
217
217
|
const catalogs = pnpm_catalogs_1.PnpmCatalogs.load(this.cwd);
|
|
218
|
+
// Entries here always carry catalogReferencedBy (set on first-seen below),
|
|
219
|
+
// so require it in the value type — that lets re-references push onto the
|
|
220
|
+
// array without an optional-fallback branch.
|
|
218
221
|
const seenCatalogEntries = new Map();
|
|
219
222
|
for (const rawDep of allDepsRaw) {
|
|
220
223
|
let dep = {
|
|
@@ -224,8 +227,11 @@ class PackageDetector {
|
|
|
224
227
|
packageJsonPath: rawDep.packageJsonPath,
|
|
225
228
|
};
|
|
226
229
|
if ((0, pnpm_catalogs_1.isCatalogReference)(rawDep.version)) {
|
|
227
|
-
|
|
228
|
-
|
|
230
|
+
// A catalog ref resolves its range from pnpm-workspace.yaml. If that
|
|
231
|
+
// file was absent (catalogs === null) or the entry is missing, we can't
|
|
232
|
+
// resolve a range — warn and skip.
|
|
233
|
+
const resolution = catalogs?.resolve(rawDep.name, rawDep.version);
|
|
234
|
+
if (!catalogs || !resolution) {
|
|
229
235
|
debug_logger_1.debugLog.warn('PackageDetector', `skipping unresolvable catalog ref: ${rawDep.name}@${rawDep.version}`);
|
|
230
236
|
continue;
|
|
231
237
|
}
|
|
@@ -239,7 +245,7 @@ class PackageDetector {
|
|
|
239
245
|
}
|
|
240
246
|
continue;
|
|
241
247
|
}
|
|
242
|
-
|
|
248
|
+
const catalogEntry = {
|
|
243
249
|
name: rawDep.name,
|
|
244
250
|
version: resolution.range,
|
|
245
251
|
type: rawDep.type,
|
|
@@ -248,13 +254,14 @@ class PackageDetector {
|
|
|
248
254
|
catalogEntries: catalogs.entriesOf(resolution.catalog),
|
|
249
255
|
catalogReferencedBy: [rawDep.packageJsonPath],
|
|
250
256
|
};
|
|
251
|
-
seenCatalogEntries.set(catalogKey,
|
|
257
|
+
seenCatalogEntries.set(catalogKey, catalogEntry);
|
|
258
|
+
dep = catalogEntry;
|
|
252
259
|
}
|
|
253
|
-
if (this.
|
|
260
|
+
if (this.isNonRegistrySpecifier(dep.version)) {
|
|
254
261
|
const key = `${dep.name}@${dep.version}`;
|
|
255
262
|
if (!seenWorkspaceRefs.has(key)) {
|
|
256
263
|
seenWorkspaceRefs.add(key);
|
|
257
|
-
debug_logger_1.debugLog.info('PackageDetector', `skipping
|
|
264
|
+
debug_logger_1.debugLog.info('PackageDetector', `skipping non-registry specifier: ${key}`);
|
|
258
265
|
}
|
|
259
266
|
continue;
|
|
260
267
|
}
|
|
@@ -388,7 +395,7 @@ class PackageDetector {
|
|
|
388
395
|
try {
|
|
389
396
|
const files = await Promise.race([
|
|
390
397
|
(0, fs_1.findAllPackageJsonFilesAsync)(this.cwd, this.excludePatterns, this.maxDepth, (currentDir, foundCount) => {
|
|
391
|
-
const truncatedDir = currentDir.length > 50 ?
|
|
398
|
+
const truncatedDir = currentDir.length > 50 ? `...${currentDir.slice(-47)}` : currentDir;
|
|
392
399
|
this.showProgress(`🔍 Scanning ${truncatedDir} (found ${foundCount})`);
|
|
393
400
|
}, {
|
|
394
401
|
scanDirs: this.scanDirs,
|
|
@@ -428,14 +435,25 @@ class PackageDetector {
|
|
|
428
435
|
list.map((dir) => ` - ${dir}`).join('\n') +
|
|
429
436
|
`\n Add the directory name(s) to "scanDirs" in .inuprc to include them.`));
|
|
430
437
|
}
|
|
431
|
-
|
|
438
|
+
/**
|
|
439
|
+
* Specifiers that don't point at a plain registry range, so there is nothing to resolve or
|
|
440
|
+
* upgrade: workspace/file/link refs, git hosts and URLs, tarball URLs, and `npm:` aliases.
|
|
441
|
+
* An `npm:` alias in particular must never be looked up under its alias name — the packument
|
|
442
|
+
* for that name is a different (or nonexistent) package.
|
|
443
|
+
*/
|
|
444
|
+
isNonRegistrySpecifier(version) {
|
|
432
445
|
return (version.includes('workspace:') ||
|
|
433
446
|
version === '*' ||
|
|
434
447
|
version.startsWith('file:') ||
|
|
435
448
|
version.startsWith('link:') ||
|
|
436
449
|
version.startsWith('github:') ||
|
|
437
450
|
version.startsWith('gitlab:') ||
|
|
438
|
-
version.startsWith('bitbucket:')
|
|
451
|
+
version.startsWith('bitbucket:') ||
|
|
452
|
+
version.startsWith('npm:') ||
|
|
453
|
+
version.startsWith('git:') ||
|
|
454
|
+
version.startsWith('git+') ||
|
|
455
|
+
version.startsWith('http:') ||
|
|
456
|
+
version.startsWith('https:'));
|
|
439
457
|
}
|
|
440
458
|
showProgress(message) {
|
|
441
459
|
terminal_1.ConsoleUtils.showProgress(message);
|
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PackageUpgrader = void 0;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
7
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
11
|
const nanospinner_1 = require("nanospinner");
|
|
9
|
-
const fs_1 = require("fs");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const child_process_1 = require("child_process");
|
|
12
12
|
const exec_1 = require("../../shared/exec");
|
|
13
|
-
const
|
|
13
|
+
const fs_1 = require("../../shared/fs");
|
|
14
14
|
const pnpm_catalogs_1 = require("../../shared/pnpm-catalogs");
|
|
15
15
|
class PackageUpgrader {
|
|
16
16
|
packageManager;
|
|
@@ -28,17 +28,15 @@ class PackageUpgrader {
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
// Catalog entries live in pnpm-workspace.yaml, not a package.json — they
|
|
31
|
-
// take the YAML write path below.
|
|
32
|
-
|
|
33
|
-
const
|
|
31
|
+
// take the YAML write path below. The type predicate narrows the catalog
|
|
32
|
+
// group so downstream code sees `catalog` as a required string.
|
|
33
|
+
const catalogChoices = choices.filter((choice) => choice.catalog !== undefined);
|
|
34
|
+
const fileChoices = choices.filter((choice) => choice.catalog === undefined);
|
|
34
35
|
// Group choices by package.json path and dependency type
|
|
35
36
|
const choicesByFileAndType = this.groupChoicesByFileAndType(fileChoices);
|
|
36
37
|
for (const [fileAndType, choiceList] of Object.entries(choicesByFileAndType)) {
|
|
37
|
-
// groupChoicesByFileAndType only creates a group
|
|
38
|
-
|
|
39
|
-
if (choiceList.length === 0)
|
|
40
|
-
continue;
|
|
41
|
-
/* v8 ignore stop */
|
|
38
|
+
// groupChoicesByFileAndType only creates a group once it has a member,
|
|
39
|
+
// so choiceList is always non-empty here.
|
|
42
40
|
const [packageJsonPath, type] = fileAndType.split('|');
|
|
43
41
|
this.log(`Processing ${type} in ${packageJsonPath}`);
|
|
44
42
|
await this.upgradeChoiceGroup(choiceList, packageJsonPath, type);
|
|
@@ -53,24 +51,19 @@ class PackageUpgrader {
|
|
|
53
51
|
await this.runInstall(choices);
|
|
54
52
|
}
|
|
55
53
|
async runInstall(choices) {
|
|
56
|
-
// upgradePackages returns early
|
|
57
|
-
//
|
|
58
|
-
/* v8 ignore start */
|
|
59
|
-
if (choices.length === 0) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
/* v8 ignore stop */
|
|
54
|
+
// The sole caller (upgradePackages) returns early on an empty selection,
|
|
55
|
+
// so choices is always non-empty here.
|
|
63
56
|
// Determine the directory to run install in
|
|
64
57
|
// Use workspace root if it exists, otherwise use the directory of the first package.json
|
|
65
58
|
const firstPackageJsonPath = choices[0].packageJsonPath;
|
|
66
|
-
const firstPackageDir = (0,
|
|
67
|
-
const workspaceRoot = (0,
|
|
59
|
+
const firstPackageDir = (0, node_path_1.dirname)(firstPackageJsonPath);
|
|
60
|
+
const workspaceRoot = (0, fs_1.findWorkspaceRoot)(firstPackageDir, this.packageManager.name);
|
|
68
61
|
const installDir = workspaceRoot || firstPackageDir;
|
|
69
62
|
// Check if package manager is installed
|
|
70
63
|
try {
|
|
71
64
|
(0, exec_1.executeCommand)(`${this.packageManager.name} --version`, installDir);
|
|
72
65
|
}
|
|
73
|
-
catch
|
|
66
|
+
catch {
|
|
74
67
|
this.log(chalk_1.default.yellow(`\n⚠️ ${this.packageManager.displayName} is detected but not installed on your system.\n` +
|
|
75
68
|
`Please run the install command manually:\n` +
|
|
76
69
|
` cd ${installDir}\n` +
|
|
@@ -85,7 +78,7 @@ class PackageUpgrader {
|
|
|
85
78
|
// inherited fds, so its progress output bypasses any JS shim — redirecting at spawn time is
|
|
86
79
|
// the only reliable way to keep stdout reserved for the --json document. stderr stays inherited.
|
|
87
80
|
const stdio = this.quiet ? ['inherit', 2, 'inherit'] : 'inherit';
|
|
88
|
-
const result = (0,
|
|
81
|
+
const result = (0, node_child_process_1.spawnSync)(installCommand, {
|
|
89
82
|
cwd: installDir,
|
|
90
83
|
stdio,
|
|
91
84
|
shell: true,
|
|
@@ -112,7 +105,7 @@ class PackageUpgrader {
|
|
|
112
105
|
choicesByFile.set(choice.packageJsonPath, group);
|
|
113
106
|
});
|
|
114
107
|
for (const [workspaceFilePath, fileChoices] of choicesByFile) {
|
|
115
|
-
if (!(0,
|
|
108
|
+
if (!(0, node_fs_1.existsSync)(workspaceFilePath)) {
|
|
116
109
|
this.log(chalk_1.default.yellow(`⚠️ Skipping catalog entries in ${workspaceFilePath} - file not found`));
|
|
117
110
|
continue;
|
|
118
111
|
}
|
|
@@ -160,7 +153,7 @@ class PackageUpgrader {
|
|
|
160
153
|
}
|
|
161
154
|
async upgradeChoiceGroup(choices, packageJsonPath, type) {
|
|
162
155
|
// Validate that package.json exists
|
|
163
|
-
if (!(0,
|
|
156
|
+
if (!(0, node_fs_1.existsSync)(packageJsonPath)) {
|
|
164
157
|
this.log(chalk_1.default.yellow(`⚠️ Skipping ${type} in ${packageJsonPath} - package.json file not found`));
|
|
165
158
|
return;
|
|
166
159
|
}
|
|
@@ -171,35 +164,33 @@ class PackageUpgrader {
|
|
|
171
164
|
: (0, nanospinner_1.createSpinner)(`Upgrading ${type} in ${packageDir}...`).start();
|
|
172
165
|
try {
|
|
173
166
|
// Read the current package.json — keep the raw text so we can round-trip its formatting
|
|
174
|
-
const rawContent = (0,
|
|
175
|
-
const packageJson = (0,
|
|
167
|
+
const rawContent = (0, node_fs_1.readFileSync)(packageJsonPath, 'utf-8');
|
|
168
|
+
const packageJson = (0, fs_1.readPackageJson)(packageJsonPath);
|
|
176
169
|
// Group by upgrade type (range vs latest)
|
|
177
170
|
const rangeChoices = choices.filter((c) => c.upgradeType === 'range');
|
|
178
171
|
const latestChoices = choices.filter((c) => c.upgradeType === 'latest');
|
|
179
172
|
// Upgrade range versions by directly modifying package.json
|
|
180
173
|
if (rangeChoices.length > 0) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
174
|
+
const section = packageJson[type] ?? {};
|
|
175
|
+
packageJson[type] = section;
|
|
184
176
|
rangeChoices.forEach((choice) => {
|
|
185
|
-
|
|
177
|
+
section[choice.name] = choice.targetVersion;
|
|
186
178
|
});
|
|
187
179
|
}
|
|
188
180
|
// Upgrade to latest versions by directly modifying package.json
|
|
189
181
|
if (latestChoices.length > 0) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
182
|
+
const section = packageJson[type] ?? {};
|
|
183
|
+
packageJson[type] = section;
|
|
193
184
|
latestChoices.forEach((choice) => {
|
|
194
|
-
|
|
185
|
+
section[choice.name] = choice.targetVersion;
|
|
195
186
|
});
|
|
196
187
|
}
|
|
197
188
|
// Write back the modified package.json, preserving the original indentation and
|
|
198
189
|
// trailing-newline style. Skip the write entirely when nothing actually changed.
|
|
199
|
-
const format = (0,
|
|
190
|
+
const format = (0, fs_1.detectJsonFormat)(rawContent);
|
|
200
191
|
const nextContent = JSON.stringify(packageJson, null, format.indent) + (format.trailingNewline ? '\n' : '');
|
|
201
192
|
if (nextContent !== rawContent) {
|
|
202
|
-
(0,
|
|
193
|
+
(0, node_fs_1.writeFileSync)(packageJsonPath, nextContent);
|
|
203
194
|
}
|
|
204
195
|
if (spinner)
|
|
205
196
|
spinner.success({ text: `Upgraded ${choices.length} ${type} in ${packageDir}` });
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadProjectConfig = loadProjectConfig;
|
|
4
4
|
exports.isPackageIgnored = isPackageIgnored;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
7
|
const package_meta_1 = require("./package-meta");
|
|
8
8
|
const CONFIG_FILES = [
|
|
9
9
|
`.${package_meta_1.PACKAGE_NAME}rc`,
|
|
@@ -16,12 +16,12 @@ const CONFIG_FILES = [
|
|
|
16
16
|
*/
|
|
17
17
|
function loadProjectConfig(cwd) {
|
|
18
18
|
let currentDir = cwd;
|
|
19
|
-
while (
|
|
19
|
+
while (true) {
|
|
20
20
|
for (const configFile of CONFIG_FILES) {
|
|
21
|
-
const configPath = (0,
|
|
22
|
-
if ((0,
|
|
21
|
+
const configPath = (0, node_path_1.join)(currentDir, configFile);
|
|
22
|
+
if ((0, node_fs_1.existsSync)(configPath)) {
|
|
23
23
|
try {
|
|
24
|
-
const content = (0,
|
|
24
|
+
const content = (0, node_fs_1.readFileSync)(configPath, 'utf-8');
|
|
25
25
|
const config = JSON.parse(content);
|
|
26
26
|
return normalizeConfig(config);
|
|
27
27
|
}
|
|
@@ -31,13 +31,12 @@ function loadProjectConfig(cwd) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
// Move to parent directory.
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
// Move to parent directory. join(root, '..') === root at the filesystem
|
|
35
|
+
// root on every platform ('/' on POSIX, 'C:\' on Windows), so this is the
|
|
36
|
+
// single, cross-platform loop terminator.
|
|
37
|
+
const parentDir = (0, node_path_1.join)(currentDir, '..');
|
|
38
38
|
if (parentDir === currentDir)
|
|
39
39
|
break;
|
|
40
|
-
/* v8 ignore stop */
|
|
41
40
|
currentDir = parentDir;
|
|
42
41
|
}
|
|
43
42
|
return {};
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.configManager = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
9
|
const env_paths_1 = __importDefault(require("env-paths"));
|
|
10
10
|
const package_meta_1 = require("./package-meta");
|
|
11
11
|
class ConfigManager {
|
|
@@ -16,17 +16,17 @@ class ConfigManager {
|
|
|
16
16
|
// Mac/Linux: ~/.config/inup, Windows: %APPDATA%/inup
|
|
17
17
|
const paths = (0, env_paths_1.default)(package_meta_1.PACKAGE_NAME);
|
|
18
18
|
this.configDir = paths.config;
|
|
19
|
-
this.configPath = (0,
|
|
19
|
+
this.configPath = (0, node_path_1.join)(this.configDir, 'config.json');
|
|
20
20
|
}
|
|
21
21
|
ensureConfigDir() {
|
|
22
|
-
if (!(0,
|
|
23
|
-
(0,
|
|
22
|
+
if (!(0, node_fs_1.existsSync)(this.configDir)) {
|
|
23
|
+
(0, node_fs_1.mkdirSync)(this.configDir, { recursive: true });
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
readConfig() {
|
|
27
27
|
try {
|
|
28
|
-
if ((0,
|
|
29
|
-
const content = (0,
|
|
28
|
+
if ((0, node_fs_1.existsSync)(this.configPath)) {
|
|
29
|
+
const content = (0, node_fs_1.readFileSync)(this.configPath, 'utf-8');
|
|
30
30
|
return JSON.parse(content);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -39,7 +39,7 @@ class ConfigManager {
|
|
|
39
39
|
writeConfig(config) {
|
|
40
40
|
try {
|
|
41
41
|
this.ensureConfigDir();
|
|
42
|
-
(0,
|
|
42
|
+
(0, node_fs_1.writeFileSync)(this.configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
45
|
console.error('Error writing config:', error);
|
|
@@ -4,9 +4,9 @@ exports.debugLog = void 0;
|
|
|
4
4
|
exports.enableDebugLogging = enableDebugLogging;
|
|
5
5
|
exports.isDebugEnabled = isDebugEnabled;
|
|
6
6
|
exports.getDebugLogPath = getDebugLogPath;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_os_1 = require("node:os");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
10
|
let _enabled = false;
|
|
11
11
|
let _logFile = null;
|
|
12
12
|
const pad = (n, width = 2) => String(n).padStart(width, '0');
|
|
@@ -21,13 +21,13 @@ function getLogFile() {
|
|
|
21
21
|
const dateStr = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
22
22
|
// Write to the OS temp dir (matches the path advertised in --help), not the
|
|
23
23
|
// current working directory — a debug log must never litter the user's repo.
|
|
24
|
-
const dir = (0,
|
|
25
|
-
if (!(0,
|
|
26
|
-
(0,
|
|
24
|
+
const dir = (0, node_path_1.join)((0, node_os_1.tmpdir)(), 'inup');
|
|
25
|
+
if (!(0, node_fs_1.existsSync)(dir)) {
|
|
26
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
27
27
|
}
|
|
28
|
-
_logFile = (0,
|
|
28
|
+
_logFile = (0, node_path_1.join)(dir, `inup-debug-${dateStr}.log`);
|
|
29
29
|
// Write a header so the file is easy to identify
|
|
30
|
-
(0,
|
|
30
|
+
(0, node_fs_1.writeFileSync)(_logFile, `=== inup debug log started at ${timestamp()} ===\n`, { flag: 'a' });
|
|
31
31
|
}
|
|
32
32
|
return _logFile;
|
|
33
33
|
}
|
|
@@ -69,7 +69,7 @@ function write(level, context, message, extra) {
|
|
|
69
69
|
}
|
|
70
70
|
line += '\n';
|
|
71
71
|
try {
|
|
72
|
-
(0,
|
|
72
|
+
(0, node_fs_1.appendFileSync)(getLogFile(), line);
|
|
73
73
|
}
|
|
74
74
|
catch {
|
|
75
75
|
// Never crash the app because of debug logging
|
package/dist/shared/exec.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeCommand = executeCommand;
|
|
4
4
|
exports.executeCommandAsync = executeCommandAsync;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const execAsync = (0,
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const node_util_1 = require("node:util");
|
|
7
|
+
const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
8
8
|
/**
|
|
9
9
|
* Execute a command synchronously
|
|
10
10
|
*/
|
|
11
11
|
function executeCommand(command, cwd) {
|
|
12
12
|
try {
|
|
13
|
-
return (0,
|
|
13
|
+
return (0, node_child_process_1.execSync)(command, {
|
|
14
14
|
encoding: 'utf-8',
|
|
15
15
|
stdio: 'pipe',
|
|
16
16
|
cwd: cwd,
|
package/dist/shared/fs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./paths"), exports);
|
|
18
17
|
__exportStar(require("./io"), exports);
|
|
18
|
+
__exportStar(require("./paths"), exports);
|
|
19
19
|
__exportStar(require("./scan"), exports);
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
package/dist/shared/fs/io.js
CHANGED
|
@@ -5,11 +5,10 @@ exports.detectJsonFormat = detectJsonFormat;
|
|
|
5
5
|
exports.readPackageJsonAsync = readPackageJsonAsync;
|
|
6
6
|
exports.collectAllDependencies = collectAllDependencies;
|
|
7
7
|
exports.collectAllDependenciesAsync = collectAllDependenciesAsync;
|
|
8
|
-
const
|
|
9
|
-
const fs_2 = require("fs");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
10
9
|
function readPackageJson(path) {
|
|
11
10
|
try {
|
|
12
|
-
const content = (0,
|
|
11
|
+
const content = (0, node_fs_1.readFileSync)(path, 'utf-8');
|
|
13
12
|
return JSON.parse(content);
|
|
14
13
|
}
|
|
15
14
|
catch (error) {
|
|
@@ -33,7 +32,7 @@ function detectJsonFormat(raw) {
|
|
|
33
32
|
}
|
|
34
33
|
async function readPackageJsonAsync(path) {
|
|
35
34
|
try {
|
|
36
|
-
const content = await
|
|
35
|
+
const content = await node_fs_1.promises.readFile(path, 'utf-8');
|
|
37
36
|
return JSON.parse(content);
|
|
38
37
|
}
|
|
39
38
|
catch (error) {
|
package/dist/shared/fs/paths.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findPackageJson = findPackageJson;
|
|
4
4
|
exports.findWorkspaceRoot = findWorkspaceRoot;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
7
|
const package_manager_1 = require("../package-manager");
|
|
8
8
|
function findPackageJson(cwd = process.cwd()) {
|
|
9
|
-
const packageJsonPath = (0,
|
|
10
|
-
return (0,
|
|
9
|
+
const packageJsonPath = (0, node_path_1.join)(cwd, 'package.json');
|
|
10
|
+
return (0, node_fs_1.existsSync)(packageJsonPath) ? packageJsonPath : null;
|
|
11
11
|
}
|
|
12
12
|
function findWorkspaceRoot(cwd = process.cwd(), packageManager) {
|
|
13
13
|
if (!packageManager) {
|