@uipath/codedapp-tool 1.206.0-preview.303 → 1.207.0-preview.305

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 CHANGED
@@ -1,17 +1,18 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
3
  Command
4
- } from "./packager-tool-z73h4t8a.js";
5
- import"./packager-tool-0ajs8pnk.js";
4
+ } from "./packager-tool-511nvmp8.js";
5
+ import"./packager-tool-9thx6ae9.js";
6
+ import"./packager-tool-ywc134a9.js";
7
+ import"./packager-tool-tjb9qmzj.js";
8
+ import"./packager-tool-62r4c9hq.js";
6
9
  import {
7
10
  metadata2,
8
11
  registerCommands2
9
- } from "./packager-tool-sbjwbrt7.js";
10
- import"./packager-tool-1qg04b7q.js";
11
- import"./packager-tool-3ss96mpk.js";
12
- import"./packager-tool-5t7c439j.js";
13
- import"./packager-tool-t0j980y4.js";
14
- import"./packager-tool-ew0d2fjb.js";
12
+ } from "./packager-tool-g7b4kkqx.js";
13
+ import"./packager-tool-bzcphfa8.js";
14
+ import"./packager-tool-rnnkxjfm.js";
15
+ import"./packager-tool-1s4184sh.js";
15
16
 
16
17
  // src/index.ts
17
18
  var program = new Command;
@@ -19,4 +20,4 @@ program.name(metadata2.name).version(metadata2.version).description(metadata2.de
19
20
  await registerCommands2(program);
20
21
  program.parse(process.argv);
21
22
 
22
- //# debugId=D460BA11CBABD40C64756E2164756E21
23
+ //# debugId=78A06C8FC8E775DF64756E2164756E21
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getFileSystem
3
- } from "./packager-tool-0ajs8pnk.js";
3
+ } from "./packager-tool-9thx6ae9.js";
4
4
  import {
5
5
  DEFAULT_AUTH_TIMEOUT_MS,
6
6
  AUTH_TIMEOUT_ERROR_CODE,
7
7
  AUTH_CANCELLED_ERROR_CODE,
8
8
  AUTH_RECLAIMED_ERROR_CODE
9
- } from "./packager-tool-1qg04b7q.js";
9
+ } from "./packager-tool-bzcphfa8.js";
10
10
  import {
11
11
  catchError2
12
12
  } from "./packager-tool-xd2w5pct.js";
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  catchError,
3
+ logger,
3
4
  quoteForShell,
4
5
  unsupportedSolutionProjectType
5
- } from "./packager-tool-z73h4t8a.js";
6
+ } from "./packager-tool-511nvmp8.js";
6
7
 
7
8
  // ../solution-sdk/src/solution-file.ts
8
9
  var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
@@ -17,6 +18,72 @@ function toPortableRelativePath(relativePath) {
17
18
  function isRecord(value) {
18
19
  return typeof value === "object" && value !== null && !Array.isArray(value);
19
20
  }
21
+ async function createSolutionManifest(fs, solutionDir, solutionName, options = {}) {
22
+ const resolvedDir = fs.path.resolve(solutionDir);
23
+ if (!(options.allowExistingDir && await fs.exists(resolvedDir))) {
24
+ await fs.mkdir(resolvedDir);
25
+ }
26
+ const solutionId = crypto.randomUUID();
27
+ const manifest = {
28
+ DocVersion: "1.0.0",
29
+ StudioMinVersion: "2025.10.0",
30
+ SolutionId: solutionId,
31
+ Projects: []
32
+ };
33
+ const solutionFile = fs.path.join(resolvedDir, `${solutionName}.uipx`);
34
+ await fs.writeFile(solutionFile, `${JSON.stringify(manifest, null, 2)}
35
+ `);
36
+ return {
37
+ solutionDir: resolvedDir,
38
+ solutionFile,
39
+ solutionId
40
+ };
41
+ }
42
+ var AUTO_SOLUTION_SUFFIX = "Solution";
43
+ async function autoScaffoldSolution(fs, baseDir, projectName) {
44
+ const solutionName = `${projectName}${AUTO_SOLUTION_SUFFIX}`;
45
+ const solutionDir = fs.path.resolve(baseDir, solutionName);
46
+ const expectedSolutionFile = fs.path.join(solutionDir, `${solutionName}.uipx`);
47
+ if (await fs.exists(expectedSolutionFile)) {
48
+ return {
49
+ Name: solutionName,
50
+ Path: solutionDir,
51
+ SolutionFile: expectedSolutionFile
52
+ };
53
+ }
54
+ const { solutionFile } = await createSolutionManifest(fs, solutionDir, solutionName, { allowExistingDir: true });
55
+ return {
56
+ Name: solutionName,
57
+ Path: solutionDir,
58
+ SolutionFile: solutionFile
59
+ };
60
+ }
61
+ async function prepareProjectLocation(fs, candidateProjectDir, projectName, options = {}) {
62
+ const resolved = fs.path.resolve(candidateProjectDir);
63
+ if (options.skipRegistration) {
64
+ return { projectDir: resolved };
65
+ }
66
+ const discovery = await findNearestParentUipxFile(fs, resolved);
67
+ if (discovery.status !== "notFound") {
68
+ return { projectDir: resolved };
69
+ }
70
+ const baseDir = fs.path.dirname(resolved);
71
+ const autoCreatedSolution = await autoScaffoldSolution(fs, baseDir, projectName);
72
+ const projectDir = fs.path.join(autoCreatedSolution.Path, projectName);
73
+ await warnIfCandidateDirShadowed(fs, resolved, projectDir);
74
+ return { projectDir, autoCreatedSolution };
75
+ }
76
+ async function warnIfCandidateDirShadowed(fs, candidateDir, projectDir) {
77
+ const [, exists] = await catchError(fs.exists(candidateDir));
78
+ if (!exists) {
79
+ return;
80
+ }
81
+ const [, entries] = await catchError(fs.readdir(candidateDir));
82
+ if (!entries || entries.length === 0) {
83
+ return;
84
+ }
85
+ logger.warn(`An existing directory "${candidateDir}" was left untouched. ` + `The project was created inside the auto-created solution at "${projectDir}". ` + "Run init from inside an existing solution, or pass --skip-solution-registration, if you meant to use the existing directory.");
86
+ }
20
87
  async function tryRegisterProjectInParentSolution(fs, projectDir, options) {
21
88
  if (options?.skipRegistration) {
22
89
  return {
@@ -117,8 +184,7 @@ async function registerProjectInParentSolution(fs, projectDir) {
117
184
  Id: projectId
118
185
  });
119
186
  solution.content.Projects = solution.projects;
120
- const [writeError] = await catchError(fs.writeFile(solutionFile, `${JSON.stringify(solution.content, null, 2)}
121
- `));
187
+ const [writeError] = await catchError(writeSolutionManifest(fs, solutionFile, solution.content));
122
188
  if (writeError) {
123
189
  return {
124
190
  Status: "Failed",
@@ -137,6 +203,30 @@ async function registerProjectInParentSolution(fs, projectDir) {
137
203
  Instructions: buildRegistrationSuccessInstructions(solutionDir)
138
204
  };
139
205
  }
206
+ async function writeSolutionManifest(fs, solutionFile, content) {
207
+ const [, previous] = await catchError(fs.readFile(solutionFile, "utf-8"));
208
+ const before = typeof previous === "string" ? previous : "";
209
+ const bom = before.startsWith("\uFEFF");
210
+ const crlf = before.includes(`\r
211
+ `);
212
+ const indent = /\n([ \t]+)\S/.exec(before.replace(/\r\n/g, `
213
+ `))?.[1] ?? " ";
214
+ const finalNewline = before === "" || /\n$/.test(before);
215
+ let text = JSON.stringify(content, null, indent) + (finalNewline ? `
216
+ ` : "");
217
+ if (crlf)
218
+ text = text.replace(/\n/g, `\r
219
+ `);
220
+ if (bom)
221
+ text = `\uFEFF${text}`;
222
+ const temp = `${solutionFile}.${crypto.randomUUID()}.tmp`;
223
+ await fs.writeFile(temp, text);
224
+ const [renameError] = await catchError(fs.rename(temp, solutionFile));
225
+ if (renameError) {
226
+ await catchError(fs.rm(temp));
227
+ throw renameError;
228
+ }
229
+ }
140
230
  async function findNearestParentUipxFile(fs, projectDir) {
141
231
  let currentDir = fs.path.dirname(fs.path.resolve(projectDir));
142
232
  while (true) {
@@ -240,7 +330,7 @@ async function readSolutionManifest(fs, solutionFile) {
240
330
  null
241
331
  ];
242
332
  }
243
- const [parseError, parsed] = catchError(() => JSON.parse(rawContent));
333
+ const [parseError, parsed] = catchError(() => JSON.parse(rawContent.replace(/^\uFEFF/, "")));
244
334
  if (parseError) {
245
335
  return [
246
336
  new Error(`Invalid JSON in solution file: ${parseError.message}`),
@@ -318,6 +408,6 @@ function buildOptedOutInstructions(projectDir) {
318
408
  `);
319
409
  }
320
410
 
321
- export { normalizeProjectType, toPortableRelativePath, tryRegisterProjectInParentSolution, findNearestParentUipxFile };
411
+ export { normalizeProjectType, toPortableRelativePath, prepareProjectLocation, tryRegisterProjectInParentSolution, findNearestParentUipxFile };
322
412
 
323
- //# debugId=4C8BD2320B4D5BBD64756E2164756E21
413
+ //# debugId=9F1E5408F765D7FE64756E2164756E21