@intelligentgraphics/ig.gfx.packager 3.1.4 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/build/bin.js +8 -0
  2. package/build/bin.js.map +1 -0
  3. package/build/build-CMbCj7x-.js +945 -0
  4. package/build/build-CMbCj7x-.js.map +1 -0
  5. package/build/build-kkMVBBJL.js +408 -0
  6. package/build/build-kkMVBBJL.js.map +1 -0
  7. package/build/cli-Co1DhAmx.js +405 -0
  8. package/build/cli-Co1DhAmx.js.map +1 -0
  9. package/build/docs-BkGeoYY2.js +30 -0
  10. package/build/docs-BkGeoYY2.js.map +1 -0
  11. package/build/generateIndex-C_DxQ2R4.js +209 -0
  12. package/build/generateIndex-C_DxQ2R4.js.map +1 -0
  13. package/build/generateParameterType-CdCi5BWM.js +46 -0
  14. package/build/generateParameterType-CdCi5BWM.js.map +1 -0
  15. package/build/package-DHx2bvVO.js +1 -0
  16. package/build/postinstall-DHTlEmNr.js +35 -0
  17. package/build/postinstall-DHTlEmNr.js.map +1 -0
  18. package/build/prompter-DONgUlzS.js +20 -0
  19. package/build/prompter-DONgUlzS.js.map +1 -0
  20. package/build/publish-E5zcQAo0.js +348 -0
  21. package/build/publish-E5zcQAo0.js.map +1 -0
  22. package/build/publishNpm-CBT1819u.js +115 -0
  23. package/build/publishNpm-CBT1819u.js.map +1 -0
  24. package/build/publishedPackage-D-KiU0FG.js +1 -0
  25. package/build/rollup-Csyght27.js +179 -0
  26. package/build/rollup-Csyght27.js.map +1 -0
  27. package/build/scripts-CBblHIL1.js +29 -0
  28. package/build/scripts-CBblHIL1.js.map +1 -0
  29. package/build/versionFile-DViDwgCa.js +123 -0
  30. package/build/versionFile-DViDwgCa.js.map +1 -0
  31. package/build/workspace-D0XY2EMu.js +1 -0
  32. package/lib/lib.js +1595 -0
  33. package/package.json +30 -30
  34. package/readme.md +7 -0
  35. package/build/bin.mjs +0 -5
  36. package/build/bin.mjs.map +0 -1
  37. package/build/cli-CTqQeYIu.mjs +0 -768
  38. package/build/cli-CTqQeYIu.mjs.map +0 -1
  39. package/build/dependencies-CCIr5dgH.mjs +0 -129
  40. package/build/dependencies-CCIr5dgH.mjs.map +0 -1
  41. package/build/docs-DvFV9WXA.mjs +0 -37
  42. package/build/docs-DvFV9WXA.mjs.map +0 -1
  43. package/build/generateIndex-COnAgsMM.mjs +0 -306
  44. package/build/generateIndex-COnAgsMM.mjs.map +0 -1
  45. package/build/generateParameterType-BFVUv72F.mjs +0 -71
  46. package/build/generateParameterType-BFVUv72F.mjs.map +0 -1
  47. package/build/index-Ck4_b8Wk.mjs +0 -1400
  48. package/build/index-Ck4_b8Wk.mjs.map +0 -1
  49. package/build/index-DHSUlJia.mjs +0 -477
  50. package/build/index-DHSUlJia.mjs.map +0 -1
  51. package/build/postinstall-BTuIhY_F.mjs +0 -61
  52. package/build/postinstall-BTuIhY_F.mjs.map +0 -1
  53. package/build/publishNpm-A02qW1UY.mjs +0 -167
  54. package/build/publishNpm-A02qW1UY.mjs.map +0 -1
  55. package/build/rollup-BeQ0dM8U.mjs +0 -221
  56. package/build/rollup-BeQ0dM8U.mjs.map +0 -1
  57. package/build/scripts-B3noxiX3.mjs +0 -45
  58. package/build/scripts-B3noxiX3.mjs.map +0 -1
  59. package/build/versionFile-B9z_qwQL.mjs +0 -206
  60. package/build/versionFile-B9z_qwQL.mjs.map +0 -1
  61. package/lib/lib.mjs +0 -2706
@@ -0,0 +1,348 @@
1
+ import { A as isErrorENOENT, C as readPackageCreatorIndex, D as writePackageCreatorManifest, S as readPackageAnimationList, _ as PACKAGE_FILE, b as getPackageReleasesDirectory, d as readWorkspaceNpmManifest, g as INDEX_FILE, h as readPublishedPackageNpmManifest, i as createPackageScopedReporter, j as isErrorEPERM, k as isErrorEACCES, l as getWorkspaceOutputPath, m as readPublishedPackageCreatorManifest, o as determineWorkspaceIGLibraries, p as readPublishedPackageCreatorIndex, r as consoleReporter, t as assetService_exports, w as readPackageCreatorManifest, x as parseCreatorPackageName } from "./build-kkMVBBJL.js";
2
+ import "./package-DHx2bvVO.js";
3
+ import "./workspace-D0XY2EMu.js";
4
+ import "./prompter-DONgUlzS.js";
5
+ import "./scripts-CBblHIL1.js";
6
+ import { buildFolders, t as PackageVersion } from "./build-CMbCj7x-.js";
7
+ import "./publishedPackage-D-KiU0FG.js";
8
+ import { a as getVersionInformationFromGit, i as getWorkspaceBannerText, n as parseVersionFromNumericVersion, r as parseVersionFromString, t as getVersionFileHandler } from "./versionFile-DViDwgCa.js";
9
+ import * as fs$1 from "node:fs";
10
+ import { createReadStream, createWriteStream } from "node:fs";
11
+ import * as path from "node:path";
12
+ import * as fs from "fs/promises";
13
+ import { pipeline } from "node:stream/promises";
14
+ import { exec } from "node:child_process";
15
+ import { promisify } from "node:util";
16
+ import JSZip from "jszip";
17
+ import { buffer } from "node:stream/consumers";
18
+ //#region src/commands/publish/zip.ts
19
+ const buildArchiveFromPublishedPackage = (location, manifest, creatorPackage) => {
20
+ const archive = new JSZip();
21
+ archive.file(PACKAGE_FILE, JSON.stringify(creatorPackage, null, 2));
22
+ const index = readPublishedPackageCreatorIndex(location);
23
+ if (index !== void 0) archive.file(INDEX_FILE, JSON.stringify(index, null, 2));
24
+ archive.file(manifest.main, fs$1.createReadStream(path.join(location.path, manifest.main)));
25
+ if (creatorPackage.Package === "IG.GFX.Standard") {
26
+ const source = path.join(location.path, "Images");
27
+ if (fs$1.existsSync(source)) {
28
+ const images = fs$1.readdirSync(source);
29
+ for (const file of images) {
30
+ const { ext } = path.parse(file);
31
+ switch (ext) {
32
+ case ".png":
33
+ case ".jpeg":
34
+ case ".jpg": break;
35
+ default: continue;
36
+ }
37
+ archive.file(file, fs$1.createReadStream(path.join(source, file)));
38
+ }
39
+ }
40
+ }
41
+ return archive;
42
+ };
43
+ const runtimeScripts = [
44
+ "Interactor",
45
+ "Core",
46
+ "Mixed"
47
+ ];
48
+ const notRuntimeScripts = ["Context", "Evaluator"];
49
+ const buildArchiveFromPackage = async (reporter, packageLocation, data, binDir, minified = true) => {
50
+ const { domain } = parseCreatorPackageName(data);
51
+ const scriptDirectories = [packageLocation.path, packageLocation.scriptsDir];
52
+ if (data.Package === "IG.GFX.Standard") {
53
+ reporter.log(`Including Images folder`);
54
+ scriptDirectories.push(path.join(packageLocation.path, "Images"));
55
+ }
56
+ const manifest = readPackageCreatorManifest(packageLocation);
57
+ if (manifest !== void 0) {
58
+ if (manifest.RunTime && notRuntimeScripts.includes(manifest.Type)) {
59
+ reporter.log("Setting script RunTime to false because of script type");
60
+ writePackageCreatorManifest(packageLocation, {
61
+ ...manifest,
62
+ RunTime: false
63
+ });
64
+ } else if (!manifest.RunTime && runtimeScripts.includes(manifest.Type)) {
65
+ reporter.log("Setting script RunTime to true because of script type");
66
+ writePackageCreatorManifest(packageLocation, {
67
+ ...manifest,
68
+ RunTime: true
69
+ });
70
+ }
71
+ }
72
+ let libFile;
73
+ try {
74
+ const libFilePath = minified ? path.join(binDir, `${data.Package}.min.js`) : path.join(binDir, `${data.Package}.js`);
75
+ libFile = fs$1.readFileSync(libFilePath, { encoding: "utf8" });
76
+ } catch (err) {
77
+ if (!isErrorENOENT(err)) throw err;
78
+ }
79
+ const archive = new JSZip();
80
+ let library = "";
81
+ if (libFile) library = libFile;
82
+ if (!library) library = `/* This file is part of the ${domain} Data Packages.
83
+ * Copyright (C) ${new Date(Date.now()).getFullYear()} intelligentgraphics. All Rights Reserved. */`;
84
+ archive.file(`${data.Package}.js`, library);
85
+ archive.file(PACKAGE_FILE, JSON.stringify(data, null, 2));
86
+ const creatorIndex = readPackageCreatorIndex(packageLocation);
87
+ if (creatorIndex !== void 0) archive.file(INDEX_FILE, JSON.stringify(creatorIndex, null, 2));
88
+ for (const directory of scriptDirectories) try {
89
+ for (const file of fs$1.readdirSync(directory)) {
90
+ const { ext } = path.parse(file);
91
+ switch (ext) {
92
+ case ".png":
93
+ case ".jpeg":
94
+ case ".jpg": break;
95
+ default: continue;
96
+ }
97
+ archive.file(file, fs$1.createReadStream(path.join(directory, file)));
98
+ }
99
+ } catch (err) {
100
+ reporter.error(`Script directory "${directory}" does not exist`);
101
+ }
102
+ return archive;
103
+ };
104
+ //#endregion
105
+ //#region src/lib/assetServiceSessionManager.ts
106
+ const createAssetServiceSessionManager = async (params) => {
107
+ const targetSession = await assetService_exports.startSession(params);
108
+ let basicsSession;
109
+ return {
110
+ getBasicsSession: async () => {
111
+ if (targetSession.subDomain === "Basics") return targetSession;
112
+ if (basicsSession === void 0) basicsSession = await assetService_exports.startSession({
113
+ ...params,
114
+ subDomain: "Basics"
115
+ });
116
+ return basicsSession;
117
+ },
118
+ getTargetSession: () => targetSession,
119
+ destroy: async () => {
120
+ await assetService_exports.closeSession(targetSession);
121
+ if (basicsSession !== void 0) await assetService_exports.closeSession(basicsSession);
122
+ }
123
+ };
124
+ };
125
+ //#endregion
126
+ //#region src/lib/dependencySync.ts
127
+ const synchronizeDependencies = async (workspaceLocation, creatorPackage, sessionManager, prompter, reporter, logUpToDate = false) => {
128
+ const libraries = determineWorkspaceIGLibraries(workspaceLocation);
129
+ if (libraries.length === 0) return true;
130
+ const targetSession = sessionManager.getTargetSession();
131
+ const uploadedPackages = (await assetService_exports.getExistingPackages(targetSession)).map((entry) => {
132
+ let version;
133
+ try {
134
+ version = parseVersionFromNumericVersion(entry.numericVersion);
135
+ } catch (err) {
136
+ throw new Error(`Encountered invalid format for version ${entry.numericVersion}`);
137
+ }
138
+ if (version.buildNumber < 100) version.preRelease = {
139
+ type: "beta",
140
+ version: version.buildNumber
141
+ };
142
+ else if (version.buildNumber > 100) version.preRelease = {
143
+ type: "patch",
144
+ version: version.buildNumber - 100
145
+ };
146
+ return {
147
+ ...entry,
148
+ version
149
+ };
150
+ });
151
+ for (const libraryLocation of libraries) {
152
+ const libraryManifest = readPublishedPackageNpmManifest(libraryLocation);
153
+ const libraryCreatorPackage = readPublishedPackageCreatorManifest(libraryLocation);
154
+ if (libraryCreatorPackage === void 0 || libraryManifest.main === void 0 || libraryCreatorPackage.Package === creatorPackage?.Package) continue;
155
+ const libraryVersion = PackageVersion.extractFromLine(libraryManifest.version);
156
+ if (libraryVersion.preRelease) {
157
+ libraryVersion.buildNumber = libraryVersion.preRelease.version;
158
+ libraryVersion.preRelease = void 0;
159
+ } else libraryVersion.buildNumber = 100;
160
+ let uploadedPackageInBasics;
161
+ let uploadedPackageInTarget;
162
+ for (const uploadedPackage of uploadedPackages) if (uploadedPackage.scope === libraryCreatorPackage.Package) if (uploadedPackage.support) uploadedPackageInBasics = uploadedPackage;
163
+ else uploadedPackageInTarget = uploadedPackage;
164
+ const validInBasics = uploadedPackageInBasics !== void 0 && !uploadedPackageInBasics.version.isLesserThan(libraryVersion);
165
+ const validInTarget = uploadedPackageInTarget !== void 0 && !uploadedPackageInTarget.version.isLesserThan(libraryVersion);
166
+ if (validInBasics || validInTarget) {
167
+ if (targetSession.subDomain !== "Basics" && uploadedPackageInBasics !== void 0 && uploadedPackageInTarget !== void 0) reporter.log(`Package ${libraryCreatorPackage.Package} is uploaded both for Basics and ${targetSession.subDomain}. The package within ${targetSession.subDomain} will be used.`);
168
+ if (logUpToDate) reporter.log(`Package ${libraryCreatorPackage.Package} is already uploaded with the required version ${libraryVersion.toVersionString({})}`);
169
+ continue;
170
+ }
171
+ const possibleTargets = [];
172
+ if (uploadedPackageInBasics) {
173
+ const version = uploadedPackageInBasics.version.toVersionString({ buildNumber: true });
174
+ possibleTargets.push({
175
+ value: "Basics",
176
+ name: `Basics (Current: ${version})`
177
+ });
178
+ } else possibleTargets.push({
179
+ value: "Basics",
180
+ name: "Basics (Current: None)"
181
+ });
182
+ if (targetSession.subDomain !== "Basics") if (uploadedPackageInTarget) {
183
+ const version = uploadedPackageInTarget.version.toVersionString({ buildNumber: true });
184
+ possibleTargets.push({
185
+ value: targetSession.subDomain,
186
+ name: `${targetSession.subDomain} (Current: ${version})`
187
+ });
188
+ } else possibleTargets.push({
189
+ value: targetSession.subDomain,
190
+ name: `${targetSession.subDomain} (Current: None)`
191
+ });
192
+ const libraryVersionString = libraryVersion.toVersionString({ buildNumber: true });
193
+ const uploadTargetScope = await prompter.ask({
194
+ message: `Version ${libraryVersionString} of dependency ${libraryCreatorPackage.Package} is required but not available. Please select a subdomain to upload the required dependency version to`,
195
+ options: [...possibleTargets, {
196
+ name: "Skip upload",
197
+ value: "Skip"
198
+ }],
199
+ default: possibleTargets[0].value
200
+ });
201
+ if (uploadTargetScope === "Skip") continue;
202
+ const archive = buildArchiveFromPublishedPackage(libraryLocation, libraryManifest, libraryCreatorPackage);
203
+ const newVersionString = libraryVersion.toVersionString({ buildNumber: true });
204
+ const session = uploadTargetScope === "Basics" ? await sessionManager.getBasicsSession() : targetSession;
205
+ reporter.log(`Uploading package ${libraryCreatorPackage.Package} with version ${newVersionString} to ${session.domain}.${session.subDomain}`);
206
+ await assetService_exports.uploadPackageFromBuffer(session, {
207
+ name: libraryCreatorPackage.Package,
208
+ version: newVersionString
209
+ }, await archive.generateAsync({ type: "nodebuffer" }));
210
+ }
211
+ };
212
+ //#endregion
213
+ //#region src/commands/publish/index.ts
214
+ const execAsync = promisify(exec);
215
+ const releaseFolder = async (options) => {
216
+ const workspace = options.workspace;
217
+ const location = options.directory;
218
+ const versionFile = getVersionFileHandler(location);
219
+ const packageDescription = readPackageCreatorManifest(location);
220
+ const fullPackageName = packageDescription.Package;
221
+ const reporter = options.reporter ?? createPackageScopedReporter(consoleReporter, packageDescription.Package);
222
+ const { domain, subdomain } = parseCreatorPackageName(packageDescription);
223
+ const publishDomain = options.domain ?? domain;
224
+ const publishSubdomain = options.subdomain ?? subdomain;
225
+ const sharedPackageJson = readWorkspaceNpmManifest(workspace);
226
+ let newVersion;
227
+ try {
228
+ newVersion = parseVersionFromString(options.newVersion);
229
+ } catch (err) {
230
+ throw new Error(`Please enter a version in this format 1.0.0.100`);
231
+ }
232
+ packageDescription.Version = newVersion.toVersionString({ buildNumber: true });
233
+ writePackageCreatorManifest(location, packageDescription);
234
+ if (newVersion.buildNumber < 100) newVersion.preRelease = {
235
+ type: "beta",
236
+ version: newVersion.buildNumber
237
+ };
238
+ else if (newVersion.buildNumber > 100) newVersion.preRelease = {
239
+ type: "patch",
240
+ version: newVersion.buildNumber - 100
241
+ };
242
+ const binDir = options.outDir ?? getWorkspaceOutputPath(workspace);
243
+ await fs.mkdir(binDir, { recursive: true });
244
+ let assetServerPackageDetails;
245
+ let packageNameWithVersion;
246
+ {
247
+ const versionWithoutPrelease = newVersion.clone();
248
+ versionWithoutPrelease.preRelease = void 0;
249
+ const newVersionString = versionWithoutPrelease.toVersionString({ buildNumber: true });
250
+ packageNameWithVersion = `${packageDescription.Package}_${newVersionString}`;
251
+ assetServerPackageDetails = {
252
+ name: packageDescription.Package,
253
+ version: newVersionString
254
+ };
255
+ }
256
+ let zipFilePath = path.join(binDir, packageNameWithVersion + ".zip");
257
+ let uploadable = { getStream: () => createReadStream(zipFilePath) };
258
+ try {
259
+ if (options.pushOnly) {
260
+ if (await fs.stat(zipFilePath).catch((err) => {
261
+ if (isErrorENOENT(err)) return false;
262
+ return Promise.reject(err);
263
+ })) throw new Error(`Expected a zip file to exist at path ${zipFilePath} since pushOnly is specified`);
264
+ } else {
265
+ const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
266
+ if (versionFile.exists) versionFile.write(fullPackageName, newVersion);
267
+ const bannerText = sharedPackageJson !== void 0 ? getWorkspaceBannerText(sharedPackageJson) : void 0;
268
+ await buildFolders({
269
+ ...options,
270
+ packages: [location],
271
+ banner: options.banner ? {
272
+ text: bannerText,
273
+ commit: gitVersionInformation.commit,
274
+ commitDirty: gitVersionInformation.dirty,
275
+ version: newVersion.toVersionString({ buildNumber: true }),
276
+ date: new Date(Date.now())
277
+ } : void 0,
278
+ preparedReporter: reporter
279
+ });
280
+ newVersion.preRelease = void 0;
281
+ try {
282
+ await fs.rm(zipFilePath);
283
+ } catch (err) {
284
+ if (!isErrorENOENT(err)) throw err;
285
+ }
286
+ if (readPackageAnimationList(location).length > 0) {
287
+ if (!readWorkspaceNpmManifest(workspace).dependencies?.["@intelligentgraphics/3d.ig.gfx.standard"]) {
288
+ if (await options.prompter.confirm(`The IG.GFX.Standard package should be added as a dependency to provide the 'AnimationInteractor' used to display animations. Do you wish to add it now?`)) {
289
+ await execAsync(`npm install @intelligentgraphics/3d.ig.gfx.standard`, {
290
+ encoding: "utf-8",
291
+ cwd: workspace.path
292
+ });
293
+ await execAsync(`npm run postinstall`, { cwd: workspace.path });
294
+ }
295
+ }
296
+ }
297
+ reporter.log(`Creating zip file`);
298
+ const archive = await buildArchiveFromPackage(reporter, location, packageDescription, binDir, options.minimize);
299
+ try {
300
+ const zipOutputStream = createWriteStream(zipFilePath);
301
+ await pipeline(archive.generateNodeStream(), zipOutputStream);
302
+ } catch (err) {
303
+ if (isErrorEACCES(err) || isErrorEPERM(err)) {
304
+ reporter.log(`Could not create zip file in the bin directory because of a permissions error. Only using it in-memory`);
305
+ uploadable = { getStream: () => archive.generateNodeStream() };
306
+ } else throw err;
307
+ }
308
+ }
309
+ if (!options.noUpload) {
310
+ if (!options.authentication) throw new Error(`Expected authentication to be available`);
311
+ reporter.log(`Opening connection to IG.Asset.Server`);
312
+ const sessionManager = await createAssetServiceSessionManager({
313
+ url: options.service,
314
+ address: options.address,
315
+ domain: publishDomain,
316
+ subDomain: publishSubdomain,
317
+ authentication: options.authentication
318
+ });
319
+ try {
320
+ if (!options.skipDependencies) try {
321
+ await synchronizeDependencies(workspace, packageDescription, sessionManager, options.prompter, reporter);
322
+ } catch (err) {
323
+ reporter.error(`Failed to synchronize dependencies for ${packageDescription.Package}`, err instanceof Error ? err : new Error(String(err)));
324
+ }
325
+ reporter.log(`Uploading package to ${publishDomain}.${publishSubdomain}`);
326
+ await assetService_exports.uploadPackageFromBuffer(sessionManager.getTargetSession(), assetServerPackageDetails, await buffer(uploadable.getStream()));
327
+ } finally {
328
+ await sessionManager.destroy().catch((err) => {
329
+ reporter.error(`Failed to close IG.Asset.Server session(s)`, err);
330
+ });
331
+ }
332
+ }
333
+ } catch (err) {
334
+ versionFile.reset();
335
+ throw err;
336
+ }
337
+ if (newVersion.buildNumber >= 100 && !options.pushOnly) {
338
+ reporter.error("Copying zip to releases folder");
339
+ const zipFileName = `${packageNameWithVersion}.zip`;
340
+ const releasesPath = getPackageReleasesDirectory(location);
341
+ await fs.mkdir(releasesPath, { recursive: true });
342
+ await pipeline(uploadable.getStream(), createWriteStream(path.join(releasesPath, zipFileName)));
343
+ }
344
+ };
345
+ //#endregion
346
+ export { releaseFolder };
347
+
348
+ //# sourceMappingURL=publish-E5zcQAo0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-E5zcQAo0.js","names":["fs","AssetService","AssetService","AssetService"],"sources":["../src/commands/publish/zip.ts","../src/lib/assetServiceSessionManager.ts","../src/lib/dependencySync.ts","../src/commands/publish/index.ts"],"sourcesContent":["import JSZip from \"jszip\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs\";\n\nimport { isErrorENOENT } from \"../../lib/error\";\nimport {\n\ttype CreatorPackage,\n\treadPackageCreatorManifest,\n\twritePackageCreatorManifest,\n\treadPackageCreatorIndex,\n\tparseCreatorPackageName,\n\ttype PackageLocation,\n\ttype PackageNpmManifest,\n\tINDEX_FILE,\n\tPACKAGE_FILE,\n} from \"../../lib/package\";\nimport {\n\ttype PublishedPackageLocation,\n\treadPublishedPackageCreatorIndex,\n} from \"../../lib/publishedPackage\";\nimport type { Reporter } from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport const buildArchiveFromPublishedPackage = (\n\tlocation: PublishedPackageLocation,\n\tmanifest: PackageNpmManifest,\n\tcreatorPackage: CreatorPackage,\n) => {\n\tconst archive = new JSZip();\n\n\tarchive.file(PACKAGE_FILE, JSON.stringify(creatorPackage, null, 2));\n\n\tconst index = readPublishedPackageCreatorIndex(location);\n\n\tif (index !== undefined) {\n\t\tarchive.file(INDEX_FILE, JSON.stringify(index, null, 2));\n\t}\n\n\tarchive.file(\n\t\tmanifest.main,\n\t\tfs.createReadStream(path.join(location.path, manifest.main)),\n\t);\n\n\tif (creatorPackage.Package === \"IG.GFX.Standard\") {\n\t\tconst source = path.join(location.path, \"Images\");\n\n\t\tif (fs.existsSync(source)) {\n\t\t\tconst images = fs.readdirSync(source);\n\n\t\t\tfor (const file of images) {\n\t\t\t\tconst { ext } = path.parse(file);\n\n\t\t\t\tswitch (ext) {\n\t\t\t\t\tcase \".png\":\n\t\t\t\t\tcase \".jpeg\":\n\t\t\t\t\tcase \".jpg\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tarchive.file(\n\t\t\t\t\tfile,\n\t\t\t\t\tfs.createReadStream(path.join(source, file)),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn archive;\n};\n\nconst runtimeScripts: CreatorPackage[\"Type\"][] = [\n\t\"Interactor\",\n\t\"Core\",\n\t\"Mixed\",\n];\n\nconst notRuntimeScripts: CreatorPackage[\"Type\"][] = [\"Context\", \"Evaluator\"];\n\nexport const buildArchiveFromPackage = async (\n\treporter: Reporter,\n\tpackageLocation: PackageLocation,\n\tdata: CreatorPackage,\n\tbinDir: string,\n\tminified = true,\n) => {\n\tconst { domain } = parseCreatorPackageName(data);\n\n\tconst scriptDirectories: string[] = [\n\t\tpackageLocation.path,\n\t\tpackageLocation.scriptsDir,\n\t];\n\n\tif (data.Package === \"IG.GFX.Standard\") {\n\t\treporter.log(`Including Images folder`);\n\t\tscriptDirectories.push(path.join(packageLocation.path, \"Images\"));\n\t}\n\n\tconst manifest = readPackageCreatorManifest(packageLocation);\n\n\tif (manifest !== undefined) {\n\t\tif (manifest.RunTime && notRuntimeScripts.includes(manifest.Type)) {\n\t\t\treporter.log(\n\t\t\t\t\"Setting script RunTime to false because of script type\",\n\t\t\t);\n\t\t\twritePackageCreatorManifest(packageLocation, {\n\t\t\t\t...manifest,\n\t\t\t\tRunTime: false,\n\t\t\t});\n\t\t} else if (\n\t\t\t!manifest.RunTime &&\n\t\t\truntimeScripts.includes(manifest.Type)\n\t\t) {\n\t\t\treporter.log(\n\t\t\t\t\"Setting script RunTime to true because of script type\",\n\t\t\t);\n\t\t\twritePackageCreatorManifest(packageLocation, {\n\t\t\t\t...manifest,\n\t\t\t\tRunTime: true,\n\t\t\t});\n\t\t}\n\t}\n\n\tlet libFile: string | undefined;\n\n\ttry {\n\t\tconst libFilePath = minified\n\t\t\t? path.join(binDir, `${data.Package}.min.js`)\n\t\t\t: path.join(binDir, `${data.Package}.js`);\n\n\t\tlibFile = fs.readFileSync(libFilePath, {\n\t\t\tencoding: \"utf8\",\n\t\t});\n\t} catch (err) {\n\t\tif (!isErrorENOENT(err)) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tconst archive = new JSZip();\n\n\tlet library: string = \"\";\n\n\tif (libFile) {\n\t\tlibrary = libFile;\n\t}\n\n\tif (!library) {\n\t\tconst date = new Date(Date.now());\n\t\tlibrary = `/* This file is part of the ${domain} Data Packages.\n\t\t* Copyright (C) ${date.getFullYear()} intelligentgraphics. All Rights Reserved. */`;\n\t}\n\n\tarchive.file(`${data.Package}.js`, library);\n\tarchive.file(PACKAGE_FILE, JSON.stringify(data, null, 2));\n\n\tconst creatorIndex = readPackageCreatorIndex(packageLocation);\n\n\tif (creatorIndex !== undefined) {\n\t\tarchive.file(INDEX_FILE, JSON.stringify(creatorIndex, null, 2));\n\t}\n\n\tfor (const directory of scriptDirectories) {\n\t\ttry {\n\t\t\tfor (const file of fs.readdirSync(directory)) {\n\t\t\t\tconst { ext } = path.parse(file);\n\n\t\t\t\tswitch (ext) {\n\t\t\t\t\tcase \".png\":\n\t\t\t\t\tcase \".jpeg\":\n\t\t\t\t\tcase \".jpg\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tarchive.file(\n\t\t\t\t\tfile,\n\t\t\t\t\tfs.createReadStream(path.join(directory, file)),\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\treporter.error(`Script directory \"${directory}\" does not exist`);\n\t\t}\n\t}\n\n\treturn archive;\n};\n","import { AssetService } from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport interface AssetServiceSessionManager {\n\tgetBasicsSession: () => Promise<AssetService.Session>;\n\tgetTargetSession: () => AssetService.Session;\n\tdestroy: () => Promise<void>;\n}\n\nexport const createAssetServiceSessionManager = async (\n\tparams: AssetService.SessionStartParams,\n): Promise<AssetServiceSessionManager> => {\n\tconst targetSession = await AssetService.startSession(params);\n\tlet basicsSession: AssetService.Session | undefined;\n\n\treturn {\n\t\tgetBasicsSession: async () => {\n\t\t\tif (targetSession.subDomain === \"Basics\") {\n\t\t\t\treturn targetSession;\n\t\t\t}\n\n\t\t\tif (basicsSession === undefined) {\n\t\t\t\tbasicsSession = await AssetService.startSession({\n\t\t\t\t\t...params,\n\t\t\t\t\tsubDomain: \"Basics\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn basicsSession;\n\t\t},\n\n\t\tgetTargetSession: () => targetSession,\n\n\t\tdestroy: async () => {\n\t\t\tawait AssetService.closeSession(targetSession);\n\n\t\t\tif (basicsSession !== undefined) {\n\t\t\t\tawait AssetService.closeSession(basicsSession);\n\t\t\t}\n\t\t},\n\t};\n};\n","import {\n\ttype WorkspaceLocation,\n\ttype CreatorPackage,\n\tAssetService,\n\tdetermineWorkspaceIGLibraries,\n\treadPublishedPackageNpmManifest,\n\treadPublishedPackageCreatorManifest,\n\ttype Reporter,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\nimport { buildArchiveFromPublishedPackage } from \"../commands/publish/zip\";\nimport { type AssetServiceSessionManager } from \"./assetServiceSessionManager\";\nimport { PackageVersion } from \"./packageVersion\";\nimport { parseVersionFromNumericVersion } from \"./parseVersion\";\nimport { type Prompter, type PrompterOption } from \"./prompter\";\n\nexport const synchronizeDependencies = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tcreatorPackage: CreatorPackage | undefined,\n\tsessionManager: AssetServiceSessionManager,\n\tprompter: Prompter,\n\treporter: Reporter,\n\tlogUpToDate: boolean = false,\n) => {\n\tinterface UploadedPackage extends Omit<\n\t\tAssetService.ExistingPackage,\n\t\t\"version\"\n\t> {\n\t\tversion: PackageVersion;\n\t}\n\n\tconst libraries = determineWorkspaceIGLibraries(workspaceLocation);\n\n\t// If there are no libraries, we don't need to check for required versions\n\tif (libraries.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst targetSession = sessionManager.getTargetSession();\n\n\tconst rawUploadedPackages =\n\t\tawait AssetService.getExistingPackages(targetSession);\n\n\tconst uploadedPackages = rawUploadedPackages.map(\n\t\t(entry): UploadedPackage => {\n\t\t\tlet version: PackageVersion;\n\n\t\t\ttry {\n\t\t\t\tversion = parseVersionFromNumericVersion(entry.numericVersion);\n\t\t\t} catch (err) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Encountered invalid format for version ${entry.numericVersion}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (version.buildNumber < 100) {\n\t\t\t\tversion.preRelease = {\n\t\t\t\t\ttype: \"beta\",\n\t\t\t\t\tversion: version.buildNumber,\n\t\t\t\t};\n\t\t\t} else if (version.buildNumber > 100) {\n\t\t\t\tversion.preRelease = {\n\t\t\t\t\ttype: \"patch\",\n\t\t\t\t\tversion: version.buildNumber - 100,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...entry,\n\t\t\t\tversion,\n\t\t\t};\n\t\t},\n\t);\n\n\tfor (const libraryLocation of libraries) {\n\t\tconst libraryManifest =\n\t\t\treadPublishedPackageNpmManifest(libraryLocation);\n\t\tconst libraryCreatorPackage =\n\t\t\treadPublishedPackageCreatorManifest(libraryLocation);\n\n\t\tif (\n\t\t\tlibraryCreatorPackage === undefined ||\n\t\t\tlibraryManifest.main === undefined ||\n\t\t\tlibraryCreatorPackage.Package === creatorPackage?.Package\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst libraryVersion = PackageVersion.extractFromLine(\n\t\t\tlibraryManifest.version,\n\t\t);\n\n\t\tif (libraryVersion.preRelease) {\n\t\t\tlibraryVersion.buildNumber = libraryVersion.preRelease.version;\n\t\t\tlibraryVersion.preRelease = undefined;\n\t\t} else {\n\t\t\tlibraryVersion.buildNumber = 100;\n\t\t}\n\n\t\tlet uploadedPackageInBasics: UploadedPackage | undefined;\n\t\tlet uploadedPackageInTarget: UploadedPackage | undefined;\n\n\t\tfor (const uploadedPackage of uploadedPackages) {\n\t\t\tif (uploadedPackage.scope === libraryCreatorPackage.Package) {\n\t\t\t\tif (uploadedPackage.support) {\n\t\t\t\t\tuploadedPackageInBasics = uploadedPackage;\n\t\t\t\t} else {\n\t\t\t\t\tuploadedPackageInTarget = uploadedPackage;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst validInBasics =\n\t\t\tuploadedPackageInBasics !== undefined &&\n\t\t\t!uploadedPackageInBasics.version.isLesserThan(libraryVersion);\n\t\tconst validInTarget =\n\t\t\tuploadedPackageInTarget !== undefined &&\n\t\t\t!uploadedPackageInTarget.version.isLesserThan(libraryVersion);\n\n\t\tif (validInBasics || validInTarget) {\n\t\t\tif (\n\t\t\t\ttargetSession.subDomain !== \"Basics\" &&\n\t\t\t\tuploadedPackageInBasics !== undefined &&\n\t\t\t\tuploadedPackageInTarget !== undefined\n\t\t\t) {\n\t\t\t\treporter.log(\n\t\t\t\t\t`Package ${libraryCreatorPackage.Package} is uploaded both for Basics and ${targetSession.subDomain}. The package within ${targetSession.subDomain} will be used.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (logUpToDate) {\n\t\t\t\treporter.log(\n\t\t\t\t\t`Package ${\n\t\t\t\t\t\tlibraryCreatorPackage.Package\n\t\t\t\t\t} is already uploaded with the required version ${libraryVersion.toVersionString(\n\t\t\t\t\t\t{},\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst possibleTargets: PrompterOption[] = [];\n\n\t\tif (uploadedPackageInBasics) {\n\t\t\tconst version = uploadedPackageInBasics.version.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t});\n\n\t\t\tpossibleTargets.push({\n\t\t\t\tvalue: \"Basics\",\n\t\t\t\tname: `Basics (Current: ${version})`,\n\t\t\t});\n\t\t} else {\n\t\t\tpossibleTargets.push({\n\t\t\t\tvalue: \"Basics\",\n\t\t\t\tname: \"Basics (Current: None)\",\n\t\t\t});\n\t\t}\n\n\t\tif (targetSession.subDomain !== \"Basics\") {\n\t\t\tif (uploadedPackageInTarget) {\n\t\t\t\tconst version = uploadedPackageInTarget.version.toVersionString(\n\t\t\t\t\t{\n\t\t\t\t\t\tbuildNumber: true,\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tpossibleTargets.push({\n\t\t\t\t\tvalue: targetSession.subDomain,\n\t\t\t\t\tname: `${targetSession.subDomain} (Current: ${version})`,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tpossibleTargets.push({\n\t\t\t\t\tvalue: targetSession.subDomain,\n\t\t\t\t\tname: `${targetSession.subDomain} (Current: None)`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst libraryVersionString = libraryVersion.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\n\t\tconst uploadTargetScope = await prompter.ask({\n\t\t\tmessage: `Version ${libraryVersionString} of dependency ${libraryCreatorPackage.Package} is required but not available. Please select a subdomain to upload the required dependency version to`,\n\t\t\toptions: [\n\t\t\t\t...possibleTargets,\n\t\t\t\t{ name: \"Skip upload\", value: \"Skip\" },\n\t\t\t],\n\t\t\tdefault: possibleTargets[0].value,\n\t\t});\n\n\t\tif (uploadTargetScope === \"Skip\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst archive = buildArchiveFromPublishedPackage(\n\t\t\tlibraryLocation,\n\t\t\tlibraryManifest,\n\t\t\tlibraryCreatorPackage,\n\t\t);\n\n\t\tconst newVersionString = libraryVersion.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\n\t\tconst session =\n\t\t\tuploadTargetScope === \"Basics\"\n\t\t\t\t? await sessionManager.getBasicsSession()\n\t\t\t\t: targetSession;\n\n\t\treporter.log(\n\t\t\t`Uploading package ${libraryCreatorPackage.Package} with version ${newVersionString} to ${session.domain}.${session.subDomain}`,\n\t\t);\n\n\t\tawait AssetService.uploadPackageFromBuffer(\n\t\t\tsession,\n\t\t\t{\n\t\t\t\tname: libraryCreatorPackage.Package,\n\t\t\t\tversion: newVersionString,\n\t\t\t},\n\t\t\tawait archive.generateAsync({ type: \"nodebuffer\" }),\n\t\t);\n\t}\n};\n","import * as path from \"node:path\";\nimport * as fs from \"fs/promises\";\nimport { createReadStream, createWriteStream } from \"node:fs\";\nimport { pipeline } from \"node:stream/promises\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nimport {\n\tAssetService,\n\tconsoleReporter,\n\tcreatePackageScopedReporter,\n\tisErrorEACCES,\n\tisErrorEPERM,\n\ttype Reporter,\n\twritePackageCreatorManifest,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nimport {\n\tgetPackageReleasesDirectory,\n\ttype PackageLocation,\n\tparseCreatorPackageName,\n\treadPackageAnimationList,\n\treadPackageCreatorManifest,\n} from \"../../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\treadWorkspaceNpmManifest,\n} from \"../../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../../lib/git\";\nimport { getWorkspaceBannerText } from \"../../lib/banner\";\nimport { parseVersionFromString } from \"../../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../../lib/versionFile\";\nimport { isErrorENOENT } from \"../../lib/error\";\nimport type { Prompter } from \"../../lib/prompter\";\nimport { PackageVersion } from \"../../lib/packageVersion\";\nimport { type BuildFoldersOptions, buildFolders } from \"../build\";\nimport { buildArchiveFromPackage } from \"./zip\";\nimport { createAssetServiceSessionManager } from \"../../lib/assetServiceSessionManager\";\nimport { synchronizeDependencies } from \"../../lib/dependencySync\";\nimport { buffer } from \"node:stream/consumers\";\n\nexport interface ReleaseFolderOptions extends Omit<\n\tBuildFoldersOptions,\n\t\"skipPackagesWithoutTsFiles\" | \"banner\" | \"packages\"\n> {\n\tdirectory: PackageLocation;\n\tnoUpload: boolean;\n\tnewVersion: string;\n\tdomain?: string;\n\tsubdomain?: string;\n\taddress?: string;\n\tservice: string;\n\tauthentication?: AssetService.Authentication;\n\tpushOnly: boolean;\n\tbanner?: boolean;\n\tprompter: Prompter;\n\tskipDependencies?: boolean;\n\treporter?: Reporter;\n}\n\nconst execAsync = promisify(exec);\n\nexport const releaseFolder = async (options: ReleaseFolderOptions) => {\n\tconst workspace = options.workspace;\n\tconst location = options.directory;\n\n\tconst versionFile = getVersionFileHandler(location);\n\n\tconst packageDescription = readPackageCreatorManifest(location);\n\tconst fullPackageName = packageDescription.Package;\n\n\tconst reporter =\n\t\toptions.reporter ??\n\t\tcreatePackageScopedReporter(\n\t\t\tconsoleReporter,\n\t\t\tpackageDescription.Package,\n\t\t);\n\n\tconst { domain, subdomain } = parseCreatorPackageName(packageDescription);\n\n\tconst publishDomain = options.domain ?? domain;\n\tconst publishSubdomain = options.subdomain ?? subdomain;\n\n\tconst sharedPackageJson = readWorkspaceNpmManifest(workspace);\n\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(options.newVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tpackageDescription.Version = newVersion.toVersionString({\n\t\tbuildNumber: true,\n\t});\n\twritePackageCreatorManifest(location, packageDescription);\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber > 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"patch\",\n\t\t\tversion: newVersion.buildNumber - 100,\n\t\t};\n\t}\n\n\t// if (sharedPackageJson !== undefined) {\n\t// \treporter.log(\n\t// \t\t`Running npm install to make sure all dependencies are up to date`,\n\t// \t);\n\t// \tawait execAsync(`npm install`, {\n\t// \t\tencoding: \"utf-8\",\n\t// \t\tcwd: workspace.path,\n\t// \t});\n\t// }\n\n\tconst binDir = options.outDir ?? getWorkspaceOutputPath(workspace);\n\tawait fs.mkdir(binDir, { recursive: true });\n\n\tlet assetServerPackageDetails: AssetService.UploadPackageDetails;\n\n\tlet packageNameWithVersion: string;\n\n\t{\n\t\tconst versionWithoutPrelease = newVersion.clone();\n\t\tversionWithoutPrelease.preRelease = undefined;\n\t\tconst newVersionString = versionWithoutPrelease.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\t\tpackageNameWithVersion = `${packageDescription.Package}_${newVersionString}`;\n\n\t\tassetServerPackageDetails = {\n\t\t\tname: packageDescription.Package,\n\t\t\tversion: newVersionString,\n\t\t};\n\t}\n\n\tlet zipFilePath = path.join(binDir, packageNameWithVersion + \".zip\");\n\tinterface Uploadable {\n\t\tgetStream: () => NodeJS.ReadableStream;\n\t}\n\n\tlet uploadable: Uploadable = {\n\t\tgetStream: () => createReadStream(zipFilePath),\n\t};\n\n\ttry {\n\t\tif (options.pushOnly) {\n\t\t\tconst zipFileExists = await fs.stat(zipFilePath).catch((err) => {\n\t\t\t\tif (isErrorENOENT(err)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn Promise.reject(err);\n\t\t\t});\n\n\t\t\tif (zipFileExists) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Expected a zip file to exist at path ${zipFilePath} since pushOnly is specified`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\t\t\tworkspace,\n\t\t\t\tlocation,\n\t\t\t);\n\n\t\t\tif (versionFile.exists) {\n\t\t\t\tversionFile.write(fullPackageName, newVersion);\n\t\t\t}\n\n\t\t\tconst bannerText =\n\t\t\t\tsharedPackageJson !== undefined\n\t\t\t\t\t? getWorkspaceBannerText(sharedPackageJson)\n\t\t\t\t\t: undefined;\n\n\t\t\tawait buildFolders({\n\t\t\t\t...options,\n\t\t\t\tpackages: [location],\n\t\t\t\tbanner: options.banner\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttext: bannerText,\n\t\t\t\t\t\t\tcommit: gitVersionInformation.commit,\n\t\t\t\t\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\t\t\t\t\tversion: newVersion.toVersionString({\n\t\t\t\t\t\t\t\tbuildNumber: true,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tdate: new Date(Date.now()),\n\t\t\t\t\t\t\t// gitVersionInformation.commitDate\n\t\t\t\t\t\t\t// \t? new Date(gitVersionInformation.commitDate)\n\t\t\t\t\t\t\t// \t: new Date(Date.now()),\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t\tpreparedReporter: reporter,\n\t\t\t});\n\n\t\t\tnewVersion.preRelease = undefined;\n\n\t\t\ttry {\n\t\t\t\tawait fs.rm(zipFilePath);\n\t\t\t} catch (err) {\n\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (readPackageAnimationList(location).length > 0) {\n\t\t\t\tconst workspaceManifest = readWorkspaceNpmManifest(workspace);\n\n\t\t\t\tif (\n\t\t\t\t\t!workspaceManifest.dependencies?.[\n\t\t\t\t\t\t\"@intelligentgraphics/3d.ig.gfx.standard\"\n\t\t\t\t\t]\n\t\t\t\t) {\n\t\t\t\t\tconst install = await options.prompter.confirm(\n\t\t\t\t\t\t`The IG.GFX.Standard package should be added as a dependency to provide the 'AnimationInteractor' used to display animations. Do you wish to add it now?`,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (install) {\n\t\t\t\t\t\tawait execAsync(\n\t\t\t\t\t\t\t`npm install @intelligentgraphics/3d.ig.gfx.standard`,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t\t\t\tcwd: workspace.path,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tawait execAsync(`npm run postinstall`, {\n\t\t\t\t\t\t\tcwd: workspace.path,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treporter.log(`Creating zip file`);\n\n\t\t\tconst archive = await buildArchiveFromPackage(\n\t\t\t\treporter,\n\t\t\t\tlocation,\n\t\t\t\tpackageDescription,\n\t\t\t\tbinDir,\n\t\t\t\toptions.minimize,\n\t\t\t);\n\n\t\t\ttry {\n\t\t\t\tconst zipOutputStream = createWriteStream(zipFilePath);\n\t\t\t\tawait pipeline(archive.generateNodeStream(), zipOutputStream);\n\t\t\t} catch (err) {\n\t\t\t\tif (isErrorEACCES(err) || isErrorEPERM(err)) {\n\t\t\t\t\treporter.log(\n\t\t\t\t\t\t`Could not create zip file in the bin directory because of a permissions error. Only using it in-memory`,\n\t\t\t\t\t);\n\t\t\t\t\tuploadable = {\n\t\t\t\t\t\tgetStream: () => archive.generateNodeStream(),\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!options.authentication) {\n\t\t\t\tthrow new Error(`Expected authentication to be available`);\n\t\t\t}\n\n\t\t\treporter.log(`Opening connection to IG.Asset.Server`);\n\n\t\t\tconst sessionManager = await createAssetServiceSessionManager({\n\t\t\t\turl: options.service,\n\t\t\t\taddress: options.address,\n\t\t\t\tdomain: publishDomain,\n\t\t\t\tsubDomain: publishSubdomain,\n\t\t\t\tauthentication: options.authentication,\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tif (!options.skipDependencies) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait synchronizeDependencies(\n\t\t\t\t\t\t\tworkspace,\n\t\t\t\t\t\t\tpackageDescription,\n\t\t\t\t\t\t\tsessionManager,\n\t\t\t\t\t\t\toptions.prompter,\n\t\t\t\t\t\t\treporter,\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\treporter.error(\n\t\t\t\t\t\t\t`Failed to synchronize dependencies for ${packageDescription.Package}`,\n\t\t\t\t\t\t\terr instanceof Error ? err : new Error(String(err)),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treporter.log(\n\t\t\t\t\t`Uploading package to ${publishDomain}.${publishSubdomain}`,\n\t\t\t\t);\n\n\t\t\t\tawait AssetService.uploadPackageFromBuffer(\n\t\t\t\t\tsessionManager.getTargetSession(),\n\t\t\t\t\tassetServerPackageDetails,\n\t\t\t\t\tawait buffer(uploadable.getStream()),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tawait sessionManager.destroy().catch((err) => {\n\t\t\t\t\treporter.error(\n\t\t\t\t\t\t`Failed to close IG.Asset.Server session(s)`,\n\t\t\t\t\t\terr,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\tversionFile.reset();\n\t\tthrow err;\n\t}\n\n\tif (newVersion.buildNumber >= 100 && !options.pushOnly) {\n\t\treporter.error(\"Copying zip to releases folder\");\n\n\t\tconst zipFileName = `${packageNameWithVersion}.zip`;\n\t\tconst releasesPath = getPackageReleasesDirectory(location);\n\n\t\tawait fs.mkdir(releasesPath, { recursive: true });\n\t\tawait pipeline(\n\t\t\tuploadable.getStream(),\n\t\t\tcreateWriteStream(path.join(releasesPath, zipFileName)),\n\t\t);\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAa,oCACZ,UACA,UACA,mBACI;CACJ,MAAM,UAAU,IAAI,OAAO;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MACR,8CACA,IACA;MACA;;;UAGI,KAAK;AACb,cAAY,OAAO;AACnB,QAAM;;AAGP,KAAI,WAAW,eAAe,OAAO,CAAC,QAAQ,UAAU;AACvD,WAAS,MAAM,iCAAiC;EAEhD,MAAM,cAAc,GAAG,uBAAuB;EAC9C,MAAM,eAAe,4BAA4B,SAAS;AAE1D,QAAM,GAAG,MAAM,cAAc,EAAE,WAAW,MAAM,CAAC;AACjD,QAAM,SACL,WAAW,WAAW,EACtB,kBAAkB,KAAK,KAAK,cAAc,YAAY,CAAC,CACvD"}
@@ -0,0 +1,115 @@
1
+ import { C as readPackageCreatorIndex, D as writePackageCreatorManifest, O as writePackageNpmManifest, T as readPackageNpmManifest, _ as PACKAGE_FILE, d as readWorkspaceNpmManifest, g as INDEX_FILE, i as createPackageScopedReporter, l as getWorkspaceOutputPath, r as consoleReporter, u as iterateWorkspacePackages, w as readPackageCreatorManifest } from "./build-kkMVBBJL.js";
2
+ import "./package-DHx2bvVO.js";
3
+ import "./workspace-D0XY2EMu.js";
4
+ import "./scripts-CBblHIL1.js";
5
+ import { buildFolders } from "./build-CMbCj7x-.js";
6
+ import { a as getVersionInformationFromGit, i as getWorkspaceBannerText, r as parseVersionFromString, t as getVersionFileHandler } from "./versionFile-DViDwgCa.js";
7
+ import * as fs from "node:fs";
8
+ import * as path from "node:path";
9
+ import { execSync } from "node:child_process";
10
+ //#region src/commands/publishNpm.ts
11
+ const publishToNpm = async ({ workspace, location, version: providedVersion, dryRun, reporter: providedReporter }) => {
12
+ let newVersion;
13
+ try {
14
+ newVersion = parseVersionFromString(providedVersion);
15
+ } catch (err) {
16
+ throw new Error(`Please enter a version in this format 1.0.0.100`);
17
+ }
18
+ if (newVersion.buildNumber < 100) newVersion.preRelease = {
19
+ type: "beta",
20
+ version: newVersion.buildNumber
21
+ };
22
+ else if (newVersion.buildNumber === 100) newVersion.preRelease = void 0;
23
+ else throw new Error(`Refusing to publish a package with a build version larger than 100.`);
24
+ const workspaceManifest = readWorkspaceNpmManifest(workspace);
25
+ const workspaceOutputPath = getWorkspaceOutputPath(workspace);
26
+ const creatorPackage = readPackageCreatorManifest(location);
27
+ const reporter = providedReporter ?? createPackageScopedReporter(consoleReporter, creatorPackage.Package);
28
+ let packageJson = readPackageNpmManifest(location);
29
+ if (packageJson === void 0) packageJson = {
30
+ name: "@intelligentgraphics/3d" + creatorPackage.Package.toLowerCase(),
31
+ version: "1.0.0",
32
+ description: creatorPackage.Package
33
+ };
34
+ packageJson.version = newVersion.toVersionString({ buildNumber: false });
35
+ packageJson.description = newVersion.toDescriptionString(creatorPackage.Package);
36
+ packageJson.main = `${creatorPackage.Package}.js`;
37
+ packageJson.types = `${creatorPackage.Package}.d.ts`;
38
+ packageJson.publishConfig ??= {};
39
+ packageJson.publishConfig.acccess = "public";
40
+ packageJson.ig = { scriptingLibrary: true };
41
+ packageJson.files = void 0;
42
+ const publishDir = path.join(workspaceOutputPath, "publish", creatorPackage.Package);
43
+ fs.rmSync(publishDir, {
44
+ recursive: true,
45
+ force: true
46
+ });
47
+ fs.mkdirSync(publishDir, { recursive: true });
48
+ writePackageNpmManifest(location, packageJson);
49
+ creatorPackage.Version = newVersion.toVersionString({ buildNumber: true });
50
+ writePackageCreatorManifest(location, creatorPackage);
51
+ const versionFile = getVersionFileHandler(location);
52
+ if (versionFile.exists) versionFile.write(creatorPackage.Package, newVersion);
53
+ const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
54
+ const bannerText = getWorkspaceBannerText(workspaceManifest);
55
+ await buildFolders({
56
+ workspace,
57
+ packages: [location],
58
+ minimize: true,
59
+ outDir: getWorkspaceOutputPath(workspace),
60
+ banner: {
61
+ text: bannerText,
62
+ commit: gitVersionInformation.commit,
63
+ commitDirty: gitVersionInformation.dirty,
64
+ version: newVersion.toVersionString({ buildNumber: true }),
65
+ date: new Date(Date.now())
66
+ }
67
+ });
68
+ fs.copyFileSync(path.join(getWorkspaceOutputPath(workspace), `${creatorPackage.Package}.d.ts`), path.join(publishDir, `${creatorPackage.Package}.d.ts`));
69
+ fs.copyFileSync(path.join(getWorkspaceOutputPath(workspace), `${creatorPackage.Package}.min.js`), path.join(publishDir, `${creatorPackage.Package}.js`));
70
+ fs.copyFileSync(path.join(location.manifestDir, "package.json"), path.join(publishDir, "package.json"));
71
+ fs.writeFileSync(path.join(publishDir, PACKAGE_FILE), JSON.stringify(creatorPackage, null, 2));
72
+ const index = readPackageCreatorIndex(location);
73
+ if (index !== void 0) fs.writeFileSync(path.join(publishDir, INDEX_FILE), JSON.stringify(index));
74
+ const readmeName = fs.readdirSync(location.path).find((name) => name.toLowerCase() === "readme.md");
75
+ if (readmeName !== void 0) fs.copyFileSync(path.join(location.path, readmeName), path.join(publishDir, readmeName));
76
+ if (creatorPackage.Package === "IG.GFX.Standard") copyImagesDirectory(path.join(location.path, "Images"), path.join(publishDir, "Images"));
77
+ const npmPublishArgs = [];
78
+ if (dryRun) npmPublishArgs.push("--dry-run");
79
+ if (newVersion.preRelease) npmPublishArgs.push("--tag", "next");
80
+ reporter.log(`Publishing to npm with version ${packageJson.version} using tag ${newVersion.preRelease ? "next" : "latest"}`);
81
+ execSync([
82
+ "npm",
83
+ "publish",
84
+ ...npmPublishArgs
85
+ ].join(" "), {
86
+ stdio: "inherit",
87
+ encoding: "utf8",
88
+ cwd: publishDir
89
+ });
90
+ for (const packageLocation of iterateWorkspacePackages(workspace)) {
91
+ const manifest = readPackageNpmManifest(packageLocation);
92
+ if (manifest?.dependencies?.[packageJson.name] !== void 0) {
93
+ manifest.dependencies[packageJson.name] = "^" + packageJson.version;
94
+ writePackageNpmManifest(packageLocation, manifest);
95
+ }
96
+ }
97
+ };
98
+ const copyImagesDirectory = (source, target) => {
99
+ fs.mkdirSync(target, { recursive: true });
100
+ for (const name of fs.readdirSync(source)) {
101
+ const sourcePath = path.join(source, name);
102
+ const targetPath = path.join(target, name);
103
+ if (fs.statSync(sourcePath).isDirectory()) copyImagesDirectory(sourcePath, targetPath);
104
+ else if ([
105
+ ".png",
106
+ ".jpg",
107
+ ".jpeg",
108
+ ".gif"
109
+ ].includes(path.extname(name))) fs.copyFileSync(sourcePath, targetPath);
110
+ }
111
+ };
112
+ //#endregion
113
+ export { publishToNpm };
114
+
115
+ //# sourceMappingURL=publishNpm-CBT1819u.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishNpm-CBT1819u.js","names":[],"sources":["../src/commands/publishNpm.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs\";\nimport { execSync } from \"node:child_process\";\n\nimport {\n\tconsoleReporter,\n\tcreatePackageScopedReporter,\n\ttype Reporter,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nimport { PackageVersion } from \"../lib/packageVersion\";\nimport {\n\tINDEX_FILE,\n\ttype PackageLocation,\n\tPACKAGE_FILE,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n\twritePackageNpmManifest,\n\twritePackageCreatorManifest,\n} from \"../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\titerateWorkspacePackages,\n\treadWorkspaceNpmManifest,\n\ttype WorkspaceLocation,\n} from \"../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../lib/git\";\nimport { getWorkspaceBannerText } from \"../lib/banner\";\nimport { parseVersionFromString } from \"../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../lib/versionFile\";\n\nimport { buildFolders } from \"./build\";\n\nexport interface PublishToNpmSettings {\n\tworkspace: WorkspaceLocation;\n\tlocation: PackageLocation;\n\tversion: string;\n\tdryRun?: boolean;\n\treporter?: Reporter;\n}\n\nexport const publishToNpm = async ({\n\tworkspace,\n\tlocation,\n\tversion: providedVersion,\n\tdryRun,\n\treporter: providedReporter,\n}: PublishToNpmSettings) => {\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(providedVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber === 100) {\n\t\tnewVersion.preRelease = undefined;\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Refusing to publish a package with a build version larger than 100.`,\n\t\t);\n\t}\n\n\tconst workspaceManifest = readWorkspaceNpmManifest(workspace);\n\tconst workspaceOutputPath = getWorkspaceOutputPath(workspace);\n\tconst creatorPackage = readPackageCreatorManifest(location);\n\n\tconst reporter =\n\t\tprovidedReporter ??\n\t\tcreatePackageScopedReporter(consoleReporter, creatorPackage.Package);\n\n\tlet packageJson = readPackageNpmManifest(location);\n\n\tif (packageJson === undefined) {\n\t\tpackageJson = {\n\t\t\tname:\n\t\t\t\t\"@intelligentgraphics/3d\" +\n\t\t\t\tcreatorPackage.Package.toLowerCase(),\n\t\t\tversion: \"1.0.0\",\n\t\t\tdescription: creatorPackage.Package,\n\t\t};\n\t}\n\n\tpackageJson.version = newVersion.toVersionString({\n\t\tbuildNumber: false,\n\t});\n\tpackageJson.description = newVersion.toDescriptionString(\n\t\tcreatorPackage.Package,\n\t);\n\tpackageJson.main = `${creatorPackage.Package}.js`;\n\tpackageJson.types = `${creatorPackage.Package}.d.ts`;\n\tpackageJson.publishConfig ??= {};\n\tpackageJson.publishConfig.acccess = \"public\";\n\tpackageJson.ig = {\n\t\tscriptingLibrary: true,\n\t};\n\tpackageJson.files = undefined;\n\n\tconst publishDir = path.join(\n\t\tworkspaceOutputPath,\n\t\t\"publish\",\n\t\tcreatorPackage.Package,\n\t);\n\tfs.rmSync(publishDir, { recursive: true, force: true });\n\tfs.mkdirSync(publishDir, { recursive: true });\n\n\twritePackageNpmManifest(location, packageJson);\n\tcreatorPackage.Version = newVersion.toVersionString({ buildNumber: true });\n\twritePackageCreatorManifest(location, creatorPackage);\n\n\tconst versionFile = getVersionFileHandler(location);\n\tif (versionFile.exists) {\n\t\tversionFile.write(creatorPackage.Package, newVersion);\n\t}\n\n\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\tworkspace,\n\t\tlocation,\n\t);\n\n\tconst bannerText = getWorkspaceBannerText(workspaceManifest);\n\n\tawait buildFolders({\n\t\tworkspace,\n\t\tpackages: [location],\n\t\tminimize: true,\n\t\toutDir: getWorkspaceOutputPath(workspace),\n\t\tbanner: {\n\t\t\ttext: bannerText,\n\t\t\tcommit: gitVersionInformation.commit,\n\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\tversion: newVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t}),\n\t\t\tdate: new Date(Date.now()),\n\t\t},\n\t});\n\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.d.ts`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.d.ts`),\n\t);\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.min.js`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.js`),\n\t);\n\n\tfs.copyFileSync(\n\t\tpath.join(location.manifestDir, \"package.json\"),\n\t\tpath.join(publishDir, \"package.json\"),\n\t);\n\n\tfs.writeFileSync(\n\t\tpath.join(publishDir, PACKAGE_FILE),\n\t\tJSON.stringify(creatorPackage, null, 2),\n\t);\n\n\tconst index = readPackageCreatorIndex(location);\n\n\tif (index !== undefined) {\n\t\tfs.writeFileSync(\n\t\t\tpath.join(publishDir, INDEX_FILE),\n\t\t\tJSON.stringify(index),\n\t\t);\n\t}\n\n\tconst readmeName = fs\n\t\t.readdirSync(location.path)\n\t\t.find((name) => name.toLowerCase() === \"readme.md\");\n\n\tif (readmeName !== undefined) {\n\t\tfs.copyFileSync(\n\t\t\tpath.join(location.path, readmeName),\n\t\t\tpath.join(publishDir, readmeName),\n\t\t);\n\t}\n\n\tif (creatorPackage.Package === \"IG.GFX.Standard\") {\n\t\tconst source = path.join(location.path, \"Images\");\n\t\tconst target = path.join(publishDir, \"Images\");\n\t\tcopyImagesDirectory(source, target);\n\t}\n\n\tconst npmPublishArgs: string[] = [];\n\n\tif (dryRun) {\n\t\tnpmPublishArgs.push(\"--dry-run\");\n\t}\n\n\tif (newVersion.preRelease) {\n\t\tnpmPublishArgs.push(\"--tag\", \"next\");\n\t}\n\n\treporter.log(\n\t\t`Publishing to npm with version ${packageJson.version} using tag ${\n\t\t\tnewVersion.preRelease ? \"next\" : \"latest\"\n\t\t}`,\n\t);\n\n\texecSync([\"npm\", \"publish\", ...npmPublishArgs].join(\" \"), {\n\t\tstdio: \"inherit\",\n\t\tencoding: \"utf8\",\n\t\tcwd: publishDir,\n\t});\n\n\tfor (const packageLocation of iterateWorkspacePackages(workspace)) {\n\t\tconst manifest = readPackageNpmManifest(packageLocation);\n\n\t\tif (manifest?.dependencies?.[packageJson.name] !== undefined) {\n\t\t\tmanifest.dependencies[packageJson.name] = \"^\" + packageJson.version;\n\t\t\twritePackageNpmManifest(packageLocation, manifest);\n\t\t}\n\t}\n};\n\nconst copyImagesDirectory = (source: string, target: string) => {\n\tfs.mkdirSync(target, { recursive: true });\n\n\tfor (const name of fs.readdirSync(source)) {\n\t\tconst sourcePath = path.join(source, name);\n\t\tconst targetPath = path.join(target, name);\n\n\t\tif (fs.statSync(sourcePath).isDirectory()) {\n\t\t\tcopyImagesDirectory(sourcePath, targetPath);\n\t\t} else {\n\t\t\tif (\n\t\t\t\t[\".png\", \".jpg\", \".jpeg\", \".gif\"].includes(path.extname(name))\n\t\t\t) {\n\t\t\t\tfs.copyFileSync(sourcePath, targetPath);\n\t\t\t}\n\t\t}\n\t}\n};\n"],"mappings":";;;;;;;;;;AA0CA,MAAa,eAAe,OAAO,EAClC,WACA,UACA,SAAS,iBACT,QACA,UAAU,uBACiB;CAC3B,IAAI;AACJ,KAAI;AACH,eAAa,uBAAuB,gBAAgB;UAC5C,KAAK;AACb,Q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