@uipath/packager-tool-webapp 1.206.0-preview.301 → 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/action-schema/duplicate-property-names.d.ts +16 -0
- package/dist/action-schema/index.d.ts +1 -0
- package/dist/action-schema/index.js +425 -113
- package/dist/constants.js +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +368 -82
- package/dist/project-identity.d.ts +21 -0
- package/dist/strategies/coded-app-build-stamp.d.ts +21 -0
- package/dist/strategies/coded-app-build.d.ts +56 -0
- package/dist/strategies/coded-app-strategy.d.ts +19 -2
- package/dist/strategies/command-runner.d.ts +25 -0
- package/dist/strategies/variant-strategy-factory.d.ts +3 -1
- package/dist/strategies/variant-strategy.d.ts +9 -0
- package/dist/webapp-tool-factory.d.ts +7 -0
- package/dist/webapp-tool.d.ts +4 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5,6 +5,12 @@ var WebAppVariantType;
|
|
|
5
5
|
WebAppVariantType["JS"] = "JS";
|
|
6
6
|
})(WebAppVariantType ||= {});
|
|
7
7
|
var WEBAPP_MANIFEST_FILE_NAME = "webAppManifest.json";
|
|
8
|
+
// src/project-identity.ts
|
|
9
|
+
import {
|
|
10
|
+
MAX_IDENTITY_FILE_BYTES,
|
|
11
|
+
ProjectTypes
|
|
12
|
+
} from "@uipath/solutionpackager-tool-core";
|
|
13
|
+
|
|
8
14
|
// src/utils/manifest-loader.ts
|
|
9
15
|
import { Path } from "@uipath/solutionpackager-tool-core";
|
|
10
16
|
async function loadWebAppManifest(fileSystem, projectPath) {
|
|
@@ -39,12 +45,30 @@ async function ensureWebAppProjectId(fileSystem, projectPath) {
|
|
|
39
45
|
}
|
|
40
46
|
return id;
|
|
41
47
|
}
|
|
48
|
+
|
|
49
|
+
// src/project-identity.ts
|
|
50
|
+
var readProjectIdentity = async (target, fs) => {
|
|
51
|
+
const projectDirectory = fs.path.resolve(target);
|
|
52
|
+
const base = { projectDirectory, projectType: ProjectTypes.AppV2 };
|
|
53
|
+
let manifest;
|
|
54
|
+
try {
|
|
55
|
+
const stat = await fs.stat(fs.path.join(projectDirectory, WEBAPP_MANIFEST_FILE_NAME));
|
|
56
|
+
if (stat && stat.size > MAX_IDENTITY_FILE_BYTES) {
|
|
57
|
+
return { ...base, status: "invalid" };
|
|
58
|
+
}
|
|
59
|
+
manifest = await loadWebAppManifest(fs, projectDirectory);
|
|
60
|
+
} catch {
|
|
61
|
+
return { ...base, status: "invalid" };
|
|
62
|
+
}
|
|
63
|
+
const id = manifest?.projectId;
|
|
64
|
+
return typeof id === "string" && id.length > 0 ? { ...base, id, status: "resolved" } : { ...base, status: "missing" };
|
|
65
|
+
};
|
|
42
66
|
// src/webapp-tool.ts
|
|
43
67
|
import {
|
|
44
|
-
Path as
|
|
68
|
+
Path as Path8,
|
|
45
69
|
ProjectTool,
|
|
46
70
|
TemporaryStorageService,
|
|
47
|
-
ToolErrorCodes,
|
|
71
|
+
ToolErrorCodes as ToolErrorCodes2,
|
|
48
72
|
ToolResult
|
|
49
73
|
} from "@uipath/solutionpackager-tool-core";
|
|
50
74
|
|
|
@@ -128,23 +152,164 @@ var ERROR_MESSAGES = {
|
|
|
128
152
|
OUTPUT_PATH_REQUIRED: "Output path is required"
|
|
129
153
|
};
|
|
130
154
|
|
|
155
|
+
// src/strategies/coded-app-build.ts
|
|
156
|
+
import { Path as Path3, ToolErrorCodes } from "@uipath/solutionpackager-tool-core";
|
|
157
|
+
var LOCKFILE_INSTALLS = [
|
|
158
|
+
{ lockfile: "package-lock.json", manager: "npm", install: ["ci"] },
|
|
159
|
+
{ lockfile: "npm-shrinkwrap.json", manager: "npm", install: ["ci"] },
|
|
160
|
+
{
|
|
161
|
+
lockfile: "pnpm-lock.yaml",
|
|
162
|
+
manager: "pnpm",
|
|
163
|
+
install: ["install", "--frozen-lockfile"]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
lockfile: "yarn.lock",
|
|
167
|
+
manager: "yarn",
|
|
168
|
+
install: ["install", "--frozen-lockfile"]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
lockfile: "bun.lock",
|
|
172
|
+
manager: "bun",
|
|
173
|
+
install: ["install", "--frozen-lockfile"]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
lockfile: "bun.lockb",
|
|
177
|
+
manager: "bun",
|
|
178
|
+
install: ["install", "--frozen-lockfile"]
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
var OUTPUT_TAIL_LINES = 20;
|
|
182
|
+
|
|
183
|
+
class CodedAppNotPackableError extends Error {
|
|
184
|
+
instructions;
|
|
185
|
+
errorCode;
|
|
186
|
+
constructor(message, instructions, errorCode = ToolErrorCodes.InvalidProject) {
|
|
187
|
+
super(message);
|
|
188
|
+
this.instructions = instructions;
|
|
189
|
+
this.errorCode = errorCode;
|
|
190
|
+
this.name = "CodedAppNotPackableError";
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function bundleProblemInstructions(bundleFolder, source) {
|
|
194
|
+
const repoint = "point config.bundlePath in webAppManifest.json at the folder the app builds to";
|
|
195
|
+
switch (source) {
|
|
196
|
+
case "built":
|
|
197
|
+
return `The app's build ran but did not leave a usable app (with its HTML entry point) in ${bundleFolder}: make the build write there, or ${repoint}. Then pack again.`;
|
|
198
|
+
case "current":
|
|
199
|
+
return `${bundleFolder} is up to date with the app's sources, so pack did not build it, and it holds no usable app (with its HTML entry point). Delete ${bundleFolder} so pack builds it again, or ${repoint}. Then pack again.`;
|
|
200
|
+
case "no-build-script":
|
|
201
|
+
return `Add a "build" script to the app's package.json that writes ${bundleFolder}, so pack can build it, or ${repoint}. Then pack again.`;
|
|
202
|
+
case "not-building":
|
|
203
|
+
return `Build the app so its output lands in ${bundleFolder}, or ${repoint}. Then pack again.`;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
async function planCodedAppBuildAsync(fileSystem, projectPath, bundlePath) {
|
|
207
|
+
const folder = await findPackageFolderAsync(fileSystem, projectPath, bundlePath);
|
|
208
|
+
if (folder === null)
|
|
209
|
+
return null;
|
|
210
|
+
const packageJsonPath = Path3.join(folder, "package.json");
|
|
211
|
+
const content = await fileSystem.readFile(packageJsonPath);
|
|
212
|
+
let packageJson;
|
|
213
|
+
try {
|
|
214
|
+
packageJson = JSON.parse(new TextDecoder().decode(content ?? new Uint8Array));
|
|
215
|
+
} catch (error) {
|
|
216
|
+
throw new CodedAppNotPackableError(`${packageJsonPath} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`, `Fix ${packageJsonPath}, then pack again.`);
|
|
217
|
+
}
|
|
218
|
+
if (!hasBuildScript(packageJson))
|
|
219
|
+
return null;
|
|
220
|
+
for (const candidate of LOCKFILE_INSTALLS) {
|
|
221
|
+
if (await fileSystem.exists(Path3.join(folder, candidate.lockfile))) {
|
|
222
|
+
return {
|
|
223
|
+
folder,
|
|
224
|
+
manager: candidate.manager,
|
|
225
|
+
lockfile: candidate.lockfile,
|
|
226
|
+
installArgs: candidate.install
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return { folder, manager: "npm", installArgs: ["install"] };
|
|
231
|
+
}
|
|
232
|
+
async function runCodedAppBuildAsync(args) {
|
|
233
|
+
const { fileSystem, runner, plan, logger, signal } = args;
|
|
234
|
+
if (!await fileSystem.exists(Path3.join(plan.folder, "node_modules"))) {
|
|
235
|
+
logger?.progress(`Installing coded app dependencies: ${plan.manager} ${plan.installArgs.join(" ")} (in ${plan.folder})`);
|
|
236
|
+
await runStepAsync(runner, plan, "install", plan.installArgs, signal);
|
|
237
|
+
}
|
|
238
|
+
logger?.progress(`Building coded app: ${plan.manager} run build (in ${plan.folder})`);
|
|
239
|
+
await runStepAsync(runner, plan, "build", ["run", "build"], signal);
|
|
240
|
+
}
|
|
241
|
+
async function runStepAsync(runner, plan, step, stepArgs, signal) {
|
|
242
|
+
const command = [plan.manager, ...stepArgs].join(" ");
|
|
243
|
+
const result = await runner.runAsync(plan.manager, stepArgs, {
|
|
244
|
+
cwd: plan.folder,
|
|
245
|
+
signal
|
|
246
|
+
});
|
|
247
|
+
signal?.throwIfAborted();
|
|
248
|
+
if (result.startError !== undefined) {
|
|
249
|
+
throw new CodedAppNotPackableError(`Could not start '${plan.manager}' to build the coded app in ${plan.folder}: ${result.startError}`, plan.lockfile === undefined || plan.manager === "npm" ? "Install Node.js (it ships npm) and make sure npm is on PATH, then pack again." : `Install ${plan.manager} (the app's ${plan.lockfile} asks for it) and make sure it is on PATH, then pack again.`);
|
|
250
|
+
}
|
|
251
|
+
if (result.exitCode !== 0) {
|
|
252
|
+
const tail = outputTail(result.output);
|
|
253
|
+
const shownTail = tail ? `
|
|
254
|
+
${tail}` : "";
|
|
255
|
+
const exitCode = result.exitCode ?? "none (the process was killed)";
|
|
256
|
+
if (step === "install") {
|
|
257
|
+
throw new CodedAppNotPackableError(`Installing the coded app's dependencies in ${plan.folder} failed: '${command}' ended with exit code ${exitCode}.${shownTail}`, `If the output shows the package registry could not be reached, pack again once it can. Otherwise run '${command}' in ${plan.folder} and fix what it reports, then pack again.`, ToolErrorCodes.DependencyInstallFailed);
|
|
258
|
+
}
|
|
259
|
+
throw new CodedAppNotPackableError(`Building the coded app in ${plan.folder} failed: '${command}' ended with exit code ${exitCode}.${shownTail}`, `Run '${command}' in ${plan.folder} and fix what it reports, then pack again.`);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
async function findPackageFolderAsync(fileSystem, projectPath, bundlePath) {
|
|
263
|
+
const root = trimTrailingSlashes(Path3.normalize(projectPath));
|
|
264
|
+
let folder = isBundleRelativePath(bundlePath) ? Path3.dirname(Path3.join(root, normalizeBundlePath(bundlePath))) : root;
|
|
265
|
+
if (folder !== root && !folder.startsWith(`${root}/`))
|
|
266
|
+
folder = root;
|
|
267
|
+
for (;; ) {
|
|
268
|
+
if (await fileSystem.exists(Path3.join(folder, "package.json"))) {
|
|
269
|
+
return folder;
|
|
270
|
+
}
|
|
271
|
+
if (folder === root)
|
|
272
|
+
return null;
|
|
273
|
+
folder = Path3.dirname(folder);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function trimTrailingSlashes(path) {
|
|
277
|
+
let end = path.length;
|
|
278
|
+
while (end > 0 && path[end - 1] === "/")
|
|
279
|
+
end -= 1;
|
|
280
|
+
return path.slice(0, end);
|
|
281
|
+
}
|
|
282
|
+
function hasBuildScript(packageJson) {
|
|
283
|
+
if (typeof packageJson !== "object" || packageJson === null)
|
|
284
|
+
return false;
|
|
285
|
+
const scripts = packageJson.scripts;
|
|
286
|
+
if (typeof scripts !== "object" || scripts === null)
|
|
287
|
+
return false;
|
|
288
|
+
const build = scripts.build;
|
|
289
|
+
return typeof build === "string" && build.trim() !== "";
|
|
290
|
+
}
|
|
291
|
+
function outputTail(output) {
|
|
292
|
+
return output.trimEnd().split(/\r?\n/).slice(-OUTPUT_TAIL_LINES).join(`
|
|
293
|
+
`);
|
|
294
|
+
}
|
|
295
|
+
|
|
131
296
|
// src/strategies/coded-app-strategy.ts
|
|
132
297
|
import {
|
|
133
298
|
NugetConstants,
|
|
134
299
|
NugetPackager,
|
|
135
|
-
Path as
|
|
136
|
-
ProjectTypes,
|
|
300
|
+
Path as Path6,
|
|
301
|
+
ProjectTypes as ProjectTypes2,
|
|
137
302
|
TargetFramework
|
|
138
303
|
} from "@uipath/solutionpackager-tool-core";
|
|
139
304
|
|
|
140
305
|
// src/utils/fs-helpers.ts
|
|
141
|
-
import { Path as
|
|
306
|
+
import { Path as Path4 } from "@uipath/solutionpackager-tool-core";
|
|
142
307
|
async function copyDirectoryAsync(fileSystem, sourcePath, destinationPath) {
|
|
143
308
|
await fileSystem.mkdir(destinationPath);
|
|
144
309
|
const entries = await fileSystem.readdir(sourcePath);
|
|
145
310
|
for (const entry of entries) {
|
|
146
|
-
const sourceEntry =
|
|
147
|
-
const destEntry =
|
|
311
|
+
const sourceEntry = Path4.join(sourcePath, entry);
|
|
312
|
+
const destEntry = Path4.join(destinationPath, entry);
|
|
148
313
|
const stat = await fileSystem.stat(sourceEntry);
|
|
149
314
|
if (stat?.isDirectory()) {
|
|
150
315
|
await copyDirectoryAsync(fileSystem, sourceEntry, destEntry);
|
|
@@ -157,11 +322,87 @@ async function copyDirectoryAsync(fileSystem, sourcePath, destinationPath) {
|
|
|
157
322
|
}
|
|
158
323
|
}
|
|
159
324
|
|
|
325
|
+
// src/strategies/coded-app-build-stamp.ts
|
|
326
|
+
import { Path as Path5 } from "@uipath/solutionpackager-tool-core";
|
|
327
|
+
var BUILD_STAMP_FILE_NAME = ".uipath-build.json";
|
|
328
|
+
var SKIPPED_DIRECTORY_NAMES = new Set([
|
|
329
|
+
"node_modules",
|
|
330
|
+
".git"
|
|
331
|
+
]);
|
|
332
|
+
async function isBuildCurrentAsync(fileSystem, plan, bundleFolder) {
|
|
333
|
+
const stamped = await readStampAsync(fileSystem, plan.folder);
|
|
334
|
+
if (stamped === null)
|
|
335
|
+
return false;
|
|
336
|
+
return stamped === await fingerprintAsync(fileSystem, plan, bundleFolder) && await fileSystem.exists(bundleFolder);
|
|
337
|
+
}
|
|
338
|
+
async function writeBuildStampAsync(fileSystem, plan, bundleFolder) {
|
|
339
|
+
const fingerprint = await fingerprintAsync(fileSystem, plan, bundleFolder);
|
|
340
|
+
await fileSystem.writeFile(Path5.join(plan.folder, BUILD_STAMP_FILE_NAME), JSON.stringify({ fingerprint }, null, 4));
|
|
341
|
+
}
|
|
342
|
+
async function readStampAsync(fileSystem, folder) {
|
|
343
|
+
const content = await fileSystem.readFile(Path5.join(folder, BUILD_STAMP_FILE_NAME), "utf-8");
|
|
344
|
+
if (content === null)
|
|
345
|
+
return null;
|
|
346
|
+
try {
|
|
347
|
+
const stamp = JSON.parse(content);
|
|
348
|
+
const fingerprint = typeof stamp === "object" && stamp !== null ? stamp.fingerprint : undefined;
|
|
349
|
+
return typeof fingerprint === "string" ? fingerprint : null;
|
|
350
|
+
} catch {
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
async function fingerprintAsync(fileSystem, plan, bundleFolder) {
|
|
355
|
+
const root = Path5.normalize(plan.folder);
|
|
356
|
+
const bundle = Path5.normalize(bundleFolder);
|
|
357
|
+
const files = await listAppFilesAsync(fileSystem, root, bundle);
|
|
358
|
+
const digests = [];
|
|
359
|
+
for (const relativePath of files) {
|
|
360
|
+
const content = await fileSystem.readFile(Path5.join(root, relativePath)) ?? new Uint8Array;
|
|
361
|
+
digests.push(`${relativePath} ${await sha256Hex(content)}`);
|
|
362
|
+
}
|
|
363
|
+
return sha256Hex(new TextEncoder().encode(digests.join(`
|
|
364
|
+
`)));
|
|
365
|
+
}
|
|
366
|
+
async function listAppFilesAsync(fileSystem, root, bundleFolder) {
|
|
367
|
+
const files = [];
|
|
368
|
+
const visit = async (directory, prefix) => {
|
|
369
|
+
for (const name of await fileSystem.readdir(directory)) {
|
|
370
|
+
const path = Path5.join(directory, name);
|
|
371
|
+
const relativePath = prefix === "" ? name : `${prefix}/${name}`;
|
|
372
|
+
if (path === bundleFolder)
|
|
373
|
+
continue;
|
|
374
|
+
if (relativePath === BUILD_STAMP_FILE_NAME)
|
|
375
|
+
continue;
|
|
376
|
+
const stats = await fileSystem.stat(path);
|
|
377
|
+
if (stats?.isDirectory()) {
|
|
378
|
+
if (SKIPPED_DIRECTORY_NAMES.has(name))
|
|
379
|
+
continue;
|
|
380
|
+
await visit(path, relativePath);
|
|
381
|
+
} else {
|
|
382
|
+
files.push(relativePath);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
await visit(root, "");
|
|
387
|
+
return files.sort(compareCodeUnits);
|
|
388
|
+
}
|
|
389
|
+
function compareCodeUnits(a, b) {
|
|
390
|
+
if (a < b)
|
|
391
|
+
return -1;
|
|
392
|
+
return a > b ? 1 : 0;
|
|
393
|
+
}
|
|
394
|
+
async function sha256Hex(bytes) {
|
|
395
|
+
const digest = await crypto.subtle.digest("SHA-256", new Uint8Array(bytes));
|
|
396
|
+
return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
397
|
+
}
|
|
398
|
+
|
|
160
399
|
// src/strategies/coded-app-strategy.ts
|
|
161
400
|
class CodedAppStrategy {
|
|
162
401
|
fileSystem;
|
|
163
|
-
|
|
402
|
+
commandRunner;
|
|
403
|
+
constructor(fileSystem, commandRunner) {
|
|
164
404
|
this.fileSystem = fileSystem;
|
|
405
|
+
this.commandRunner = commandRunner;
|
|
165
406
|
}
|
|
166
407
|
async validateAsync(args) {
|
|
167
408
|
const { projectPath, manifest, logger } = args;
|
|
@@ -171,8 +412,12 @@ class CodedAppStrategy {
|
|
|
171
412
|
bundlePath = DEFAULT_BUNDLE_PATH;
|
|
172
413
|
}
|
|
173
414
|
const isCompiled = typed.config?.isCompiled ?? true;
|
|
174
|
-
if (isCompiled)
|
|
175
|
-
|
|
415
|
+
if (!isCompiled)
|
|
416
|
+
return;
|
|
417
|
+
const fullBundlePath = Path6.join(projectPath, bundlePath);
|
|
418
|
+
const plan = this.commandRunner === undefined ? null : await planCodedAppBuildAsync(this.fileSystem, projectPath, bundlePath);
|
|
419
|
+
const packWillBuild = plan !== null && !await isBuildCurrentAsync(this.fileSystem, plan, fullBundlePath);
|
|
420
|
+
if (!packWillBuild) {
|
|
176
421
|
const message = await this.describeBundleProblemAsync(fullBundlePath, typed.config?.mainFile);
|
|
177
422
|
if (message) {
|
|
178
423
|
const warnable = logger;
|
|
@@ -193,30 +438,19 @@ class CodedAppStrategy {
|
|
|
193
438
|
}
|
|
194
439
|
const isCompiled = manifest.config?.isCompiled ?? true;
|
|
195
440
|
const declaredMainFile = manifest.config?.mainFile;
|
|
196
|
-
const fullBundlePath =
|
|
441
|
+
const fullBundlePath = Path6.join(projectPath, bundlePath);
|
|
197
442
|
if (isBundleRelativePath(bundlePath) && !await isCanonicalBundleChild(this.fileSystem, projectPath, bundlePath)) {
|
|
198
443
|
throw new Error(ERROR_MESSAGES.BUNDLE_OUTSIDE_PROJECT(bundlePath));
|
|
199
444
|
}
|
|
200
445
|
if (isCompiled) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (!bundleExists) {
|
|
204
|
-
throw new Error(ERROR_MESSAGES.BUNDLE_NOT_FOUND(fullBundlePath));
|
|
205
|
-
}
|
|
206
|
-
const bundleStat = await this.fileSystem.stat(fullBundlePath);
|
|
207
|
-
if (!bundleStat?.isDirectory()) {
|
|
208
|
-
throw new Error(ERROR_MESSAGES.BUNDLE_NOT_DIRECTORY(fullBundlePath));
|
|
209
|
-
}
|
|
210
|
-
const problem = await this.describeBundleEntryProblemAsync(fullBundlePath, declaredMainFile);
|
|
211
|
-
if (problem) {
|
|
212
|
-
throw new Error(problem);
|
|
213
|
-
}
|
|
446
|
+
const bundleSource = await this.prepareBundleAsync(args, bundlePath, fullBundlePath);
|
|
447
|
+
await this.assertBundlePackableAsync(fullBundlePath, declaredMainFile, bundleSource, logger);
|
|
214
448
|
} else {
|
|
215
449
|
logger?.info("Build mode (isCompiled=false) is not yet implemented in v1.");
|
|
216
450
|
throw new Error(ERROR_MESSAGES.BUILD_NOT_SUPPORTED);
|
|
217
451
|
}
|
|
218
|
-
const localBuildFolder =
|
|
219
|
-
const contentFolder =
|
|
452
|
+
const localBuildFolder = Path6.join(outputPath, `${NugetConstants.OutputFolderName}-${crypto.randomUUID()}`);
|
|
453
|
+
const contentFolder = Path6.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
220
454
|
try {
|
|
221
455
|
await this.fileSystem.mkdir(contentFolder);
|
|
222
456
|
logger?.progress("Copying bundle to content folder...");
|
|
@@ -225,7 +459,7 @@ class CodedAppStrategy {
|
|
|
225
459
|
await this.prepareMetadataFiles(localBuildFolder, contentFolder, packageInfo, manifest, projectPath, fullBundlePath);
|
|
226
460
|
logger?.progress("Creating NuGet package...");
|
|
227
461
|
const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
|
|
228
|
-
const nupkgPath =
|
|
462
|
+
const nupkgPath = Path6.join(outputPath, nupkgFileName);
|
|
229
463
|
const packager = new NugetPackager(this.fileSystem);
|
|
230
464
|
const result = await packager.packAsync(localBuildFolder, packageInfo, nupkgPath);
|
|
231
465
|
logger?.info(`Package created successfully: ${result.outputPath}`);
|
|
@@ -238,17 +472,53 @@ class CodedAppStrategy {
|
|
|
238
472
|
}
|
|
239
473
|
}
|
|
240
474
|
}
|
|
475
|
+
async prepareBundleAsync(args, bundlePath, fullBundlePath) {
|
|
476
|
+
const runner = args.buildApp ? this.commandRunner : undefined;
|
|
477
|
+
if (runner === undefined)
|
|
478
|
+
return "not-building";
|
|
479
|
+
const plan = await planCodedAppBuildAsync(this.fileSystem, args.projectPath, bundlePath);
|
|
480
|
+
if (plan === null)
|
|
481
|
+
return "no-build-script";
|
|
482
|
+
if (await isBuildCurrentAsync(this.fileSystem, plan, fullBundlePath)) {
|
|
483
|
+
args.logger?.info(`Skipping build: ${bundlePath} was built from the app's current sources`);
|
|
484
|
+
return "current";
|
|
485
|
+
}
|
|
486
|
+
await runCodedAppBuildAsync({
|
|
487
|
+
fileSystem: this.fileSystem,
|
|
488
|
+
runner,
|
|
489
|
+
plan,
|
|
490
|
+
logger: args.logger,
|
|
491
|
+
signal: args.signal
|
|
492
|
+
});
|
|
493
|
+
await writeBuildStampAsync(this.fileSystem, plan, fullBundlePath);
|
|
494
|
+
return "built";
|
|
495
|
+
}
|
|
496
|
+
async assertBundlePackableAsync(fullBundlePath, declaredMainFile, bundleSource, logger) {
|
|
497
|
+
logger?.progress("Validating compiled bundle...");
|
|
498
|
+
const bundleExists = await this.fileSystem.exists(fullBundlePath);
|
|
499
|
+
if (!bundleExists) {
|
|
500
|
+
throw new CodedAppNotPackableError(ERROR_MESSAGES.BUNDLE_NOT_FOUND(fullBundlePath), bundleProblemInstructions(fullBundlePath, bundleSource));
|
|
501
|
+
}
|
|
502
|
+
const bundleStat = await this.fileSystem.stat(fullBundlePath);
|
|
503
|
+
if (!bundleStat?.isDirectory()) {
|
|
504
|
+
throw new CodedAppNotPackableError(ERROR_MESSAGES.BUNDLE_NOT_DIRECTORY(fullBundlePath), bundleProblemInstructions(fullBundlePath, bundleSource));
|
|
505
|
+
}
|
|
506
|
+
const problem = await this.describeBundleEntryProblemAsync(fullBundlePath, declaredMainFile);
|
|
507
|
+
if (problem) {
|
|
508
|
+
throw new CodedAppNotPackableError(problem, bundleProblemInstructions(fullBundlePath, bundleSource));
|
|
509
|
+
}
|
|
510
|
+
}
|
|
241
511
|
async prepareMetadataFiles(_localBuildFolder, contentFolder, _packageInfo, manifest, projectPath, sourceBundlePath) {
|
|
242
512
|
const declaredMainFile = manifest.config?.mainFile;
|
|
243
513
|
const mainFile = await this.resolveMainFileAsync(contentFolder, declaredMainFile);
|
|
244
514
|
if (!mainFile) {
|
|
245
515
|
throw new Error(declaredMainFile ? ERROR_MESSAGES.MAIN_FILE_LOST(sourceBundlePath, declaredMainFile) : ERROR_MESSAGES.BUNDLE_ENTRY_POINT_LOST(sourceBundlePath));
|
|
246
516
|
}
|
|
247
|
-
const operatePath =
|
|
517
|
+
const operatePath = Path6.join(contentFolder, NugetConstants.OperateFileName);
|
|
248
518
|
const operateModel = {
|
|
249
519
|
projectId: await ensureWebAppProjectId(this.fileSystem, projectPath),
|
|
250
520
|
main: mainFile,
|
|
251
|
-
contentType:
|
|
521
|
+
contentType: ProjectTypes2.WebApp,
|
|
252
522
|
targetFramework: TargetFramework.Portable,
|
|
253
523
|
targetRuntime: TARGET_RUNTIME,
|
|
254
524
|
runtimeOptions: {
|
|
@@ -258,13 +528,13 @@ class CodedAppStrategy {
|
|
|
258
528
|
};
|
|
259
529
|
const operateJson = JSON.stringify(operateModel, null, 2);
|
|
260
530
|
await this.fileSystem.writeFile(operatePath, operateJson);
|
|
261
|
-
await this.fileSystem.writeFile(
|
|
531
|
+
await this.fileSystem.writeFile(Path6.join(contentFolder, WEBAPP_MANIFEST_FILE_NAME), JSON.stringify({
|
|
262
532
|
...manifest,
|
|
263
533
|
config: { ...manifest.config, mainFile },
|
|
264
534
|
projectId: operateModel.projectId
|
|
265
535
|
}, null, 2));
|
|
266
|
-
const uipathJsonSourcePath =
|
|
267
|
-
const uipathJsonDestPath =
|
|
536
|
+
const uipathJsonSourcePath = Path6.join(projectPath, "uipath.json");
|
|
537
|
+
const uipathJsonDestPath = Path6.join(contentFolder, "uipath.json");
|
|
268
538
|
const uipathJsonExists = await this.fileSystem.exists(uipathJsonSourcePath);
|
|
269
539
|
if (uipathJsonExists) {
|
|
270
540
|
const uipathJsonContent = await this.fileSystem.readFile(uipathJsonSourcePath, "utf-8");
|
|
@@ -272,8 +542,8 @@ class CodedAppStrategy {
|
|
|
272
542
|
await this.fileSystem.writeFile(uipathJsonDestPath, uipathJsonContent);
|
|
273
543
|
}
|
|
274
544
|
}
|
|
275
|
-
const actionSchemaSourcePath =
|
|
276
|
-
const actionSchemaDestPath =
|
|
545
|
+
const actionSchemaSourcePath = Path6.join(projectPath, "action-schema.json");
|
|
546
|
+
const actionSchemaDestPath = Path6.join(contentFolder, "action-schema.json");
|
|
277
547
|
const actionSchemaExists = await this.fileSystem.exists(actionSchemaSourcePath);
|
|
278
548
|
if (actionSchemaExists) {
|
|
279
549
|
const actionSchemaContent = await this.fileSystem.readFile(actionSchemaSourcePath, "utf-8");
|
|
@@ -281,7 +551,7 @@ class CodedAppStrategy {
|
|
|
281
551
|
await this.fileSystem.writeFile(actionSchemaDestPath, actionSchemaContent);
|
|
282
552
|
}
|
|
283
553
|
}
|
|
284
|
-
const bindingsPath =
|
|
554
|
+
const bindingsPath = Path6.join(contentFolder, "bindings.json");
|
|
285
555
|
const bindingsExists = await this.fileSystem.exists(bindingsPath);
|
|
286
556
|
if (!bindingsExists) {
|
|
287
557
|
const bindingsJson = JSON.stringify({
|
|
@@ -290,12 +560,12 @@ class CodedAppStrategy {
|
|
|
290
560
|
}, null, 2);
|
|
291
561
|
await this.fileSystem.writeFile(bindingsPath, bindingsJson);
|
|
292
562
|
}
|
|
293
|
-
const bindingsV2Path =
|
|
563
|
+
const bindingsV2Path = Path6.join(contentFolder, "bindings_v2.json");
|
|
294
564
|
const bindingsCandidatePaths = [
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
565
|
+
Path6.join(projectPath, "source", "bindings_v2.json"),
|
|
566
|
+
Path6.join(projectPath, "source", "bindings.json"),
|
|
567
|
+
Path6.join(projectPath, "bindings.json"),
|
|
568
|
+
Path6.join(projectPath, "bindings_v2.json")
|
|
299
569
|
];
|
|
300
570
|
let bindingsV2Json = null;
|
|
301
571
|
for (const candidate of bindingsCandidatePaths) {
|
|
@@ -315,8 +585,8 @@ class CodedAppStrategy {
|
|
|
315
585
|
}, null, 2);
|
|
316
586
|
}
|
|
317
587
|
await this.fileSystem.writeFile(bindingsV2Path, bindingsV2Json);
|
|
318
|
-
const entryPointsPath =
|
|
319
|
-
const projectEntryPointsPath =
|
|
588
|
+
const entryPointsPath = Path6.join(contentFolder, "entry-points.json");
|
|
589
|
+
const projectEntryPointsPath = Path6.join(projectPath, "entry-points.json");
|
|
320
590
|
let entryPointsContent;
|
|
321
591
|
const projectEntryPointsExists = await this.fileSystem.exists(projectEntryPointsPath);
|
|
322
592
|
if (projectEntryPointsExists) {
|
|
@@ -330,13 +600,13 @@ class CodedAppStrategy {
|
|
|
330
600
|
entryPointsContent = this.createDefaultEntryPoints(mainFile);
|
|
331
601
|
}
|
|
332
602
|
await this.fileSystem.writeFile(entryPointsPath, entryPointsContent);
|
|
333
|
-
const packageDescriptorPath =
|
|
603
|
+
const packageDescriptorPath = Path6.join(contentFolder, NugetConstants.PackageDescriptorFileName);
|
|
334
604
|
const packageDescriptor = {
|
|
335
605
|
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
336
606
|
files: {
|
|
337
|
-
[NugetConstants.OperateFileName]:
|
|
338
|
-
"entry-points.json":
|
|
339
|
-
"bindings.json":
|
|
607
|
+
[NugetConstants.OperateFileName]: Path6.join(NugetConstants.ContentFolderName, NugetConstants.OperateFileName),
|
|
608
|
+
"entry-points.json": Path6.join(NugetConstants.ContentFolderName, "entry-points.json"),
|
|
609
|
+
"bindings.json": Path6.join(NugetConstants.ContentFolderName, "bindings_v2.json")
|
|
340
610
|
}
|
|
341
611
|
};
|
|
342
612
|
const packageDescriptorJson = JSON.stringify(packageDescriptor, null, 2);
|
|
@@ -438,8 +708,8 @@ class CodedAppStrategy {
|
|
|
438
708
|
import {
|
|
439
709
|
NugetConstants as NugetConstants2,
|
|
440
710
|
NugetPackager as NugetPackager2,
|
|
441
|
-
Path as
|
|
442
|
-
ProjectTypes as
|
|
711
|
+
Path as Path7,
|
|
712
|
+
ProjectTypes as ProjectTypes3,
|
|
443
713
|
TargetFramework as TargetFramework2
|
|
444
714
|
} from "@uipath/solutionpackager-tool-core";
|
|
445
715
|
class JsAppsStrategy {
|
|
@@ -449,7 +719,7 @@ class JsAppsStrategy {
|
|
|
449
719
|
}
|
|
450
720
|
async validateAsync(args) {
|
|
451
721
|
const { projectPath, logger } = args;
|
|
452
|
-
const appFolder =
|
|
722
|
+
const appFolder = Path7.join(projectPath, APP_FOLDER_NAME);
|
|
453
723
|
const exists = await this.fileSystem.exists(appFolder);
|
|
454
724
|
if (!exists) {
|
|
455
725
|
const message = ERROR_MESSAGES.APP_FOLDER_NOT_FOUND(appFolder);
|
|
@@ -473,7 +743,7 @@ class JsAppsStrategy {
|
|
|
473
743
|
async packageAsync(args) {
|
|
474
744
|
const { projectPath, manifest, outputPath, packageInfo, logger } = args;
|
|
475
745
|
logger?.info(`Packaging JS variant: ${packageInfo.id}@${packageInfo.version}`);
|
|
476
|
-
const appFolder =
|
|
746
|
+
const appFolder = Path7.join(projectPath, APP_FOLDER_NAME);
|
|
477
747
|
logger?.progress("Validating .app folder...");
|
|
478
748
|
const appFolderExists = await this.fileSystem.exists(appFolder);
|
|
479
749
|
if (!appFolderExists) {
|
|
@@ -483,9 +753,9 @@ class JsAppsStrategy {
|
|
|
483
753
|
if (!appFolderStat?.isDirectory()) {
|
|
484
754
|
throw new Error(ERROR_MESSAGES.APP_FOLDER_NOT_DIRECTORY(appFolder));
|
|
485
755
|
}
|
|
486
|
-
const localBuildFolder =
|
|
487
|
-
const contentFolder =
|
|
488
|
-
const contentAppFolder =
|
|
756
|
+
const localBuildFolder = Path7.join(outputPath, NugetConstants2.OutputFolderName);
|
|
757
|
+
const contentFolder = Path7.join(localBuildFolder, NugetConstants2.ContentFolderName);
|
|
758
|
+
const contentAppFolder = Path7.join(contentFolder, CONTENT_APP_FOLDER_NAME);
|
|
489
759
|
await this.fileSystem.mkdir(contentFolder);
|
|
490
760
|
try {
|
|
491
761
|
logger?.progress("Copying .app folder into content/app...");
|
|
@@ -494,7 +764,7 @@ class JsAppsStrategy {
|
|
|
494
764
|
await this.prepareMetadataFiles(contentFolder, contentAppFolder, packageInfo, manifest, projectPath);
|
|
495
765
|
logger?.progress("Creating NuGet package...");
|
|
496
766
|
const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
|
|
497
|
-
const nupkgPath =
|
|
767
|
+
const nupkgPath = Path7.join(outputPath, nupkgFileName);
|
|
498
768
|
const packager = new NugetPackager2(this.fileSystem);
|
|
499
769
|
const result = await packager.packAsync(localBuildFolder, packageInfo, nupkgPath);
|
|
500
770
|
logger?.info(`Package created successfully: ${result.outputPath}`);
|
|
@@ -510,11 +780,11 @@ class JsAppsStrategy {
|
|
|
510
780
|
async prepareMetadataFiles(contentFolder, _contentAppFolder, _packageInfo, _manifest, projectPath) {
|
|
511
781
|
const mainFile = "index.html";
|
|
512
782
|
const mainRelativeToContent = `${CONTENT_APP_FOLDER_NAME}/${mainFile}`;
|
|
513
|
-
const operatePath =
|
|
783
|
+
const operatePath = Path7.join(contentFolder, NugetConstants2.OperateFileName);
|
|
514
784
|
const operateModel = {
|
|
515
785
|
projectId: await ensureWebAppProjectId(this.fileSystem, projectPath),
|
|
516
786
|
main: mainRelativeToContent,
|
|
517
|
-
contentType:
|
|
787
|
+
contentType: ProjectTypes3.WebApp,
|
|
518
788
|
targetFramework: TargetFramework2.Portable,
|
|
519
789
|
targetRuntime: TARGET_JS_RUNTIME,
|
|
520
790
|
runtimeOptions: {
|
|
@@ -524,8 +794,8 @@ class JsAppsStrategy {
|
|
|
524
794
|
};
|
|
525
795
|
const operateJson = JSON.stringify(operateModel, null, 2);
|
|
526
796
|
await this.fileSystem.writeFile(operatePath, operateJson);
|
|
527
|
-
const manifestSourcePath =
|
|
528
|
-
const manifestDestPath =
|
|
797
|
+
const manifestSourcePath = Path7.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
798
|
+
const manifestDestPath = Path7.join(contentFolder, WEBAPP_MANIFEST_FILE_NAME);
|
|
529
799
|
const manifestExists = await this.fileSystem.exists(manifestSourcePath);
|
|
530
800
|
if (manifestExists) {
|
|
531
801
|
const manifestContent = await this.fileSystem.readFile(manifestSourcePath);
|
|
@@ -533,8 +803,8 @@ class JsAppsStrategy {
|
|
|
533
803
|
await this.fileSystem.writeFile(manifestDestPath, manifestContent);
|
|
534
804
|
}
|
|
535
805
|
}
|
|
536
|
-
const uipathJsonSourcePath =
|
|
537
|
-
const uipathJsonDestPath =
|
|
806
|
+
const uipathJsonSourcePath = Path7.join(projectPath, "uipath.json");
|
|
807
|
+
const uipathJsonDestPath = Path7.join(contentFolder, "uipath.json");
|
|
538
808
|
const uipathJsonExists = await this.fileSystem.exists(uipathJsonSourcePath);
|
|
539
809
|
if (uipathJsonExists) {
|
|
540
810
|
const uipathJsonContent = await this.fileSystem.readFile(uipathJsonSourcePath);
|
|
@@ -542,20 +812,20 @@ class JsAppsStrategy {
|
|
|
542
812
|
await this.fileSystem.writeFile(uipathJsonDestPath, uipathJsonContent);
|
|
543
813
|
}
|
|
544
814
|
}
|
|
545
|
-
const bindingsPath =
|
|
815
|
+
const bindingsPath = Path7.join(contentFolder, "bindings.json");
|
|
546
816
|
const bindingsExists = await this.fileSystem.exists(bindingsPath);
|
|
547
817
|
if (!bindingsExists) {
|
|
548
818
|
const bindingsJson = JSON.stringify({ version: "1.0", resources: [] }, null, 2);
|
|
549
819
|
await this.fileSystem.writeFile(bindingsPath, bindingsJson);
|
|
550
820
|
}
|
|
551
|
-
const bindingsV2Path =
|
|
821
|
+
const bindingsV2Path = Path7.join(contentFolder, "bindings_v2.json");
|
|
552
822
|
const bindingsV2Exists = await this.fileSystem.exists(bindingsV2Path);
|
|
553
823
|
if (!bindingsV2Exists) {
|
|
554
824
|
const bindingsV2Json = JSON.stringify({ version: "2.0", resources: [] }, null, 2);
|
|
555
825
|
await this.fileSystem.writeFile(bindingsV2Path, bindingsV2Json);
|
|
556
826
|
}
|
|
557
|
-
const entryPointsPath =
|
|
558
|
-
const projectEntryPointsPath =
|
|
827
|
+
const entryPointsPath = Path7.join(contentFolder, "entry-points.json");
|
|
828
|
+
const projectEntryPointsPath = Path7.join(projectPath, "entry-points.json");
|
|
559
829
|
let entryPointsContent;
|
|
560
830
|
const projectEntryPointsExists = await this.fileSystem.exists(projectEntryPointsPath);
|
|
561
831
|
if (projectEntryPointsExists) {
|
|
@@ -569,12 +839,12 @@ class JsAppsStrategy {
|
|
|
569
839
|
entryPointsContent = this.createDefaultEntryPoints(mainRelativeToContent);
|
|
570
840
|
}
|
|
571
841
|
await this.fileSystem.writeFile(entryPointsPath, entryPointsContent);
|
|
572
|
-
const packageDescriptorPath =
|
|
842
|
+
const packageDescriptorPath = Path7.join(contentFolder, NugetConstants2.PackageDescriptorFileName);
|
|
573
843
|
const packageDescriptor = {
|
|
574
844
|
files: {
|
|
575
|
-
[NugetConstants2.OperateFileName]:
|
|
576
|
-
"entry-points.json":
|
|
577
|
-
"bindings.json":
|
|
845
|
+
[NugetConstants2.OperateFileName]: Path7.join(NugetConstants2.ContentFolderName, NugetConstants2.OperateFileName),
|
|
846
|
+
"entry-points.json": Path7.join(NugetConstants2.ContentFolderName, "entry-points.json"),
|
|
847
|
+
"bindings.json": Path7.join(NugetConstants2.ContentFolderName, "bindings_v2.json")
|
|
578
848
|
}
|
|
579
849
|
};
|
|
580
850
|
const packageDescriptorJson = JSON.stringify(packageDescriptor, null, 2);
|
|
@@ -624,11 +894,11 @@ class JsAppsStrategy {
|
|
|
624
894
|
|
|
625
895
|
// src/strategies/variant-strategy-factory.ts
|
|
626
896
|
class VariantStrategyFactory {
|
|
627
|
-
static createStrategy(manifest, fileSystem) {
|
|
897
|
+
static createStrategy(manifest, fileSystem, commandRunner) {
|
|
628
898
|
const variant = manifest.type;
|
|
629
899
|
switch (variant) {
|
|
630
900
|
case "Coded" /* Coded */:
|
|
631
|
-
return new CodedAppStrategy(fileSystem);
|
|
901
|
+
return new CodedAppStrategy(fileSystem, commandRunner);
|
|
632
902
|
case "JS" /* JS */:
|
|
633
903
|
return new JsAppsStrategy(fileSystem);
|
|
634
904
|
default:
|
|
@@ -639,10 +909,12 @@ class VariantStrategyFactory {
|
|
|
639
909
|
|
|
640
910
|
// src/webapp-tool.ts
|
|
641
911
|
class WebAppTool extends ProjectTool {
|
|
912
|
+
commandRunner;
|
|
642
913
|
_temporaryStorage;
|
|
643
914
|
_tempBuildFolder = null;
|
|
644
|
-
constructor(fileSystem, logger) {
|
|
915
|
+
constructor(fileSystem, logger, commandRunner) {
|
|
645
916
|
super(fileSystem, logger);
|
|
917
|
+
this.commandRunner = commandRunner;
|
|
646
918
|
this._temporaryStorage = new TemporaryStorageService(fileSystem);
|
|
647
919
|
}
|
|
648
920
|
async restoreAsync(_options, _cancellationToken) {
|
|
@@ -686,7 +958,7 @@ class WebAppTool extends ProjectTool {
|
|
|
686
958
|
this.logger.info("Build operation for WebApp is lightweight (metadata preparation only)");
|
|
687
959
|
return ToolResult.success();
|
|
688
960
|
}
|
|
689
|
-
async packAsync(options,
|
|
961
|
+
async packAsync(options, cancellationToken) {
|
|
690
962
|
if (!options.projectPath) {
|
|
691
963
|
return this.handleError(new Error(ERROR_MESSAGES.PROJECT_PATH_REQUIRED), "Packing");
|
|
692
964
|
}
|
|
@@ -716,11 +988,16 @@ class WebAppTool extends ProjectTool {
|
|
|
716
988
|
manifest,
|
|
717
989
|
outputPath: options.outputPath,
|
|
718
990
|
packageInfo: options.package,
|
|
991
|
+
buildApp: options.codedBundle === undefined && options.skipBuild !== true,
|
|
992
|
+
signal: cancellationToken,
|
|
719
993
|
logger: this.createStrategyLogger()
|
|
720
994
|
});
|
|
721
995
|
this.logger.info(`WebApp package created successfully: ${nupkgPath}`);
|
|
722
|
-
return new ToolResult(
|
|
996
|
+
return new ToolResult(ToolErrorCodes2.Success, "done", [nupkgPath]);
|
|
723
997
|
} catch (error) {
|
|
998
|
+
if (cancellationToken?.aborted) {
|
|
999
|
+
return ToolResult.error(ToolErrorCodes2.Canceled, ERROR_MESSAGES.PACKING_FAILED("the pack was canceled"));
|
|
1000
|
+
}
|
|
724
1001
|
return this.handleError(error, `Packing WebApp project '${options.package.id}'`);
|
|
725
1002
|
}
|
|
726
1003
|
}
|
|
@@ -735,12 +1012,12 @@ class WebAppTool extends ProjectTool {
|
|
|
735
1012
|
} catch {}
|
|
736
1013
|
}
|
|
737
1014
|
async getManifestAndStrategy(projectPath, codedBundle) {
|
|
738
|
-
const manifestPath =
|
|
1015
|
+
const manifestPath = Path8.join(projectPath, WEBAPP_MANIFEST_FILE_NAME);
|
|
739
1016
|
const manifestExists = await this.fileSystem.exists(manifestPath);
|
|
740
1017
|
if (!manifestExists && !codedBundle) {
|
|
741
1018
|
throw new Error(ERROR_MESSAGES.MANIFEST_NOT_FOUND(WEBAPP_MANIFEST_FILE_NAME));
|
|
742
1019
|
}
|
|
743
|
-
const projectJsonPath =
|
|
1020
|
+
const projectJsonPath = Path8.join(projectPath, PROJECT_JSON_FILE);
|
|
744
1021
|
if (await this.fileSystem.exists(projectJsonPath)) {
|
|
745
1022
|
throw new Error(ERROR_MESSAGES.PROJECT_JSON_FOUND);
|
|
746
1023
|
}
|
|
@@ -761,7 +1038,7 @@ class WebAppTool extends ProjectTool {
|
|
|
761
1038
|
config: { ...manifest.config, ...codedBundle }
|
|
762
1039
|
};
|
|
763
1040
|
}
|
|
764
|
-
const strategy = VariantStrategyFactory.createStrategy(manifest, this.fileSystem);
|
|
1041
|
+
const strategy = VariantStrategyFactory.createStrategy(manifest, this.fileSystem, this.commandRunner);
|
|
765
1042
|
return { manifest, strategy };
|
|
766
1043
|
}
|
|
767
1044
|
handleError(error, context) {
|
|
@@ -775,7 +1052,10 @@ class WebAppTool extends ProjectTool {
|
|
|
775
1052
|
} else {
|
|
776
1053
|
userMessage = errorMessage;
|
|
777
1054
|
}
|
|
778
|
-
|
|
1055
|
+
if (error instanceof CodedAppNotPackableError) {
|
|
1056
|
+
return ToolResult.error(error.errorCode, userMessage, error.instructions);
|
|
1057
|
+
}
|
|
1058
|
+
return ToolResult.error(ToolErrorCodes2.InternalError, userMessage);
|
|
779
1059
|
}
|
|
780
1060
|
createStrategyLogger() {
|
|
781
1061
|
return {
|
|
@@ -788,12 +1068,17 @@ class WebAppTool extends ProjectTool {
|
|
|
788
1068
|
}
|
|
789
1069
|
// src/webapp-tool-factory.ts
|
|
790
1070
|
import {
|
|
791
|
-
ProjectTypes as
|
|
1071
|
+
ProjectTypes as ProjectTypes4
|
|
792
1072
|
} from "@uipath/solutionpackager-tool-core";
|
|
793
1073
|
class WebAppToolFactory {
|
|
794
|
-
|
|
1074
|
+
commandRunner;
|
|
1075
|
+
readProjectIdentityAsync = readProjectIdentity;
|
|
1076
|
+
supportedTypes = [ProjectTypes4.AppV2];
|
|
1077
|
+
constructor(commandRunner) {
|
|
1078
|
+
this.commandRunner = commandRunner;
|
|
1079
|
+
}
|
|
795
1080
|
async createAsync(logger, fileSystem) {
|
|
796
|
-
return new WebAppTool(fileSystem, logger);
|
|
1081
|
+
return new WebAppTool(fileSystem, logger, this.commandRunner);
|
|
797
1082
|
}
|
|
798
1083
|
}
|
|
799
1084
|
export {
|
|
@@ -801,7 +1086,8 @@ export {
|
|
|
801
1086
|
WebAppTool,
|
|
802
1087
|
WebAppToolFactory,
|
|
803
1088
|
WebAppVariantType,
|
|
804
|
-
ensureWebAppProjectId
|
|
1089
|
+
ensureWebAppProjectId,
|
|
1090
|
+
readProjectIdentity
|
|
805
1091
|
};
|
|
806
1092
|
|
|
807
|
-
//# debugId=
|
|
1093
|
+
//# debugId=18560A50AA92C1F564756E2164756E21
|