pnpm-catalog-updates 1.1.8 → 1.2.0
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 +4 -4
- package/dist/index.js +51 -25
- package/dist/index.js.map +1 -1
- package/package.json +16 -14
- package/src/cli/commandRegistrar.ts +20 -1
- package/src/cli/commands/initCommand.ts +3 -1
- package/src/cli/interactive/InteractiveOptionsCollector.ts +1 -1
- package/src/cli/interactive/interactivePrompts.ts +11 -11
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# pcu
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/pcu)
|
|
4
|
-
[](https://www.npmjs.com/package/pcu)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](https://nodejs.org/)
|
|
7
7
|
|
|
8
8
|
A powerful CLI tool for managing pnpm workspace catalog dependencies with ease.
|
|
9
9
|
|
|
@@ -102,8 +102,8 @@ pcu analyze react 19.0.0
|
|
|
102
102
|
## Links
|
|
103
103
|
|
|
104
104
|
- [Complete Documentation](https://pcu-cli.dev/en)
|
|
105
|
-
- [Report Issues](https://github.com/
|
|
106
|
-
- [GitHub Repository](https://github.com/
|
|
105
|
+
- [Report Issues](https://github.com/yldm-tech/pnpm-catalog-updates/issues)
|
|
106
|
+
- [GitHub Repository](https://github.com/yldm-tech/pnpm-catalog-updates)
|
|
107
107
|
|
|
108
108
|
## License
|
|
109
109
|
|
package/dist/index.js
CHANGED
|
@@ -12188,6 +12188,12 @@ var AIAnalysisService = class {
|
|
|
12188
12188
|
* Get available AI providers
|
|
12189
12189
|
*/
|
|
12190
12190
|
async getAvailableProviders() {
|
|
12191
|
+
if (this.providersInitialized) {
|
|
12192
|
+
const providerInfos = await Promise.all(
|
|
12193
|
+
Array.from(this.providers.values()).map((provider) => provider.getInfo())
|
|
12194
|
+
);
|
|
12195
|
+
return providerInfos.filter((provider) => provider.available).sort((a, b) => b.priority - a.priority);
|
|
12196
|
+
}
|
|
12191
12197
|
return this.detector.getAvailableProviders();
|
|
12192
12198
|
}
|
|
12193
12199
|
/**
|
|
@@ -13371,6 +13377,13 @@ var CatalogCheckService = class {
|
|
|
13371
13377
|
async checkOutdatedDependencies(options = {}) {
|
|
13372
13378
|
const workspacePath = WorkspacePath.fromString(options.workspacePath || process.cwd());
|
|
13373
13379
|
const config = await ConfigLoader.loadConfig(workspacePath.toString());
|
|
13380
|
+
const configWithOptions = {
|
|
13381
|
+
...config,
|
|
13382
|
+
defaults: {
|
|
13383
|
+
...config.defaults,
|
|
13384
|
+
...options
|
|
13385
|
+
}
|
|
13386
|
+
};
|
|
13374
13387
|
const workspace = await this.workspaceRepository.getByPath(workspacePath);
|
|
13375
13388
|
const catalogs = workspace.getCatalogs();
|
|
13376
13389
|
const catalogInfos = [];
|
|
@@ -13382,7 +13395,10 @@ var CatalogCheckService = class {
|
|
|
13382
13395
|
}
|
|
13383
13396
|
throw new CatalogNotFoundError("default", []);
|
|
13384
13397
|
}
|
|
13385
|
-
const filteredPackagesByCatalog = this.getFilteredPackagesFromCatalogs(
|
|
13398
|
+
const filteredPackagesByCatalog = this.getFilteredPackagesFromCatalogs(
|
|
13399
|
+
catalogsToCheck,
|
|
13400
|
+
configWithOptions
|
|
13401
|
+
);
|
|
13386
13402
|
let totalPackages = 0;
|
|
13387
13403
|
for (const packages of filteredPackagesByCatalog.values()) {
|
|
13388
13404
|
totalPackages += packages.length;
|
|
@@ -13499,7 +13515,7 @@ var CatalogCheckService = class {
|
|
|
13499
13515
|
*/
|
|
13500
13516
|
async processPackageCheck(packageName, currentRange, catalog, workspace, config, options) {
|
|
13501
13517
|
const packageConfig = ConfigLoader.getPackageConfig(packageName, config);
|
|
13502
|
-
const effectiveTarget = packageConfig.target;
|
|
13518
|
+
const effectiveTarget = options.target || packageConfig.target || "latest";
|
|
13503
13519
|
const skipSecurityCheck = options.noSecurity || config.security?.enableCheck === false;
|
|
13504
13520
|
const outdatedInfo = await this.checkPackageUpdate(
|
|
13505
13521
|
packageName,
|
|
@@ -13631,8 +13647,9 @@ var CatalogCheckService = class {
|
|
|
13631
13647
|
return diff === "minor" || diff === "patch" || diff === "same";
|
|
13632
13648
|
}
|
|
13633
13649
|
return false;
|
|
13634
|
-
} catch {
|
|
13635
|
-
|
|
13650
|
+
} catch (error) {
|
|
13651
|
+
logger.error(String(error));
|
|
13652
|
+
throw error;
|
|
13636
13653
|
}
|
|
13637
13654
|
});
|
|
13638
13655
|
if (compatibleVersions.length === 0) {
|
|
@@ -15289,12 +15306,8 @@ var WorkspaceService = class {
|
|
|
15289
15306
|
* Check if workspace uses catalogs
|
|
15290
15307
|
*/
|
|
15291
15308
|
async usesCatalogs(workspacePath) {
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
return !workspace.getCatalogs().isEmpty();
|
|
15295
|
-
} catch {
|
|
15296
|
-
return false;
|
|
15297
|
-
}
|
|
15309
|
+
const workspace = await this.discoverWorkspace(workspacePath);
|
|
15310
|
+
return !workspace.getCatalogs().isEmpty();
|
|
15298
15311
|
}
|
|
15299
15312
|
/**
|
|
15300
15313
|
* Get packages that use a specific catalog
|
|
@@ -21655,7 +21668,9 @@ catalogs:
|
|
|
21655
21668
|
lines.push("");
|
|
21656
21669
|
lines.push(StyledText.muted(t("command.init.step5")));
|
|
21657
21670
|
lines.push(StyledText.muted(" https://pnpm.io/workspaces"));
|
|
21658
|
-
lines.push(
|
|
21671
|
+
lines.push(
|
|
21672
|
+
StyledText.muted(" https://github.com/yldm-tech/pnpm-catalog-updates#configuration")
|
|
21673
|
+
);
|
|
21659
21674
|
cliOutput.print(lines.join("\n"));
|
|
21660
21675
|
}
|
|
21661
21676
|
/**
|
|
@@ -22961,7 +22976,7 @@ var InteractivePrompts = class {
|
|
|
22961
22976
|
];
|
|
22962
22977
|
const answers = await inquirer2.prompt([
|
|
22963
22978
|
{
|
|
22964
|
-
type: "
|
|
22979
|
+
type: "select",
|
|
22965
22980
|
name: "catalog",
|
|
22966
22981
|
message: StyledText.iconCatalog(t("prompt.selectCatalog")),
|
|
22967
22982
|
choices: choices2,
|
|
@@ -22983,7 +22998,7 @@ var InteractivePrompts = class {
|
|
|
22983
22998
|
];
|
|
22984
22999
|
const answers = await inquirer2.prompt([
|
|
22985
23000
|
{
|
|
22986
|
-
type: "
|
|
23001
|
+
type: "select",
|
|
22987
23002
|
name: "strategy",
|
|
22988
23003
|
message: StyledText.iconUpdate(t("prompt.selectUpdateStrategy")),
|
|
22989
23004
|
choices: strategies
|
|
@@ -23015,7 +23030,7 @@ var InteractivePrompts = class {
|
|
|
23015
23030
|
async autoCompletePackage(packages, message = t("prompt.selectPackage")) {
|
|
23016
23031
|
const answers = await inquirer2.prompt([
|
|
23017
23032
|
{
|
|
23018
|
-
type: "
|
|
23033
|
+
type: "select",
|
|
23019
23034
|
name: "package",
|
|
23020
23035
|
message,
|
|
23021
23036
|
choices: packages.map((pkg) => ({ name: pkg, value: pkg })),
|
|
@@ -23035,7 +23050,7 @@ var InteractivePrompts = class {
|
|
|
23035
23050
|
];
|
|
23036
23051
|
const answers = await inquirer2.prompt([
|
|
23037
23052
|
{
|
|
23038
|
-
type: "
|
|
23053
|
+
type: "select",
|
|
23039
23054
|
name: "path",
|
|
23040
23055
|
message: t("prompt.selectWorkspace"),
|
|
23041
23056
|
choices: choices2
|
|
@@ -23061,7 +23076,7 @@ var InteractivePrompts = class {
|
|
|
23061
23076
|
];
|
|
23062
23077
|
const answers = await inquirer2.prompt([
|
|
23063
23078
|
{
|
|
23064
|
-
type: "
|
|
23079
|
+
type: "select",
|
|
23065
23080
|
name: "selected",
|
|
23066
23081
|
message: t("prompt.browsePath", { path: currentPath }),
|
|
23067
23082
|
choices: choices2,
|
|
@@ -23103,7 +23118,7 @@ var InteractivePrompts = class {
|
|
|
23103
23118
|
*/
|
|
23104
23119
|
async selectTheme() {
|
|
23105
23120
|
const answers = await inquirer2.prompt({
|
|
23106
|
-
type: "
|
|
23121
|
+
type: "select",
|
|
23107
23122
|
name: "theme",
|
|
23108
23123
|
message: t("prompt.selectTheme"),
|
|
23109
23124
|
choices: [
|
|
@@ -23125,7 +23140,7 @@ var InteractivePrompts = class {
|
|
|
23125
23140
|
${t("prompt.configWizard")}
|
|
23126
23141
|
`));
|
|
23127
23142
|
const themeAnswer = await inquirer2.prompt({
|
|
23128
|
-
type: "
|
|
23143
|
+
type: "select",
|
|
23129
23144
|
name: "theme",
|
|
23130
23145
|
message: t("prompt.selectTheme"),
|
|
23131
23146
|
choices: [
|
|
@@ -23149,7 +23164,7 @@ ${t("prompt.configWizard")}
|
|
|
23149
23164
|
default: true
|
|
23150
23165
|
});
|
|
23151
23166
|
const strategyAnswer = await inquirer2.prompt({
|
|
23152
|
-
type: "
|
|
23167
|
+
type: "select",
|
|
23153
23168
|
name: "updateStrategy",
|
|
23154
23169
|
message: t("prompt.defaultStrategy"),
|
|
23155
23170
|
choices: [
|
|
@@ -23216,7 +23231,7 @@ ${t("prompt.impactPreview")}
|
|
|
23216
23231
|
];
|
|
23217
23232
|
const answers = await inquirer2.prompt([
|
|
23218
23233
|
{
|
|
23219
|
-
type: "
|
|
23234
|
+
type: "select",
|
|
23220
23235
|
name: "action",
|
|
23221
23236
|
message: StyledText.iconError(t("prompt.errorMessage", { error })),
|
|
23222
23237
|
choices: options
|
|
@@ -24135,7 +24150,7 @@ var InteractiveOptionsCollector = class {
|
|
|
24135
24150
|
message: t("interactive.analyze.packageName"),
|
|
24136
24151
|
placeholder: "lodash, react, ...",
|
|
24137
24152
|
validate: (value) => {
|
|
24138
|
-
if (!value
|
|
24153
|
+
if (!value?.trim()) return t("interactive.analyze.packageNameRequired");
|
|
24139
24154
|
return void 0;
|
|
24140
24155
|
}
|
|
24141
24156
|
});
|
|
@@ -24303,7 +24318,8 @@ function createCommandAction(serviceFactory, config, executor) {
|
|
|
24303
24318
|
}
|
|
24304
24319
|
let finalOptions = options;
|
|
24305
24320
|
if (config.interactiveCollector) {
|
|
24306
|
-
const
|
|
24321
|
+
const isCiMode = globalOptions.ci === true;
|
|
24322
|
+
const isInteractive = isCiMode ? false : options.interactive === true;
|
|
24307
24323
|
const noMeaningfulOptions = !hasProvidedOptions(
|
|
24308
24324
|
options,
|
|
24309
24325
|
command,
|
|
@@ -24328,6 +24344,16 @@ function createCommandAction(serviceFactory, config, executor) {
|
|
|
24328
24344
|
};
|
|
24329
24345
|
}
|
|
24330
24346
|
function registerCommands(program, serviceFactory, packageJson) {
|
|
24347
|
+
program.option(
|
|
24348
|
+
"--ci",
|
|
24349
|
+
"Enable CI mode for non-interactive execution. Skips all prompts and uses sensible defaults.",
|
|
24350
|
+
false
|
|
24351
|
+
).hook("preAction", (thisCommand) => {
|
|
24352
|
+
const opts = thisCommand.opts();
|
|
24353
|
+
if (opts.ci) {
|
|
24354
|
+
opts.noColor = true;
|
|
24355
|
+
}
|
|
24356
|
+
});
|
|
24331
24357
|
program.command("check").description(t("cli.description.check")).option("-i, --interactive", t("cli.option.interactive")).option("--catalog <name>", t("cli.option.catalog")).addOption(
|
|
24332
24358
|
new Option("-f, --format <type>", t("cli.option.format")).choices(CLI_CHOICES.format).default("table")
|
|
24333
24359
|
).addOption(
|
|
@@ -24673,12 +24699,12 @@ ${t("cli.help.tipLabel")} ${t("cli.help.tipContent", { locale: I18n.getLocale()
|
|
|
24673
24699
|
}
|
|
24674
24700
|
|
|
24675
24701
|
// src/cli/index.ts
|
|
24676
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
24677
|
-
var __dirname = dirname(__filename);
|
|
24702
|
+
var __filename$1 = fileURLToPath(import.meta.url);
|
|
24703
|
+
var __dirname$1 = dirname(__filename$1);
|
|
24678
24704
|
var _packageJson = null;
|
|
24679
24705
|
function getPackageJson() {
|
|
24680
24706
|
if (!_packageJson) {
|
|
24681
|
-
_packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
|
|
24707
|
+
_packageJson = JSON.parse(readFileSync(join(__dirname$1, "../package.json"), "utf-8"));
|
|
24682
24708
|
}
|
|
24683
24709
|
return _packageJson;
|
|
24684
24710
|
}
|