@intelligentgraphics/ig.gfx.packager 3.0.0-alpha.9 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.mjs +48 -41
- package/build/cli.mjs.map +1 -1
- package/build/{index2.mjs → commands/build.mjs} +3 -3
- package/build/commands/build.mjs.map +1 -0
- package/build/{generate.mjs → commands/generate.ts.mjs} +7 -7
- package/build/commands/generate.ts.mjs.map +1 -0
- package/build/{postinstall.mjs → commands/postinstall.ts.mjs} +3 -3
- package/build/commands/postinstall.ts.mjs.map +1 -0
- package/build/{index3.mjs → commands/publish.mjs} +11 -11
- package/build/commands/publish.mjs.map +1 -0
- package/build/{publishNpm.mjs → commands/publishNpm.ts.mjs} +5 -5
- package/build/commands/publishNpm.ts.mjs.map +1 -0
- package/build/dependencies.mjs +19 -10
- package/build/dependencies.mjs.map +1 -1
- package/build/index.mjs.map +1 -1
- package/build/scripts.mjs.map +1 -1
- package/build/versionFile.mjs +10 -10
- package/build/versionFile.mjs.map +1 -1
- package/locales/de.json +18 -18
- package/locales/en.json +37 -37
- package/package.json +2 -2
- package/readme.md +24 -2
- package/scripts/postinstall.js +22 -22
- package/build/generate.mjs.map +0 -1
- package/build/index2.mjs.map +0 -1
- package/build/index3.mjs.map +0 -1
- package/build/postinstall.mjs.map +0 -1
- package/build/publishNpm.mjs.map +0 -1
package/build/cli.mjs
CHANGED
|
@@ -24,18 +24,27 @@ const getNodeErrorCode = error => {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
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
|
|
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
31
|
*/
|
|
32
32
|
const isErrorENOENT = error => getNodeErrorCode(error) === "ENOENT";
|
|
33
33
|
|
|
34
|
+
const stripUtf8Bom = text => {
|
|
35
|
+
// Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
|
|
36
|
+
// conversion translates it to FEFF (UTF-16 BOM).
|
|
37
|
+
if (text.charCodeAt(0) === 0xfeff) {
|
|
38
|
+
return text.slice(1);
|
|
39
|
+
}
|
|
40
|
+
return text;
|
|
41
|
+
};
|
|
42
|
+
|
|
34
43
|
const readNpmManifest = directory => {
|
|
35
44
|
const packageJsonPath = path.join(directory, "package.json");
|
|
36
|
-
const packageJson = fs.readFileSync(packageJsonPath, {
|
|
45
|
+
const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, {
|
|
37
46
|
encoding: "utf8"
|
|
38
|
-
});
|
|
47
|
+
}));
|
|
39
48
|
return JSON.parse(packageJson);
|
|
40
49
|
};
|
|
41
50
|
const writeNpmManifest = (directory, packageJson) => {
|
|
@@ -48,11 +57,11 @@ const PACKAGE_FILE = "_Package.json";
|
|
|
48
57
|
const INDEX_FILE = "_Index.json";
|
|
49
58
|
const ANIMATION_FILE_SUFFIX = ".animation.json";
|
|
50
59
|
|
|
51
|
-
/**
|
|
52
|
-
* Describes the location of a single package.
|
|
53
|
-
*
|
|
54
|
-
* @export
|
|
55
|
-
* @interface PackageLocation
|
|
60
|
+
/**
|
|
61
|
+
* Describes the location of a single package.
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
* @interface PackageLocation
|
|
56
65
|
*/
|
|
57
66
|
|
|
58
67
|
const parseCreatorPackageName = manifest => {
|
|
@@ -62,11 +71,11 @@ const parseCreatorPackageName = manifest => {
|
|
|
62
71
|
subdomain: subdomainParts.join(".")
|
|
63
72
|
};
|
|
64
73
|
};
|
|
65
|
-
/**
|
|
66
|
-
* Detects the package at the given directory.
|
|
67
|
-
*
|
|
68
|
-
* @param {string} directory
|
|
69
|
-
* @returns {PackageLocation}
|
|
74
|
+
/**
|
|
75
|
+
* Detects the package at the given directory.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} directory
|
|
78
|
+
* @returns {PackageLocation}
|
|
70
79
|
*/
|
|
71
80
|
const detectPackage = (workspace, directory) => {
|
|
72
81
|
directory = path.resolve(workspace.path, directory);
|
|
@@ -107,9 +116,9 @@ const detectPackage = (workspace, directory) => {
|
|
|
107
116
|
};
|
|
108
117
|
const readPackageCreatorManifest = location => {
|
|
109
118
|
const packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);
|
|
110
|
-
const packageJson = fs.readFileSync(packageJsonPath, {
|
|
119
|
+
const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, {
|
|
111
120
|
encoding: "utf8"
|
|
112
|
-
});
|
|
121
|
+
}));
|
|
113
122
|
const result = JSON.parse(packageJson);
|
|
114
123
|
return {
|
|
115
124
|
...result,
|
|
@@ -123,9 +132,9 @@ const writePackageCreatorManifest = (location, creatorPackage) => {
|
|
|
123
132
|
const readPackageCreatorIndex = location => {
|
|
124
133
|
try {
|
|
125
134
|
const indexPath = path.join(location.manifestDir, INDEX_FILE);
|
|
126
|
-
const index = fs.readFileSync(indexPath, {
|
|
135
|
+
const index = stripUtf8Bom(fs.readFileSync(indexPath, {
|
|
127
136
|
encoding: "utf8"
|
|
128
|
-
});
|
|
137
|
+
}));
|
|
129
138
|
return JSON.parse(index);
|
|
130
139
|
} catch (err) {
|
|
131
140
|
if (isErrorENOENT(err)) {
|
|
@@ -166,11 +175,11 @@ const getPackageReleasesDirectory = location => path.join(location.path, "Releas
|
|
|
166
175
|
|
|
167
176
|
// Functionality related to working with a workspace consisting of multiple packages.
|
|
168
177
|
|
|
169
|
-
/**
|
|
170
|
-
* Describe the location of a workspace constining of n packages.
|
|
171
|
-
*
|
|
172
|
-
* @export
|
|
173
|
-
* @interface WorkspaceLocation
|
|
178
|
+
/**
|
|
179
|
+
* Describe the location of a workspace constining of n packages.
|
|
180
|
+
*
|
|
181
|
+
* @export
|
|
182
|
+
* @interface WorkspaceLocation
|
|
174
183
|
*/
|
|
175
184
|
|
|
176
185
|
const detectWorkspace = directory => {
|
|
@@ -235,8 +244,8 @@ const createDefaultPrompter = () => {
|
|
|
235
244
|
};
|
|
236
245
|
|
|
237
246
|
var name = "@intelligentgraphics/ig.gfx.packager";
|
|
238
|
-
var version = "3.0.0-
|
|
239
|
-
var description = "IG.GFX.Packager 3.0.0
|
|
247
|
+
var version = "3.0.0-beta.0";
|
|
248
|
+
var description = "IG.GFX.Packager 3.0.0 Beta 0 (3.0.0.11)";
|
|
240
249
|
var author = "Michael Beier <mb@intelligentgraphics.biz>";
|
|
241
250
|
var main = "build/index.mjs";
|
|
242
251
|
var type = "module";
|
|
@@ -353,9 +362,9 @@ const preCommandCheck = async () => {
|
|
|
353
362
|
var _repositoryPackage, _repositoryPackage$de, _repositoryPackage2, _repositoryPackage2$d;
|
|
354
363
|
const executedLocalPackager = path.relative(process.cwd(), __filename).indexOf("..") === -1;
|
|
355
364
|
let repositoryPackage;
|
|
365
|
+
const workspaceLocation = detectWorkspace(process.cwd());
|
|
356
366
|
try {
|
|
357
|
-
|
|
358
|
-
repositoryPackage = JSON.parse(repositoryPackageJson);
|
|
367
|
+
repositoryPackage = readWorkspaceNpmManifest(workspaceLocation);
|
|
359
368
|
} catch (err) {}
|
|
360
369
|
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"]) {
|
|
361
370
|
const parts = ["Detected locally installed ig.gfx.packager."];
|
|
@@ -381,14 +390,12 @@ Run "npm install" to get rid of the local packager version.`);
|
|
|
381
390
|
isGlobal: true,
|
|
382
391
|
defer: true
|
|
383
392
|
});
|
|
384
|
-
|
|
385
|
-
const packageJson = readWorkspaceNpmManifest(workspaceLocation);
|
|
386
|
-
if (packageJson === undefined) {
|
|
393
|
+
if (repositoryPackage === undefined) {
|
|
387
394
|
throw new Error("Could not load package.json file in current directory");
|
|
388
395
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
writeWorkspaceNpmManifest(workspaceLocation,
|
|
396
|
+
repositoryPackage.scripts ??= {};
|
|
397
|
+
repositoryPackage.scripts.postinstall = "packager postinstall";
|
|
398
|
+
writeWorkspaceNpmManifest(workspaceLocation, repositoryPackage);
|
|
392
399
|
};
|
|
393
400
|
const yargsInstance = yargs(process.argv.slice(2));
|
|
394
401
|
yargsInstance.command("build [directories...]", "Builds the specified directories", argv => argv.options(buildOptions), async ({
|
|
@@ -398,7 +405,7 @@ yargsInstance.command("build [directories...]", "Builds the specified directorie
|
|
|
398
405
|
await preCommandCheck();
|
|
399
406
|
const {
|
|
400
407
|
buildFolders
|
|
401
|
-
} = await import('./
|
|
408
|
+
} = await import('./commands/build.mjs').then(function (n) { return n.i; });
|
|
402
409
|
await buildFolders({
|
|
403
410
|
...options,
|
|
404
411
|
directories: directories
|
|
@@ -513,7 +520,7 @@ yargsInstance.command("publish [directory]", "Publishes the specified directory"
|
|
|
513
520
|
}
|
|
514
521
|
const {
|
|
515
522
|
releaseFolder
|
|
516
|
-
} = await import('./
|
|
523
|
+
} = await import('./commands/publish.mjs');
|
|
517
524
|
const prompter = createDefaultPrompter();
|
|
518
525
|
const fullOptions = {
|
|
519
526
|
...options,
|
|
@@ -542,7 +549,7 @@ yargsInstance.command({
|
|
|
542
549
|
await preCommandCheck();
|
|
543
550
|
const {
|
|
544
551
|
extract
|
|
545
|
-
} = await import('./generate.mjs');
|
|
552
|
+
} = await import('./commands/generate.ts.mjs');
|
|
546
553
|
const workspace = detectWorkspace(process.cwd());
|
|
547
554
|
const location = detectPackage(workspace, directory);
|
|
548
555
|
extract(location, ignore);
|
|
@@ -554,7 +561,7 @@ yargsInstance.command({
|
|
|
554
561
|
handler: async () => {
|
|
555
562
|
const {
|
|
556
563
|
executePostInstall
|
|
557
|
-
} = await import('./postinstall.mjs');
|
|
564
|
+
} = await import('./commands/postinstall.ts.mjs');
|
|
558
565
|
executePostInstall(detectWorkspace(process.cwd()));
|
|
559
566
|
},
|
|
560
567
|
describe: "Runs postinstall tasks"
|
|
@@ -580,7 +587,7 @@ yargsInstance.command({
|
|
|
580
587
|
const workspace = detectWorkspace(process.cwd());
|
|
581
588
|
const {
|
|
582
589
|
publishToNpm
|
|
583
|
-
} = await import('./publishNpm.mjs');
|
|
590
|
+
} = await import('./commands/publishNpm.ts.mjs');
|
|
584
591
|
await publishToNpm({
|
|
585
592
|
workspace,
|
|
586
593
|
location: detectPackage(workspace, directory),
|
|
@@ -596,5 +603,5 @@ var cli = /*#__PURE__*/Object.freeze({
|
|
|
596
603
|
__proto__: null
|
|
597
604
|
});
|
|
598
605
|
|
|
599
|
-
export { INDEX_FILE as I, PACKAGE_FILE as P, 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 };
|
|
606
|
+
export { INDEX_FILE as I, PACKAGE_FILE as P, 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, stripUtf8Bom as s, translate as t, writePackageCreatorManifest as w };
|
|
600
607
|
//# sourceMappingURL=cli.mjs.map
|
package/build/cli.mjs.map
CHANGED
|
@@ -1 +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\";\r\nimport * as path from \"path\";\r\nimport { dirname } from \"path\";\r\nimport { fileURLToPath } from \"url\";\r\n\r\nconst __dirname = dirname(fileURLToPath(import.meta.url));\r\n\r\nconst instance = y18n({\r\n\tdirectory: path.join(__dirname, \"..\", \"locales\"),\r\n\tupdateFiles: false,\r\n\tlocale: \"en\",\r\n\tfallbackToLanguage: true,\r\n});\r\n\r\nexport const setLocale = (locale: string) => {\r\n\tinstance.setLocale(locale);\r\n};\r\n\r\nexport const translate = (key: string, ...args: string[]) =>\r\n\tinstance.__(key, ...args);\r\n","interface NodeError extends Error {\r\n\tcode: string;\r\n}\r\n\r\nexport const getNodeErrorCode = (error: unknown) => {\r\n\tif (\r\n\t\terror !== null &&\r\n\t\ttypeof error === \"object\" &&\r\n\t\t(error as NodeError).code !== undefined\r\n\t) {\r\n\t\treturn (error as NodeError).code;\r\n\t}\r\n};\r\n\r\n/**\r\n * Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.\r\n *\r\n * @param {unknown} error\r\n */\r\nexport const isErrorEACCES = (error: unknown) =>\r\n\tgetNodeErrorCode(error) === \"EACCES\";\r\n\r\n/**\r\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.\r\n *\r\n * @param {unknown} error\r\n */\r\nexport const isErrorENOENT = (error: unknown) =>\r\n\tgetNodeErrorCode(error) === \"ENOENT\";\r\n","import * as fs from \"fs\";\r\nimport * as path from \"path\";\r\nimport { writePackageSync } from \"write-pkg\";\r\n\r\nimport { PackageJSON } from \"./packageJSON\";\r\n\r\nexport const readNpmManifest = <T extends PackageJSON>(\r\n\tdirectory: string,\r\n): T => {\r\n\tconst packageJsonPath = path.join(directory, \"package.json\");\r\n\tconst packageJson = fs.readFileSync(packageJsonPath, {\r\n\t\tencoding: \"utf8\",\r\n\t});\r\n\treturn JSON.parse(packageJson);\r\n};\r\n\r\nexport const writeNpmManifest = <T extends PackageJSON>(\r\n\tdirectory: string,\r\n\tpackageJson: T,\r\n) => {\r\n\tconst packageJsonPath = path.join(directory, \"package.json\");\r\n\twritePackageSync(packageJsonPath, packageJson);\r\n};\r\n","// Functionality related to working with a single package.\r\n\r\nimport * as path from \"path\";\r\nimport * as fs from \"fs\";\r\n\r\nimport { isErrorENOENT } from \"./error\";\r\nimport { WorkspaceLocation } from \"./workspace\";\r\nimport { readNpmManifest, writeNpmManifest } from \"./npmPackage\";\r\nimport { PackageJSON } from \"./packageJSON\";\r\n\r\nexport const PACKAGE_FILE = \"_Package.json\";\r\nexport const INDEX_FILE = \"_Index.json\";\r\nconst ANIMATION_FILE_SUFFIX = \".animation.json\";\r\n\r\n/**\r\n * Describes the location of a single package.\r\n *\r\n * @export\r\n * @interface PackageLocation\r\n */\r\nexport interface PackageLocation {\r\n\t_kind: \"PackageLocation\";\r\n\t/**\r\n\t * Main directory of a package\r\n\t *\r\n\t * @type {string}\r\n\t */\r\n\tpath: string;\r\n\t/**\r\n\t * Directory containing the typescript files\r\n\t *\r\n\t * @type {string}\r\n\t */\r\n\tscriptsDir: string;\r\n\t/**\r\n\t * Diretory containing the _Package.json, _Index.json, package.json and animation.json files\r\n\t *\r\n\t * @type {string}\r\n\t */\r\n\tmanifestDir: string;\r\n}\r\n\r\nexport interface CreatorPackage {\r\n\tScope: string;\r\n\tPackage: string;\r\n\tRunTime: boolean;\r\n\tType: \"Interactor\" | \"Mixed\" | \"Core\" | \"Context\" | \"Evaluator\";\r\n}\r\n\r\nexport type CreatorIndex = CreatorIndexEntry[];\r\n\r\nexport interface CreatorIndexEntry {\r\n\tName: string;\r\n\tDescription?: string;\r\n\tType: \"Interactor\" | \"Evaluator\";\r\n\tParameters: CreatorIndexParameter[];\r\n}\r\n\r\nexport interface CreatorIndexParameter {\r\n\tName: string;\r\n\tType: CreatorIndexParameterType;\r\n\tDescription?: string;\r\n\tDefault?: unknown;\r\n\tDisplayIndex: number;\r\n}\r\n\r\nexport type CreatorIndexParameterType =\r\n\t| \"String\"\r\n\t| \"LengthM\"\r\n\t| \"Material\"\r\n\t| \"Boolean\"\r\n\t| \"Bool\"\r\n\t| \"ArcDEG\"\r\n\t| \"Integer\"\r\n\t| \"Int\"\r\n\t| \"Float\";\r\n\r\nexport const parseCreatorPackageName = (manifest: CreatorPackage) => {\r\n\tconst [domain, ...subdomainParts] = manifest.Package.split(\".\");\r\n\treturn {\r\n\t\tdomain,\r\n\t\tsubdomain: subdomainParts.join(\".\"),\r\n\t};\r\n};\r\n\r\nexport interface PackageNpmManifest extends PackageJSON {\r\n\tig?: {\r\n\t\tscriptingLibrary?: boolean;\r\n\t};\r\n}\r\n\r\n/**\r\n * Detects the package at the given directory.\r\n *\r\n * @param {string} directory\r\n * @returns {PackageLocation}\r\n */\r\nexport const detectPackage = (\r\n\tworkspace: WorkspaceLocation,\r\n\tdirectory: string,\r\n): PackageLocation => {\r\n\tdirectory = path.resolve(workspace.path, directory);\r\n\r\n\tconst scriptsPath = path.join(directory, \"Scripts\");\r\n\tconst tsPath = path.join(directory, \"ts\");\r\n\r\n\tlet location: PackageLocation;\r\n\r\n\tif (fs.existsSync(scriptsPath)) {\r\n\t\tlocation = {\r\n\t\t\t_kind: \"PackageLocation\",\r\n\t\t\tpath: directory,\r\n\t\t\tscriptsDir: scriptsPath,\r\n\t\t\tmanifestDir: scriptsPath,\r\n\t\t};\r\n\t} else if (fs.existsSync(tsPath)) {\r\n\t\tlocation = {\r\n\t\t\t_kind: \"PackageLocation\",\r\n\t\t\tpath: directory,\r\n\t\t\tscriptsDir: tsPath,\r\n\t\t\tmanifestDir: directory,\r\n\t\t};\r\n\t} else {\r\n\t\tlocation = {\r\n\t\t\t_kind: \"PackageLocation\",\r\n\t\t\tpath: directory,\r\n\t\t\tscriptsDir: directory,\r\n\t\t\tmanifestDir: directory,\r\n\t\t};\r\n\t}\r\n\r\n\ttry {\r\n\t\treadPackageCreatorManifest(location);\r\n\t} catch (err) {\r\n\t\tif (isErrorENOENT(err)) {\r\n\t\t\tthrow new Error(\r\n\t\t\t\t`No _Package.json found in ${location.manifestDir}`,\r\n\t\t\t);\r\n\t\t}\r\n\t\tthrow err;\r\n\t}\r\n\r\n\treturn location;\r\n};\r\n\r\nexport const readPackageCreatorManifest = (\r\n\tlocation: PackageLocation,\r\n): CreatorPackage => {\r\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\r\n\tconst packageJson = fs.readFileSync(packageJsonPath, { encoding: \"utf8\" });\r\n\tconst result: Omit<CreatorPackage, \"Scope\"> & { Scope?: string } =\r\n\t\tJSON.parse(packageJson);\r\n\treturn {\r\n\t\t...result,\r\n\t\tScope: result.Scope || result.Package,\r\n\t};\r\n};\r\n\r\nexport const writePackageCreatorManifest = (\r\n\tlocation: PackageLocation,\r\n\tcreatorPackage: CreatorPackage,\r\n) => {\r\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\r\n\tfs.writeFileSync(\r\n\t\tpackageJsonPath,\r\n\t\tJSON.stringify(creatorPackage, null, \"\\t\") + \"\\n\",\r\n\t);\r\n};\r\n\r\nexport const readPackageCreatorIndex = (\r\n\tlocation: PackageLocation,\r\n): CreatorIndex | undefined => {\r\n\ttry {\r\n\t\tconst indexPath = path.join(location.manifestDir, INDEX_FILE);\r\n\t\tconst index = fs.readFileSync(indexPath, { encoding: \"utf8\" });\r\n\t\treturn JSON.parse(index);\r\n\t} catch (err) {\r\n\t\tif (isErrorENOENT(err)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\tthrow err;\r\n\t}\r\n};\r\n\r\nexport const writePackageCreatorIndex = (\r\n\tlocation: PackageLocation,\r\n\tindex: CreatorIndex,\r\n) => {\r\n\tconst packageJsonPath = path.join(location.manifestDir, INDEX_FILE);\r\n\tfs.writeFileSync(packageJsonPath, JSON.stringify(index, null, \"\\t\") + \"\\n\");\r\n};\r\n\r\nexport const readPackageNpmManifest = (\r\n\tlocation: PackageLocation,\r\n): PackageNpmManifest | undefined => {\r\n\ttry {\r\n\t\treturn readNpmManifest(location.manifestDir);\r\n\t} catch (err) {\r\n\t\tif (isErrorENOENT(err)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\tthrow err;\r\n\t}\r\n};\r\n\r\nexport const writePackageNpmManifest = (\r\n\tlocation: PackageLocation,\r\n\tpackageJson: PackageNpmManifest,\r\n) => {\r\n\twriteNpmManifest(location.manifestDir, packageJson);\r\n};\r\n\r\nexport const readPackageAnimationList = (location: PackageLocation) => {\r\n\tconst directoryContent = fs.readdirSync(location.manifestDir);\r\n\tconst animationPathList: string[] = [];\r\n\r\n\tfor (const entry of directoryContent) {\r\n\t\tif (entry.endsWith(ANIMATION_FILE_SUFFIX)) {\r\n\t\t\tconst animationPath = path.join(location.manifestDir, entry);\r\n\t\t\tanimationPathList.push(animationPath);\r\n\t\t}\r\n\t}\r\n\r\n\treturn animationPathList;\r\n};\r\n\r\nexport const getPackageReleasesDirectory = (location: PackageLocation) =>\r\n\tpath.join(location.path, \"Releases\");\r\n\r\nexport const arePackageLocationsEqual = (\r\n\ta: PackageLocation,\r\n\tb: PackageLocation,\r\n) => a.path === b.path;\r\n","// Functionality related to working with a workspace consisting of multiple packages.\r\n\r\nimport * as path from \"path\";\r\nimport * as fs from \"fs\";\r\n\r\nimport { PackageJSON } from \"./packageJSON\";\r\nimport { isErrorENOENT } from \"./error\";\r\nimport { readNpmManifest, writeNpmManifest } from \"./npmPackage\";\r\nimport { detectPackage } from \"./package\";\r\n\r\n/**\r\n * Describe the location of a workspace constining of n packages.\r\n *\r\n * @export\r\n * @interface WorkspaceLocation\r\n */\r\nexport interface WorkspaceLocation {\r\n\t_kind: \"WorkspaceLocation\";\r\n\tpath: string;\r\n}\r\n\r\nexport interface WorkspacePackageJSON extends PackageJSON {\r\n\tpackager?: { banner?: string };\r\n}\r\n\r\nexport const detectWorkspace = (directory: string): WorkspaceLocation => {\r\n\tdirectory = path.resolve(process.cwd(), directory);\r\n\treturn {\r\n\t\t_kind: \"WorkspaceLocation\",\r\n\t\tpath: directory,\r\n\t};\r\n};\r\n\r\nexport const readWorkspaceNpmManifest = (\r\n\tworkspace: WorkspaceLocation,\r\n): WorkspacePackageJSON | undefined => {\r\n\ttry {\r\n\t\treturn readNpmManifest<WorkspacePackageJSON>(workspace.path);\r\n\t} catch (err) {\r\n\t\tif (isErrorENOENT(err)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\tthrow err;\r\n\t}\r\n};\r\n\r\nexport const writeWorkspaceNpmManifest = <T extends WorkspacePackageJSON>(\r\n\tworkspace: WorkspaceLocation,\r\n\tpackageJson: T,\r\n) => writeNpmManifest(workspace.path, packageJson);\r\n\r\nexport const getWorkspaceOutputPath = (workspace: WorkspaceLocation) =>\r\n\tpath.join(workspace.path, \"bin\");\r\n\r\nexport const getWorkspaceLibPath = (workspace: WorkspaceLocation) =>\r\n\tpath.join(workspace.path, \"lib\");\r\n\r\nexport function* iterateWorkspacePackages(workspace: WorkspaceLocation) {\r\n\tconst entries = fs.readdirSync(workspace.path, { withFileTypes: true });\r\n\r\n\tfor (const entry of entries) {\r\n\t\tif (!entry.isDirectory()) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tyield detectPackage(workspace, entry.name);\r\n\t\t} catch {}\r\n\t}\r\n}\r\n","import inquirer from \"inquirer\";\r\n\r\nexport interface PrompterQuestion {\r\n\tmessage: string;\r\n\toptions: string[];\r\n\tdefault?: string;\r\n}\r\n\r\nexport interface Prompter {\r\n\tconfirm(message: string): Promise<boolean>;\r\n\r\n\task(question: PrompterQuestion): Promise<string>;\r\n}\r\n\r\nexport const createDefaultPrompter = (): Prompter => {\r\n\treturn {\r\n\t\tconfirm: async (message) => {\r\n\t\t\tconst { confirm } = await inquirer.prompt([\r\n\t\t\t\t{\r\n\t\t\t\t\ttype: \"confirm\",\r\n\t\t\t\t\tmessage,\r\n\t\t\t\t\tname: \"confirm\",\r\n\t\t\t\t},\r\n\t\t\t]);\r\n\t\t\treturn confirm as boolean;\r\n\t\t},\r\n\r\n\t\task: async (question) => {\r\n\t\t\tconst { answer } = await inquirer.prompt([\r\n\t\t\t\t{\r\n\t\t\t\t\ttype: \"list\",\r\n\t\t\t\t\tmessage: question.message,\r\n\t\t\t\t\tname: \"answer\",\r\n\t\t\t\t\tchoices: question.options,\r\n\t\t\t\t\tdefault: question.default,\r\n\t\t\t\t},\r\n\t\t\t]);\r\n\t\t\treturn answer as string;\r\n\t\t},\r\n\t};\r\n};\r\n","import updateNotifier from \"update-notifier\";\r\nimport * as fs from \"fs\";\r\nimport * as path from \"path\";\r\nimport yargs from \"yargs/yargs\";\r\nimport { fileURLToPath } from \"url\";\r\n\r\nimport { translate } from \"./lib/localization\";\r\nimport { Authentication } from \"./lib/authentication\";\r\nimport { detectPackage } from \"./lib/package\";\r\nimport {\r\n\tdetectWorkspace,\r\n\treadWorkspaceNpmManifest,\r\n\twriteWorkspaceNpmManifest,\r\n} from \"./lib/workspace\";\r\nimport type { ReleaseFolderOptions } from \"./commands/publish\";\r\nimport { createDefaultPrompter } from \"./lib/prompter\";\r\n\r\nimport pjson from \"../package.json\";\r\n\r\nconst __filename = fileURLToPath(import.meta.url);\r\n\r\nconst captureError = (err: Error) => {\r\n\tconsole.log(\"\");\r\n\r\n\tif (process.env.NODE_ENV !== \"production\") {\r\n\t\tconsole.error(err);\r\n\t} else {\r\n\t\tconsole.error(translate(\"messages.error\", err.message));\r\n\t}\r\n};\r\n\r\nconst buildOptions = {\r\n\toutDir: {\r\n\t\tdescription: translate(\"options.outDir.description\"),\r\n\t\ttype: \"string\",\r\n\t\tdefault: \"bin\",\r\n\t\tcoerce: (input: string | undefined | null) =>\r\n\t\t\tinput === undefined || input === null\r\n\t\t\t\t? undefined\r\n\t\t\t\t: path.resolve(process.cwd(), input),\r\n\t},\r\n\tminimize: {\r\n\t\tdescription: translate(\"options.minimize.description\"),\r\n\t\ttype: \"boolean\",\r\n\t\tdefault: true,\r\n\t},\r\n\tcwd: {\r\n\t\tdescription: translate(\"options.cwd.description\"),\r\n\t\ttype: \"string\",\r\n\t\tdefault: process.cwd(),\r\n\t},\r\n\tclean: {\r\n\t\tdescription: translate(\"options.clean.description\"),\r\n\t\ttype: \"boolean\",\r\n\t\tdefault: false,\r\n\t},\r\n\tdocs: {\r\n\t\ttype: \"boolean\",\r\n\t\tdefault: false,\r\n\t},\r\n} as const;\r\n\r\nconst preCommandCheck = async () => {\r\n\tconst executedLocalPackager =\r\n\t\tpath.relative(process.cwd(), __filename).indexOf(\"..\") === -1;\r\n\r\n\tlet repositoryPackage:\r\n\t\t| {\r\n\t\t\t\tdependencies?: Record<string, string>;\r\n\t\t\t\tdevDependencies?: Record<string, string>;\r\n\t\t }\r\n\t\t| undefined;\r\n\r\n\ttry {\r\n\t\tconst repositoryPackageJson = fs.readFileSync(\r\n\t\t\tpath.resolve(process.cwd(), \"package.json\"),\r\n\t\t\t\"utf8\",\r\n\t\t);\r\n\r\n\t\trepositoryPackage = JSON.parse(repositoryPackageJson);\r\n\t} catch (err) {}\r\n\r\n\tif (\r\n\t\trepositoryPackage?.dependencies?.[\r\n\t\t\t\"@intelligentgraphics/ig.gfx.packager\"\r\n\t\t] ||\r\n\t\trepositoryPackage?.devDependencies?.[\r\n\t\t\t\"@intelligentgraphics/ig.gfx.packager\"\r\n\t\t]\r\n\t) {\r\n\t\tconst parts = [\"Detected locally installed ig.gfx.packager.\"];\r\n\r\n\t\tif (executedLocalPackager) {\r\n\t\t\tparts.push(\r\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.',\r\n\t\t\t);\r\n\t\t}\r\n\t\tparts.push(\r\n\t\t\t'Run \"npm uninstall @intelligentgraphics/ig.gfx.packager\" to remove the local version.',\r\n\t\t);\r\n\r\n\t\tconsole.error(parts.join(\"\\n\"));\r\n\t\tprocess.exit(1);\r\n\t}\r\n\r\n\tif (executedLocalPackager) {\r\n\t\tconsole.error(`Detected locally installed ig.gfx.packager.\r\nRun \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.\r\nRun \"npm install\" to get rid of the local packager version.`);\r\n\t\tprocess.exit(1);\r\n\t}\r\n\r\n\tconst notifier = updateNotifier({\r\n\t\tpkg: pjson,\r\n\t\tshouldNotifyInNpmScript: true,\r\n\t\tupdateCheckInterval: 1000 * 60,\r\n\t});\r\n\r\n\tnotifier.notify({\r\n\t\tisGlobal: true,\r\n\t\tdefer: true,\r\n\t});\r\n\r\n\tconst workspaceLocation = detectWorkspace(process.cwd());\r\n\r\n\tconst packageJson = readWorkspaceNpmManifest(workspaceLocation);\r\n\r\n\tif (packageJson === undefined) {\r\n\t\tthrow new Error(\r\n\t\t\t\"Could not load package.json file in current directory\",\r\n\t\t);\r\n\t}\r\n\r\n\tpackageJson.scripts ??= {};\r\n\tpackageJson.scripts.postinstall = \"packager postinstall\";\r\n\r\n\twriteWorkspaceNpmManifest(workspaceLocation, packageJson);\r\n};\r\n\r\nconst yargsInstance = yargs(process.argv.slice(2));\r\n\r\nyargsInstance.command(\r\n\t\"build [directories...]\",\r\n\t\"Builds the specified directories\",\r\n\t(argv) => argv.options(buildOptions),\r\n\tasync ({ directories = [], ...options }) => {\r\n\t\tawait preCommandCheck();\r\n\r\n\t\tconst { buildFolders } = await import(\"./commands/build\");\r\n\r\n\t\tawait buildFolders({\r\n\t\t\t...options,\r\n\t\t\tdirectories: directories as string[],\r\n\t\t}).catch(captureError);\r\n\t},\r\n);\r\n\r\nyargsInstance.command(\r\n\t\"publish [directory]\",\r\n\t\"Publishes the specified directory\",\r\n\t(argv) =>\r\n\t\targv.options({\r\n\t\t\t...buildOptions,\r\n\t\t\tnoUpload: {\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t\tdefault: false,\r\n\t\t\t\tdescription: translate(\"options.noUpload.description\"),\r\n\t\t\t},\r\n\t\t\tdomain: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.domain.description\"),\r\n\t\t\t},\r\n\t\t\tsubdomain: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.subdomain.description\"),\r\n\t\t\t},\r\n\t\t\tnewVersion: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.newVersion.description\"),\r\n\t\t\t\tdefault: process.env.VERSION,\r\n\t\t\t\trequired: true,\r\n\t\t\t},\r\n\t\t\taddress: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.address.description\"),\r\n\t\t\t\tdefault: \"localhost\",\r\n\t\t\t},\r\n\t\t\tservice: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.service.description\"),\r\n\t\t\t\tdefault: process.env.IG_GFX_ASSET_SERVICE,\r\n\t\t\t\trequired: true,\r\n\t\t\t},\r\n\t\t\tuser: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.user.description\"),\r\n\t\t\t\tdefault: process.env.IG_GFX_USER,\r\n\t\t\t},\r\n\t\t\tpassword: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.password.description\"),\r\n\t\t\t\tdefault: process.env.IG_GFX_PWD,\r\n\t\t\t},\r\n\t\t\tdocs: {\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t\tdefault: false,\r\n\t\t\t\tdescription: translate(\"options.docs.description\"),\r\n\t\t\t},\r\n\t\t\tpushOnly: {\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t\tdefault: false,\r\n\t\t\t\tdescription: translate(\"options.pushOnly.description\"),\r\n\t\t\t},\r\n\t\t\tlicense: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.license.description\"),\r\n\t\t\t\tdefault: process.env.IG_GFX_LICENSE,\r\n\t\t\t},\r\n\t\t}),\r\n\tasync ({ directory, user, password, service, license, ...options }) => {\r\n\t\tawait preCommandCheck();\r\n\r\n\t\tif (!options.noUpload) {\r\n\t\t\tif (!service) {\r\n\t\t\t\tcaptureError(\r\n\t\t\t\t\tnew Error(\r\n\t\t\t\t\t\ttranslate(\r\n\t\t\t\t\t\t\t\"options.service.demands\",\r\n\t\t\t\t\t\t\t\"IG_GFX_ASSET_SERVICE\",\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (!license && (!user || !password)) {\r\n\t\t\t\tcaptureError(\r\n\t\t\t\t\tnew Error(\r\n\t\t\t\t\t\t`Expected authentication to be provided through either of the following methods:\r\n\t - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable\r\n\t - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`,\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (license && !license.endsWith(\".iglic\")) {\r\n\t\t\t\tcaptureError(\r\n\t\t\t\t\tnew Error(\r\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.`,\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlet authentication: Authentication | undefined;\r\n\r\n\t\tif (license) {\r\n\t\t\tconst fullLicensePath = path.resolve(process.cwd(), license);\r\n\t\t\ttry {\r\n\t\t\t\tconst content = fs.readFileSync(fullLicensePath);\r\n\t\t\t\tauthentication = {\r\n\t\t\t\t\ttype: \"license\",\r\n\t\t\t\t\tlicense: content.toString(\"base64\"),\r\n\t\t\t\t};\r\n\t\t\t} catch (err) {\r\n\t\t\t\tif (err?.code === \"ENOENT\") {\r\n\t\t\t\t\tcaptureError(\r\n\t\t\t\t\t\tnew Error(\r\n\t\t\t\t\t\t\t`Expected to find a license file at path: ${fullLicensePath}`,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tcaptureError(\r\n\t\t\t\t\tnew Error(\r\n\t\t\t\t\t\t`Failed to read license file at path: ${fullLicensePath}`,\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} else if (user && password) {\r\n\t\t\tconsole.log(\r\n\t\t\t\t`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`,\r\n\t\t\t);\r\n\t\t\tauthentication = {\r\n\t\t\t\ttype: \"credentials\",\r\n\t\t\t\tusername: user,\r\n\t\t\t\tpassword,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tconst { releaseFolder } = await import(\"./commands/publish\");\r\n\r\n\t\tconst prompter = createDefaultPrompter();\r\n\r\n\t\tconst fullOptions: ReleaseFolderOptions = {\r\n\t\t\t...options,\r\n\t\t\tauthentication,\r\n\t\t\tservice: service!,\r\n\t\t\tdirectory: directory as string,\r\n\t\t\tbanner: true,\r\n\t\t\tprompter,\r\n\t\t\tnewVersion: options.newVersion!,\r\n\t\t};\r\n\r\n\t\tawait releaseFolder(fullOptions).catch(captureError);\r\n\t},\r\n);\r\n\r\nyargsInstance.command({\r\n\tcommand: \"generateIndex [directory]\",\r\n\tbuilder: (argv) => {\r\n\t\treturn argv.option(\"ignore\", {\r\n\t\t\ttype: \"array\",\r\n\t\t\tdefault: [],\r\n\t\t\tdescription: translate(\"options.ignore.description\"),\r\n\t\t});\r\n\t},\r\n\thandler: async ({ directory, ignore }) => {\r\n\t\tawait preCommandCheck();\r\n\r\n\t\tconst { extract } = await import(\"./commands/generate\");\r\n\r\n\t\tconst workspace = detectWorkspace(process.cwd());\r\n\t\tconst location = detectPackage(workspace, directory as string);\r\n\r\n\t\textract(location, ignore as string[]);\r\n\t},\r\n});\r\n\r\nyargsInstance.command({\r\n\tcommand: \"postinstall\",\r\n\tbuilder: (argv) => argv,\r\n\thandler: async () => {\r\n\t\tconst { executePostInstall } = await import(\"./commands/postinstall\");\r\n\r\n\t\texecutePostInstall(detectWorkspace(process.cwd()));\r\n\t},\r\n\tdescribe: \"Runs postinstall tasks\",\r\n});\r\n\r\nyargsInstance.command({\r\n\tcommand: \"publishNpm [directory]\",\r\n\tbuilder: (argv) =>\r\n\t\targv.options({\r\n\t\t\tnewVersion: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdescription: translate(\"options.newVersion.description\"),\r\n\t\t\t\tdefault: process.env.VERSION,\r\n\t\t\t\trequired: true,\r\n\t\t\t},\r\n\t\t\tdryRun: {\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t}),\r\n\thandler: async ({ directory, newVersion, dryRun }) => {\r\n\t\tconst workspace = detectWorkspace(process.cwd());\r\n\r\n\t\tconst { publishToNpm } = await import(\"./commands/publishNpm\");\r\n\r\n\t\tawait publishToNpm({\r\n\t\t\tworkspace,\r\n\t\t\tlocation: detectPackage(workspace, directory as string),\r\n\t\t\tversion: newVersion,\r\n\t\t\tdryRun,\r\n\t\t}).catch(captureError);\r\n\t},\r\n\tdescribe: \"Publishes the package to npm\",\r\n});\r\n\r\nyargsInstance\r\n\t.demandCommand()\r\n\t.pkgConf(\"packager\")\r\n\t.showHelpOnFail(false)\r\n\t.version().argv;\r\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","writePackageSync","PACKAGE_FILE","INDEX_FILE","ANIMATION_FILE_SUFFIX","parseCreatorPackageName","manifest","domain","subdomainParts","Package","split","subdomain","detectPackage","workspace","resolve","scriptsPath","tsPath","location","existsSync","_kind","scriptsDir","manifestDir","readPackageCreatorManifest","err","Error","result","Scope","writePackageCreatorManifest","creatorPackage","writeFileSync","stringify","readPackageCreatorIndex","indexPath","index","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,IAA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,aAAa,CACXyC,aAAa,EAAE,CACfC,OAAO,CAAC,UAAU,CAAC,CACnBC,cAAc,CAAC,KAAK,CAAC,CACrBH,OAAO,EAAE,CAACtC,IAAI;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","sources":["../src/lib/localization.ts","../src/lib/error.ts","../src/lib/stripUtf8Bom.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","export const stripUtf8Bom = (text: string) => {\n\t// Catches EFBBBF (UTF-8 BOM) because the buffer-to-string\n\t// conversion translates it to FEFF (UTF-16 BOM).\n\tif (text.charCodeAt(0) === 0xfeff) {\n\t\treturn text.slice(1);\n\t}\n\n\treturn text;\n};\n","import * as fs from \"fs\";\nimport * as path from \"path\";\nimport { writePackageSync } from \"write-pkg\";\n\nimport { PackageJSON } from \"./packageJSON\";\nimport { stripUtf8Bom } from \"./stripUtf8Bom\";\n\nexport const readNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n): T => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\tconst packageJson = stripUtf8Bom(\n\t\tfs.readFileSync(packageJsonPath, {\n\t\t\tencoding: \"utf8\",\n\t\t}),\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\twritePackageSync(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\";\nimport { stripUtf8Bom } from \"./stripUtf8Bom\";\n\nexport const PACKAGE_FILE = \"_Package.json\";\nexport const INDEX_FILE = \"_Index.json\";\nconst ANIMATION_FILE_SUFFIX = \".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 type CreatorIndex = CreatorIndexEntry[];\n\nexport interface CreatorIndexEntry {\n\tName: string;\n\tDescription?: string;\n\tType: \"Interactor\" | \"Evaluator\";\n\tParameters: CreatorIndexParameter[];\n}\n\nexport interface CreatorIndexParameter {\n\tName: string;\n\tType: CreatorIndexParameterType;\n\tDescription?: string;\n\tDefault?: unknown;\n\tDisplayIndex: number;\n}\n\nexport type CreatorIndexParameterType =\n\t| \"String\"\n\t| \"LengthM\"\n\t| \"Material\"\n\t| \"Boolean\"\n\t| \"Bool\"\n\t| \"ArcDEG\"\n\t| \"Integer\"\n\t| \"Int\"\n\t| \"Float\";\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\ttry {\n\t\treadPackageCreatorManifest(location);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\tthrow new Error(\n\t\t\t\t`No _Package.json found in ${location.manifestDir}`,\n\t\t\t);\n\t\t}\n\t\tthrow err;\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 = stripUtf8Bom(\n\t\tfs.readFileSync(packageJsonPath, { encoding: \"utf8\" }),\n\t);\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): CreatorIndex | undefined => {\n\ttry {\n\t\tconst indexPath = path.join(location.manifestDir, INDEX_FILE);\n\t\tconst index = stripUtf8Bom(\n\t\t\tfs.readFileSync(indexPath, { encoding: \"utf8\" }),\n\t\t);\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: CreatorIndex,\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_SUFFIX)) {\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 { 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/publish\";\nimport { createDefaultPrompter } from \"./lib/prompter\";\nimport { PackageJSON } from \"./lib/packageJSON\";\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: PackageJSON | undefined;\n\n\tconst workspaceLocation = detectWorkspace(process.cwd());\n\n\ttry {\n\t\trepositoryPackage = readWorkspaceNpmManifest(workspaceLocation);\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\tif (repositoryPackage === 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\trepositoryPackage.scripts ??= {};\n\trepositoryPackage.scripts.postinstall = \"packager postinstall\";\n\n\twriteWorkspaceNpmManifest(workspaceLocation, repositoryPackage);\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/publish\");\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: \"Publishes the package to npm\",\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","stripUtf8Bom","text","charCodeAt","slice","readNpmManifest","packageJsonPath","packageJson","fs","readFileSync","encoding","JSON","parse","writeNpmManifest","writePackageSync","PACKAGE_FILE","INDEX_FILE","ANIMATION_FILE_SUFFIX","parseCreatorPackageName","manifest","domain","subdomainParts","Package","split","subdomain","detectPackage","workspace","resolve","scriptsPath","tsPath","location","existsSync","_kind","scriptsDir","manifestDir","readPackageCreatorManifest","err","Error","result","Scope","writePackageCreatorManifest","creatorPackage","writeFileSync","stringify","readPackageCreatorIndex","indexPath","index","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","workspaceLocation","dependencies","devDependencies","parts","exit","notifier","updateNotifier","pkg","pjson","shouldNotifyInNpmScript","updateCheckInterval","notify","isGlobal","defer","scripts","postinstall","yargsInstance","yargs","argv","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,EAAAA,WAAW,EAAE,KAAK;AAClBC,EAAAA,MAAM,EAAE,IAAI;AACZC,EAAAA,kBAAkB,EAAE,IAAA;AACrB,CAAC,CAAC,CAAA;MAMWC,SAAS,GAAG,CAACC,GAAW,EAAE,GAAGC,IAAc,KACvDV,QAAQ,CAACW,EAAE,CAACF,GAAG,EAAE,GAAGC,IAAI;;ACflB,MAAME,gBAAgB,GAAIC,KAAc,IAAK;AACnD,EAAA,IACCA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACxBA,KAAK,CAAeC,IAAI,KAAKC,SAAS,EACtC;IACD,OAAQF,KAAK,CAAeC,IAAI,CAAA;AACjC,GAAA;AACD,CAAC,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gCAAgC,CAAC;AACxD0F,MAAAA,OAAO,EAAEtB,OAAO,CAAC2B,GAAG,CAACwC,OAAO;AAC5BC,MAAAA,QAAQ,EAAE,IAAA;KACV;AACD2B,IAAAA,MAAM,EAAE;AACP/E,MAAAA,IAAI,EAAE,SAAA;AACP,KAAA;AACD,GAAC,CAAC;AACH0E,EAAAA,OAAO,EAAE,OAAO;IAAEpK,SAAS;IAAE4I,UAAU;AAAE6B,IAAAA,MAAAA;AAAO,GAAC,KAAK;IACrD,MAAMjI,SAAS,GAAGiC,eAAe,CAACC,OAAO,CAACC,GAAG,EAAE,CAAC,CAAA;IAEhD,MAAM;AAAE+F,MAAAA,YAAAA;AAAa,KAAC,GAAG,MAAM,OAAO,8BAAuB,CAAC,CAAA;AAE9D,IAAA,MAAMA,YAAY,CAAC;MAClBlI,SAAS;AACTI,MAAAA,QAAQ,EAAEL,aAAa,CAACC,SAAS,EAAExC,SAAS,CAAW;AACvD2K,MAAAA,OAAO,EAAE/B,UAAU;AACnB6B,MAAAA,MAAAA;AACD,KAAC,CAAC,CAAC/B,KAAK,CAACxC,YAAY,CAAC,CAAA;GACtB;AACDsE,EAAAA,QAAQ,EAAE,8BAAA;AACX,CAAC,CAAC,CAAA;AAEFpC,aAAa,CACXwC,aAAa,EAAE,CACfC,OAAO,CAAC,UAAU,CAAC,CACnBC,cAAc,CAAC,KAAK,CAAC,CACrBH,OAAO,EAAE,CAACrC,IAAI;;;;;;;;"}
|
|
@@ -3,9 +3,9 @@ import * as path from 'path';
|
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import glob from 'glob';
|
|
5
5
|
import * as terser from 'terser';
|
|
6
|
-
import { d as detectWorkspace, t as translate, r as readPackageCreatorManifest, a as detectPackage, b as readPackageNpmManifest } from '
|
|
6
|
+
import { d as detectWorkspace, t as translate, r as readPackageCreatorManifest, a as detectPackage, b as readPackageNpmManifest } from '../cli.mjs';
|
|
7
7
|
import ts from 'typescript';
|
|
8
|
-
import { g as getPackageTypescriptFiles } from '
|
|
8
|
+
import { g as getPackageTypescriptFiles } from '../scripts.mjs';
|
|
9
9
|
import typedoc from 'typedoc';
|
|
10
10
|
|
|
11
11
|
const logPackageMessage = (name, step, index, total) => {
|
|
@@ -323,4 +323,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
323
323
|
});
|
|
324
324
|
|
|
325
325
|
export { buildFolders as b, index as i, logPackageMessage as l };
|
|
326
|
-
//# sourceMappingURL=
|
|
326
|
+
//# sourceMappingURL=build.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.mjs","sources":["../../src/lib/log.ts","../../src/commands/build/tsc.ts","../../src/commands/build/docs.ts","../../src/lib/toposort.ts","../../src/commands/build/index.ts"],"sourcesContent":["export const logPackageMessage = (\n\tname: string,\n\tstep: string,\n\tindex?: number,\n\ttotal?: number,\n) => {\n\tconst numLength = total === undefined ? undefined : total.toString().length;\n\n\tconst indexString =\n\t\ttotal === undefined || total < 2\n\t\t\t? \"\"\n\t\t\t: `${index!.toString().padStart(numLength!, \"0\")}/${total} `;\n\n\tconst identifierString = `${indexString}${name.padEnd(15)}`;\n\n\tconsole.log(`${identifierString} >> ${step}`);\n};\n","import ts from \"typescript\";\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport { PackageLocation } from \"../../lib/package\";\n\nimport { FolderBuilder } from \".\";\nimport { getPackageTypescriptFiles } from \"../../lib/scripts\";\n\nexport const tryReadTsConfig = (location: PackageLocation) => {\n\tconst { config } = ts.readConfigFile(\n\t\tpath.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t(path) => {\n\t\t\ttry {\n\t\t\t\treturn fs.readFileSync(path, \"utf8\");\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t);\n\n\treturn config as {\n\t\tcompilerOptions: ts.CompilerOptions;\n\t};\n};\n\nexport const build: FolderBuilder = async (\n\tlocation: PackageLocation,\n\toutputDir: string,\n) => {\n\tconst config = tryReadTsConfig(location);\n\n\tconfig.compilerOptions.lib = [\"es5\", \"dom\"];\n\n\tconst result = ts.convertCompilerOptionsFromJson(\n\t\tconfig.compilerOptions,\n\t\tlocation.scriptsDir,\n\t);\n\n\tconst compilerOptions: ts.CompilerOptions = {\n\t\t...result.options,\n\t\tremoveComments: false,\n\t\tdeclaration: true,\n\t\tsourceMap: false,\n\t\t// We don't use tsc to actually emit the files, but we still need to set the correct\n\t\t// output directory so the compiler can rewrite the `reference path` directives.\n\t\toutFile: path.join(outputDir, \"out.js\"),\n\t\ttarget: ts.ScriptTarget.ES5,\n\t\tnoEmitOnError: true,\n\t};\n\n\tconst host = ts.createCompilerHost(compilerOptions);\n\thost.getCurrentDirectory = () => location.scriptsDir;\n\n\tlet js: string | undefined;\n\tlet definitions: string | undefined;\n\n\thost.writeFile = (fileName, data, writeByteOrderMark) => {\n\t\tif (fileName.endsWith(\".js\")) {\n\t\t\tjs = data;\n\t\t} else if (fileName.endsWith(\".d.ts\")) {\n\t\t\tdefinitions = data;\n\t\t}\n\t};\n\n\tconst files = getPackageTypescriptFiles(location);\n\n\tif (files.length === 0) {\n\t\tthrow new Error(\n\t\t\t`Expected typescript files to exist when building a package. Packages only consisting of animation jsons do not need to be built.`,\n\t\t);\n\t}\n\n\tconst programOptions: ts.CreateProgramOptions = {\n\t\trootNames: files,\n\t\toptions: compilerOptions,\n\t\thost,\n\t};\n\n\tconst program = ts.createProgram(programOptions);\n\tconst emitResult = program.emit();\n\tconst allDiagnostics = ts.getPreEmitDiagnostics(program);\n\n\tif (!emitResult.emitSkipped) {\n\t\tif (allDiagnostics.length > 0) {\n\t\t\tconsole.log(allDiagnostics.map(createErrorMessage).join(\"\\n\"));\n\t\t}\n\n\t\tif (js === undefined || definitions === undefined) {\n\t\t\tthrow new Error(`Unexpected: no js or definitions were created`);\n\t\t}\n\n\t\treturn { js, definitions };\n\t}\n\n\tconst error = allDiagnostics.map(createErrorMessage).join(\"\\n\");\n\n\tthrow new Error(error);\n};\n\nconst createErrorMessage = (diagnostic: ts.Diagnostic) => {\n\tif (!diagnostic.file) {\n\t\treturn `${ts.flattenDiagnosticMessageText(\n\t\t\tdiagnostic.messageText,\n\t\t\t\"\\n\",\n\t\t)}`;\n\t}\n\n\tconst { line, character } = diagnostic.file.getLineAndCharacterOfPosition(\n\t\tdiagnostic.start!,\n\t);\n\n\tconst message = ts.flattenDiagnosticMessageText(\n\t\tdiagnostic.messageText,\n\t\t\"\\n\",\n\t);\n\n\treturn `${diagnostic.file.fileName} (${line + 1},${\n\t\tcharacter + 1\n\t}): ${message}`;\n};\n","import typedoc from \"typedoc\";\nimport glob from \"glob\";\nimport ts from \"typescript\";\nimport * as path from \"path\";\nimport { PackageLocation } from \"../../lib/package\";\n\nexport const generateDocs = async (\n\tlocation: PackageLocation,\n\tdeclarationFile: string,\n\toutFolder: string,\n\tname: string,\n) => {\n\tconst app = new typedoc.Application();\n\n\tconst mediaDir = path.join(location.manifestDir, \"Media\");\n\n\tapp.bootstrap({\n\t\tentryPoints: [declarationFile],\n\t\tmedia: mediaDir,\n\t\tout: outFolder,\n\t\ttsconfig: path.join(location.scriptsDir, \"tsconfig.json\"),\n\t\tskipErrorChecking: true,\n\t});\n\n\tapp.options.setCompilerOptions(\n\t\t[declarationFile],\n\t\t{\n\t\t\ttarget: ts.ScriptTarget.ES5,\n\t\t},\n\t\tundefined,\n\t);\n\n\tapp.options.setValue(\"name\", name);\n\n\tconst [readmePath] = glob.sync(\"**/readme.md\", {\n\t\tabsolute: true,\n\t\tcwd: location.manifestDir,\n\t});\n\n\tif (readmePath) {\n\t\tapp.options.setValue(\"readme\", readmePath);\n\t}\n\n\tconst project = app.convert();\n\n\tif (project) {\n\t\tawait app.generateDocs(project, outFolder);\n\t}\n};\n","// Stolen from ig.tools.core\n\nexport const toposort = (packages: Record<string, string[]>) => {\n\tconst queue = Object.getOwnPropertyNames(packages);\n\tconst result: string[] = [];\n\n\tlet index = 0;\n\n\twhile (queue.length > 0) {\n\t\tif (index >= queue.length) {\n\t\t\tthrow new Error(\"Packages can not have cyclic dependencies\");\n\t\t}\n\n\t\tconst queueEntry = queue[index];\n\n\t\tconst dependencies = packages[queueEntry];\n\t\tconst dependencyQueued = dependencies.some((dependency) =>\n\t\t\tqueue.includes(dependency),\n\t\t);\n\n\t\tif (dependencyQueued) {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tqueue.splice(index, 1);\n\t\tindex = 0;\n\t\tresult.push(queueEntry);\n\t}\n\n\treturn result;\n};\n","import * as path from \"path\";\nimport * as fs from \"fs\";\nimport glob from \"glob\";\nimport * as terser from \"terser\";\n\nimport { logPackageMessage } from \"../../lib/log\";\nimport { translate } from \"../../lib/localization\";\nimport { build as tscBuild } from \"./tsc\";\nimport { generateDocs } from \"./docs\";\nimport {\n\tdetectPackage,\n\tPackageLocation,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n} from \"../../lib/package\";\nimport { detectWorkspace, WorkspaceLocation } from \"../../lib/workspace\";\nimport { getPackageTypescriptFiles } from \"../../lib/scripts\";\nimport { toposort } from \"../../lib/toposort\";\nimport { PackageJSON } from \"../../lib/packageJSON\";\n\nexport interface BannerOptions {\n\ttext: string | undefined;\n\tversion: string | undefined;\n\tcommit: string | undefined;\n\tcommitDirty: boolean | undefined;\n\tdate: Date | undefined;\n}\n\nexport interface BuildFoldersOptions {\n\tcwd: string;\n\tdirectories: string[];\n\toutDir?: string;\n\tminimize: boolean;\n\tbanner?: BannerOptions;\n\tclean?: boolean;\n\tdocs?: boolean;\n\tskipPackagesWithoutTsFiles?: boolean;\n}\n\nexport interface BuildFolderOptions extends BuildFoldersOptions {\n\toutFile: string;\n}\n\nexport interface FolderBuilderResult {\n\tjs: string;\n\tdefinitions: string;\n}\n\nexport type FolderBuilder = (\n\tlocation: PackageLocation,\n\toutputDir: string,\n) => Promise<FolderBuilderResult>;\n\ntype FolderData = {\n\tlocation: PackageLocation;\n\tdata?: PackageJSON;\n};\n\nexport const buildFolders = async (options: BuildFoldersOptions) => {\n\tif (options.outDir !== undefined && options.clean) {\n\t\tfs.rmSync(options.outDir, { recursive: true });\n\t}\n\n\tconst workspace = detectWorkspace(options.cwd);\n\tconst folders = resolvePackagesFromArgs(options.directories, workspace);\n\n\tif (folders.length === 0) {\n\t\treturn console.log(translate(\"messages.buildSkipEmpty\"));\n\t}\n\n\tconst sortedPackages = sortPackagesByBuildOrder(folders);\n\n\tlet index = 1;\n\n\tfor (const location of sortedPackages) {\n\t\tif (\n\t\t\toptions.skipPackagesWithoutTsFiles &&\n\t\t\tgetPackageTypescriptFiles(location).length === 0\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tensureTsConfig(location);\n\n\t\tconst data = readPackageCreatorManifest(location);\n\n\t\tconst logStep = (step: string) =>\n\t\t\tlogPackageMessage(data.Package, step, index, folders.length);\n\n\t\tlogStep(translate(\"messages.building\"));\n\n\t\tconst outputDirectory = options.outDir || location.scriptsDir;\n\t\tfs.mkdirSync(outputDirectory, { recursive: true });\n\n\t\tconst buildResult = await tscBuild(location, outputDirectory);\n\t\tconst banner = options.banner\n\t\t\t? createBannerComment(options.banner)\n\t\t\t: undefined;\n\n\t\tif (banner) {\n\t\t\tbuildResult.js = banner + \"\\n\" + buildResult.js;\n\t\t\tbuildResult.definitions = banner + \"\\n\" + buildResult.definitions;\n\t\t}\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(outputDirectory, `${data.Package}.js`),\n\t\t\tbuildResult.js,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\t\tfs.writeFileSync(\n\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\tbuildResult.definitions,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\n\t\tif (options.minimize) {\n\t\t\tconst minifyResult = await terser.minify(buildResult.js, {\n\t\t\t\tecma: 5,\n\t\t\t});\n\n\t\t\tconst minifiedPath = path.join(\n\t\t\t\toutputDirectory,\n\t\t\t\t`${data.Package}.min.js`,\n\t\t\t);\n\t\t\tfs.writeFileSync(minifiedPath, minifyResult.code!, {\n\t\t\t\tencoding: \"utf8\",\n\t\t\t});\n\t\t}\n\n\t\tif (location.path.includes(\"Basics\")) {\n\t\t\tfs.mkdirSync(path.join(options.cwd, \"lib\"), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\n\t\t\tlogStep(translate(\"messages.basicsCopy\"));\n\t\t\tfs.writeFileSync(\n\t\t\t\tpath.join(options.cwd, \"lib\", `${data.Package}.d.ts`),\n\t\t\t\tbuildResult.definitions,\n\t\t\t\t{ encoding: \"utf8\" },\n\t\t\t);\n\t\t}\n\n\t\tif (options.docs) {\n\t\t\tlogStep(translate(\"messages.docsGeneration\"));\n\t\t\tawait generateDocs(\n\t\t\t\tlocation,\n\t\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\t\tpath.join(options.cwd, \"docs\", data.Package),\n\t\t\t\tdata.Package,\n\t\t\t);\n\t\t}\n\n\t\t// logStep(translate(\"messages.built\"));\n\n\t\tindex++;\n\t}\n};\n\nconst resolvePackagesFromArgs = (\n\targs: string[] = [],\n\tworkspace: WorkspaceLocation,\n) => {\n\tconst folders = new Map<string, PackageLocation>();\n\n\tfor (const arg of args) {\n\t\tglob.sync(arg, { cwd: workspace.path, absolute: true }).forEach(\n\t\t\t(folder) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst location = detectPackage(workspace, folder);\n\t\t\t\t\tfolders.set(folder, location);\n\t\t\t\t} catch (err) {}\n\t\t\t},\n\t\t);\n\t}\n\n\treturn Array.from(folders.values());\n};\n\nconst ensureTsConfig = (location: PackageLocation) => {\n\tconst tsconfigPath = path.join(location.scriptsDir, \"tsconfig.json\");\n\n\tif (!fs.existsSync(tsconfigPath)) {\n\t\tconst content = {};\n\t\tapplyTsConfigOption(content);\n\n\t\tfs.writeFileSync(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\t} else {\n\t\tconst content = JSON.parse(fs.readFileSync(tsconfigPath, \"utf8\"));\n\t\tapplyTsConfigOption(content);\n\t\tfs.writeFileSync(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n};\n\nconst applyTsConfigOption = (data: {\n\tcompilerOptions?: { target?: string; lib?: string[] };\n}) => {\n\tdata.compilerOptions = data.compilerOptions ?? {};\n\tdata.compilerOptions.target = \"es5\";\n\tdata.compilerOptions.lib = [\"es5\", \"dom\"];\n};\n\nconst sortPackagesByBuildOrder = (\n\tfolders: PackageLocation[],\n): PackageLocation[] => {\n\tconst packages = Array.from(folders).reduce(\n\t\t(\n\t\t\tacc: Record<string, FolderData>,\n\t\t\tlocation,\n\t\t): Record<string, FolderData> => {\n\t\t\tconst data = readPackageNpmManifest(location);\n\n\t\t\tif (data !== undefined) {\n\t\t\t\tacc[data.name] = {\n\t\t\t\t\tdata,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tacc[location.path] = {\n\t\t\t\t\tdata: undefined,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst packageDependencies = Object.getOwnPropertyNames(packages).reduce(\n\t\t(acc, packageName) => {\n\t\t\tconst packageData = packages[packageName];\n\n\t\t\tif (packageData.data === undefined) {\n\t\t\t\tacc[packageName] = [];\n\t\t\t} else {\n\t\t\t\tacc[packageName] = Object.getOwnPropertyNames({\n\t\t\t\t\t...packageData.data.devDependencies,\n\t\t\t\t\t...packageData.data.dependencies,\n\t\t\t\t\t...packageData.data.peerDependencies,\n\t\t\t\t}).filter((packageName) => packages[packageName] !== undefined);\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst sortedPackages = toposort(packageDependencies);\n\tconst result: PackageLocation[] = [];\n\n\tfor (const packageName of sortedPackages) {\n\t\tconst location = packages[packageName].location;\n\n\t\tif (readPackageCreatorManifest(location).Package.endsWith(\".Basics\")) {\n\t\t\tresult.unshift(location);\n\t\t} else {\n\t\t\tresult.push(location);\n\t\t}\n\t}\n\n\treturn result;\n};\n\nconst createBannerComment = (banner: BannerOptions) => {\n\tconst bannerParts: string[] = [];\n\n\tif (banner.text) {\n\t\tbannerParts.push(\" * \" + banner.text);\n\t}\n\n\t{\n\t\tconst details: string[] = [];\n\n\t\tif (banner.version) {\n\t\t\tdetails.push(`Version: ${banner.version}`);\n\t\t}\n\t\tif (banner.commit) {\n\t\t\tif (banner.commitDirty) {\n\t\t\t\tdetails.push(`Commit: ${banner.commit} (dirty)`);\n\t\t\t} else {\n\t\t\t\tdetails.push(`Commit: ${banner.commit}`);\n\t\t\t}\n\t\t}\n\t\tif (banner.date) {\n\t\t\tdetails.push(`Date: ${banner.date.toISOString()}`);\n\t\t}\n\n\t\tconst detailsText = details.map((line) => ` * ${line}`).join(\"\\n\");\n\t\tif (detailsText) {\n\t\t\tbannerParts.push(detailsText);\n\t\t}\n\t}\n\n\tconst bannerText = bannerParts.join(\"\\n\\n\");\n\n\tif (bannerText) {\n\t\treturn `/*\n${bannerText}\n*\n* @preserve\t\t\t\n*/`;\n\t}\n\n\treturn undefined;\n};\n"],"names":["logPackageMessage","name","step","index","total","numLength","undefined","toString","length","indexString","padStart","identifierString","padEnd","console","log","tryReadTsConfig","location","config","ts","readConfigFile","path","join","scriptsDir","fs","readFileSync","build","outputDir","compilerOptions","lib","result","convertCompilerOptionsFromJson","options","removeComments","declaration","sourceMap","outFile","target","ScriptTarget","ES5","noEmitOnError","host","createCompilerHost","getCurrentDirectory","js","definitions","writeFile","fileName","data","writeByteOrderMark","endsWith","files","getPackageTypescriptFiles","Error","programOptions","rootNames","program","createProgram","emitResult","emit","allDiagnostics","getPreEmitDiagnostics","emitSkipped","map","createErrorMessage","error","diagnostic","file","flattenDiagnosticMessageText","messageText","line","character","getLineAndCharacterOfPosition","start","message","generateDocs","declarationFile","outFolder","app","typedoc","Application","mediaDir","manifestDir","bootstrap","entryPoints","media","out","tsconfig","skipErrorChecking","setCompilerOptions","setValue","readmePath","glob","sync","absolute","cwd","project","convert","toposort","packages","queue","Object","getOwnPropertyNames","queueEntry","dependencies","dependencyQueued","some","dependency","includes","splice","push","buildFolders","outDir","clean","rmSync","recursive","workspace","detectWorkspace","folders","resolvePackagesFromArgs","directories","translate","sortedPackages","sortPackagesByBuildOrder","skipPackagesWithoutTsFiles","ensureTsConfig","readPackageCreatorManifest","logStep","Package","outputDirectory","mkdirSync","buildResult","tscBuild","banner","createBannerComment","writeFileSync","encoding","minimize","minifyResult","terser","minify","ecma","minifiedPath","code","docs","args","Map","arg","forEach","folder","detectPackage","set","err","Array","from","values","tsconfigPath","existsSync","content","applyTsConfigOption","JSON","stringify","parse","reduce","acc","readPackageNpmManifest","packageDependencies","packageName","packageData","devDependencies","peerDependencies","filter","unshift","bannerParts","text","details","version","commit","commitDirty","date","toISOString","detailsText","bannerText"],"mappings":";;;;;;;;;;AAAO,MAAMA,iBAAiB,GAAG,CAChCC,IAAY,EACZC,IAAY,EACZC,KAAc,EACdC,KAAc,KACV;AACJ,EAAA,MAAMC,SAAS,GAAGD,KAAK,KAAKE,SAAS,GAAGA,SAAS,GAAGF,KAAK,CAACG,QAAQ,EAAE,CAACC,MAAM,CAAA;EAE3E,MAAMC,WAAW,GAChBL,KAAK,KAAKE,SAAS,IAAIF,KAAK,GAAG,CAAC,GAC7B,EAAE,GACD,CAAA,EAAED,KAAK,CAAEI,QAAQ,EAAE,CAACG,QAAQ,CAACL,SAAS,EAAG,GAAG,CAAE,CAAGD,CAAAA,EAAAA,KAAM,CAAE,CAAA,CAAA,CAAA;EAE9D,MAAMO,gBAAgB,GAAI,CAAA,EAAEF,WAAY,CAAA,EAAER,IAAI,CAACW,MAAM,CAAC,EAAE,CAAE,CAAC,CAAA,CAAA;EAE3DC,OAAO,CAACC,GAAG,CAAE,CAAA,E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,SAAA,EAAWuB,MAAM,CAAC2C,OAAQ,EAAC,CAAC,CAAA;AAC3C,KAAA;IACA,IAAI3C,MAAM,CAAC4C,MAAM,EAAE;MAClB,IAAI5C,MAAM,CAAC6C,WAAW,EAAE;QACvBH,OAAO,CAACjE,IAAI,CAAE,CAAA,QAAA,EAAUuB,MAAM,CAAC4C,MAAO,UAAS,CAAC,CAAA;AACjD,OAAC,MAAM;QACNF,OAAO,CAACjE,IAAI,CAAE,CAAA,QAAA,EAAUuB,MAAM,CAAC4C,MAAO,EAAC,CAAC,CAAA;AACzC,OAAA;AACD,KAAA;IACA,IAAI5C,MAAM,CAAC8C,IAAI,EAAE;MAChBJ,OAAO,CAACjE,IAAI,CAAE,CAAQuB,MAAAA,EAAAA,MAAM,CAAC8C,IAAI,CAACC,WAAW,EAAG,CAAA,CAAC,CAAC,CAAA;AACnD,KAAA;AAEA,IAAA,MAAMC,WAAW,GAAGN,OAAO,CAAChH,GAAG,CAAEO,IAAI,IAAM,CAAKA,GAAAA,EAAAA,IAAK,EAAC,CAAC,CAAChD,IAAI,CAAC,IAAI,CAAC,CAAA;AAClE,IAAA,IAAI+J,WAAW,EAAE;AAChBR,MAAAA,WAAW,CAAC/D,IAAI,CAACuE,WAAW,CAAC,CAAA;AAC9B,KAAA;AACD,GAAA;AAEA,EAAA,MAAMC,UAAU,GAAGT,WAAW,CAACvJ,IAAI,CAAC,MAAM,CAAC,CAAA;AAE3C,EAAA,IAAIgK,UAAU,EAAE;IACf,OAAQ,CAAA;AACV,EAAEA,UAAW,CAAA;AACb;AACA;AACA,EAAG,CAAA,CAAA;AACF,GAAA;AAEA,EAAA,OAAO/K,SAAS,CAAA;AACjB,CAAC;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import ts from 'typescript';
|
|
3
|
-
import { k as writePackageCreatorIndex } from '
|
|
4
|
-
import { g as getPackageTypescriptFiles } from '
|
|
3
|
+
import { k as writePackageCreatorIndex } from '../cli.mjs';
|
|
4
|
+
import { g as getPackageTypescriptFiles } from '../scripts.mjs';
|
|
5
5
|
import 'update-notifier';
|
|
6
6
|
import 'fs';
|
|
7
7
|
import 'path';
|
|
@@ -132,10 +132,10 @@ function findParametersInterfaceInFiles(program, fileList, name) {
|
|
|
132
132
|
return undefined;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
/**
|
|
136
|
-
* Extracts and returns script array for _Index.json from a src folder
|
|
137
|
-
*
|
|
138
|
-
* @param folderPath path to a src folder
|
|
135
|
+
/**
|
|
136
|
+
* Extracts and returns script array for _Index.json from a src folder
|
|
137
|
+
*
|
|
138
|
+
* @param folderPath path to a src folder
|
|
139
139
|
*/
|
|
140
140
|
function extract(location, ignore = []) {
|
|
141
141
|
const files = getPackageTypescriptFiles(location);
|
|
@@ -189,4 +189,4 @@ function extract(location, ignore = []) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
export { extract };
|
|
192
|
-
//# sourceMappingURL=generate.mjs.map
|
|
192
|
+
//# sourceMappingURL=generate.ts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.ts.mjs","sources":["../../src/commands/generate.ts"],"sourcesContent":["import ts from \"typescript\";\n\nimport {\n\tPackageLocation,\n\twritePackageCreatorIndex,\n\treadPackageCreatorIndex,\n} from \"../lib/package\";\nimport { getPackageTypescriptFiles } from \"../lib/scripts\";\nimport {\n\tCreatorIndexEntry,\n\tCreatorIndexParameter,\n\tCreatorIndexParameterType,\n} from \"../lib/package\";\n\nfunction findTsNode<T extends ts.Node>(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => node is T,\n): T | undefined;\nfunction findTsNode(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => boolean,\n): ts.Node | undefined;\nfunction findTsNode(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => boolean,\n): ts.Node | undefined {\n\tlet result: ts.Node | undefined;\n\n\tts.forEachChild(node, (child) => {\n\t\tif (callback(child)) {\n\t\t\tresult = child;\n\t\t\treturn true;\n\t\t}\n\t});\n\n\treturn result;\n}\n\nfunction capitalizeFirstLetter(string) {\n\treturn string?.charAt(0).toUpperCase() + string?.slice(1);\n}\n\nfunction parseDefault(value: string, type: string) {\n\tconst uType: CreatorIndexParameterType = capitalizeFirstLetter(type);\n\tif (value === \"null\") return null;\n\tswitch (uType) {\n\t\tcase \"LengthM\":\n\t\tcase \"ArcDEG\":\n\t\tcase \"Float\":\n\t\t\treturn parseFloat(value);\n\t\tcase \"Integer\":\n\t\tcase \"Int\":\n\t\t\treturn parseInt(value);\n\t\tcase \"Boolean\":\n\t\tcase \"Bool\":\n\t\t\treturn value === \"true\";\n\t\tcase \"Material\":\n\t\tcase \"String\":\n\t\tdefault:\n\t\t\treturn value.replace(/^\"/, \"\").replace(/\"$/, \"\");\n\t}\n}\n\nfunction findEvaluatorNode(node: ts.Node): ts.ClassDeclaration | undefined {\n\tif (\n\t\tts.isModuleDeclaration(node) &&\n\t\tnode.body &&\n\t\tts.isModuleDeclaration(node.body) &&\n\t\tnode.body.body\n\t) {\n\t\tconst classDeclaration = findTsNode(\n\t\t\tnode.body.body,\n\t\t\t(child): child is ts.ClassDeclaration => {\n\t\t\t\tif (!ts.isClassDeclaration(child)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst isEvaluator = child.heritageClauses?.some((clause) => {\n\t\t\t\t\tif (clause.token !== ts.SyntaxKind.ExtendsKeyword) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn clause.types.some((type) =>\n\t\t\t\t\t\ttype.getText().includes(\"Evaluator\"),\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\treturn isEvaluator ?? false;\n\t\t\t},\n\t\t);\n\n\t\treturn classDeclaration;\n\t}\n}\n\nfunction getParameter(evaluatorNode: ts.ClassDeclaration) {\n\tlet memb = evaluatorNode.members?.find(\n\t\t(member) => member?.name?.getText().toLowerCase() == \"create\",\n\t);\n\tif (ts.isMethodDeclaration(memb!)) {\n\t\treturn memb.parameters.find(\n\t\t\t(para) => para.name.getText().toLowerCase() == \"parameters\",\n\t\t);\n\t}\n}\n\nfunction findParametersInterface(\n\tnode: ts.Node,\n\tinterfaceName: string,\n): ts.InterfaceDeclaration | undefined {\n\tif (\n\t\tts.isModuleDeclaration(node) &&\n\t\tnode.body &&\n\t\tts.isModuleDeclaration(node.body) &&\n\t\tnode.body.body\n\t) {\n\t\tconst interfaceDeclaration = findTsNode(\n\t\t\tnode.body.body,\n\t\t\t(child): child is ts.InterfaceDeclaration =>\n\t\t\t\tts.isInterfaceDeclaration(child) &&\n\t\t\t\tchild.name.getText() == interfaceName,\n\t\t);\n\n\t\treturn interfaceDeclaration;\n\t}\n\n\treturn undefined;\n}\n\nfunction getModuleName(sourceFile: ts.Node): string {\n\tlet fullName = \"\";\n\tif (ts.isModuleDeclaration(sourceFile)) {\n\t\tfullName += sourceFile.name.getText();\n\n\t\tlet packageB = sourceFile.body!;\n\t\tif (ts.isModuleDeclaration(packageB)) {\n\t\t\tfullName += \".\" + packageB.name.getText();\n\t\t}\n\t}\n\treturn fullName;\n}\n\nfunction genParameters(\n\tinterfac: ts.InterfaceDeclaration,\n): CreatorIndexParameter[] {\n\treturn interfac.members.map((member, i) => {\n\t\tlet para = {} as CreatorIndexParameter;\n\n\t\tpara.Name = member.name!.getText();\n\t\tif (para.Name.length > 45)\n\t\t\tthrow new Error(`Parameter name length >45 '${para.Name}'`);\n\n\t\tlet rawDocTags = ts.getJSDocTags(member);\n\t\tif (rawDocTags.length) {\n\t\t\tlet dict = getTagDict(rawDocTags);\n\t\t\tif (dict.summary) para.Description = dict.summary;\n\t\t\tif (dict.creatorType)\n\t\t\t\tpara.Type = dict.creatorType as CreatorIndexParameterType;\n\t\t\tif (dict.default && dict.creatorType)\n\t\t\t\tpara.Default = parseDefault(dict.default, dict.creatorType);\n\t\t\tpara.DisplayIndex = i + 1;\n\t\t}\n\t\treturn para;\n\t});\n}\n\ninterface IDocTags {\n\tdefault?: string;\n\tcreatorType?: string;\n\tsummary?: string;\n}\n\nfunction getTagDict(tags: any): IDocTags {\n\tlet dict = {};\n\ttags.forEach((tag) => {\n\t\tdict[tag.tagName.text] = tag.comment;\n\t});\n\treturn dict;\n}\n\nfunction findParametersInterfaceInFiles(\n\tprogram: ts.Program,\n\tfileList: string[],\n\tname: string,\n): ts.InterfaceDeclaration | undefined {\n\tfor (const file of fileList) {\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\tif (sourceFile === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`Expected a source file to exist for file name \"${file}\"`,\n\t\t\t);\n\t\t}\n\n\t\tlet interfaceDeclaration: ts.InterfaceDeclaration | undefined;\n\n\t\tts.forEachChild(sourceFile, (node) => {\n\t\t\tinterfaceDeclaration = findParametersInterface(node, name);\n\n\t\t\treturn interfaceDeclaration !== undefined;\n\t\t});\n\n\t\tif (interfaceDeclaration !== undefined) {\n\t\t\treturn interfaceDeclaration;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Extracts and returns script array for _Index.json from a src folder\n *\n * @param folderPath path to a src folder\n */\nexport function extract(location: PackageLocation, ignore: string[] = []) {\n\tconst files = getPackageTypescriptFiles(location);\n\tconst filtered = files.filter((path) => {\n\t\treturn !ignore.some((suffix) => path.endsWith(suffix));\n\t});\n\tlet arr = new Array<CreatorIndexEntry>();\n\n\tlet program = ts.createProgram(filtered, { allowJs: true });\n\tprogram.getTypeChecker();\n\tfiltered.forEach((file) => {\n\t\t// Create a Program to represent the project, then pull out the\n\t\t// source file to parse its AST.\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\t// Loop through the root AST nodes of the file\n\t\tts.forEachChild(sourceFile!, (node) => {\n\t\t\tconst evalNode = findEvaluatorNode(node);\n\n\t\t\tif (evalNode === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet moduleName = getModuleName(node);\n\n\t\t\tif (evalNode.name === undefined) {\n\t\t\t\tthrow new Error(`Expected evaluator class to have a name`);\n\t\t\t}\n\n\t\t\tconst name = moduleName + \".\" + evalNode.name.getText();\n\n\t\t\tif (name.length > 45)\n\t\t\t\tthrow new Error(`Package name length >45 '${name}'`);\n\n\t\t\tlet para = getParameter(evalNode);\n\t\t\tlet paraName = (para?.type as any).typeName.getText();\n\t\t\tlet interfac = findParametersInterfaceInFiles(\n\t\t\t\tprogram,\n\t\t\t\tfiltered,\n\t\t\t\tparaName,\n\t\t\t);\n\n\t\t\tif (interfac === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to find parameters type declaration for evaluator ${evalNode.name.getText()}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst obj: CreatorIndexEntry = {\n\t\t\t\tName: name,\n\t\t\t\tParameters: [],\n\t\t\t\tType: \"Evaluator\",\n\t\t\t};\n\n\t\t\tlet rawDocTags = ts.getJSDocTags(evalNode);\n\t\t\tif (rawDocTags.length) {\n\t\t\t\tlet dict = getTagDict(rawDocTags);\n\t\t\t\tif (dict.summary) obj.Description = dict.summary;\n\t\t\t\tif (dict.creatorType)\n\t\t\t\t\tobj.Type = dict.creatorType as \"Interactor\" | \"Evaluator\";\n\t\t\t}\n\n\t\t\tobj.Parameters = genParameters(interfac);\n\n\t\t\tarr.push(obj);\n\t\t});\n\t});\n\n\twritePackageCreatorIndex(location, arr);\n}\n"],"names":["findTsNode","node","callback","result","ts","forEachChild","child","capitalizeFirstLetter","string","charAt","toUpperCase","slice","parseDefault","value","type","uType","parseFloat","parseInt","replace","findEvaluatorNode","isModuleDeclaration","body","classDeclaration","isClassDeclaration","isEvaluator","heritageClauses","some","clause","token","SyntaxKind","ExtendsKeyword","types","getText","includes","getParameter","evaluatorNode","memb","members","find","member","name","toLowerCase","isMethodDeclaration","parameters","para","findParametersInterface","interfaceName","interfaceDeclaration","isInterfaceDeclaration","undefined","getModuleName","sourceFile","fullName","packageB","genParameters","interfac","map","i","Name","length","Error","rawDocTags","getJSDocTags","dict","getTagDict","summary","Description","creatorType","Type","default","Default","DisplayIndex","tags","forEach","tag","tagName","text","comment","findParametersInterfaceInFiles","program","fileList","file","getSourceFile","extract","location","ignore","files","getPackageTypescriptFiles","filtered","filter","path","suffix","endsWith","arr","Array","createProgram","allowJs","getTypeChecker","evalNode","moduleName","paraName","typeName","obj","Parameters","push","writePackageCreatorIndex"],"mappings":";;;;;;;;;;;;;;AAsBA,SAASA,UAAU,CAClBC,IAAa,EACbC,QAAoC,EACd;AACtB,EAAA,IAAIC,MAA2B,CAAA;AAE/BC,EAAAA,EAAE,CAACC,YAAY,CAACJ,IAAI,EAAGK,KAAK,IAAK;AAChC,IAAA,IAAIJ,QAAQ,CAACI,KAAK,CAAC,EAAE;AACpBH,MAAAA,MAAM,GAAGG,KAAK,CAAA;AACd,MAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AACD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,MAAM,CAAA;AACd,CAAA;AAEA,SAASI,qBAAqB,CAACC,MAAM,EAAE;EACtC,OAAO,CAAAA,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,KAAGF,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEG,KAAK,CAAC,CAAC,CAAC,CAAA,CAAA;AAC1D,CAAA;AAEA,SAASC,YAAY,CAACC,KAAa,EAAEC,IAAY,EAAE;AAClD,EAAA,MAAMC,KAAgC,GAAGR,qBAAqB,CAACO,IAAI,CAAC,CAAA;AACpE,EAAA,IAAID,KAAK,KAAK,MAAM,EAAE,OAAO,IAAI,CAAA;AACjC,EAAA,QAAQE,KAAK;AACZ,IAAA,KAAK,SAAS,CAAA;AACd,IAAA,KAAK,QAAQ,CAAA;AACb,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AE,CAAC0D,YAAY,CAACoC,QAAQ,CAAC,CAAA;MAC1C,IAAIrC,UAAU,CAACF,MAAM,EAAE;AACtB,QAAA,IAAII,IAAI,GAAGC,UAAU,CAACH,UAAU,CAAC,CAAA;QACjC,IAAIE,IAAI,CAACE,OAAO,EAAEqC,GAAG,CAACpC,WAAW,GAAGH,IAAI,CAACE,OAAO,CAAA;QAChD,IAAIF,IAAI,CAACI,WAAW,EACnBmC,GAAG,CAAClC,IAAI,GAAGL,IAAI,CAACI,WAAyC,CAAA;AAC3D,OAAA;AAEAmC,MAAAA,GAAG,CAACC,UAAU,GAAGjD,aAAa,CAACC,QAAQ,CAAC,CAAA;AAExCsC,MAAAA,GAAG,CAACW,IAAI,CAACF,GAAG,CAAC,CAAA;AACd,KAAC,CAAC,CAAA;AACH,GAAC,CAAC,CAAA;AAEFG,EAAAA,wBAAwB,CAACrB,QAAQ,EAAES,GAAG,CAAC,CAAA;AACxC;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
import { f as readWorkspaceNpmManifest, l as getWorkspaceLibPath } from '
|
|
5
|
-
import { d as determineWorkspaceIGLibraries, a as readPublishedPackageNpmManifest } from '
|
|
4
|
+
import { f as readWorkspaceNpmManifest, l as getWorkspaceLibPath } from '../cli.mjs';
|
|
5
|
+
import { d as determineWorkspaceIGLibraries, a as readPublishedPackageNpmManifest } from '../dependencies.mjs';
|
|
6
6
|
import 'update-notifier';
|
|
7
7
|
import 'yargs/yargs';
|
|
8
8
|
import 'url';
|
|
@@ -49,4 +49,4 @@ const executePostInstall = workspace => {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export { executePostInstall };
|
|
52
|
-
//# sourceMappingURL=postinstall.mjs.map
|
|
52
|
+
//# sourceMappingURL=postinstall.ts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postinstall.ts.mjs","sources":["../../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport {\n\tgetWorkspaceLibPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { readPublishedPackageNpmManifest } from \"../lib/publishedPackage\";\nimport { determineWorkspaceIGLibraries } from \"../lib/dependencies\";\n\nconst DEFINITION_FILE_HINT =\n\t\"// This file is automatically managed by the ig.gfx.packager.\";\n\nexport const executePostInstall = (workspace: WorkspaceLocation) => {\n\tconst manifest = readWorkspaceNpmManifest(workspace);\n\n\tif (manifest === undefined) {\n\t\tthrow new Error(`Expected an npm manifest to exist.`);\n\t}\n\n\tconst libPath = getWorkspaceLibPath(workspace);\n\n\tfs.mkdirSync(libPath, { recursive: true });\n\n\tconst existingDefinitions = fs.readdirSync(libPath);\n\n\t// delete all existing definition files that are managed by the packager.\n\t// we'll recreate all needed definitions in the next step.\n\tfor (const existingDefinitionName of existingDefinitions) {\n\t\tconst content = fs.readFileSync(\n\t\t\tpath.join(libPath, existingDefinitionName),\n\t\t\t{ encoding: \"utf-8\" },\n\t\t);\n\n\t\tif (content.startsWith(DEFINITION_FILE_HINT)) {\n\t\t\tfs.rmSync(path.join(libPath, existingDefinitionName));\n\t\t}\n\t}\n\n\tconst libraryLocations = determineWorkspaceIGLibraries(workspace);\n\n\tfor (const location of libraryLocations) {\n\t\tconst manifest = readPublishedPackageNpmManifest(location);\n\n\t\t// add a hint to the top of the file so we know it's managed by the packager.\n\t\tconst content = `${DEFINITION_FILE_HINT}\n// This is a reference to version ${manifest.version}.\n// Run \"npm install\" to install the types if they are missing or not up to date.\n/// <reference types=\"${manifest.name}\" />`;\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(getWorkspaceLibPath(workspace), manifest.types),\n\t\t\tcontent,\n\t\t\t{\n\t\t\t\tencoding: \"utf8\",\n\t\t\t},\n\t\t);\n\t}\n};\n"],"names":["DEFINITION_FILE_HINT","executePostInstall","workspace","manifest","readWorkspaceNpmManifest","undefined","Error","libPath","getWorkspaceLibPath","fs","mkdirSync","recursive","existingDefinitions","readdirSync","existingDefinitionName","content","readFileSync","path","join","encoding","startsWith","rmSync","libraryLocations","determineWorkspaceIGLibraries","location","readPublishedPackageNpmManifest","version","name","writeFileSync","types"],"mappings":";;;;;;;;;;;;;AAWA,MAAMA,oBAAoB,GACzB,+DAA+D,CAAA;AAEnDC,MAAAA,kBAAkB,GAAIC,SAA4B,IAAK;AACnE,EAAA,MAAMC,QAAQ,GAAGC,wBAAwB,CAACF,SAAS,CAAC,CAAA;EAEpD,IAAIC,QAAQ,KAAKE,SAAS,EAAE;AAC3B,IAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,kCAAA,CAAmC,CAAC,CAAA;AACtD,GAAA;AAEA,EAAA,MAAMC,OAAO,GAAGC,mBAAmB,CAACN,SAAS,CAAC,CAAA;AAE9CO,EAAAA,EAAE,CAACC,SAAS,CAACH,OAAO,EAAE;AAAEI,IAAAA,SAAS,EAAE,IAAA;AAAK,GAAC,CAAC,CAAA;AAE1C,EAAA,MAAMC,mBAAmB,GAAGH,EAAE,CAACI,WAAW,CAACN,OAAO,CAAC,CAAA;;AAEnD;AACA;AACA,EAAA,KAAK,MAAMO,sBAAsB,IAAIF,mBAAmB,EAAE;AACzD,IAAA,MAAMG,OAAO,GAAGN,EAAE,CAACO,YAAY,CAC9BC,IAAI,CAACC,IAAI,CAACX,OAAO,EAAEO,sBAAsB,CAAC,EAC1C;AAAEK,MAAAA,QAAQ,EAAE,OAAA;AAAQ,KAAC,CACrB,CAAA;AAED,IAAA,IAAIJ,OAAO,CAACK,UAAU,CAACpB,oBAAoB,CAAC,EAAE;MAC7CS,EAAE,CAACY,MAAM,CAACJ,IAAI,CAACC,IAAI,CAACX,OAAO,EAAEO,sBAAsB,CAAC,CAAC,CAAA;AACtD,KAAA;AACD,GAAA;AAEA,EAAA,MAAMQ,gBAAgB,GAAGC,6BAA6B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