@camunda8/cli 4.7.0-alpha.24 → 4.7.0-alpha.26
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/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/node-version.d.ts +18 -0
- package/dist/core/node-version.d.ts.map +1 -0
- package/dist/core/node-version.js +38 -0
- package/dist/core/node-version.js.map +1 -0
- package/dist/default-plugins/cluster/c8ctl-plugin.js +169 -0
- package/dist/default-plugins/element-template/c8ctl-plugin.js +27 -5
- package/dist/default-plugins/mcp/c8ctl-plugin.js +2064 -17
- package/dist/default-plugins/modeler/README.md +2 -1
- package/dist/default-plugins/modeler/c8ctl-plugin.js +152 -83
- package/dist/default-plugins/setup/c8ctl-plugin.js +140 -82
- package/dist/default-plugins/skills/README.md +1 -1
- package/dist/default-plugins/skills/c8ctl-plugin.js +2054 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/command-local/skills-install-helpers.js +6 -3
- package/dist/utils/command-local/skills-install-helpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,8 @@ Default c8ctl plugin that manages Camunda Desktop Modeler.
|
|
|
7
7
|
- `c8ctl modeler install` — install the latest stable Desktop Modeler on
|
|
8
8
|
macOS (Homebrew or the Camunda-signed release into `/Applications`),
|
|
9
9
|
Windows (winget), or Linux (x64, into `/usr/bin` via sudo). Skips the
|
|
10
|
-
installation when Modeler is already installed
|
|
10
|
+
installation when Modeler is already installed, and warns when a newer
|
|
11
|
+
release is available.
|
|
11
12
|
- `c8ctl modeler update` — update through Homebrew, winget, or the direct
|
|
12
13
|
release installation method. Reports when the installation is already up to
|
|
13
14
|
date.
|
|
@@ -2223,6 +2223,28 @@ function renderCommandFailure(logger, message, error, { verbose = false } = {})
|
|
|
2223
2223
|
});
|
|
2224
2224
|
}
|
|
2225
2225
|
|
|
2226
|
+
// src/core/node-version.ts
|
|
2227
|
+
var import_semver = __toESM(require_semver2(), 1);
|
|
2228
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
2229
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
2230
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2231
|
+
function readRequiredNodeRange() {
|
|
2232
|
+
try {
|
|
2233
|
+
const packageJson = join2(
|
|
2234
|
+
dirname2(fileURLToPath2(import.meta.url)),
|
|
2235
|
+
"..",
|
|
2236
|
+
"..",
|
|
2237
|
+
"package.json"
|
|
2238
|
+
);
|
|
2239
|
+
const pkg = JSON.parse(readFileSync2(packageJson, "utf-8"));
|
|
2240
|
+
const node = isRecord(pkg) && isRecord(pkg.engines) && pkg.engines.node;
|
|
2241
|
+
return typeof node === "string" ? node : void 0;
|
|
2242
|
+
} catch {
|
|
2243
|
+
return void 0;
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
var REQUIRED_NODE_RANGE = readRequiredNodeRange();
|
|
2247
|
+
|
|
2226
2248
|
// src/core/update-check.ts
|
|
2227
2249
|
var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
|
|
2228
2250
|
|
|
@@ -2238,7 +2260,7 @@ import {
|
|
|
2238
2260
|
lstatSync,
|
|
2239
2261
|
mkdirSync,
|
|
2240
2262
|
mkdtempSync,
|
|
2241
|
-
readFileSync as
|
|
2263
|
+
readFileSync as readFileSync3,
|
|
2242
2264
|
readlinkSync,
|
|
2243
2265
|
realpathSync,
|
|
2244
2266
|
renameSync,
|
|
@@ -2248,12 +2270,12 @@ import {
|
|
|
2248
2270
|
writeFileSync
|
|
2249
2271
|
} from "node:fs";
|
|
2250
2272
|
import { homedir as homedir2, tmpdir } from "node:os";
|
|
2251
|
-
import { delimiter, dirname as
|
|
2273
|
+
import { delimiter, dirname as dirname3, join as join3 } from "node:path";
|
|
2252
2274
|
import { Readable, Transform } from "node:stream";
|
|
2253
2275
|
import { pipeline } from "node:stream/promises";
|
|
2254
2276
|
|
|
2255
2277
|
// default-plugins/modeler/helpers.ts
|
|
2256
|
-
var
|
|
2278
|
+
var import_semver2 = __toESM(require_semver2(), 1);
|
|
2257
2279
|
var MODELER_RELEASE_URL = "https://downloads.camunda.cloud/release/camunda-modeler/";
|
|
2258
2280
|
function latestStableModelerVersion(indexHtml) {
|
|
2259
2281
|
const versions = Array.from(
|
|
@@ -2261,9 +2283,9 @@ function latestStableModelerVersion(indexHtml) {
|
|
|
2261
2283
|
(match) => match[1]
|
|
2262
2284
|
).filter((version) => version !== void 0);
|
|
2263
2285
|
const latest = versions.filter((version) => {
|
|
2264
|
-
const parsed = (0,
|
|
2286
|
+
const parsed = (0, import_semver2.parse)(version);
|
|
2265
2287
|
return parsed !== null && parsed.prerelease.length === 0;
|
|
2266
|
-
}).sort(
|
|
2288
|
+
}).sort(import_semver2.rcompare)[0];
|
|
2267
2289
|
if (!latest) {
|
|
2268
2290
|
throw new Error(
|
|
2269
2291
|
`No stable Camunda Modeler release found. Download manually from ${MODELER_RELEASE_URL}`
|
|
@@ -2272,14 +2294,14 @@ function latestStableModelerVersion(indexHtml) {
|
|
|
2272
2294
|
return latest;
|
|
2273
2295
|
}
|
|
2274
2296
|
function isNewerModelerVersion(candidate, current) {
|
|
2275
|
-
const candidateVersion = (0,
|
|
2276
|
-
const currentVersion = (0,
|
|
2297
|
+
const candidateVersion = (0, import_semver2.parse)(candidate);
|
|
2298
|
+
const currentVersion = (0, import_semver2.parse)(current);
|
|
2277
2299
|
if (!candidateVersion || !currentVersion) {
|
|
2278
2300
|
throw new Error(
|
|
2279
2301
|
`Invalid Camunda Modeler version "${candidate}" or "${current}"`
|
|
2280
2302
|
);
|
|
2281
2303
|
}
|
|
2282
|
-
return (0,
|
|
2304
|
+
return (0, import_semver2.gt)(candidateVersion, currentVersion);
|
|
2283
2305
|
}
|
|
2284
2306
|
function modelerMacArchiveName(version, architecture) {
|
|
2285
2307
|
if (architecture !== "arm64" && architecture !== "x64") {
|
|
@@ -2365,7 +2387,7 @@ function errorCode(error) {
|
|
|
2365
2387
|
var lifecycleToken = randomUUID();
|
|
2366
2388
|
function readLifecycleLock(path) {
|
|
2367
2389
|
try {
|
|
2368
|
-
const parsed = JSON.parse(
|
|
2390
|
+
const parsed = JSON.parse(readFileSync3(path, "utf8"));
|
|
2369
2391
|
return isRecord(parsed) ? parsed : void 0;
|
|
2370
2392
|
} catch {
|
|
2371
2393
|
return void 0;
|
|
@@ -2496,24 +2518,6 @@ ${diagnostics}` : "";
|
|
|
2496
2518
|
);
|
|
2497
2519
|
}
|
|
2498
2520
|
}
|
|
2499
|
-
function runCommandCapture(command, args, failureMessage) {
|
|
2500
|
-
const result = spawnSync(command, args, {
|
|
2501
|
-
encoding: "utf8",
|
|
2502
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
2503
|
-
});
|
|
2504
|
-
const diagnostics = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
|
|
2505
|
-
const details = diagnostics ? `
|
|
2506
|
-
${diagnostics}` : "";
|
|
2507
|
-
if (result.error) {
|
|
2508
|
-
throw new Error(`${failureMessage}: ${result.error.message}${details}`);
|
|
2509
|
-
}
|
|
2510
|
-
if (result.status !== 0) {
|
|
2511
|
-
throw new Error(
|
|
2512
|
-
`${failureMessage} (exit code ${formatExitCode(result.status)}).${details}`
|
|
2513
|
-
);
|
|
2514
|
-
}
|
|
2515
|
-
return result.stdout ?? "";
|
|
2516
|
-
}
|
|
2517
2521
|
function registerWithLaunchServices(appPath, logger) {
|
|
2518
2522
|
const result = spawnSync(LAUNCH_SERVICES_REGISTER, ["-f", appPath], {
|
|
2519
2523
|
stdio: "ignore"
|
|
@@ -2564,10 +2568,10 @@ function isInstalledWith({
|
|
|
2564
2568
|
);
|
|
2565
2569
|
}
|
|
2566
2570
|
function userApplicationsDir() {
|
|
2567
|
-
return
|
|
2571
|
+
return join3(homedir2(), "Applications");
|
|
2568
2572
|
}
|
|
2569
2573
|
function findInstalledModeler() {
|
|
2570
|
-
return [SYSTEM_APPLICATIONS_DIR, userApplicationsDir()].map((dir) =>
|
|
2574
|
+
return [SYSTEM_APPLICATIONS_DIR, userApplicationsDir()].map((dir) => join3(dir, APP_BUNDLE_NAME)).find((location) => existsSync(location));
|
|
2571
2575
|
}
|
|
2572
2576
|
function resolveHomebrewModelerPath() {
|
|
2573
2577
|
const failureMessage = "Could not locate the Camunda Modeler app installed by Homebrew";
|
|
@@ -2625,6 +2629,32 @@ async function fetchReleaseIndex(signal) {
|
|
|
2625
2629
|
);
|
|
2626
2630
|
}
|
|
2627
2631
|
}
|
|
2632
|
+
async function warnIfUpdateAvailable(logger, findUpdate) {
|
|
2633
|
+
try {
|
|
2634
|
+
const update = await findUpdate();
|
|
2635
|
+
if (update) {
|
|
2636
|
+
logger.warn(`${update} Run \`c8ctl modeler update\` to update it.`);
|
|
2637
|
+
}
|
|
2638
|
+
} catch (error) {
|
|
2639
|
+
logger.debug(
|
|
2640
|
+
`Could not check for a newer Camunda Modeler: ${errorMessage(error)}`
|
|
2641
|
+
);
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
async function newerReleaseThan(installedVersion) {
|
|
2645
|
+
const interrupts = registerDownloadInterrupts("Modeler update check");
|
|
2646
|
+
let latestVersion;
|
|
2647
|
+
try {
|
|
2648
|
+
latestVersion = latestStableModelerVersion(
|
|
2649
|
+
await fetchReleaseIndex(
|
|
2650
|
+
AbortSignal.any([interrupts.signal, AbortSignal.timeout(1e4)])
|
|
2651
|
+
)
|
|
2652
|
+
);
|
|
2653
|
+
} finally {
|
|
2654
|
+
interrupts.cleanup();
|
|
2655
|
+
}
|
|
2656
|
+
return isNewerModelerVersion(latestVersion, installedVersion) ? `Camunda Modeler ${installedVersion} is installed, but ${latestVersion} is available.` : void 0;
|
|
2657
|
+
}
|
|
2628
2658
|
async function downloadArchive({
|
|
2629
2659
|
url,
|
|
2630
2660
|
destination,
|
|
@@ -2710,7 +2740,7 @@ async function downloadLatestRelease({
|
|
|
2710
2740
|
}) {
|
|
2711
2741
|
const version = latestStableModelerVersion(await fetchReleaseIndex(signal));
|
|
2712
2742
|
const name = archiveName(version);
|
|
2713
|
-
const archivePath =
|
|
2743
|
+
const archivePath = join3(dir, name);
|
|
2714
2744
|
reportProgress(
|
|
2715
2745
|
{ logger, quiet },
|
|
2716
2746
|
`Downloading Camunda Modeler ${version} for ${platform2}...`
|
|
@@ -2734,7 +2764,7 @@ async function downloadReleaseVersion({
|
|
|
2734
2764
|
signal
|
|
2735
2765
|
}) {
|
|
2736
2766
|
const name = archiveName(version);
|
|
2737
|
-
const archivePath =
|
|
2767
|
+
const archivePath = join3(dir, name);
|
|
2738
2768
|
reportProgress(
|
|
2739
2769
|
{ logger, quiet },
|
|
2740
2770
|
`Downloading Camunda Modeler ${version} for ${platform2}...`
|
|
@@ -2773,8 +2803,8 @@ async function installFromOfficialDownload({
|
|
|
2773
2803
|
logger,
|
|
2774
2804
|
quiet
|
|
2775
2805
|
}) {
|
|
2776
|
-
const destination =
|
|
2777
|
-
const tempDir = mkdtempSync(
|
|
2806
|
+
const destination = join3(applicationsDir, APP_BUNDLE_NAME);
|
|
2807
|
+
const tempDir = mkdtempSync(join3(tmpdir(), "c8ctl-modeler-"));
|
|
2778
2808
|
const controller = new AbortController();
|
|
2779
2809
|
let interruptedSignal;
|
|
2780
2810
|
const interrupt = (signal) => {
|
|
@@ -2797,7 +2827,7 @@ async function installFromOfficialDownload({
|
|
|
2797
2827
|
if (applicationsDir !== SYSTEM_APPLICATIONS_DIR) {
|
|
2798
2828
|
mkdirSync(applicationsDir, { recursive: true });
|
|
2799
2829
|
}
|
|
2800
|
-
const stagingDir = mkdtempSync(
|
|
2830
|
+
const stagingDir = mkdtempSync(join3(applicationsDir, ".c8ctl-modeler-"));
|
|
2801
2831
|
try {
|
|
2802
2832
|
reportProgress(
|
|
2803
2833
|
{ logger, quiet },
|
|
@@ -2807,7 +2837,7 @@ async function installFromOfficialDownload({
|
|
|
2807
2837
|
failureMessage: "Could not extract Camunda Modeler",
|
|
2808
2838
|
quiet
|
|
2809
2839
|
});
|
|
2810
|
-
const stagedApp =
|
|
2840
|
+
const stagedApp = join3(stagingDir, APP_BUNDLE_NAME);
|
|
2811
2841
|
if (!existsSync(stagedApp)) {
|
|
2812
2842
|
throw manualDownloadError(
|
|
2813
2843
|
`The Camunda Modeler ${version} archive did not contain ${APP_BUNDLE_NAME}`
|
|
@@ -2863,8 +2893,8 @@ function registerWithWindows(executable, logger) {
|
|
|
2863
2893
|
'Could not register Camunda Modeler for .bpmn, .dmn, .form, and .rpa files. Choose it with "Open with" instead.'
|
|
2864
2894
|
);
|
|
2865
2895
|
}
|
|
2866
|
-
const appData = process.env.APPDATA ||
|
|
2867
|
-
const shortcut =
|
|
2896
|
+
const appData = process.env.APPDATA || join3(homedir2(), "AppData", "Roaming");
|
|
2897
|
+
const shortcut = join3(
|
|
2868
2898
|
appData,
|
|
2869
2899
|
"Microsoft",
|
|
2870
2900
|
"Windows",
|
|
@@ -2890,15 +2920,20 @@ function registerWithWindows(executable, logger) {
|
|
|
2890
2920
|
);
|
|
2891
2921
|
}
|
|
2892
2922
|
}
|
|
2893
|
-
|
|
2923
|
+
var WINGET_UPDATE_NOTICE = "A newer Camunda Modeler is available with winget.";
|
|
2924
|
+
async function installOnWindows({
|
|
2894
2925
|
isDryRun,
|
|
2895
2926
|
logger,
|
|
2896
2927
|
quiet
|
|
2897
2928
|
}) {
|
|
2898
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
2899
|
-
const installDir =
|
|
2900
|
-
const executable =
|
|
2929
|
+
const localAppData = process.env.LOCALAPPDATA || join3(homedir2(), "AppData", "Local");
|
|
2930
|
+
const installDir = join3(localAppData, "Programs", "Camunda Modeler");
|
|
2931
|
+
const executable = join3(installDir, WINDOWS_EXECUTABLE);
|
|
2901
2932
|
if (existsSync(executable)) {
|
|
2933
|
+
await warnIfUpdateAvailable(
|
|
2934
|
+
logger,
|
|
2935
|
+
() => wingetUpgradeAvailable() ? WINGET_UPDATE_NOTICE : void 0
|
|
2936
|
+
);
|
|
2902
2937
|
return {
|
|
2903
2938
|
kind: "info",
|
|
2904
2939
|
message: `Camunda Modeler is already installed at ${installDir}; skipping installation.`
|
|
@@ -2916,6 +2951,10 @@ function installOnWindows({
|
|
|
2916
2951
|
notInstalledStatus: WINGET_NO_APPLICATIONS_FOUND,
|
|
2917
2952
|
description: "the winget Modeler package"
|
|
2918
2953
|
})) {
|
|
2954
|
+
await warnIfUpdateAvailable(
|
|
2955
|
+
logger,
|
|
2956
|
+
() => wingetUpgradeAvailable() ? WINGET_UPDATE_NOTICE : void 0
|
|
2957
|
+
);
|
|
2919
2958
|
return {
|
|
2920
2959
|
kind: "info",
|
|
2921
2960
|
message: "Camunda Modeler is already installed with winget; skipping installation."
|
|
@@ -2962,7 +3001,7 @@ function installOnWindows({
|
|
|
2962
3001
|
function findOnPath(command) {
|
|
2963
3002
|
const path = process.env.PATH;
|
|
2964
3003
|
if (path === void 0) return void 0;
|
|
2965
|
-
return path.split(delimiter).map((dir) =>
|
|
3004
|
+
return path.split(delimiter).map((dir) => join3(dir || ".", command)).find((path2) => {
|
|
2966
3005
|
try {
|
|
2967
3006
|
accessSync(path2, constants.X_OK);
|
|
2968
3007
|
return statSync(path2).isFile();
|
|
@@ -2985,7 +3024,7 @@ function registerWithDesktop({
|
|
|
2985
3024
|
logger,
|
|
2986
3025
|
quiet
|
|
2987
3026
|
}) {
|
|
2988
|
-
const script =
|
|
3027
|
+
const script = join3(installDir, "support", "xdg_register.sh");
|
|
2989
3028
|
if (!findOnPath("xdg-mime")) {
|
|
2990
3029
|
logger.warn(
|
|
2991
3030
|
`Could not register Camunda Modeler for .bpmn, .dmn, .form, and .rpa files because xdg-utils is not installed. Install xdg-utils, then run ${script}.`
|
|
@@ -3007,7 +3046,7 @@ function unregisterWithDesktop({
|
|
|
3007
3046
|
logger,
|
|
3008
3047
|
quiet
|
|
3009
3048
|
}) {
|
|
3010
|
-
const script =
|
|
3049
|
+
const script = join3(installDir, "support", "xdg_unregister.sh");
|
|
3011
3050
|
if (!existsSync(script)) {
|
|
3012
3051
|
logger.warn(
|
|
3013
3052
|
`Could not unregister Camunda Modeler file types because ${script} is missing.`
|
|
@@ -3042,6 +3081,13 @@ async function installOnLinux({
|
|
|
3042
3081
|
}) {
|
|
3043
3082
|
const installedPath = findOnPath(LINUX_EXECUTABLE);
|
|
3044
3083
|
if (installedPath) {
|
|
3084
|
+
const managed = findManagedLinuxModeler();
|
|
3085
|
+
if (managed) {
|
|
3086
|
+
await warnIfUpdateAvailable(
|
|
3087
|
+
logger,
|
|
3088
|
+
() => newerReleaseThan(managed.version)
|
|
3089
|
+
);
|
|
3090
|
+
}
|
|
3045
3091
|
return {
|
|
3046
3092
|
kind: "info",
|
|
3047
3093
|
message: `Camunda Modeler is already installed at ${installedPath}; skipping installation.`
|
|
@@ -3073,7 +3119,7 @@ async function installOnLinux({
|
|
|
3073
3119
|
{ logger, quiet },
|
|
3074
3120
|
"Checking for the latest stable Camunda Modeler release..."
|
|
3075
3121
|
);
|
|
3076
|
-
const tempDir = mkdtempSync(
|
|
3122
|
+
const tempDir = mkdtempSync(join3(tmpdir(), "c8ctl-modeler-"));
|
|
3077
3123
|
const controller = new AbortController();
|
|
3078
3124
|
let interruptedSignal;
|
|
3079
3125
|
const interrupt = (signal) => {
|
|
@@ -3094,8 +3140,8 @@ async function installOnLinux({
|
|
|
3094
3140
|
signal: controller.signal
|
|
3095
3141
|
});
|
|
3096
3142
|
const releaseDir = `camunda-modeler-${version}-linux-x64`;
|
|
3097
|
-
const installDir =
|
|
3098
|
-
const launcher =
|
|
3143
|
+
const installDir = join3(LINUX_INSTALL_ROOT, releaseDir);
|
|
3144
|
+
const launcher = join3(LINUX_INSTALL_ROOT, LINUX_EXECUTABLE);
|
|
3099
3145
|
reportProgress(
|
|
3100
3146
|
{ logger, quiet },
|
|
3101
3147
|
`Installing Camunda Modeler to ${installDir}...`
|
|
@@ -3107,12 +3153,12 @@ async function installOnLinux({
|
|
|
3107
3153
|
quiet
|
|
3108
3154
|
);
|
|
3109
3155
|
runAsRoot(
|
|
3110
|
-
["chmod", "4755",
|
|
3156
|
+
["chmod", "4755", join3(installDir, "chrome-sandbox")],
|
|
3111
3157
|
"Could not set up the Camunda Modeler sandbox",
|
|
3112
3158
|
quiet
|
|
3113
3159
|
);
|
|
3114
3160
|
runAsRoot(
|
|
3115
|
-
["ln", "-sfn",
|
|
3161
|
+
["ln", "-sfn", join3(releaseDir, LINUX_EXECUTABLE), launcher],
|
|
3116
3162
|
`Could not link ${launcher}`,
|
|
3117
3163
|
quiet
|
|
3118
3164
|
);
|
|
@@ -3140,18 +3186,23 @@ async function installDesktopModeler(ctx) {
|
|
|
3140
3186
|
}
|
|
3141
3187
|
const installedPath = findInstalledModeler();
|
|
3142
3188
|
if (installedPath) {
|
|
3189
|
+
await warnIfUpdateAvailable(ctx.logger, async () => {
|
|
3190
|
+
if (hasPackageManager("brew", "Homebrew") && homebrewModelerInstalled()) {
|
|
3191
|
+
return homebrewModelerOutdated() ? HOMEBREW_UPDATE_NOTICE : void 0;
|
|
3192
|
+
}
|
|
3193
|
+
return newerReleaseThan(readMacModelerVersion(installedPath));
|
|
3194
|
+
});
|
|
3143
3195
|
return {
|
|
3144
3196
|
kind: "info",
|
|
3145
3197
|
message: `Camunda Modeler is already installed at ${installedPath}; skipping installation.`
|
|
3146
3198
|
};
|
|
3147
3199
|
}
|
|
3148
3200
|
if (hasPackageManager("brew", "Homebrew")) {
|
|
3149
|
-
if (
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
})) {
|
|
3201
|
+
if (homebrewModelerInstalled()) {
|
|
3202
|
+
await warnIfUpdateAvailable(
|
|
3203
|
+
ctx.logger,
|
|
3204
|
+
() => homebrewModelerOutdated() ? HOMEBREW_UPDATE_NOTICE : void 0
|
|
3205
|
+
);
|
|
3155
3206
|
return {
|
|
3156
3207
|
kind: "info",
|
|
3157
3208
|
message: "Camunda Modeler is already installed with Homebrew; skipping installation."
|
|
@@ -3186,7 +3237,7 @@ async function installDesktopModeler(ctx) {
|
|
|
3186
3237
|
info: {
|
|
3187
3238
|
dryRun: true,
|
|
3188
3239
|
command: "modeler install",
|
|
3189
|
-
message: `Dry run: would download the latest stable Camunda Modeler and install it to ${
|
|
3240
|
+
message: `Dry run: would download the latest stable Camunda Modeler and install it to ${join3(applicationsDir, APP_BUNDLE_NAME)}.`
|
|
3190
3241
|
}
|
|
3191
3242
|
};
|
|
3192
3243
|
}
|
|
@@ -3246,13 +3297,31 @@ function homebrewModelerInstalled() {
|
|
|
3246
3297
|
description: "the Homebrew Modeler cask"
|
|
3247
3298
|
});
|
|
3248
3299
|
}
|
|
3249
|
-
|
|
3250
|
-
|
|
3300
|
+
var HOMEBREW_UPDATE_NOTICE = "A newer Camunda Modeler is available with Homebrew.";
|
|
3301
|
+
function homebrewModelerOutdated() {
|
|
3302
|
+
const failureMessage = "Could not check Homebrew for Camunda Modeler updates";
|
|
3303
|
+
const result = spawnSync(
|
|
3251
3304
|
"brew",
|
|
3252
3305
|
["outdated", "--cask", "--quiet", "camunda-modeler"],
|
|
3253
|
-
|
|
3254
|
-
)
|
|
3255
|
-
|
|
3306
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
3307
|
+
);
|
|
3308
|
+
const stdout = (result.stdout ?? "").trim();
|
|
3309
|
+
const diagnostics = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
|
|
3310
|
+
const details = diagnostics ? `
|
|
3311
|
+
${diagnostics}` : "";
|
|
3312
|
+
if (result.error) {
|
|
3313
|
+
throw new Error(`${failureMessage}: ${result.error.message}${details}`);
|
|
3314
|
+
}
|
|
3315
|
+
if (result.status === 0 && stdout === "") return false;
|
|
3316
|
+
if ((result.status === 0 || result.status === 1) && stdout.split(/\r?\n/).some((line) => /(^|\/)camunda-modeler$/.test(line.trim()))) {
|
|
3317
|
+
return true;
|
|
3318
|
+
}
|
|
3319
|
+
throw new Error(
|
|
3320
|
+
`${failureMessage} (exit code ${formatExitCode(result.status)}).${details}`
|
|
3321
|
+
);
|
|
3322
|
+
}
|
|
3323
|
+
function updateHomebrewModeler(ctx) {
|
|
3324
|
+
if (!homebrewModelerOutdated()) {
|
|
3256
3325
|
return {
|
|
3257
3326
|
kind: "info",
|
|
3258
3327
|
message: "Camunda Modeler is already up to date with Homebrew."
|
|
@@ -3294,8 +3363,8 @@ function verifyMacModelerBundle(appPath, action, quiet) {
|
|
|
3294
3363
|
);
|
|
3295
3364
|
}
|
|
3296
3365
|
function readMacModelerVersion(appPath) {
|
|
3297
|
-
const plistPath =
|
|
3298
|
-
const plist =
|
|
3366
|
+
const plistPath = join3(appPath, "Contents", "Info.plist");
|
|
3367
|
+
const plist = readFileSync3(plistPath, "utf8");
|
|
3299
3368
|
const version = /<key>CFBundleShortVersionString<\/key>\s*<string>([^<]+)<\/string>/.exec(plist)?.[1]?.trim();
|
|
3300
3369
|
if (!version) {
|
|
3301
3370
|
throw new Error(
|
|
@@ -3312,7 +3381,7 @@ async function updateDirectMacModeler(ctx, appPath) {
|
|
|
3312
3381
|
}
|
|
3313
3382
|
verifyMacModelerBundle(appPath, "update", ctx.quiet);
|
|
3314
3383
|
const currentVersion = readMacModelerVersion(appPath);
|
|
3315
|
-
const tempDir = mkdtempSync(
|
|
3384
|
+
const tempDir = mkdtempSync(join3(tmpdir(), "c8ctl-modeler-"));
|
|
3316
3385
|
const interruption = registerDownloadInterrupts("Modeler update");
|
|
3317
3386
|
try {
|
|
3318
3387
|
reportProgress(
|
|
@@ -3344,10 +3413,10 @@ async function updateDirectMacModeler(ctx, appPath) {
|
|
|
3344
3413
|
signal: interruption.signal
|
|
3345
3414
|
});
|
|
3346
3415
|
const stagingDir = mkdtempSync(
|
|
3347
|
-
|
|
3416
|
+
join3(dirname3(appPath), ".c8ctl-modeler-update-")
|
|
3348
3417
|
);
|
|
3349
|
-
const stagedApp =
|
|
3350
|
-
const backupApp =
|
|
3418
|
+
const stagedApp = join3(stagingDir, APP_BUNDLE_NAME);
|
|
3419
|
+
const backupApp = join3(stagingDir, "previous.app");
|
|
3351
3420
|
try {
|
|
3352
3421
|
reportProgress(ctx, `Updating Camunda Modeler to ${latestVersion}...`);
|
|
3353
3422
|
runCommand("ditto", ["-x", "-k", archivePath, stagingDir], {
|
|
@@ -3438,9 +3507,9 @@ function wingetUpgradeAvailable() {
|
|
|
3438
3507
|
${result.stderr ?? ""}`.split(/\r?\n/).some((line) => line.includes(WINGET_PACKAGE_ID));
|
|
3439
3508
|
}
|
|
3440
3509
|
function wingetModelerPaths() {
|
|
3441
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
3442
|
-
const installDir =
|
|
3443
|
-
return { installDir, executable:
|
|
3510
|
+
const localAppData = process.env.LOCALAPPDATA || join3(homedir2(), "AppData", "Local");
|
|
3511
|
+
const installDir = join3(localAppData, "Programs", "Camunda Modeler");
|
|
3512
|
+
return { installDir, executable: join3(installDir, WINDOWS_EXECUTABLE) };
|
|
3444
3513
|
}
|
|
3445
3514
|
function updateWindowsModeler(ctx) {
|
|
3446
3515
|
const { executable, installDir } = wingetModelerPaths();
|
|
@@ -3485,8 +3554,8 @@ function updateWindowsModeler(ctx) {
|
|
|
3485
3554
|
return { kind: "success", message: "Updated Camunda Modeler with winget." };
|
|
3486
3555
|
}
|
|
3487
3556
|
function unregisterWindowsModeler(ctx, executable) {
|
|
3488
|
-
const appData = process.env.APPDATA ||
|
|
3489
|
-
const shortcut =
|
|
3557
|
+
const appData = process.env.APPDATA || join3(homedir2(), "AppData", "Roaming");
|
|
3558
|
+
const shortcut = join3(
|
|
3490
3559
|
appData,
|
|
3491
3560
|
"Microsoft",
|
|
3492
3561
|
"Windows",
|
|
@@ -3569,7 +3638,7 @@ function pathExists(path) {
|
|
|
3569
3638
|
}
|
|
3570
3639
|
}
|
|
3571
3640
|
function findManagedLinuxModeler() {
|
|
3572
|
-
const launcher =
|
|
3641
|
+
const launcher = join3(LINUX_INSTALL_ROOT, LINUX_EXECUTABLE);
|
|
3573
3642
|
let target;
|
|
3574
3643
|
try {
|
|
3575
3644
|
target = readlinkSync(launcher);
|
|
@@ -3580,7 +3649,7 @@ function findManagedLinuxModeler() {
|
|
|
3580
3649
|
target
|
|
3581
3650
|
)?.[1];
|
|
3582
3651
|
if (!version) return void 0;
|
|
3583
|
-
const installDir =
|
|
3652
|
+
const installDir = join3(
|
|
3584
3653
|
LINUX_INSTALL_ROOT,
|
|
3585
3654
|
`camunda-modeler-${version}-linux-x64`
|
|
3586
3655
|
);
|
|
@@ -3589,7 +3658,7 @@ function findManagedLinuxModeler() {
|
|
|
3589
3658
|
function linuxModelerForAction(action) {
|
|
3590
3659
|
const installation = findManagedLinuxModeler();
|
|
3591
3660
|
if (installation) return installation;
|
|
3592
|
-
const launcher =
|
|
3661
|
+
const launcher = join3(LINUX_INSTALL_ROOT, LINUX_EXECUTABLE);
|
|
3593
3662
|
const installedPath = findOnPath(LINUX_EXECUTABLE);
|
|
3594
3663
|
if (installedPath || pathExists(launcher)) {
|
|
3595
3664
|
throw new Error(
|
|
@@ -3606,12 +3675,12 @@ async function updateLinuxModeler(ctx) {
|
|
|
3606
3675
|
}
|
|
3607
3676
|
const installation = linuxModelerForAction("update");
|
|
3608
3677
|
if (!installation) return noModelerInstalled();
|
|
3609
|
-
if (!existsSync(
|
|
3678
|
+
if (!existsSync(join3(installation.installDir, LINUX_EXECUTABLE))) {
|
|
3610
3679
|
throw new Error(
|
|
3611
|
-
`Camunda Modeler ${installation.version} is only partially installed: ${
|
|
3680
|
+
`Camunda Modeler ${installation.version} is only partially installed: ${join3(installation.installDir, LINUX_EXECUTABLE)} is missing. Run \`c8ctl modeler remove\` to clean up, then \`c8ctl modeler install\` to install it again.`
|
|
3612
3681
|
);
|
|
3613
3682
|
}
|
|
3614
|
-
const tempDir = mkdtempSync(
|
|
3683
|
+
const tempDir = mkdtempSync(join3(tmpdir(), "c8ctl-modeler-"));
|
|
3615
3684
|
const interruption = registerDownloadInterrupts("Modeler update");
|
|
3616
3685
|
try {
|
|
3617
3686
|
reportProgress(
|
|
@@ -3628,7 +3697,7 @@ async function updateLinuxModeler(ctx) {
|
|
|
3628
3697
|
};
|
|
3629
3698
|
}
|
|
3630
3699
|
const newReleaseName = `camunda-modeler-${latestVersion}-linux-x64`;
|
|
3631
|
-
const newInstallDir =
|
|
3700
|
+
const newInstallDir = join3(LINUX_INSTALL_ROOT, newReleaseName);
|
|
3632
3701
|
if (ctx.isDryRun) {
|
|
3633
3702
|
return dryRunResult(
|
|
3634
3703
|
"modeler update",
|
|
@@ -3656,7 +3725,7 @@ async function updateLinuxModeler(ctx) {
|
|
|
3656
3725
|
quiet: ctx.quiet,
|
|
3657
3726
|
signal: interruption.signal
|
|
3658
3727
|
});
|
|
3659
|
-
const temporaryLauncher =
|
|
3728
|
+
const temporaryLauncher = join3(
|
|
3660
3729
|
LINUX_INSTALL_ROOT,
|
|
3661
3730
|
".c8ctl-camunda-modeler-update"
|
|
3662
3731
|
);
|
|
@@ -3678,13 +3747,13 @@ async function updateLinuxModeler(ctx) {
|
|
|
3678
3747
|
"Could not extract Camunda Modeler",
|
|
3679
3748
|
ctx.quiet
|
|
3680
3749
|
);
|
|
3681
|
-
if (!existsSync(
|
|
3750
|
+
if (!existsSync(join3(newInstallDir, LINUX_EXECUTABLE))) {
|
|
3682
3751
|
throw manualDownloadError(
|
|
3683
3752
|
`The Camunda Modeler ${latestVersion} archive did not contain ${newReleaseName}/${LINUX_EXECUTABLE}`
|
|
3684
3753
|
);
|
|
3685
3754
|
}
|
|
3686
3755
|
runAsRoot(
|
|
3687
|
-
["chmod", "4755",
|
|
3756
|
+
["chmod", "4755", join3(newInstallDir, "chrome-sandbox")],
|
|
3688
3757
|
"Could not set up the Camunda Modeler sandbox",
|
|
3689
3758
|
ctx.quiet
|
|
3690
3759
|
);
|
|
@@ -3692,7 +3761,7 @@ async function updateLinuxModeler(ctx) {
|
|
|
3692
3761
|
[
|
|
3693
3762
|
"ln",
|
|
3694
3763
|
"-sfn",
|
|
3695
|
-
|
|
3764
|
+
join3(newReleaseName, LINUX_EXECUTABLE),
|
|
3696
3765
|
temporaryLauncher
|
|
3697
3766
|
],
|
|
3698
3767
|
`Could not prepare ${LINUX_EXECUTABLE}`,
|