@intelligentgraphics/ig.gfx.packager 3.0.0-alpha.0 → 3.0.0-alpha.3

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 (38) hide show
  1. package/build/cli.mjs +593 -0
  2. package/build/cli.mjs.map +1 -0
  3. package/build/commands/{build.js → build.mjs} +74 -77
  4. package/build/commands/build.mjs.map +1 -0
  5. package/build/commands/{generate.js → generate.mjs} +32 -58
  6. package/build/commands/generate.mjs.map +1 -0
  7. package/build/commands/postinstall.mjs +49 -0
  8. package/build/commands/postinstall.mjs.map +1 -0
  9. package/build/commands/publishNpm.mjs +129 -0
  10. package/build/commands/publishNpm.mjs.map +1 -0
  11. package/build/commands/{release.js → release.mjs} +91 -119
  12. package/build/commands/release.mjs.map +1 -0
  13. package/build/{dependencies.js → dependencies.mjs} +16 -40
  14. package/build/dependencies.mjs.map +1 -0
  15. package/build/index.mjs +6 -0
  16. package/build/index.mjs.map +1 -0
  17. package/build/scripts.mjs +11 -0
  18. package/build/scripts.mjs.map +1 -0
  19. package/build/versionFile.mjs +352 -0
  20. package/build/versionFile.mjs.map +1 -0
  21. package/package.json +9 -10
  22. package/readme.md +12 -0
  23. package/build/cli.js +0 -8315
  24. package/build/cli.js.map +0 -1
  25. package/build/commands/build.js.map +0 -1
  26. package/build/commands/generate.js.map +0 -1
  27. package/build/commands/postinstall.js +0 -77
  28. package/build/commands/postinstall.js.map +0 -1
  29. package/build/commands/publishNpm.js +0 -156
  30. package/build/commands/publishNpm.js.map +0 -1
  31. package/build/commands/release.js.map +0 -1
  32. package/build/dependencies.js.map +0 -1
  33. package/build/index.js +0 -7
  34. package/build/index.js.map +0 -1
  35. package/build/scripts.js +0 -31
  36. package/build/scripts.js.map +0 -1
  37. package/build/versionFile.js +0 -181
  38. package/build/versionFile.js.map +0 -1
package/build/cli.mjs ADDED
@@ -0,0 +1,593 @@
1
+ #!/usr/bin/env node
2
+ import updateNotifier from 'update-notifier';
3
+ import * as fs from 'fs';
4
+ import * as path from 'path';
5
+ import { dirname } from 'path';
6
+ import yargs from 'yargs/yargs';
7
+ import { fileURLToPath } from 'url';
8
+ import y18n from 'y18n';
9
+ import writePkg from 'write-pkg';
10
+ import inquirer from 'inquirer';
11
+
12
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
+ const instance = y18n({
14
+ directory: path.join(__dirname, "..", "locales"),
15
+ updateFiles: false,
16
+ locale: "en",
17
+ fallbackToLanguage: true
18
+ });
19
+ const translate = (key, ...args) => instance.__(key, ...args);
20
+
21
+ const getNodeErrorCode = error => {
22
+ if (error !== null && typeof error === "object" && error.code !== undefined) {
23
+ return error.code;
24
+ }
25
+ };
26
+
27
+ /**
28
+ * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.
29
+ *
30
+ * @param {unknown} error
31
+ */
32
+ const isErrorENOENT = error => getNodeErrorCode(error) === "ENOENT";
33
+
34
+ const readNpmManifest = directory => {
35
+ const packageJsonPath = path.join(directory, "package.json");
36
+ const packageJson = fs.readFileSync(packageJsonPath, {
37
+ encoding: "utf8"
38
+ });
39
+ return JSON.parse(packageJson);
40
+ };
41
+ const writeNpmManifest = (directory, packageJson) => {
42
+ const packageJsonPath = path.join(directory, "package.json");
43
+ writePkg.sync(packageJsonPath, packageJson);
44
+ };
45
+
46
+ // Functionality related to working with a single package.
47
+ const PACKAGE_FILE = "_Package.json";
48
+ const INDEX_FILE = "_Index.json";
49
+ const ANIMATION_FILE = ".animation.json";
50
+
51
+ /**
52
+ * Describes the location of a single package.
53
+ *
54
+ * @export
55
+ * @interface PackageLocation
56
+ */
57
+
58
+ const parseCreatorPackageName = manifest => {
59
+ const [domain, ...subdomainParts] = manifest.Package.split(".");
60
+ return {
61
+ domain,
62
+ subdomain: subdomainParts.join(".")
63
+ };
64
+ };
65
+ /**
66
+ * Detects the package at the given directory.
67
+ *
68
+ * @param {string} directory
69
+ * @returns {PackageLocation}
70
+ */
71
+ const detectPackage = (workspace, directory) => {
72
+ directory = path.resolve(workspace.path, directory);
73
+ const scriptsPath = path.join(directory, "Scripts");
74
+ const tsPath = path.join(directory, "ts");
75
+ let location;
76
+ if (fs.existsSync(scriptsPath)) {
77
+ location = {
78
+ _kind: "PackageLocation",
79
+ path: directory,
80
+ scriptsDir: scriptsPath,
81
+ manifestDir: scriptsPath
82
+ };
83
+ } else if (fs.existsSync(tsPath)) {
84
+ location = {
85
+ _kind: "PackageLocation",
86
+ path: directory,
87
+ scriptsDir: tsPath,
88
+ manifestDir: directory
89
+ };
90
+ } else {
91
+ location = {
92
+ _kind: "PackageLocation",
93
+ path: directory,
94
+ scriptsDir: directory,
95
+ manifestDir: directory
96
+ };
97
+ }
98
+ if (readPackageCreatorManifest(location) === undefined) {
99
+ throw new Error(`No _Package.json found in ${location.manifestDir}`);
100
+ }
101
+ return location;
102
+ };
103
+ const readPackageCreatorManifest = location => {
104
+ const packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);
105
+ const packageJson = fs.readFileSync(packageJsonPath, {
106
+ encoding: "utf8"
107
+ });
108
+ const result = JSON.parse(packageJson);
109
+ return {
110
+ ...result,
111
+ Scope: result.Scope || result.Package
112
+ };
113
+ };
114
+ const writePackageCreatorManifest = (location, creatorPackage) => {
115
+ const packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);
116
+ fs.writeFileSync(packageJsonPath, JSON.stringify(creatorPackage, null, "\t") + "\n");
117
+ };
118
+ const readPackageCreatorIndex = location => {
119
+ try {
120
+ const indexPath = path.join(location.manifestDir, INDEX_FILE);
121
+ const index = fs.readFileSync(indexPath, {
122
+ encoding: "utf8"
123
+ });
124
+ return JSON.parse(index);
125
+ } catch (err) {
126
+ if (isErrorENOENT(err)) {
127
+ return undefined;
128
+ }
129
+ throw err;
130
+ }
131
+ };
132
+ const writePackageCreatorIndex = (location, index) => {
133
+ const packageJsonPath = path.join(location.manifestDir, INDEX_FILE);
134
+ fs.writeFileSync(packageJsonPath, JSON.stringify(index, null, "\t") + "\n");
135
+ };
136
+ const readPackageNpmManifest = location => {
137
+ try {
138
+ return readNpmManifest(location.manifestDir);
139
+ } catch (err) {
140
+ if (isErrorENOENT(err)) {
141
+ return undefined;
142
+ }
143
+ throw err;
144
+ }
145
+ };
146
+ const writePackageNpmManifest = (location, packageJson) => {
147
+ writeNpmManifest(location.manifestDir, packageJson);
148
+ };
149
+ const readPackageAnimationList = location => {
150
+ const directoryContent = fs.readdirSync(location.manifestDir);
151
+ const animationPathList = [];
152
+ for (const entry of directoryContent) {
153
+ if (entry.endsWith(ANIMATION_FILE)) {
154
+ const animationPath = path.join(location.manifestDir, entry);
155
+ animationPathList.push(animationPath);
156
+ }
157
+ }
158
+ return animationPathList;
159
+ };
160
+ const getPackageReleasesDirectory = location => path.join(location.path, "Releases");
161
+
162
+ // Functionality related to working with a workspace consisting of multiple packages.
163
+
164
+ /**
165
+ * Describe the location of a workspace constining of n packages.
166
+ *
167
+ * @export
168
+ * @interface WorkspaceLocation
169
+ */
170
+
171
+ const detectWorkspace = directory => {
172
+ directory = path.resolve(process.cwd(), directory);
173
+ return {
174
+ _kind: "WorkspaceLocation",
175
+ path: directory
176
+ };
177
+ };
178
+ const readWorkspaceNpmManifest = workspace => {
179
+ try {
180
+ return readNpmManifest(workspace.path);
181
+ } catch (err) {
182
+ if (isErrorENOENT(err)) {
183
+ return undefined;
184
+ }
185
+ throw err;
186
+ }
187
+ };
188
+ const writeWorkspaceNpmManifest = (workspace, packageJson) => writeNpmManifest(workspace.path, packageJson);
189
+ const getWorkspaceOutputPath = workspace => path.join(workspace.path, "bin");
190
+ const getWorkspaceLibPath = workspace => path.join(workspace.path, "lib");
191
+ function* iterateWorkspacePackages(workspace) {
192
+ const entries = fs.readdirSync(workspace.path, {
193
+ withFileTypes: true
194
+ });
195
+ for (const entry of entries) {
196
+ if (!entry.isDirectory()) {
197
+ continue;
198
+ }
199
+ try {
200
+ yield detectPackage(workspace, entry.name);
201
+ } catch {}
202
+ }
203
+ }
204
+
205
+ const createDefaultPrompter = () => {
206
+ return {
207
+ confirm: async message => {
208
+ const {
209
+ confirm
210
+ } = await inquirer.prompt([{
211
+ type: "confirm",
212
+ message,
213
+ name: "confirm"
214
+ }]);
215
+ return confirm;
216
+ },
217
+ ask: async question => {
218
+ const {
219
+ answer
220
+ } = await inquirer.prompt([{
221
+ type: "list",
222
+ message: question.message,
223
+ name: "answer",
224
+ choices: question.options,
225
+ default: question.default
226
+ }]);
227
+ return answer;
228
+ }
229
+ };
230
+ };
231
+
232
+ var name = "@intelligentgraphics/ig.gfx.packager";
233
+ var version = "3.0.0-alpha.3";
234
+ var description = "IG.GFX.Packager 3.0.0 Alpha 3 (3.0.0.4)";
235
+ var author = "Michael Beier <mb@intelligentgraphics.biz>";
236
+ var main = "build/index.mjs";
237
+ var type = "module";
238
+ var publishConfig = {
239
+ access: "public"
240
+ };
241
+ var engines = {
242
+ node: ">=16.0.0"
243
+ };
244
+ var bin = {
245
+ packager: "./build/index.mjs"
246
+ };
247
+ var files = [
248
+ "build",
249
+ "locales",
250
+ "scripts"
251
+ ];
252
+ var scripts = {
253
+ dist: "rollup -c rollup.config.mjs",
254
+ clean: "rimraf build *.tsbuildinfo",
255
+ prepublishOnly: "yarn clean && yarn dist",
256
+ test: "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js",
257
+ format: "prettier --write \"**/*.{ts,tsx,json}\""
258
+ };
259
+ var dependencies = {
260
+ ajv: "^8.6.2",
261
+ axios: "^0.21.1",
262
+ "core-js": "^3.16.0",
263
+ glob: "^7.1.4",
264
+ inquirer: "^9.1.4",
265
+ jszip: "^3.10.0",
266
+ lodash: "^4.17.21",
267
+ resolve: "^1.22.1",
268
+ "simple-git": "^3.15.1",
269
+ "source-map-support": "^0.5.19",
270
+ terser: "^4.8.0",
271
+ typedoc: "~0.23.2",
272
+ typescript: "~4.9.4",
273
+ "update-notifier": "^5.1.0",
274
+ "v8-compile-cache": "^2.1.1",
275
+ "write-pkg": "4",
276
+ y18n: "^5.0.8",
277
+ yargs: "^17.0.1"
278
+ };
279
+ var devDependencies = {
280
+ "@babel/preset-env": "^7.18.9",
281
+ "@babel/preset-typescript": "^7.18.6",
282
+ "@rollup/plugin-babel": "^6.0.3",
283
+ "@rollup/plugin-commonjs": "^24.0.0",
284
+ "@rollup/plugin-json": "^6.0.0",
285
+ "@rollup/plugin-node-resolve": "^15.0.1",
286
+ "@types/glob": "^7.1.4",
287
+ "@types/node": "^16.4.11",
288
+ "@types/update-notifier": "^5.1.0",
289
+ "@types/yargs": "^17.0.2",
290
+ rollup: "^3.10.0"
291
+ };
292
+ var pjson = {
293
+ name: name,
294
+ version: version,
295
+ description: description,
296
+ author: author,
297
+ main: main,
298
+ "private": false,
299
+ type: type,
300
+ publishConfig: publishConfig,
301
+ engines: engines,
302
+ bin: bin,
303
+ files: files,
304
+ scripts: scripts,
305
+ dependencies: dependencies,
306
+ devDependencies: devDependencies
307
+ };
308
+
309
+ const __filename = fileURLToPath(import.meta.url);
310
+ const captureError = err => {
311
+ console.log("");
312
+ if (process.env.NODE_ENV !== "production") {
313
+ console.error(err);
314
+ } else {
315
+ console.error(translate("messages.error", err.message));
316
+ }
317
+ };
318
+ const buildOptions = {
319
+ outDir: {
320
+ description: translate("options.outDir.description"),
321
+ type: "string",
322
+ default: "bin",
323
+ coerce: input => input === undefined || input === null ? undefined : path.resolve(process.cwd(), input)
324
+ },
325
+ minimize: {
326
+ description: translate("options.minimize.description"),
327
+ type: "boolean",
328
+ default: true
329
+ },
330
+ cwd: {
331
+ description: translate("options.cwd.description"),
332
+ type: "string",
333
+ default: process.cwd()
334
+ },
335
+ clean: {
336
+ description: translate("options.clean.description"),
337
+ type: "boolean",
338
+ default: false
339
+ },
340
+ docs: {
341
+ type: "boolean",
342
+ default: false
343
+ }
344
+ };
345
+ const preCommandCheck = async () => {
346
+ var _repositoryPackage, _repositoryPackage$de, _repositoryPackage2, _repositoryPackage2$d;
347
+ const executedLocalPackager = path.relative(process.cwd(), __filename).indexOf("..") === -1;
348
+ let repositoryPackage;
349
+ try {
350
+ const repositoryPackageJson = fs.readFileSync(path.resolve(process.cwd(), "package.json"), "utf8");
351
+ repositoryPackage = JSON.parse(repositoryPackageJson);
352
+ } catch (err) {}
353
+ if ((_repositoryPackage = repositoryPackage) !== null && _repositoryPackage !== void 0 && (_repositoryPackage$de = _repositoryPackage.dependencies) !== null && _repositoryPackage$de !== void 0 && _repositoryPackage$de["@intelligentgraphics/ig.gfx.packager"] || (_repositoryPackage2 = repositoryPackage) !== null && _repositoryPackage2 !== void 0 && (_repositoryPackage2$d = _repositoryPackage2.devDependencies) !== null && _repositoryPackage2$d !== void 0 && _repositoryPackage2$d["@intelligentgraphics/ig.gfx.packager"]) {
354
+ const parts = ["Detected locally installed ig.gfx.packager."];
355
+ if (executedLocalPackager) {
356
+ parts.push('Run "npm install -g @intelligentgraphics/ig.gfx.packager@latest" to install the global version, if it is not yet installed.');
357
+ }
358
+ parts.push('Run "npm uninstall @intelligentgraphics/ig.gfx.packager" to remove the local version.');
359
+ console.error(parts.join("\n"));
360
+ process.exit(1);
361
+ }
362
+ if (executedLocalPackager) {
363
+ console.error(`Detected locally installed ig.gfx.packager.
364
+ Run "npm install -g @intelligentgraphics/ig.gfx.packager@latest" to install the global version, if it is not yet installed.
365
+ Run "npm install" to get rid of the local packager version.`);
366
+ process.exit(1);
367
+ }
368
+ const notifier = updateNotifier({
369
+ pkg: pjson,
370
+ shouldNotifyInNpmScript: true,
371
+ updateCheckInterval: 1000 * 60
372
+ });
373
+ notifier.notify({
374
+ isGlobal: true,
375
+ defer: true
376
+ });
377
+ const workspaceLocation = detectWorkspace(process.cwd());
378
+ const packageJson = readWorkspaceNpmManifest(workspaceLocation);
379
+ if (packageJson === undefined) {
380
+ throw new Error("Could not load package.json file in current directory");
381
+ }
382
+ packageJson.scripts ??= {};
383
+ packageJson.scripts.postinstall = "packager postinstall";
384
+ writeWorkspaceNpmManifest(workspaceLocation, packageJson);
385
+ };
386
+ const yargsInstance = yargs(process.argv.slice(2));
387
+ yargsInstance.command("build [directories...]", "Builds the specified directories", argv => argv.options(buildOptions), async ({
388
+ directories = [],
389
+ ...options
390
+ }) => {
391
+ await preCommandCheck();
392
+ const {
393
+ buildFolders
394
+ } = await import('./commands/build.mjs').then(function (n) { return n.i; });
395
+ await buildFolders({
396
+ ...options,
397
+ directories: directories
398
+ }).catch(captureError);
399
+ });
400
+ yargsInstance.command("publish [directory]", "Publishes the specified directory", argv => argv.options({
401
+ ...buildOptions,
402
+ noUpload: {
403
+ type: "boolean",
404
+ default: false,
405
+ description: translate("options.noUpload.description")
406
+ },
407
+ domain: {
408
+ type: "string",
409
+ description: translate("options.domain.description")
410
+ },
411
+ subdomain: {
412
+ type: "string",
413
+ description: translate("options.subdomain.description")
414
+ },
415
+ newVersion: {
416
+ type: "string",
417
+ description: translate("options.newVersion.description"),
418
+ default: process.env.VERSION,
419
+ required: true
420
+ },
421
+ address: {
422
+ type: "string",
423
+ description: translate("options.address.description"),
424
+ default: "localhost"
425
+ },
426
+ service: {
427
+ type: "string",
428
+ description: translate("options.service.description"),
429
+ default: process.env.IG_GFX_ASSET_SERVICE,
430
+ required: true
431
+ },
432
+ user: {
433
+ type: "string",
434
+ description: translate("options.user.description"),
435
+ default: process.env.IG_GFX_USER
436
+ },
437
+ password: {
438
+ type: "string",
439
+ description: translate("options.password.description"),
440
+ default: process.env.IG_GFX_PWD
441
+ },
442
+ docs: {
443
+ type: "boolean",
444
+ default: false,
445
+ description: translate("options.docs.description")
446
+ },
447
+ pushOnly: {
448
+ type: "boolean",
449
+ default: false,
450
+ description: translate("options.pushOnly.description")
451
+ },
452
+ license: {
453
+ type: "string",
454
+ description: translate("options.license.description"),
455
+ default: process.env.IG_GFX_LICENSE
456
+ }
457
+ }), async ({
458
+ directory,
459
+ user,
460
+ password,
461
+ service,
462
+ license,
463
+ ...options
464
+ }) => {
465
+ await preCommandCheck();
466
+ if (!options.noUpload) {
467
+ if (!service) {
468
+ captureError(new Error(translate("options.service.demands", "IG_GFX_ASSET_SERVICE")));
469
+ return;
470
+ }
471
+ if (!license && (!user || !password)) {
472
+ captureError(new Error(`Expected authentication to be provided through either of the following methods:
473
+ - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable
474
+ - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`));
475
+ return;
476
+ }
477
+ if (license && !license.endsWith(".iglic")) {
478
+ captureError(new Error(`Expected the license path to end with the extension .iglic. Received the path "${license}". You may need to reload your environment variables by restarting the program you're using to execute the packager.`));
479
+ return;
480
+ }
481
+ }
482
+ let authentication;
483
+ if (license) {
484
+ const fullLicensePath = path.resolve(process.cwd(), license);
485
+ try {
486
+ const content = fs.readFileSync(fullLicensePath);
487
+ authentication = {
488
+ type: "license",
489
+ license: content.toString("base64")
490
+ };
491
+ } catch (err) {
492
+ if ((err === null || err === void 0 ? void 0 : err.code) === "ENOENT") {
493
+ captureError(new Error(`Expected to find a license file at path: ${fullLicensePath}`));
494
+ return;
495
+ }
496
+ captureError(new Error(`Failed to read license file at path: ${fullLicensePath}`));
497
+ return;
498
+ }
499
+ } else if (user && password) {
500
+ console.log(`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`);
501
+ authentication = {
502
+ type: "credentials",
503
+ username: user,
504
+ password
505
+ };
506
+ }
507
+ const {
508
+ releaseFolder
509
+ } = await import('./commands/release.mjs');
510
+ const prompter = createDefaultPrompter();
511
+ const fullOptions = {
512
+ ...options,
513
+ authentication,
514
+ service: service,
515
+ directory: directory,
516
+ banner: true,
517
+ prompter,
518
+ newVersion: options.newVersion
519
+ };
520
+ await releaseFolder(fullOptions).catch(captureError);
521
+ });
522
+ yargsInstance.command({
523
+ command: "generateIndex [directory]",
524
+ builder: argv => {
525
+ return argv.option("ignore", {
526
+ type: "array",
527
+ default: [],
528
+ description: translate("options.ignore.description")
529
+ });
530
+ },
531
+ handler: async ({
532
+ directory,
533
+ ignore
534
+ }) => {
535
+ await preCommandCheck();
536
+ const {
537
+ extract
538
+ } = await import('./commands/generate.mjs');
539
+ const workspace = detectWorkspace(process.cwd());
540
+ const location = detectPackage(workspace, directory);
541
+ extract(location, ignore);
542
+ }
543
+ });
544
+ yargsInstance.command({
545
+ command: "postinstall",
546
+ builder: argv => argv,
547
+ handler: async () => {
548
+ const {
549
+ executePostInstall
550
+ } = await import('./commands/postinstall.mjs');
551
+ executePostInstall(detectWorkspace(process.cwd()));
552
+ },
553
+ describe: "Runs postinstall tasks"
554
+ });
555
+ yargsInstance.command({
556
+ command: "publishNpm [directory]",
557
+ builder: argv => argv.options({
558
+ newVersion: {
559
+ type: "string",
560
+ description: translate("options.newVersion.description"),
561
+ default: process.env.VERSION,
562
+ required: true
563
+ },
564
+ dryRun: {
565
+ type: "boolean"
566
+ }
567
+ }),
568
+ handler: async ({
569
+ directory,
570
+ newVersion,
571
+ dryRun
572
+ }) => {
573
+ const workspace = detectWorkspace(process.cwd());
574
+ const {
575
+ publishToNpm
576
+ } = await import('./commands/publishNpm.mjs');
577
+ await publishToNpm({
578
+ workspace,
579
+ location: detectPackage(workspace, directory),
580
+ version: newVersion,
581
+ dryRun
582
+ }).catch(captureError);
583
+ },
584
+ describe: "Publishes the package to npm. Requires @intelligentgraphics/ig.tools to be installed"
585
+ });
586
+ yargsInstance.demandCommand().pkgConf("packager").showHelpOnFail(false).version().argv;
587
+
588
+ var cli = /*#__PURE__*/Object.freeze({
589
+ __proto__: null
590
+ });
591
+
592
+ export { detectPackage as a, readPackageNpmManifest as b, readPackageAnimationList as c, detectWorkspace as d, readPackageCreatorIndex as e, readWorkspaceNpmManifest as f, getWorkspaceOutputPath as g, getPackageReleasesDirectory as h, isErrorENOENT as i, readNpmManifest as j, writePackageCreatorIndex as k, getWorkspaceLibPath as l, writePackageNpmManifest as m, iterateWorkspacePackages as n, cli as o, parseCreatorPackageName as p, readPackageCreatorManifest as r, translate as t, writePackageCreatorManifest as w };
593
+ //# sourceMappingURL=cli.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.mjs","sources":["../src/lib/localization.ts","../src/lib/error.ts","../src/lib/npmPackage.ts","../src/lib/package.ts","../src/lib/workspace.ts","../src/lib/prompter.ts","../src/cli.ts"],"sourcesContent":["import y18n from \"y18n\";\nimport * as path from \"path\";\nimport { dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst instance = y18n({\n\tdirectory: path.join(__dirname, \"..\", \"locales\"),\n\tupdateFiles: false,\n\tlocale: \"en\",\n\tfallbackToLanguage: true,\n});\n\nexport const setLocale = (locale: string) => {\n\tinstance.setLocale(locale);\n};\n\nexport const translate = (key: string, ...args: string[]) =>\n\tinstance.__(key, ...args);\n","interface NodeError extends Error {\n\tcode: string;\n}\n\nexport const getNodeErrorCode = (error: unknown) => {\n\tif (\n\t\terror !== null &&\n\t\ttypeof error === \"object\" &&\n\t\t(error as NodeError).code !== undefined\n\t) {\n\t\treturn (error as NodeError).code;\n\t}\n};\n\n/**\n * Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.\n *\n * @param {unknown} error\n */\nexport const isErrorEACCES = (error: unknown) =>\n\tgetNodeErrorCode(error) === \"EACCES\";\n\n/**\n * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.\n *\n * @param {unknown} error\n */\nexport const isErrorENOENT = (error: unknown) =>\n\tgetNodeErrorCode(error) === \"ENOENT\";\n","import * as fs from \"fs\";\nimport * as path from \"path\";\nimport writePkg from \"write-pkg\";\n\nimport { PackageJSON } from \"./packageJSON\";\n\nexport const readNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n): T => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\tconst packageJson = fs.readFileSync(packageJsonPath, {\n\t\tencoding: \"utf8\",\n\t});\n\treturn JSON.parse(packageJson);\n};\n\nexport const writeNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n\tpackageJson: T,\n) => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\twritePkg.sync(packageJsonPath, packageJson);\n};\n","// Functionality related to working with a single package.\n\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport { isErrorENOENT } from \"./error\";\nimport { WorkspaceLocation } from \"./workspace\";\nimport { readNpmManifest, writeNpmManifest } from \"./npmPackage\";\nimport { PackageJSON } from \"./packageJSON\";\n\nconst PACKAGE_FILE = \"_Package.json\";\nconst INDEX_FILE = \"_Index.json\";\nconst ANIMATION_FILE = \".animation.json\";\n\n/**\n * Describes the location of a single package.\n *\n * @export\n * @interface PackageLocation\n */\nexport interface PackageLocation {\n\t_kind: \"PackageLocation\";\n\t/**\n\t * Main directory of a package\n\t *\n\t * @type {string}\n\t */\n\tpath: string;\n\t/**\n\t * Directory containing the typescript files\n\t *\n\t * @type {string}\n\t */\n\tscriptsDir: string;\n\t/**\n\t * Diretory containing the _Package.json, _Index.json, package.json and animation.json files\n\t *\n\t * @type {string}\n\t */\n\tmanifestDir: string;\n}\n\nexport interface CreatorPackage {\n\tScope: string;\n\tPackage: string;\n\tRunTime: boolean;\n\tType: \"Interactor\" | \"Mixed\" | \"Core\" | \"Context\" | \"Evaluator\";\n}\n\nexport const parseCreatorPackageName = (manifest: CreatorPackage) => {\n\tconst [domain, ...subdomainParts] = manifest.Package.split(\".\");\n\treturn {\n\t\tdomain,\n\t\tsubdomain: subdomainParts.join(\".\"),\n\t};\n};\n\nexport interface PackageNpmManifest extends PackageJSON {\n\tig?: {\n\t\tscriptingLibrary?: boolean;\n\t};\n}\n\n/**\n * Detects the package at the given directory.\n *\n * @param {string} directory\n * @returns {PackageLocation}\n */\nexport const detectPackage = (\n\tworkspace: WorkspaceLocation,\n\tdirectory: string,\n): PackageLocation => {\n\tdirectory = path.resolve(workspace.path, directory);\n\n\tconst scriptsPath = path.join(directory, \"Scripts\");\n\tconst tsPath = path.join(directory, \"ts\");\n\n\tlet location: PackageLocation;\n\n\tif (fs.existsSync(scriptsPath)) {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: scriptsPath,\n\t\t\tmanifestDir: scriptsPath,\n\t\t};\n\t} else if (fs.existsSync(tsPath)) {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: tsPath,\n\t\t\tmanifestDir: directory,\n\t\t};\n\t} else {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: directory,\n\t\t\tmanifestDir: directory,\n\t\t};\n\t}\n\n\tif (readPackageCreatorManifest(location) === undefined) {\n\t\tthrow new Error(`No _Package.json found in ${location.manifestDir}`);\n\t}\n\n\treturn location;\n};\n\nexport const readPackageCreatorManifest = (\n\tlocation: PackageLocation,\n): CreatorPackage => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tconst packageJson = fs.readFileSync(packageJsonPath, { encoding: \"utf8\" });\n\tconst result: Omit<CreatorPackage, \"Scope\"> & { Scope?: string } =\n\t\tJSON.parse(packageJson);\n\treturn {\n\t\t...result,\n\t\tScope: result.Scope || result.Package,\n\t};\n};\n\nexport const writePackageCreatorManifest = (\n\tlocation: PackageLocation,\n\tcreatorPackage: CreatorPackage,\n) => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tfs.writeFileSync(\n\t\tpackageJsonPath,\n\t\tJSON.stringify(creatorPackage, null, \"\\t\") + \"\\n\",\n\t);\n};\n\nexport const readPackageCreatorIndex = (\n\tlocation: PackageLocation,\n): object | undefined => {\n\ttry {\n\t\tconst indexPath = path.join(location.manifestDir, INDEX_FILE);\n\t\tconst index = fs.readFileSync(indexPath, { encoding: \"utf8\" });\n\t\treturn JSON.parse(index);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writePackageCreatorIndex = (\n\tlocation: PackageLocation,\n\tindex: object,\n) => {\n\tconst packageJsonPath = path.join(location.manifestDir, INDEX_FILE);\n\tfs.writeFileSync(packageJsonPath, JSON.stringify(index, null, \"\\t\") + \"\\n\");\n};\n\nexport const readPackageNpmManifest = (\n\tlocation: PackageLocation,\n): PackageNpmManifest | undefined => {\n\ttry {\n\t\treturn readNpmManifest(location.manifestDir);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writePackageNpmManifest = (\n\tlocation: PackageLocation,\n\tpackageJson: PackageNpmManifest,\n) => {\n\twriteNpmManifest(location.manifestDir, packageJson);\n};\n\nexport const readPackageAnimationList = (location: PackageLocation) => {\n\tconst directoryContent = fs.readdirSync(location.manifestDir);\n\tconst animationPathList: string[] = [];\n\n\tfor (const entry of directoryContent) {\n\t\tif (entry.endsWith(ANIMATION_FILE)) {\n\t\t\tconst animationPath = path.join(location.manifestDir, entry);\n\t\t\tanimationPathList.push(animationPath);\n\t\t}\n\t}\n\n\treturn animationPathList;\n};\n\nexport const getPackageReleasesDirectory = (location: PackageLocation) =>\n\tpath.join(location.path, \"Releases\");\n\nexport const arePackageLocationsEqual = (\n\ta: PackageLocation,\n\tb: PackageLocation,\n) => a.path === b.path;\n","// Functionality related to working with a workspace consisting of multiple packages.\n\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport { PackageJSON } from \"./packageJSON\";\nimport { isErrorENOENT } from \"./error\";\nimport { readNpmManifest, writeNpmManifest } from \"./npmPackage\";\nimport { detectPackage } from \"./package\";\n\n/**\n * Describe the location of a workspace constining of n packages.\n *\n * @export\n * @interface WorkspaceLocation\n */\nexport interface WorkspaceLocation {\n\t_kind: \"WorkspaceLocation\";\n\tpath: string;\n}\n\nexport interface WorkspacePackageJSON extends PackageJSON {\n\tpackager?: { banner?: string };\n}\n\nexport const detectWorkspace = (directory: string): WorkspaceLocation => {\n\tdirectory = path.resolve(process.cwd(), directory);\n\treturn {\n\t\t_kind: \"WorkspaceLocation\",\n\t\tpath: directory,\n\t};\n};\n\nexport const readWorkspaceNpmManifest = (\n\tworkspace: WorkspaceLocation,\n): WorkspacePackageJSON | undefined => {\n\ttry {\n\t\treturn readNpmManifest<WorkspacePackageJSON>(workspace.path);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writeWorkspaceNpmManifest = <T extends WorkspacePackageJSON>(\n\tworkspace: WorkspaceLocation,\n\tpackageJson: T,\n) => writeNpmManifest(workspace.path, packageJson);\n\nexport const getWorkspaceOutputPath = (workspace: WorkspaceLocation) =>\n\tpath.join(workspace.path, \"bin\");\n\nexport const getWorkspaceLibPath = (workspace: WorkspaceLocation) =>\n\tpath.join(workspace.path, \"lib\");\n\nexport function* iterateWorkspacePackages(workspace: WorkspaceLocation) {\n\tconst entries = fs.readdirSync(workspace.path, { withFileTypes: true });\n\n\tfor (const entry of entries) {\n\t\tif (!entry.isDirectory()) {\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tyield detectPackage(workspace, entry.name);\n\t\t} catch {}\n\t}\n}\n","import inquirer from \"inquirer\";\n\nexport interface PrompterQuestion {\n\tmessage: string;\n\toptions: string[];\n\tdefault?: string;\n}\n\nexport interface Prompter {\n\tconfirm(message: string): Promise<boolean>;\n\n\task(question: PrompterQuestion): Promise<string>;\n}\n\nexport const createDefaultPrompter = (): Prompter => {\n\treturn {\n\t\tconfirm: async (message) => {\n\t\t\tconst { confirm } = await inquirer.prompt([\n\t\t\t\t{\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tmessage,\n\t\t\t\t\tname: \"confirm\",\n\t\t\t\t},\n\t\t\t]);\n\t\t\treturn confirm as boolean;\n\t\t},\n\n\t\task: async (question) => {\n\t\t\tconst { answer } = await inquirer.prompt([\n\t\t\t\t{\n\t\t\t\t\ttype: \"list\",\n\t\t\t\t\tmessage: question.message,\n\t\t\t\t\tname: \"answer\",\n\t\t\t\t\tchoices: question.options,\n\t\t\t\t\tdefault: question.default,\n\t\t\t\t},\n\t\t\t]);\n\t\t\treturn answer as string;\n\t\t},\n\t};\n};\n","import updateNotifier from \"update-notifier\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport yargs from \"yargs/yargs\";\nimport * as yargsTypes from \"yargs\";\nimport { fileURLToPath } from \"url\";\n\nimport { translate } from \"./lib/localization\";\nimport { Authentication } from \"./lib/authentication\";\nimport { detectPackage } from \"./lib/package\";\nimport {\n\tdetectWorkspace,\n\treadWorkspaceNpmManifest,\n\twriteWorkspaceNpmManifest,\n} from \"./lib/workspace\";\nimport type { ReleaseFolderOptions } from \"./commands/release\";\nimport { createDefaultPrompter } from \"./lib/prompter\";\n\nimport pjson from \"../package.json\";\n\nconst __filename = fileURLToPath(import.meta.url);\n\nconst captureError = (err: Error) => {\n\tconsole.log(\"\");\n\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconsole.error(err);\n\t} else {\n\t\tconsole.error(translate(\"messages.error\", err.message));\n\t}\n};\n\nconst buildOptions = {\n\toutDir: {\n\t\tdescription: translate(\"options.outDir.description\"),\n\t\ttype: \"string\",\n\t\tdefault: \"bin\",\n\t\tcoerce: (input: string | undefined | null) =>\n\t\t\tinput === undefined || input === null\n\t\t\t\t? undefined\n\t\t\t\t: path.resolve(process.cwd(), input),\n\t},\n\tminimize: {\n\t\tdescription: translate(\"options.minimize.description\"),\n\t\ttype: \"boolean\",\n\t\tdefault: true,\n\t},\n\tcwd: {\n\t\tdescription: translate(\"options.cwd.description\"),\n\t\ttype: \"string\",\n\t\tdefault: process.cwd(),\n\t},\n\tclean: {\n\t\tdescription: translate(\"options.clean.description\"),\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t},\n\tdocs: {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t},\n} as const;\n\nconst preCommandCheck = async () => {\n\tconst executedLocalPackager =\n\t\tpath.relative(process.cwd(), __filename).indexOf(\"..\") === -1;\n\n\tlet repositoryPackage:\n\t\t| {\n\t\t\t\tdependencies?: Record<string, string>;\n\t\t\t\tdevDependencies?: Record<string, string>;\n\t\t }\n\t\t| undefined;\n\n\ttry {\n\t\tconst repositoryPackageJson = fs.readFileSync(\n\t\t\tpath.resolve(process.cwd(), \"package.json\"),\n\t\t\t\"utf8\",\n\t\t);\n\n\t\trepositoryPackage = JSON.parse(repositoryPackageJson);\n\t} catch (err) {}\n\n\tif (\n\t\trepositoryPackage?.dependencies?.[\n\t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t\t] ||\n\t\trepositoryPackage?.devDependencies?.[\n\t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t\t]\n\t) {\n\t\tconst parts = [\"Detected locally installed ig.gfx.packager.\"];\n\n\t\tif (executedLocalPackager) {\n\t\t\tparts.push(\n\t\t\t\t'Run \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.',\n\t\t\t);\n\t\t}\n\t\tparts.push(\n\t\t\t'Run \"npm uninstall @intelligentgraphics/ig.gfx.packager\" to remove the local version.',\n\t\t);\n\n\t\tconsole.error(parts.join(\"\\n\"));\n\t\tprocess.exit(1);\n\t}\n\n\tif (executedLocalPackager) {\n\t\tconsole.error(`Detected locally installed ig.gfx.packager.\nRun \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.\nRun \"npm install\" to get rid of the local packager version.`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst notifier = updateNotifier({\n\t\tpkg: pjson,\n\t\tshouldNotifyInNpmScript: true,\n\t\tupdateCheckInterval: 1000 * 60,\n\t});\n\n\tnotifier.notify({\n\t\tisGlobal: true,\n\t\tdefer: true,\n\t});\n\n\tconst workspaceLocation = detectWorkspace(process.cwd());\n\n\tconst packageJson = readWorkspaceNpmManifest(workspaceLocation);\n\n\tif (packageJson === undefined) {\n\t\tthrow new Error(\n\t\t\t\"Could not load package.json file in current directory\",\n\t\t);\n\t}\n\n\tpackageJson.scripts ??= {};\n\tpackageJson.scripts.postinstall = \"packager postinstall\";\n\n\twriteWorkspaceNpmManifest(workspaceLocation, packageJson);\n};\n\nconst yargsInstance = yargs(process.argv.slice(2));\n\nyargsInstance.command(\n\t\"build [directories...]\",\n\t\"Builds the specified directories\",\n\t(argv) => argv.options(buildOptions),\n\tasync ({ directories = [], ...options }) => {\n\t\tawait preCommandCheck();\n\n\t\tconst { buildFolders } = await import(\"./commands/build\");\n\n\t\tawait buildFolders({\n\t\t\t...options,\n\t\t\tdirectories: directories as string[],\n\t\t}).catch(captureError);\n\t},\n);\n\nyargsInstance.command(\n\t\"publish [directory]\",\n\t\"Publishes the specified directory\",\n\t(argv) =>\n\t\targv.options({\n\t\t\t...buildOptions,\n\t\t\tnoUpload: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.noUpload.description\"),\n\t\t\t},\n\t\t\tdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.domain.description\"),\n\t\t\t},\n\t\t\tsubdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.subdomain.description\"),\n\t\t\t},\n\t\t\tnewVersion: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.newVersion.description\"),\n\t\t\t\tdefault: process.env.VERSION,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\taddress: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.address.description\"),\n\t\t\t\tdefault: \"localhost\",\n\t\t\t},\n\t\t\tservice: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.service.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_ASSET_SERVICE,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\tuser: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.user.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_USER,\n\t\t\t},\n\t\t\tpassword: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.password.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_PWD,\n\t\t\t},\n\t\t\tdocs: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.docs.description\"),\n\t\t\t},\n\t\t\tpushOnly: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.pushOnly.description\"),\n\t\t\t},\n\t\t\tlicense: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.license.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_LICENSE,\n\t\t\t},\n\t\t}),\n\tasync ({ directory, user, password, service, license, ...options }) => {\n\t\tawait preCommandCheck();\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!service) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\ttranslate(\n\t\t\t\t\t\t\t\"options.service.demands\",\n\t\t\t\t\t\t\t\"IG_GFX_ASSET_SERVICE\",\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!license && (!user || !password)) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected authentication to be provided through either of the following methods:\n\t - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable\n\t - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (license && !license.endsWith(\".iglic\")) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected the license path to end with the extension .iglic. Received the path \"${license}\". You may need to reload your environment variables by restarting the program you're using to execute the packager.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlet authentication: Authentication | undefined;\n\n\t\tif (license) {\n\t\t\tconst fullLicensePath = path.resolve(process.cwd(), license);\n\t\t\ttry {\n\t\t\t\tconst content = fs.readFileSync(fullLicensePath);\n\t\t\t\tauthentication = {\n\t\t\t\t\ttype: \"license\",\n\t\t\t\t\tlicense: content.toString(\"base64\"),\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tif (err?.code === \"ENOENT\") {\n\t\t\t\t\tcaptureError(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Expected to find a license file at path: ${fullLicensePath}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Failed to read license file at path: ${fullLicensePath}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (user && password) {\n\t\t\tconsole.log(\n\t\t\t\t`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`,\n\t\t\t);\n\t\t\tauthentication = {\n\t\t\t\ttype: \"credentials\",\n\t\t\t\tusername: user,\n\t\t\t\tpassword,\n\t\t\t};\n\t\t}\n\n\t\tconst { releaseFolder } = await import(\"./commands/release\");\n\n\t\tconst prompter = createDefaultPrompter();\n\n\t\tconst fullOptions: ReleaseFolderOptions = {\n\t\t\t...options,\n\t\t\tauthentication,\n\t\t\tservice: service!,\n\t\t\tdirectory: directory as string,\n\t\t\tbanner: true,\n\t\t\tprompter,\n\t\t\tnewVersion: options.newVersion!,\n\t\t};\n\n\t\tawait releaseFolder(fullOptions).catch(captureError);\n\t},\n);\n\nyargsInstance.command({\n\tcommand: \"generateIndex [directory]\",\n\tbuilder: (argv) => {\n\t\treturn argv.option(\"ignore\", {\n\t\t\ttype: \"array\",\n\t\t\tdefault: [],\n\t\t\tdescription: translate(\"options.ignore.description\"),\n\t\t});\n\t},\n\thandler: async ({ directory, ignore }) => {\n\t\tawait preCommandCheck();\n\n\t\tconst { extract } = await import(\"./commands/generate\");\n\n\t\tconst workspace = detectWorkspace(process.cwd());\n\t\tconst location = detectPackage(workspace, directory as string);\n\n\t\textract(location, ignore as string[]);\n\t},\n});\n\nyargsInstance.command({\n\tcommand: \"postinstall\",\n\tbuilder: (argv) => argv,\n\thandler: async () => {\n\t\tconst { executePostInstall } = await import(\"./commands/postinstall\");\n\n\t\texecutePostInstall(detectWorkspace(process.cwd()));\n\t},\n\tdescribe: \"Runs postinstall tasks\",\n});\n\nyargsInstance.command({\n\tcommand: \"publishNpm [directory]\",\n\tbuilder: (argv) =>\n\t\targv.options({\n\t\t\tnewVersion: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.newVersion.description\"),\n\t\t\t\tdefault: process.env.VERSION,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\tdryRun: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t}),\n\thandler: async ({ directory, newVersion, dryRun }) => {\n\t\tconst workspace = detectWorkspace(process.cwd());\n\n\t\tconst { publishToNpm } = await import(\"./commands/publishNpm\");\n\n\t\tawait publishToNpm({\n\t\t\tworkspace,\n\t\t\tlocation: detectPackage(workspace, directory as string),\n\t\t\tversion: newVersion,\n\t\t\tdryRun,\n\t\t}).catch(captureError);\n\t},\n\tdescribe:\n\t\t\"Publishes the package to npm. Requires @intelligentgraphics/ig.tools to be installed\",\n});\n\nyargsInstance\n\t.demandCommand()\n\t.pkgConf(\"packager\")\n\t.showHelpOnFail(false)\n\t.version().argv;\n"],"names":["__dirname","dirname","fileURLToPath","import","meta","url","instance","y18n","directory","path","join","updateFiles","locale","fallbackToLanguage","translate","key","args","__","getNodeErrorCode","error","code","undefined","isErrorENOENT","readNpmManifest","packageJsonPath","packageJson","fs","readFileSync","encoding","JSON","parse","writeNpmManifest","writePkg","sync","PACKAGE_FILE","INDEX_FILE","ANIMATION_FILE","parseCreatorPackageName","manifest","domain","subdomainParts","Package","split","subdomain","detectPackage","workspace","resolve","scriptsPath","tsPath","location","existsSync","_kind","scriptsDir","manifestDir","readPackageCreatorManifest","Error","result","Scope","writePackageCreatorManifest","creatorPackage","writeFileSync","stringify","readPackageCreatorIndex","indexPath","index","err","writePackageCreatorIndex","readPackageNpmManifest","writePackageNpmManifest","readPackageAnimationList","directoryContent","readdirSync","animationPathList","entry","endsWith","animationPath","push","getPackageReleasesDirectory","detectWorkspace","process","cwd","readWorkspaceNpmManifest","writeWorkspaceNpmManifest","getWorkspaceOutputPath","getWorkspaceLibPath","iterateWorkspacePackages","entries","withFileTypes","isDirectory","name","createDefaultPrompter","confirm","message","inquirer","prompt","type","ask","question","answer","choices","options","default","__filename","captureError","console","log","env","NODE_ENV","buildOptions","outDir","description","coerce","input","minimize","clean","docs","preCommandCheck","executedLocalPackager","relative","indexOf","repositoryPackage","repositoryPackageJson","dependencies","devDependencies","parts","exit","notifier","updateNotifier","pkg","pjson","shouldNotifyInNpmScript","updateCheckInterval","notify","isGlobal","defer","workspaceLocation","scripts","postinstall","yargsInstance","yargs","argv","slice","command","directories","buildFolders","catch","noUpload","newVersion","VERSION","required","address","service","IG_GFX_ASSET_SERVICE","user","IG_GFX_USER","password","IG_GFX_PWD","pushOnly","license","IG_GFX_LICENSE","authentication","fullLicensePath","content","toString","username","releaseFolder","prompter","fullOptions","banner","builder","option","handler","ignore","extract","executePostInstall","describe","dryRun","publishToNpm","version","demandCommand","pkgConf","showHelpOnFail"],"mappings":";;;;;;;;;;;AAKA,MAAMA,SAAS,GAAGC,OAAO,CAACC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAA;AAEzD,MAAMC,QAAQ,GAAGC,IAAI,CAAC;EACrBC,SAAS,EAAEC,IAAI,CAACC,IAAI,CAACV,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC;AAChDW,EAA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