@uipath/cli 1.206.0-preview.306 → 1.207.0-preview.307
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 +48 -0
- package/dist/{browser-strategy-p5fhwxqj.js → browser-strategy-5rfwnk5q.js} +1 -1
- package/dist/cli-1jpx8z2w.js +28 -0
- package/dist/cliInstaller-3dxg6fbd.js +23 -0
- package/dist/{contentStore-34hat2cd.js → contentStore-5p86z7qq.js} +7 -6
- package/dist/{environmentInfo-tr3pt6x1.js → environmentInfo-wp5jthdh.js} +6 -6
- package/dist/{feedbackPrompts-bx209g5v.js → feedbackPrompts-fc66gq0p.js} +3 -3
- package/dist/forcedUpdate-fm57455c.js +21 -0
- package/dist/{handlers-jjwt24f2.js → handlers-rg3d62gb.js} +13 -9
- package/dist/index-2f6vv7yr.js +81 -0
- package/dist/index-319vtrwd.js +264 -0
- package/dist/index-33wtbzyw.js +248 -0
- package/dist/index-5dbc9t09.js +41 -0
- package/dist/index-5ygg5mrs.js +1272 -0
- package/dist/{index-99emfvtm.js → index-65pyx6c9.js} +4 -2
- package/dist/{index-rr5hdtcy.js → index-81197qe5.js} +15 -17
- package/dist/{index-2mm750yx.js → index-8n0z4r6f.js} +69 -13
- package/dist/{index-8zhmg5tz.js → index-8pk6n4t9.js} +2 -2
- package/dist/{index-nsrrst23.js → index-ack311y7.js} +12 -2
- package/dist/index-afhekp0a.js +331 -0
- package/dist/{index-szbq3m4j.js → index-bf2mdvne.js} +8 -12
- package/dist/{index-2n2vr5w5.js → index-dt6mjnkf.js} +39 -57
- package/dist/{index-85fgzk87.js → index-dtgfa304.js} +1 -1
- package/dist/{index-y7d0cth0.js → index-e82sznr2.js} +7 -7
- package/dist/index-ej6eeger.js +23 -0
- package/dist/{index-bxc30q35.js → index-gk5pc8xr.js} +2 -2
- package/dist/{index-7q9kcs3w.js → index-h2ctqv68.js} +14 -5
- package/dist/{index-m780gg7f.js → index-hfvbp7ay.js} +30 -14
- package/dist/index-jk7em40j.js +37 -0
- package/dist/{index-691s5342.js → index-jn06044v.js} +2130 -834
- package/dist/{index-vhn8f5d2.js → index-kdr4xvby.js} +5 -5
- package/dist/{index-ckp8r4dh.js → index-mb62swmp.js} +2 -2
- package/dist/index-nzfpbep9.js +14 -0
- package/dist/{index-z070caqq.js → index-p64w2wrt.js} +30 -8
- package/dist/{index-8x2rp038.js → index-petywj9n.js} +81 -58
- package/dist/{index-nn8qzaxe.js → index-phkawd97.js} +2 -2
- package/dist/{index-ede5v6yy.js → index-q3f93ttm.js} +26 -17
- package/dist/{index-3s642t05.js → index-spnvnhbf.js} +7 -10
- package/dist/index-v7yphxb8.js +118 -0
- package/dist/index-vrfbee4d.js +340 -0
- package/dist/{index-69mcde3n.js → index-xw81b1gn.js} +196 -81
- package/dist/{index-wg3cne7n.js → index-xxms6rt8.js} +24 -5
- package/dist/{index-21kns9qg.js → index-y7v9rkq9.js} +1 -1
- package/dist/{index-fdztq951.js → index-zhp702kh.js} +393 -82
- package/dist/index.js +23 -18
- package/dist/{install-kgcwdbqs.js → install-h76qyy1e.js} +6 -7
- package/dist/{node-strategy-p1n8wr5s.js → node-strategy-9t0ttffv.js} +2 -2
- package/dist/{project-context-caht70an.js → project-context-rc4ghykm.js} +13 -5
- package/dist/{prompt-9ze9zy34.js → prompt-5vbvcsds.js} +5 -5
- package/dist/{server-qg4rm5e3.js → server-8c4jwqjh.js} +5 -5
- package/dist/{skillCatalog-fvrcgryd.js → skillCatalog-bqya1aer.js} +8 -7
- package/dist/skillsService-8yjvmz8c.js +35 -0
- package/dist/{telemetry-drain-rt346cfz.js → telemetry-drain-8qr5tzmf.js} +2 -2
- package/dist/tree-fk9gwh4v.js +16 -0
- package/dist/updateService-9qew50s3.js +377 -0
- package/dist/updateService.cli-xtqp78g7.js +15 -0
- package/dist/updateService.skills-e2pbe2w6.js +27 -0
- package/dist/updateService.tools-m58m2fbt.js +19 -0
- package/package.json +2 -2
- package/dist/cli-7rv7qys0.js +0 -23
- package/dist/index-3qp7d08f.js +0 -240
- package/dist/index-3zf0ywpb.js +0 -95
- package/dist/index-753mncpq.js +0 -271
- package/dist/index-w3my9pw8.js +0 -45
- package/dist/skillsService-0387c5f0.js +0 -29
- package/dist/tree-4dhk82fh.js +0 -17
- package/dist/updateService-a3ypvwz8.js +0 -522
- package/dist/updateService.skills-nkdzyrwv.js +0 -22
- package/dist/updateService.tools-3zfct9yk.js +0 -16
package/README.md
CHANGED
|
@@ -408,6 +408,54 @@ uip tools install @uipath/automation-tool
|
|
|
408
408
|
✅ Successfully installed @uipath/automation-tool
|
|
409
409
|
```
|
|
410
410
|
|
|
411
|
+
#### Freezing tool versions (CI/CD)
|
|
412
|
+
|
|
413
|
+
A fresh runner installs each tool at its newest patch. To freeze the CLI, the
|
|
414
|
+
tools and the skills, run `uip config freeze` in the repo on your machine and
|
|
415
|
+
commit `.uipath/config.json`. Freeze writes the `versions` block
|
|
416
|
+
(`cli`, `tools`, and `skills` when skills are installed) and `core.updateChannel`,
|
|
417
|
+
and no other key. With `--all`, it also pins each tool that is not installed,
|
|
418
|
+
at the newest build on the CLI's line. A tool with no build on the line is
|
|
419
|
+
left out, with a warning. When no tool is installed and the registry has no
|
|
420
|
+
build of any tool, the freeze fails. When another registry lookup fails, the
|
|
421
|
+
freeze fails and writes nothing. A CLI off `versions.cli` refuses normal
|
|
422
|
+
commands.
|
|
423
|
+
|
|
424
|
+
**Example:**
|
|
425
|
+
```bash
|
|
426
|
+
mkdir -p .uipath && touch .uipath/config.json # first freeze in a repo with no config file
|
|
427
|
+
uip config freeze
|
|
428
|
+
git add .uipath/config.json
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Freeze writes the current config: the nearest `.uipath/config.json`, else
|
|
432
|
+
`~/.uipath/config.json`, the machine-level freeze. An empty config file is an
|
|
433
|
+
empty config.
|
|
434
|
+
|
|
435
|
+
In the pipeline, install the CLI, then run `uip update`. It puts the CLI, the
|
|
436
|
+
tools and the skills on their pins:
|
|
437
|
+
```bash
|
|
438
|
+
npm i -g @uipath/cli
|
|
439
|
+
uip update
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
When the newest CLI is not the pinned one, `uip update` downloads the CLI a
|
|
443
|
+
second time. To skip that, install `@uipath/cli@<versions.cli>` directly, or
|
|
444
|
+
cache the global npm install between runs.
|
|
445
|
+
|
|
446
|
+
On a developer's laptop, a repo with a frozen `.uipath/config.json` runs on its
|
|
447
|
+
pins. See [At run time](https://github.com/UiPath/cli/blob/main/docs/reference/versioning.md#at-run-time).
|
|
448
|
+
|
|
449
|
+
The Studio-bundled CLI ignores the CLI and tool pins, follows
|
|
450
|
+
`versions.skills`, and refuses `uip config freeze`.
|
|
451
|
+
|
|
452
|
+
`uip config unfreeze` removes the `versions` block and `core.updateChannel`.
|
|
453
|
+
`uip config export --output-file <path>` and `uip config import --input <path>`
|
|
454
|
+
copy the whole config file. Import checks the file first, replaces the current
|
|
455
|
+
config and installs nothing.
|
|
456
|
+
|
|
457
|
+
See [Freezing a CI pipeline](https://github.com/UiPath/cli/blob/main/docs/reference/versioning.md#freezing-a-ci-pipeline).
|
|
458
|
+
|
|
411
459
|
#### Declaring tool directories from a host (`UIPATH_CLI_TOOLS_DIRS`)
|
|
412
460
|
|
|
413
461
|
By default the CLI finds its tools by walking up from its own location and
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import"./index-65pyx6c9.js";
|
|
2
|
+
import"./index-8n0z4r6f.js";
|
|
3
|
+
import"./index-p64w2wrt.js";
|
|
4
|
+
import"./index-zhp702kh.js";
|
|
5
|
+
import {
|
|
6
|
+
runNode
|
|
7
|
+
} from "./index-jn06044v.js";
|
|
8
|
+
import"./index-ej6eeger.js";
|
|
9
|
+
import"./index-v7yphxb8.js";
|
|
10
|
+
import"./index-5ygg5mrs.js";
|
|
11
|
+
import"./index-kdr4xvby.js";
|
|
12
|
+
import"./index-xw81b1gn.js";
|
|
13
|
+
import"./index-2f6vv7yr.js";
|
|
14
|
+
import"./index-33wtbzyw.js";
|
|
15
|
+
import"./index-jk7em40j.js";
|
|
16
|
+
import"./index-8pk6n4t9.js";
|
|
17
|
+
import"./index-bf2mdvne.js";
|
|
18
|
+
import"./index-afhekp0a.js";
|
|
19
|
+
import"./index-5dbc9t09.js";
|
|
20
|
+
import"./index-xxms6rt8.js";
|
|
21
|
+
import"./index-dt6mjnkf.js";
|
|
22
|
+
import"./index-mb62swmp.js";
|
|
23
|
+
import"./index-h2ctqv68.js";
|
|
24
|
+
export {
|
|
25
|
+
runNode as run
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//# debugId=8E9E2D342E0680B264756E2164756E21
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectCliInstallContext2,
|
|
3
|
+
describeUpdateCommand2,
|
|
4
|
+
resolveUpdateCommand2,
|
|
5
|
+
detectShadowedCliInstall2,
|
|
6
|
+
readInstalledCliVersion2,
|
|
7
|
+
CliSelfUpdateError2,
|
|
8
|
+
runCliSelfUpdate2
|
|
9
|
+
} from "./index-319vtrwd.js";
|
|
10
|
+
import"./index-xw81b1gn.js";
|
|
11
|
+
import"./index-zhp702kh.js";
|
|
12
|
+
import"./index-p64w2wrt.js";
|
|
13
|
+
export {
|
|
14
|
+
CliSelfUpdateError2 as CliSelfUpdateError,
|
|
15
|
+
describeUpdateCommand2 as describeUpdateCommand,
|
|
16
|
+
detectCliInstallContext2 as detectCliInstallContext,
|
|
17
|
+
detectShadowedCliInstall2 as detectShadowedCliInstall,
|
|
18
|
+
readInstalledCliVersion2 as readInstalledCliVersion,
|
|
19
|
+
resolveUpdateCommand2 as resolveUpdateCommand,
|
|
20
|
+
runCliSelfUpdate2 as runCliSelfUpdate
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//# debugId=AD56E9E844951F7664756E2164756E21
|
|
@@ -14,12 +14,13 @@ import {
|
|
|
14
14
|
removeFromManifest2,
|
|
15
15
|
readExtraFiles2,
|
|
16
16
|
recordExtraFiles2
|
|
17
|
-
} from "./index-
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
17
|
+
} from "./index-petywj9n.js";
|
|
18
|
+
import"./index-mb62swmp.js";
|
|
19
|
+
import"./index-jk7em40j.js";
|
|
20
|
+
import"./index-xw81b1gn.js";
|
|
21
|
+
import"./index-zhp702kh.js";
|
|
21
22
|
import"./index-5gce5wfd.js";
|
|
22
|
-
import"./index-
|
|
23
|
+
import"./index-p64w2wrt.js";
|
|
23
24
|
export {
|
|
24
25
|
DEFAULT_SOURCE2 as DEFAULT_SOURCE,
|
|
25
26
|
MANIFEST_NAME2 as MANIFEST_NAME,
|
|
@@ -38,4 +39,4 @@ export {
|
|
|
38
39
|
updateManifestAfterInstall2 as updateManifestAfterInstall
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
//# debugId=
|
|
42
|
+
//# debugId=7429421C2B290D6064756E2164756E21
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import"./index-
|
|
1
|
+
import"./index-p64w2wrt.js";
|
|
2
2
|
import {
|
|
3
3
|
catchError,
|
|
4
4
|
detectAgent
|
|
5
|
-
} from "./index-
|
|
6
|
-
import"./index-
|
|
7
|
-
import"./index-
|
|
5
|
+
} from "./index-zhp702kh.js";
|
|
6
|
+
import"./index-65pyx6c9.js";
|
|
7
|
+
import"./index-8n0z4r6f.js";
|
|
8
8
|
import"./index-5j0bfd3e.js";
|
|
9
9
|
import {
|
|
10
10
|
auth
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-81197qe5.js";
|
|
12
12
|
import {
|
|
13
13
|
package_default
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-phkawd97.js";
|
|
15
15
|
|
|
16
16
|
// src/services/environmentInfo.ts
|
|
17
17
|
import { arch as osArch, release as osRelease, type as osType } from "node:os";
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
dist_default3,
|
|
4
4
|
dist_default4
|
|
5
5
|
} from "./index-5j0bfd3e.js";
|
|
6
|
-
import"./index-
|
|
6
|
+
import"./index-p64w2wrt.js";
|
|
7
7
|
import {
|
|
8
8
|
catchError
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-zhp702kh.js";
|
|
10
10
|
import {
|
|
11
11
|
VALID_TYPES,
|
|
12
12
|
VALID_PRIORITIES,
|
|
13
13
|
normalizeUrl
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-8pk6n4t9.js";
|
|
15
15
|
|
|
16
16
|
// src/services/feedbackPrompts.ts
|
|
17
17
|
function isExitPrompt(error) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeToolPin2,
|
|
3
|
+
removeToolPins2,
|
|
4
|
+
writeBackVersions2
|
|
5
|
+
} from "./index-afhekp0a.js";
|
|
6
|
+
import"./index-5ygg5mrs.js";
|
|
7
|
+
import"./index-v7yphxb8.js";
|
|
8
|
+
import"./index-ej6eeger.js";
|
|
9
|
+
import"./index-jk7em40j.js";
|
|
10
|
+
import"./index-xw81b1gn.js";
|
|
11
|
+
import"./index-zhp702kh.js";
|
|
12
|
+
import"./index-8n0z4r6f.js";
|
|
13
|
+
import"./index-p64w2wrt.js";
|
|
14
|
+
import"./index-65pyx6c9.js";
|
|
15
|
+
export {
|
|
16
|
+
removeToolPins2 as removeToolPins,
|
|
17
|
+
writeBackVersions2 as writeBackVersions,
|
|
18
|
+
writeToolPin2 as writeToolPin
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//# debugId=11B52CBD829179BF64756E2164756E21
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
AUTH_TIMEOUT_ERROR_CODE2,
|
|
4
4
|
AUTH_CANCELLED_ERROR_CODE2,
|
|
5
5
|
AUTH_RECLAIMED_ERROR_CODE2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-65pyx6c9.js";
|
|
7
7
|
import {
|
|
8
8
|
getActiveAuthProfile2,
|
|
9
9
|
getActiveAuthProfileFilePath2,
|
|
@@ -16,15 +16,15 @@ import {
|
|
|
16
16
|
DEFAULT_ENV_FILENAME2,
|
|
17
17
|
resolveEnvFileLocationAsync2,
|
|
18
18
|
isTenantSelectionError2
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-8n0z4r6f.js";
|
|
20
20
|
import {
|
|
21
21
|
getFileSystem2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-p64w2wrt.js";
|
|
23
23
|
import {
|
|
24
24
|
catchError,
|
|
25
|
+
RESULTS,
|
|
25
26
|
formatErrorChain,
|
|
26
27
|
describeConnectivityError,
|
|
27
|
-
RESULTS,
|
|
28
28
|
getOutputSink,
|
|
29
29
|
logger,
|
|
30
30
|
getOutputFormat,
|
|
@@ -34,17 +34,18 @@ import {
|
|
|
34
34
|
resolveEnvReference,
|
|
35
35
|
canPrompt,
|
|
36
36
|
splitScopeList
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-zhp702kh.js";
|
|
38
38
|
import"./index-5j0bfd3e.js";
|
|
39
39
|
import {
|
|
40
40
|
auth
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-81197qe5.js";
|
|
42
42
|
import {
|
|
43
43
|
COPYRIGHT_NOTICE,
|
|
44
44
|
trackAuthLogin,
|
|
45
45
|
trackTenantSelection,
|
|
46
|
-
trackTokenRefresh
|
|
47
|
-
|
|
46
|
+
trackTokenRefresh,
|
|
47
|
+
warnIfEnvAuthOverrides
|
|
48
|
+
} from "./index-h2ctqv68.js";
|
|
48
49
|
|
|
49
50
|
// src/commands/login/handlers.ts
|
|
50
51
|
function resolveCallbackTimeoutOverrideMs() {
|
|
@@ -474,6 +475,9 @@ async function runLogin(context, options) {
|
|
|
474
475
|
if (noBrowser && (clientSecret || clientAssertion)) {
|
|
475
476
|
logger.warn(clientSecret ? "--no-browser has no effect with client credentials; no browser is opened." : "--no-browser has no effect for federated login; no browser is opened.");
|
|
476
477
|
}
|
|
478
|
+
if (getActiveAuthProfile2() === undefined) {
|
|
479
|
+
warnIfEnvAuthOverrides("the login saved here");
|
|
480
|
+
}
|
|
477
481
|
logger.info(authStartMessage(authFlow, noBrowser));
|
|
478
482
|
let tenantFetchError;
|
|
479
483
|
const handleAuthEvent = (event) => {
|
|
@@ -802,4 +806,4 @@ export {
|
|
|
802
806
|
runTenantSet
|
|
803
807
|
};
|
|
804
808
|
|
|
805
|
-
//# debugId=
|
|
809
|
+
//# debugId=43499382E926C34164756E2164756E21
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
catchError,
|
|
3
|
+
logger
|
|
4
|
+
} from "./index-zhp702kh.js";
|
|
5
|
+
import {
|
|
6
|
+
compareSemver,
|
|
7
|
+
isNpmViewMetadataError,
|
|
8
|
+
toolService
|
|
9
|
+
} from "./index-xw81b1gn.js";
|
|
10
|
+
import {
|
|
11
|
+
majorOf,
|
|
12
|
+
formatVersionPin
|
|
13
|
+
} from "./index-v7yphxb8.js";
|
|
14
|
+
|
|
15
|
+
// src/services/updateService.cli.ts
|
|
16
|
+
var CLI_VERSION_PROBE_TIMEOUT_MS = 20000;
|
|
17
|
+
async function checkCliVersion2(opts) {
|
|
18
|
+
if (opts.isDev) {
|
|
19
|
+
return skipped(opts.cliPkgVersion, "dev mode");
|
|
20
|
+
}
|
|
21
|
+
if (opts.pin) {
|
|
22
|
+
const exact = formatVersionPin(opts.pin);
|
|
23
|
+
const same = exact === opts.cliPkgVersion;
|
|
24
|
+
return {
|
|
25
|
+
current: opts.cliPkgVersion,
|
|
26
|
+
available: same ? null : exact,
|
|
27
|
+
action: same ? "none" : "notice",
|
|
28
|
+
reason: same ? `on the CLI pin ${exact}; newer versions were not looked up, because the pin is exact` : `the CLI pin is ${exact}; newer versions were not looked up, because the pin is exact`
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const [err, latest] = await catchError(toolService.searchLatestVersion("@uipath/cli", undefined, {
|
|
32
|
+
channel: opts.channel,
|
|
33
|
+
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
34
|
+
}));
|
|
35
|
+
if (err) {
|
|
36
|
+
logger.debug(`CLI version probe failed: ${err.message}`);
|
|
37
|
+
return skipped(opts.cliPkgVersion, isNpmViewMetadataError(err) ? err.message : "network error");
|
|
38
|
+
}
|
|
39
|
+
if (!latest) {
|
|
40
|
+
return skipped(opts.cliPkgVersion, `no ${opts.channel} version found`);
|
|
41
|
+
}
|
|
42
|
+
if (exceedsMajorCeiling(latest, opts.maxMajor)) {
|
|
43
|
+
return {
|
|
44
|
+
current: opts.cliPkgVersion,
|
|
45
|
+
available: latest,
|
|
46
|
+
action: "none",
|
|
47
|
+
reason: null,
|
|
48
|
+
heldBackVersion: latest
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
current: opts.cliPkgVersion,
|
|
53
|
+
available: latest,
|
|
54
|
+
action: compareSemver(latest, opts.cliPkgVersion) > 0 ? "notice" : "none",
|
|
55
|
+
reason: null
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async function isVersionPublished2(packageName, version) {
|
|
59
|
+
const [err, found] = await catchError(toolService.searchLatestVersion(packageName, undefined, {
|
|
60
|
+
exact: version,
|
|
61
|
+
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
62
|
+
}));
|
|
63
|
+
if (err) {
|
|
64
|
+
logger.debug(`${packageName}@${version} lookup failed: ${err.message}`);
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return found === version;
|
|
68
|
+
}
|
|
69
|
+
function exceedsMajorCeiling(version, maxMajor) {
|
|
70
|
+
if (maxMajor === undefined)
|
|
71
|
+
return false;
|
|
72
|
+
const major = majorOf(version);
|
|
73
|
+
return major !== null && major > maxMajor;
|
|
74
|
+
}
|
|
75
|
+
function skipped(current, reason) {
|
|
76
|
+
return { current, available: null, action: "skipped", reason };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { checkCliVersion2, isVersionPublished2 };
|
|
80
|
+
|
|
81
|
+
//# debugId=2483E05AB853F8B064756E2164756E21
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFileSystem2
|
|
3
|
+
} from "./index-p64w2wrt.js";
|
|
4
|
+
import {
|
|
5
|
+
catchError,
|
|
6
|
+
logger
|
|
7
|
+
} from "./index-zhp702kh.js";
|
|
8
|
+
import {
|
|
9
|
+
withSystemCaEnv,
|
|
10
|
+
getGlobalNpmUipathDir,
|
|
11
|
+
validatePackageSpec,
|
|
12
|
+
toolService
|
|
13
|
+
} from "./index-xw81b1gn.js";
|
|
14
|
+
|
|
15
|
+
// src/services/cliInstaller.ts
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
function detectCliInstallContext2(execPath) {
|
|
18
|
+
const exe = (execPath ?? fileURLToPath(import.meta.url)).replace(/\\/g, "/");
|
|
19
|
+
const brew = /\/Cellar\/([^/]+)\/[^/]+\//.exec(exe);
|
|
20
|
+
if (brew)
|
|
21
|
+
return { kind: "brew", formula: brew[1] };
|
|
22
|
+
if (exe.includes("/install/global/node_modules/@uipath/cli/")) {
|
|
23
|
+
return { kind: "bun", global: true };
|
|
24
|
+
}
|
|
25
|
+
if (exe.includes("/node_modules/@uipath/cli/") && (exe.includes("/pnpm/global/") || exe.includes("/pnpm-global/"))) {
|
|
26
|
+
return { kind: "pnpm", global: true };
|
|
27
|
+
}
|
|
28
|
+
if (exe.includes("/node_modules/@uipath/cli/") && exe.includes("/.pnpm/")) {
|
|
29
|
+
return { kind: "pnpm", global: false };
|
|
30
|
+
}
|
|
31
|
+
if (exe.includes("/node_modules/@uipath/cli/"))
|
|
32
|
+
return { kind: "npm" };
|
|
33
|
+
return { kind: "unknown" };
|
|
34
|
+
}
|
|
35
|
+
function describeUpdateCommand2(target, ctx, global) {
|
|
36
|
+
switch (ctx.kind) {
|
|
37
|
+
case "brew":
|
|
38
|
+
return `brew upgrade ${ctx.formula}`;
|
|
39
|
+
case "bun":
|
|
40
|
+
return isGlobalPackageManagerInstall(ctx, global) ? `bun add -g ${target}` : `bun add ${target}`;
|
|
41
|
+
case "pnpm":
|
|
42
|
+
return isGlobalPackageManagerInstall(ctx, global) ? `pnpm add -g ${target}` : `pnpm add ${target}`;
|
|
43
|
+
case "npm":
|
|
44
|
+
return global !== false ? `npm install -g ${target}` : `npm install ${target}`;
|
|
45
|
+
case "unknown":
|
|
46
|
+
return `npm install -g ${target}`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function resolveUpdateCommand2(target, ctx, installPath, global) {
|
|
50
|
+
if (ctx.kind === "npm" && global === false && await isBunProject(installPath)) {
|
|
51
|
+
return describeUpdateCommand2(target, { kind: "bun", global: false });
|
|
52
|
+
}
|
|
53
|
+
return describeUpdateCommand2(target, ctx, global);
|
|
54
|
+
}
|
|
55
|
+
async function detectShadowedCliInstall2(global, installPath, runningVersion, installCtx, execPath) {
|
|
56
|
+
const fs = getFileSystem2();
|
|
57
|
+
const normalize = (p) => {
|
|
58
|
+
let forward = p.replace(/\\/g, "/");
|
|
59
|
+
let end = forward.length;
|
|
60
|
+
while (end > 0 && forward[end - 1] === "/")
|
|
61
|
+
end--;
|
|
62
|
+
forward = forward.slice(0, end);
|
|
63
|
+
return process.platform === "win32" ? forward.toLowerCase() : forward;
|
|
64
|
+
};
|
|
65
|
+
let packageDir;
|
|
66
|
+
if (global) {
|
|
67
|
+
if (installCtx.kind !== "npm" && installCtx.kind !== "unknown") {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const uipathDir = await getGlobalNpmUipathDir();
|
|
71
|
+
if (!uipathDir)
|
|
72
|
+
return null;
|
|
73
|
+
packageDir = fs.path.join(uipathDir, "cli");
|
|
74
|
+
} else {
|
|
75
|
+
packageDir = fs.path.join(installPath, "node_modules", "@uipath", "cli");
|
|
76
|
+
}
|
|
77
|
+
const parsed = await readPackageJson(packageDir);
|
|
78
|
+
if (typeof parsed?.version !== "string" || !parsed.version) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
if (parsed.version === runningVersion)
|
|
82
|
+
return null;
|
|
83
|
+
const exe = normalize(execPath ?? fileURLToPath(import.meta.url));
|
|
84
|
+
const normalizedPackageDir = normalize(packageDir);
|
|
85
|
+
if (exe.startsWith(`${normalizedPackageDir}/`))
|
|
86
|
+
return null;
|
|
87
|
+
if (!global && installCtx.kind === "pnpm" && exe.startsWith(`${normalize(installPath)}/node_modules/.pnpm/`) && exe.includes("/node_modules/@uipath/cli/")) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return { installedVersion: parsed.version, packageDir };
|
|
91
|
+
}
|
|
92
|
+
async function readPackageJson(dir) {
|
|
93
|
+
const fs = getFileSystem2();
|
|
94
|
+
const [readErr, raw] = await catchError(fs.readFile(fs.path.join(dir, "package.json"), { encoding: "utf-8" }));
|
|
95
|
+
if (readErr || !raw)
|
|
96
|
+
return;
|
|
97
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(raw));
|
|
98
|
+
return parseErr ? undefined : parsed ?? undefined;
|
|
99
|
+
}
|
|
100
|
+
async function readInstalledCliVersion2(execPath) {
|
|
101
|
+
const fs = getFileSystem2();
|
|
102
|
+
const exe = execPath ?? fileURLToPath(import.meta.url);
|
|
103
|
+
const store = exe.replace(/\\/g, "/").indexOf("/node_modules/.pnpm/");
|
|
104
|
+
if (store !== -1) {
|
|
105
|
+
const link = fs.path.join(exe.slice(0, store), "node_modules", "@uipath", "cli");
|
|
106
|
+
const parsed = await readPackageJson(link);
|
|
107
|
+
return typeof parsed?.version === "string" ? parsed.version : undefined;
|
|
108
|
+
}
|
|
109
|
+
let dir = fs.path.dirname(exe);
|
|
110
|
+
while (true) {
|
|
111
|
+
const parsed = await readPackageJson(dir);
|
|
112
|
+
if (parsed?.name === "@uipath/cli") {
|
|
113
|
+
return typeof parsed.version === "string" ? parsed.version : undefined;
|
|
114
|
+
}
|
|
115
|
+
const parent = fs.path.dirname(dir);
|
|
116
|
+
if (parent === dir)
|
|
117
|
+
return;
|
|
118
|
+
dir = parent;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
class CliSelfUpdateError2 extends Error {
|
|
123
|
+
originalError;
|
|
124
|
+
manualCommand;
|
|
125
|
+
constructor(originalError, manualCommand) {
|
|
126
|
+
super(originalError instanceof Error ? originalError.message : String(originalError));
|
|
127
|
+
this.name = "CliSelfUpdateError";
|
|
128
|
+
this.originalError = originalError;
|
|
129
|
+
this.manualCommand = manualCommand;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function runCliSelfUpdate2(target, ctx, installPath, global) {
|
|
133
|
+
switch (ctx.kind) {
|
|
134
|
+
case "brew":
|
|
135
|
+
await spawnBrewUpgrade(ctx.formula);
|
|
136
|
+
return;
|
|
137
|
+
case "bun":
|
|
138
|
+
await spawnPackageManagerAdd("bun", target, installPath, ctx.global || global);
|
|
139
|
+
return;
|
|
140
|
+
case "pnpm":
|
|
141
|
+
await spawnPackageManagerAdd("pnpm", target, installPath, ctx.global || global);
|
|
142
|
+
return;
|
|
143
|
+
case "npm":
|
|
144
|
+
if (!global && await isBunProject(installPath)) {
|
|
145
|
+
await runWithManualCommand(spawnPackageManagerAdd("bun", target, installPath, false), describeUpdateCommand2(target, {
|
|
146
|
+
kind: "bun",
|
|
147
|
+
global: false
|
|
148
|
+
}));
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
await toolService.install(target, installPath, { global });
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async function runWithManualCommand(operation, manualCommand) {
|
|
156
|
+
const [error] = await catchError(operation);
|
|
157
|
+
if (error)
|
|
158
|
+
throw new CliSelfUpdateError2(error, manualCommand);
|
|
159
|
+
}
|
|
160
|
+
function isGlobalPackageManagerInstall(ctx, global) {
|
|
161
|
+
return ctx.global || global === true;
|
|
162
|
+
}
|
|
163
|
+
var SAFE_BREW_ARG = /^[a-z0-9_@.-]+(\/[a-z0-9_@.-]+){0,2}$/;
|
|
164
|
+
var SAFE_PACKAGE_MANAGER = /^(bun|pnpm)$/;
|
|
165
|
+
var SHELL_SAFE_ARG = /^[a-zA-Z0-9@/._-]+$/;
|
|
166
|
+
var SHELL_SAFE_COMMAND_LINE = /^[a-zA-Z0-9@/._\- ]+$/;
|
|
167
|
+
var BREW_TIMEOUT_MS = 5 * 60 * 1000;
|
|
168
|
+
var PACKAGE_MANAGER_TIMEOUT_MS = 5 * 60 * 1000;
|
|
169
|
+
async function spawnBrewUpgrade(formula) {
|
|
170
|
+
if (!SAFE_BREW_ARG.test(formula)) {
|
|
171
|
+
throw new Error(`Invalid brew formula name: '${formula}'`);
|
|
172
|
+
}
|
|
173
|
+
await spawnSelfUpdateCommand({
|
|
174
|
+
executable: "brew",
|
|
175
|
+
args: ["upgrade", formula],
|
|
176
|
+
label: "brew upgrade",
|
|
177
|
+
timeoutMs: BREW_TIMEOUT_MS
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async function spawnPackageManagerAdd(packageManager, target, installPath, global) {
|
|
181
|
+
if (!SAFE_PACKAGE_MANAGER.test(packageManager)) {
|
|
182
|
+
throw new Error(`Invalid package manager: '${packageManager}'`);
|
|
183
|
+
}
|
|
184
|
+
validatePackageSpec(target);
|
|
185
|
+
const args = global ? ["add", "-g", target] : ["add", target];
|
|
186
|
+
for (const arg of [packageManager, ...args]) {
|
|
187
|
+
if (!SHELL_SAFE_ARG.test(arg)) {
|
|
188
|
+
throw new Error(`Unsafe package manager argument: '${arg}'`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
await spawnSelfUpdateCommand({
|
|
192
|
+
executable: packageManager,
|
|
193
|
+
args,
|
|
194
|
+
cwd: installPath,
|
|
195
|
+
label: `${packageManager} add`,
|
|
196
|
+
shellOnWindows: true,
|
|
197
|
+
timeoutMs: PACKAGE_MANAGER_TIMEOUT_MS
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
async function isBunProject(installPath) {
|
|
201
|
+
const { getFileSystem } = await import("./index-y7v9rkq9.js");
|
|
202
|
+
const fs = getFileSystem();
|
|
203
|
+
const bunLock = fs.path.join(installPath, "bun.lock");
|
|
204
|
+
const bunLockb = fs.path.join(installPath, "bun.lockb");
|
|
205
|
+
return await fs.exists(bunLock) || await fs.exists(bunLockb);
|
|
206
|
+
}
|
|
207
|
+
async function spawnSelfUpdateCommand({
|
|
208
|
+
executable,
|
|
209
|
+
args,
|
|
210
|
+
label,
|
|
211
|
+
timeoutMs,
|
|
212
|
+
cwd,
|
|
213
|
+
shellOnWindows = false
|
|
214
|
+
}) {
|
|
215
|
+
const { spawn } = await import("node:child_process");
|
|
216
|
+
logger.debug(`Running: ${executable} ${args.join(" ")}`);
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
let proc;
|
|
219
|
+
if (shellOnWindows && process.platform === "win32") {
|
|
220
|
+
const commandLine = [executable, ...args].join(" ");
|
|
221
|
+
if (!SHELL_SAFE_COMMAND_LINE.test(commandLine)) {
|
|
222
|
+
reject(new Error(`Unsafe command line: '${commandLine}'`));
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
proc = spawn(commandLine, [], {
|
|
226
|
+
cwd,
|
|
227
|
+
env: withSystemCaEnv(),
|
|
228
|
+
shell: true,
|
|
229
|
+
stdio: ["inherit", "pipe", "pipe"]
|
|
230
|
+
});
|
|
231
|
+
} else {
|
|
232
|
+
proc = spawn(executable, args, {
|
|
233
|
+
cwd,
|
|
234
|
+
env: withSystemCaEnv(),
|
|
235
|
+
stdio: ["inherit", "pipe", "pipe"]
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
let stderr = "";
|
|
239
|
+
const MAX_STDERR = 65536;
|
|
240
|
+
proc.stdout?.on("data", (d) => {
|
|
241
|
+
logger.info(d.toString().trimEnd());
|
|
242
|
+
});
|
|
243
|
+
proc.stderr?.on("data", (d) => {
|
|
244
|
+
if (stderr.length < MAX_STDERR)
|
|
245
|
+
stderr += d.toString();
|
|
246
|
+
});
|
|
247
|
+
const timer = setTimeout(() => {
|
|
248
|
+
proc.kill("SIGTERM");
|
|
249
|
+
reject(new Error(`${label} timed out after ${timeoutMs / 1000}s`));
|
|
250
|
+
}, timeoutMs);
|
|
251
|
+
proc.on("error", (err) => {
|
|
252
|
+
clearTimeout(timer);
|
|
253
|
+
reject(err);
|
|
254
|
+
});
|
|
255
|
+
proc.on("close", (code) => {
|
|
256
|
+
clearTimeout(timer);
|
|
257
|
+
code === 0 ? resolve() : reject(new Error(stderr.trim() || `${label} failed with code ${code}`));
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export { detectCliInstallContext2, describeUpdateCommand2, resolveUpdateCommand2, detectShadowedCliInstall2, readInstalledCliVersion2, CliSelfUpdateError2, runCliSelfUpdate2 };
|
|
263
|
+
|
|
264
|
+
//# debugId=2E4A61CCBCA47FEF64756E2164756E21
|