@getmagical/cli 0.13.0 → 0.13.1
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/index.js +48 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14001,7 +14001,7 @@ var WORK_ITEM_ACTIVE_STATUSES = [
|
|
|
14001
14001
|
// ../common/dist/src/zod-schemas/queue-work-item-receipt.schema.js
|
|
14002
14002
|
import { z as z13 } from "zod";
|
|
14003
14003
|
var queueWorkItemReceiptSchema = z13.strictObject({
|
|
14004
|
-
id: z13.string().min(1).transform((value) => brandString(value)).describe("The work item created by queueWorkItem."),
|
|
14004
|
+
id: z13.string().min(1).transform((value) => brandString(value)).describe("The work item created by queueWorkItem or queueWorkItemAndWait."),
|
|
14005
14005
|
targetId: z13.string().min(1).transform((value) => brandString(value)).describe("The target automation selected when the work was queued.")
|
|
14006
14006
|
});
|
|
14007
14007
|
var queueWorkItemReceiptWriteSchema = z13.object({
|
|
@@ -32145,6 +32145,37 @@ function resolveInstallPrefixFromPackageRoot(packageRootPath) {
|
|
|
32145
32145
|
currentPath = parentPath;
|
|
32146
32146
|
}
|
|
32147
32147
|
}
|
|
32148
|
+
function readInstalledPackageVersion({
|
|
32149
|
+
packageName,
|
|
32150
|
+
packageRootPath
|
|
32151
|
+
}) {
|
|
32152
|
+
const packageManifestPath2 = path17.join(packageRootPath, "package.json");
|
|
32153
|
+
if (!fs2.existsSync(packageManifestPath2)) {
|
|
32154
|
+
throw new CliError(
|
|
32155
|
+
`Installed package metadata was not found at ${packageManifestPath2}. Reinstall mgcl and try again.`
|
|
32156
|
+
);
|
|
32157
|
+
}
|
|
32158
|
+
const packageManifestResult2 = safeJsonParse(
|
|
32159
|
+
fs2.readFileSync(packageManifestPath2, "utf8")
|
|
32160
|
+
);
|
|
32161
|
+
if (isErr(packageManifestResult2)) {
|
|
32162
|
+
throw new CliError(`Failed to parse ${packageManifestPath2}.`, {
|
|
32163
|
+
cause: packageManifestResult2.error.cause
|
|
32164
|
+
});
|
|
32165
|
+
}
|
|
32166
|
+
const packageManifest = packageManifestResult2.value;
|
|
32167
|
+
if (packageManifest.name !== packageName) {
|
|
32168
|
+
throw new CliError(
|
|
32169
|
+
`Expected installed package ${packageName} at ${packageManifestPath2}. Reinstall mgcl and try again.`
|
|
32170
|
+
);
|
|
32171
|
+
}
|
|
32172
|
+
if (typeof packageManifest.version !== "string" || !packageManifest.version) {
|
|
32173
|
+
throw new CliError(
|
|
32174
|
+
`Installed package version is missing from ${packageManifestPath2}. Reinstall mgcl and try again.`
|
|
32175
|
+
);
|
|
32176
|
+
}
|
|
32177
|
+
return packageManifest.version;
|
|
32178
|
+
}
|
|
32148
32179
|
function resolveNpmCommandFromPath() {
|
|
32149
32180
|
return {
|
|
32150
32181
|
argsPrefix: [],
|
|
@@ -32182,8 +32213,13 @@ async function installPublishedCli({
|
|
|
32182
32213
|
distTag,
|
|
32183
32214
|
installPrefix,
|
|
32184
32215
|
packageName,
|
|
32216
|
+
packageRootPath,
|
|
32185
32217
|
registryUrl
|
|
32186
32218
|
}) {
|
|
32219
|
+
const previousVersion = readInstalledPackageVersion({
|
|
32220
|
+
packageName,
|
|
32221
|
+
packageRootPath
|
|
32222
|
+
});
|
|
32187
32223
|
const npmCommand = resolveManagedNpmCommand(installPrefix) ?? resolveNpmCommandFromPath();
|
|
32188
32224
|
const packageSpecifier = `${packageName}@${distTag}`;
|
|
32189
32225
|
const npmArguments = [
|
|
@@ -32226,7 +32262,12 @@ async function installPublishedCli({
|
|
|
32226
32262
|
});
|
|
32227
32263
|
return {
|
|
32228
32264
|
installPrefix,
|
|
32265
|
+
installedVersion: readInstalledPackageVersion({
|
|
32266
|
+
packageName,
|
|
32267
|
+
packageRootPath
|
|
32268
|
+
}),
|
|
32229
32269
|
packageSpecifier,
|
|
32270
|
+
previousVersion,
|
|
32230
32271
|
registryUrl
|
|
32231
32272
|
};
|
|
32232
32273
|
}
|
|
@@ -32255,6 +32296,7 @@ async function selfUpdateInstalledCli({
|
|
|
32255
32296
|
distTag,
|
|
32256
32297
|
installPrefix,
|
|
32257
32298
|
packageName,
|
|
32299
|
+
packageRootPath,
|
|
32258
32300
|
registryUrl
|
|
32259
32301
|
});
|
|
32260
32302
|
}
|
|
@@ -33637,17 +33679,20 @@ async function handleSelfUpdate(dependencies, options) {
|
|
|
33637
33679
|
throw new CliError("Self-update is not configured for this CLI instance.");
|
|
33638
33680
|
}
|
|
33639
33681
|
const updateResult = await selfUpdateCli();
|
|
33682
|
+
const updated = updateResult.previousVersion !== updateResult.installedVersion;
|
|
33640
33683
|
if (options.json) {
|
|
33641
33684
|
writeJsonOutput4(dependencies.io, {
|
|
33642
33685
|
installPrefix: updateResult.installPrefix,
|
|
33686
|
+
installedVersion: updateResult.installedVersion,
|
|
33643
33687
|
packageSpecifier: updateResult.packageSpecifier,
|
|
33688
|
+
previousVersion: updateResult.previousVersion,
|
|
33644
33689
|
registryUrl: updateResult.registryUrl,
|
|
33645
|
-
updated
|
|
33690
|
+
updated
|
|
33646
33691
|
});
|
|
33647
33692
|
return;
|
|
33648
33693
|
}
|
|
33649
33694
|
dependencies.io.info(
|
|
33650
|
-
`Updated mgcl via npm (${updateResult.packageSpecifier}) in ${updateResult.installPrefix}.`
|
|
33695
|
+
updated ? `Updated mgcl from ${updateResult.previousVersion} to ${updateResult.installedVersion} via npm (${updateResult.packageSpecifier}) in ${updateResult.installPrefix}.` : `mgcl is already at ${updateResult.installedVersion}; no version change (${updateResult.packageSpecifier}) in ${updateResult.installPrefix}.`
|
|
33651
33696
|
);
|
|
33652
33697
|
}
|
|
33653
33698
|
async function handleOperationCommand(dependencies, operationSpec, commandOptions) {
|