@intelligentgraphics/ig.gfx.packager 3.0.0-alpha.6 → 3.0.0-alpha.8

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 CHANGED
@@ -6,7 +6,7 @@ import { dirname } from 'path';
6
6
  import yargs from 'yargs/yargs';
7
7
  import { fileURLToPath } from 'url';
8
8
  import y18n from 'y18n';
9
- import writePkg from 'write-pkg';
9
+ import { writePackageSync } from 'write-pkg';
10
10
  import inquirer from 'inquirer';
11
11
 
12
12
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -40,13 +40,13 @@ const readNpmManifest = directory => {
40
40
  };
41
41
  const writeNpmManifest = (directory, packageJson) => {
42
42
  const packageJsonPath = path.join(directory, "package.json");
43
- writePkg.sync(packageJsonPath, packageJson);
43
+ writePackageSync(packageJsonPath, packageJson);
44
44
  };
45
45
 
46
46
  // Functionality related to working with a single package.
47
47
  const PACKAGE_FILE = "_Package.json";
48
48
  const INDEX_FILE = "_Index.json";
49
- const ANIMATION_FILE = ".animation.json";
49
+ const ANIMATION_FILE_SUFFIX = ".animation.json";
50
50
 
51
51
  /**
52
52
  * Describes the location of a single package.
@@ -95,8 +95,13 @@ const detectPackage = (workspace, directory) => {
95
95
  manifestDir: directory
96
96
  };
97
97
  }
98
- if (readPackageCreatorManifest(location) === undefined) {
99
- throw new Error(`No _Package.json found in ${location.manifestDir}`);
98
+ try {
99
+ readPackageCreatorManifest(location);
100
+ } catch (err) {
101
+ if (isErrorENOENT(err)) {
102
+ throw new Error(`No _Package.json found in ${location.manifestDir}`);
103
+ }
104
+ throw err;
100
105
  }
101
106
  return location;
102
107
  };
@@ -150,7 +155,7 @@ const readPackageAnimationList = location => {
150
155
  const directoryContent = fs.readdirSync(location.manifestDir);
151
156
  const animationPathList = [];
152
157
  for (const entry of directoryContent) {
153
- if (entry.endsWith(ANIMATION_FILE)) {
158
+ if (entry.endsWith(ANIMATION_FILE_SUFFIX)) {
154
159
  const animationPath = path.join(location.manifestDir, entry);
155
160
  animationPathList.push(animationPath);
156
161
  }
@@ -230,8 +235,8 @@ const createDefaultPrompter = () => {
230
235
  };
231
236
 
232
237
  var name = "@intelligentgraphics/ig.gfx.packager";
233
- var version = "3.0.0-alpha.6";
234
- var description = "IG.GFX.Packager 3.0.0 Alpha 6 (3.0.0.7)";
238
+ var version = "3.0.0-alpha.8";
239
+ var description = "IG.GFX.Packager 3.0.0 Alpha 8 (3.0.0.9)";
235
240
  var author = "Michael Beier <mb@intelligentgraphics.biz>";
236
241
  var main = "build/index.mjs";
237
242
  var type = "module";
@@ -239,7 +244,7 @@ var publishConfig = {
239
244
  access: "public"
240
245
  };
241
246
  var engines = {
242
- node: ">=16.0.0"
247
+ node: ">=16.19.0"
243
248
  };
244
249
  var bin = {
245
250
  packager: "./build/index.mjs"
@@ -257,24 +262,24 @@ var scripts = {
257
262
  format: "prettier --write \"**/*.{ts,tsx,json}\""
258
263
  };
259
264
  var dependencies = {
260
- ajv: "^8.6.2",
261
- axios: "^0.21.1",
262
- "core-js": "^3.16.0",
263
- glob: "^7.1.4",
265
+ ajv: "^8.12.0",
266
+ axios: "^1.2.5",
267
+ "core-js": "^3.27.2",
268
+ glob: "^8.1.0",
264
269
  inquirer: "^9.1.4",
265
- jszip: "^3.10.0",
270
+ jszip: "^3.10.1",
266
271
  lodash: "^4.17.21",
267
272
  resolve: "^1.22.1",
268
- "simple-git": "^3.15.1",
269
- "source-map-support": "^0.5.19",
270
- terser: "^4.8.0",
273
+ "simple-git": "^3.16.0",
274
+ "source-map-support": "^0.5.21",
275
+ terser: "^5.16.1",
271
276
  typedoc: "~0.23.2",
272
277
  typescript: "~4.9.4",
273
- "update-notifier": "^5.1.0",
274
- "v8-compile-cache": "^2.1.1",
275
- "write-pkg": "4",
278
+ "update-notifier": "^6.0.2",
279
+ "v8-compile-cache": "^2.3.0",
280
+ "write-pkg": "^5.1.0",
276
281
  y18n: "^5.0.8",
277
- yargs: "^17.0.1"
282
+ yargs: "^17.6.2"
278
283
  };
279
284
  var devDependencies = {
280
285
  "@babel/preset-env": "^7.18.9",
@@ -283,10 +288,10 @@ var devDependencies = {
283
288
  "@rollup/plugin-commonjs": "^24.0.0",
284
289
  "@rollup/plugin-json": "^6.0.0",
285
290
  "@rollup/plugin-node-resolve": "^15.0.1",
286
- "@types/glob": "^7.1.4",
291
+ "@types/glob": "^8.0.1",
287
292
  "@types/inquirer": "^9.0.3",
288
293
  "@types/node": "^16.4.11",
289
- "@types/update-notifier": "^5.1.0",
294
+ "@types/update-notifier": "^6.0.1",
290
295
  "@types/yargs": "^17.0.2",
291
296
  rollup: "^3.10.0",
292
297
  vitest: "^0.28.1"
@@ -618,5 +623,5 @@ var cli = /*#__PURE__*/Object.freeze({
618
623
  __proto__: null
619
624
  });
620
625
 
621
- export { detectPackage as a, readPackageNpmManifest as b, readPackageAnimationList as c, detectWorkspace as d, readPackageCreatorIndex as e, readWorkspaceNpmManifest as f, getWorkspaceOutputPath as g, getPackageReleasesDirectory as h, isErrorENOENT as i, readNpmManifest as j, writePackageCreatorIndex as k, getWorkspaceLibPath as l, writePackageNpmManifest as m, iterateWorkspacePackages as n, cli as o, parseCreatorPackageName as p, readPackageCreatorManifest as r, translate as t, writePackageCreatorManifest as w };
626
+ 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 };
622
627
  //# 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\";\nimport * as path from \"path\";\nimport { dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst instance = y18n({\n\tdirectory: path.join(__dirname, \"..\", \"locales\"),\n\tupdateFiles: false,\n\tlocale: \"en\",\n\tfallbackToLanguage: true,\n});\n\nexport const setLocale = (locale: string) => {\n\tinstance.setLocale(locale);\n};\n\nexport const translate = (key: string, ...args: string[]) =>\n\tinstance.__(key, ...args);\n","interface NodeError extends Error {\n\tcode: string;\n}\n\nexport const getNodeErrorCode = (error: unknown) => {\n\tif (\n\t\terror !== null &&\n\t\ttypeof error === \"object\" &&\n\t\t(error as NodeError).code !== undefined\n\t) {\n\t\treturn (error as NodeError).code;\n\t}\n};\n\n/**\n * Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.\n *\n * @param {unknown} error\n */\nexport const isErrorEACCES = (error: unknown) =>\n\tgetNodeErrorCode(error) === \"EACCES\";\n\n/**\n * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.\n *\n * @param {unknown} error\n */\nexport const isErrorENOENT = (error: unknown) =>\n\tgetNodeErrorCode(error) === \"ENOENT\";\n","import * as fs from \"fs\";\nimport * as path from \"path\";\nimport writePkg from \"write-pkg\";\n\nimport { PackageJSON } from \"./packageJSON\";\n\nexport const readNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n): T => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\tconst packageJson = fs.readFileSync(packageJsonPath, {\n\t\tencoding: \"utf8\",\n\t});\n\treturn JSON.parse(packageJson);\n};\n\nexport const writeNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n\tpackageJson: T,\n) => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\twritePkg.sync(packageJsonPath, packageJson);\n};\n","// Functionality related to working with a single package.\n\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport { isErrorENOENT } from \"./error\";\nimport { WorkspaceLocation } from \"./workspace\";\nimport { readNpmManifest, writeNpmManifest } from \"./npmPackage\";\nimport { PackageJSON } from \"./packageJSON\";\n\nconst PACKAGE_FILE = \"_Package.json\";\nconst INDEX_FILE = \"_Index.json\";\nconst ANIMATION_FILE = \".animation.json\";\n\n/**\n * Describes the location of a single package.\n *\n * @export\n * @interface PackageLocation\n */\nexport interface PackageLocation {\n\t_kind: \"PackageLocation\";\n\t/**\n\t * Main directory of a package\n\t *\n\t * @type {string}\n\t */\n\tpath: string;\n\t/**\n\t * Directory containing the typescript files\n\t *\n\t * @type {string}\n\t */\n\tscriptsDir: string;\n\t/**\n\t * Diretory containing the _Package.json, _Index.json, package.json and animation.json files\n\t *\n\t * @type {string}\n\t */\n\tmanifestDir: string;\n}\n\nexport interface CreatorPackage {\n\tScope: string;\n\tPackage: string;\n\tRunTime: boolean;\n\tType: \"Interactor\" | \"Mixed\" | \"Core\" | \"Context\" | \"Evaluator\";\n}\n\nexport const parseCreatorPackageName = (manifest: CreatorPackage) => {\n\tconst [domain, ...subdomainParts] = manifest.Package.split(\".\");\n\treturn {\n\t\tdomain,\n\t\tsubdomain: subdomainParts.join(\".\"),\n\t};\n};\n\nexport interface PackageNpmManifest extends PackageJSON {\n\tig?: {\n\t\tscriptingLibrary?: boolean;\n\t};\n}\n\n/**\n * Detects the package at the given directory.\n *\n * @param {string} directory\n * @returns {PackageLocation}\n */\nexport const detectPackage = (\n\tworkspace: WorkspaceLocation,\n\tdirectory: string,\n): PackageLocation => {\n\tdirectory = path.resolve(workspace.path, directory);\n\n\tconst scriptsPath = path.join(directory, \"Scripts\");\n\tconst tsPath = path.join(directory, \"ts\");\n\n\tlet location: PackageLocation;\n\n\tif (fs.existsSync(scriptsPath)) {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: scriptsPath,\n\t\t\tmanifestDir: scriptsPath,\n\t\t};\n\t} else if (fs.existsSync(tsPath)) {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: tsPath,\n\t\t\tmanifestDir: directory,\n\t\t};\n\t} else {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: directory,\n\t\t\tmanifestDir: directory,\n\t\t};\n\t}\n\n\tif (readPackageCreatorManifest(location) === undefined) {\n\t\tthrow new Error(`No _Package.json found in ${location.manifestDir}`);\n\t}\n\n\treturn location;\n};\n\nexport const readPackageCreatorManifest = (\n\tlocation: PackageLocation,\n): CreatorPackage => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tconst packageJson = fs.readFileSync(packageJsonPath, { encoding: \"utf8\" });\n\tconst result: Omit<CreatorPackage, \"Scope\"> & { Scope?: string } =\n\t\tJSON.parse(packageJson);\n\treturn {\n\t\t...result,\n\t\tScope: result.Scope || result.Package,\n\t};\n};\n\nexport const writePackageCreatorManifest = (\n\tlocation: PackageLocation,\n\tcreatorPackage: CreatorPackage,\n) => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tfs.writeFileSync(\n\t\tpackageJsonPath,\n\t\tJSON.stringify(creatorPackage, null, \"\\t\") + \"\\n\",\n\t);\n};\n\nexport const readPackageCreatorIndex = (\n\tlocation: PackageLocation,\n): object | undefined => {\n\ttry {\n\t\tconst indexPath = path.join(location.manifestDir, INDEX_FILE);\n\t\tconst index = fs.readFileSync(indexPath, { encoding: \"utf8\" });\n\t\treturn JSON.parse(index);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writePackageCreatorIndex = (\n\tlocation: PackageLocation,\n\tindex: object,\n) => {\n\tconst packageJsonPath = path.join(location.manifestDir, INDEX_FILE);\n\tfs.writeFileSync(packageJsonPath, JSON.stringify(index, null, \"\\t\") + \"\\n\");\n};\n\nexport const readPackageNpmManifest = (\n\tlocation: PackageLocation,\n): PackageNpmManifest | undefined => {\n\ttry {\n\t\treturn readNpmManifest(location.manifestDir);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writePackageNpmManifest = (\n\tlocation: PackageLocation,\n\tpackageJson: PackageNpmManifest,\n) => {\n\twriteNpmManifest(location.manifestDir, packageJson);\n};\n\nexport const readPackageAnimationList = (location: PackageLocation) => {\n\tconst directoryContent = fs.readdirSync(location.manifestDir);\n\tconst animationPathList: string[] = [];\n\n\tfor (const entry of directoryContent) {\n\t\tif (entry.endsWith(ANIMATION_FILE)) {\n\t\t\tconst animationPath = path.join(location.manifestDir, entry);\n\t\t\tanimationPathList.push(animationPath);\n\t\t}\n\t}\n\n\treturn animationPathList;\n};\n\nexport const getPackageReleasesDirectory = (location: PackageLocation) =>\n\tpath.join(location.path, \"Releases\");\n\nexport const arePackageLocationsEqual = (\n\ta: PackageLocation,\n\tb: PackageLocation,\n) => a.path === b.path;\n","// Functionality related to working with a workspace consisting of multiple packages.\n\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport { PackageJSON } from \"./packageJSON\";\nimport { isErrorENOENT } from \"./error\";\nimport { readNpmManifest, writeNpmManifest } from \"./npmPackage\";\nimport { detectPackage } from \"./package\";\n\n/**\n * Describe the location of a workspace constining of n packages.\n *\n * @export\n * @interface WorkspaceLocation\n */\nexport interface WorkspaceLocation {\n\t_kind: \"WorkspaceLocation\";\n\tpath: string;\n}\n\nexport interface WorkspacePackageJSON extends PackageJSON {\n\tpackager?: { banner?: string };\n}\n\nexport const detectWorkspace = (directory: string): WorkspaceLocation => {\n\tdirectory = path.resolve(process.cwd(), directory);\n\treturn {\n\t\t_kind: \"WorkspaceLocation\",\n\t\tpath: directory,\n\t};\n};\n\nexport const readWorkspaceNpmManifest = (\n\tworkspace: WorkspaceLocation,\n): WorkspacePackageJSON | undefined => {\n\ttry {\n\t\treturn readNpmManifest<WorkspacePackageJSON>(workspace.path);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writeWorkspaceNpmManifest = <T extends WorkspacePackageJSON>(\n\tworkspace: WorkspaceLocation,\n\tpackageJson: T,\n) => writeNpmManifest(workspace.path, packageJson);\n\nexport const getWorkspaceOutputPath = (workspace: WorkspaceLocation) =>\n\tpath.join(workspace.path, \"bin\");\n\nexport const getWorkspaceLibPath = (workspace: WorkspaceLocation) =>\n\tpath.join(workspace.path, \"lib\");\n\nexport function* iterateWorkspacePackages(workspace: WorkspaceLocation) {\n\tconst entries = fs.readdirSync(workspace.path, { withFileTypes: true });\n\n\tfor (const entry of entries) {\n\t\tif (!entry.isDirectory()) {\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tyield detectPackage(workspace, entry.name);\n\t\t} catch {}\n\t}\n}\n","import inquirer from \"inquirer\";\n\nexport interface PrompterQuestion {\n\tmessage: string;\n\toptions: string[];\n\tdefault?: string;\n}\n\nexport interface Prompter {\n\tconfirm(message: string): Promise<boolean>;\n\n\task(question: PrompterQuestion): Promise<string>;\n}\n\nexport const createDefaultPrompter = (): Prompter => {\n\treturn {\n\t\tconfirm: async (message) => {\n\t\t\tconst { confirm } = await inquirer.prompt([\n\t\t\t\t{\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tmessage,\n\t\t\t\t\tname: \"confirm\",\n\t\t\t\t},\n\t\t\t]);\n\t\t\treturn confirm as boolean;\n\t\t},\n\n\t\task: async (question) => {\n\t\t\tconst { answer } = await inquirer.prompt([\n\t\t\t\t{\n\t\t\t\t\ttype: \"list\",\n\t\t\t\t\tmessage: question.message,\n\t\t\t\t\tname: \"answer\",\n\t\t\t\t\tchoices: question.options,\n\t\t\t\t\tdefault: question.default,\n\t\t\t\t},\n\t\t\t]);\n\t\t\treturn answer as string;\n\t\t},\n\t};\n};\n","import updateNotifier from \"update-notifier\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport yargs from \"yargs/yargs\";\nimport * as yargsTypes from \"yargs\";\nimport { fileURLToPath } from \"url\";\n\nimport { translate } from \"./lib/localization\";\nimport { Authentication } from \"./lib/authentication\";\nimport { detectPackage } from \"./lib/package\";\nimport {\n\tdetectWorkspace,\n\treadWorkspaceNpmManifest,\n\twriteWorkspaceNpmManifest,\n} from \"./lib/workspace\";\nimport type { ReleaseFolderOptions } from \"./commands/publish\";\nimport { createDefaultPrompter } from \"./lib/prompter\";\n\nimport pjson from \"../package.json\";\n\nconst __filename = fileURLToPath(import.meta.url);\n\nconst captureError = (err: Error) => {\n\tconsole.log(\"\");\n\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconsole.error(err);\n\t} else {\n\t\tconsole.error(translate(\"messages.error\", err.message));\n\t}\n};\n\nconst buildOptions = {\n\toutDir: {\n\t\tdescription: translate(\"options.outDir.description\"),\n\t\ttype: \"string\",\n\t\tdefault: \"bin\",\n\t\tcoerce: (input: string | undefined | null) =>\n\t\t\tinput === undefined || input === null\n\t\t\t\t? undefined\n\t\t\t\t: path.resolve(process.cwd(), input),\n\t},\n\tminimize: {\n\t\tdescription: translate(\"options.minimize.description\"),\n\t\ttype: \"boolean\",\n\t\tdefault: true,\n\t},\n\tcwd: {\n\t\tdescription: translate(\"options.cwd.description\"),\n\t\ttype: \"string\",\n\t\tdefault: process.cwd(),\n\t},\n\tclean: {\n\t\tdescription: translate(\"options.clean.description\"),\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t},\n\tdocs: {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t},\n} as const;\n\nconst preCommandCheck = async () => {\n\t// \tconst executedLocalPackager =\n\t// \t\tpath.relative(process.cwd(), __filename).indexOf(\"..\") === -1;\n\n\t// \tlet repositoryPackage:\n\t// \t\t| {\n\t// \t\t\t\tdependencies?: Record<string, string>;\n\t// \t\t\t\tdevDependencies?: Record<string, string>;\n\t// \t\t }\n\t// \t\t| undefined;\n\n\t// \ttry {\n\t// \t\tconst repositoryPackageJson = fs.readFileSync(\n\t// \t\t\tpath.resolve(process.cwd(), \"package.json\"),\n\t// \t\t\t\"utf8\",\n\t// \t\t);\n\n\t// \t\trepositoryPackage = JSON.parse(repositoryPackageJson);\n\t// \t} catch (err) {}\n\n\t// \tif (\n\t// \t\trepositoryPackage?.dependencies?.[\n\t// \t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t// \t\t] ||\n\t// \t\trepositoryPackage?.devDependencies?.[\n\t// \t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t// \t\t]\n\t// \t) {\n\t// \t\tconst parts = [\"Detected locally installed ig.gfx.packager.\"];\n\n\t// \t\tif (executedLocalPackager) {\n\t// \t\t\tparts.push(\n\t// \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\t);\n\t// \t\t}\n\t// \t\tparts.push(\n\t// \t\t\t'Run \"npm uninstall @intelligentgraphics/ig.gfx.packager\" to remove the local version.',\n\t// \t\t);\n\n\t// \t\tconsole.error(parts.join(\"\\n\"));\n\t// \t\tprocess.exit(1);\n\t// \t}\n\n\t// \tif (executedLocalPackager) {\n\t// \t\tconsole.error(`Detected locally installed ig.gfx.packager.\n\t// Run \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.\n\t// Run \"npm install\" to get rid of the local packager version.`);\n\t// \t\tprocess.exit(1);\n\t// \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: false,\n\t\tdefer: true,\n\t});\n\n\tconst workspaceLocation = detectWorkspace(process.cwd());\n\n\tconst packageJson = readWorkspaceNpmManifest(workspaceLocation);\n\n\tif (packageJson === undefined) {\n\t\tthrow new Error(\n\t\t\t\"Could not load package.json file in current directory\",\n\t\t);\n\t}\n\n\tpackageJson.scripts ??= {};\n\tpackageJson.scripts.postinstall = \"packager postinstall\";\n\n\twriteWorkspaceNpmManifest(workspaceLocation, packageJson);\n};\n\nconst yargsInstance = yargs(process.argv.slice(2));\n\nyargsInstance.command(\n\t\"build [directories...]\",\n\t\"Builds the specified directories\",\n\t(argv) => argv.options(buildOptions),\n\tasync ({ directories = [], ...options }) => {\n\t\tawait preCommandCheck();\n\n\t\tconst { buildFolders } = await import(\"./commands/build\");\n\n\t\tawait buildFolders({\n\t\t\t...options,\n\t\t\tdirectories: directories as string[],\n\t\t}).catch(captureError);\n\t},\n);\n\nyargsInstance.command(\n\t\"publish [directory]\",\n\t\"Publishes the specified directory\",\n\t(argv) =>\n\t\targv.options({\n\t\t\t...buildOptions,\n\t\t\tnoUpload: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.noUpload.description\"),\n\t\t\t},\n\t\t\tdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.domain.description\"),\n\t\t\t},\n\t\t\tsubdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.subdomain.description\"),\n\t\t\t},\n\t\t\tnewVersion: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.newVersion.description\"),\n\t\t\t\tdefault: process.env.VERSION,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\taddress: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.address.description\"),\n\t\t\t\tdefault: \"localhost\",\n\t\t\t},\n\t\t\tservice: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.service.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_ASSET_SERVICE,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\tuser: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.user.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_USER,\n\t\t\t},\n\t\t\tpassword: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.password.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_PWD,\n\t\t\t},\n\t\t\tdocs: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.docs.description\"),\n\t\t\t},\n\t\t\tpushOnly: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.pushOnly.description\"),\n\t\t\t},\n\t\t\tlicense: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.license.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_LICENSE,\n\t\t\t},\n\t\t}),\n\tasync ({ directory, user, password, service, license, ...options }) => {\n\t\tawait preCommandCheck();\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!service) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\ttranslate(\n\t\t\t\t\t\t\t\"options.service.demands\",\n\t\t\t\t\t\t\t\"IG_GFX_ASSET_SERVICE\",\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!license && (!user || !password)) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected authentication to be provided through either of the following methods:\n\t - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable\n\t - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (license && !license.endsWith(\".iglic\")) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected the license path to end with the extension .iglic. Received the path \"${license}\". You may need to reload your environment variables by restarting the program you're using to execute the packager.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlet authentication: Authentication | undefined;\n\n\t\tif (license) {\n\t\t\tconst fullLicensePath = path.resolve(process.cwd(), license);\n\t\t\ttry {\n\t\t\t\tconst content = fs.readFileSync(fullLicensePath);\n\t\t\t\tauthentication = {\n\t\t\t\t\ttype: \"license\",\n\t\t\t\t\tlicense: content.toString(\"base64\"),\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tif (err?.code === \"ENOENT\") {\n\t\t\t\t\tcaptureError(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Expected to find a license file at path: ${fullLicensePath}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Failed to read license file at path: ${fullLicensePath}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (user && password) {\n\t\t\tconsole.log(\n\t\t\t\t`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`,\n\t\t\t);\n\t\t\tauthentication = {\n\t\t\t\ttype: \"credentials\",\n\t\t\t\tusername: user,\n\t\t\t\tpassword,\n\t\t\t};\n\t\t}\n\n\t\tconst { releaseFolder } = await import(\"./commands/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","readNpmManifest","packageJsonPath","packageJson","fs","readFileSync","encoding","JSON","parse","writeNpmManifest","writePkg","sync","PACKAGE_FILE","INDEX_FILE","ANIMATION_FILE","parseCreatorPackageName","manifest","domain","subdomainParts","Package","split","subdomain","detectPackage","workspace","resolve","scriptsPath","tsPath","location","existsSync","_kind","scriptsDir","manifestDir","readPackageCreatorManifest","Error","result","Scope","writePackageCreatorManifest","creatorPackage","writeFileSync","stringify","readPackageCreatorIndex","indexPath","index","err","writePackageCreatorIndex","readPackageNpmManifest","writePackageNpmManifest","readPackageAnimationList","directoryContent","readdirSync","animationPathList","entry","endsWith","animationPath","push","getPackageReleasesDirectory","detectWorkspace","process","cwd","readWorkspaceNpmManifest","writeWorkspaceNpmManifest","getWorkspaceOutputPath","getWorkspaceLibPath","iterateWorkspacePackages","entries","withFileTypes","isDirectory","name","createDefaultPrompter","confirm","message","inquirer","prompt","type","ask","question","answer","choices","options","default","captureError","console","log","env","NODE_ENV","buildOptions","outDir","description","coerce","input","minimize","clean","docs","preCommandCheck","notifier","updateNotifier","pkg","pjson","shouldNotifyInNpmScript","updateCheckInterval","notify","isGlobal","defer","workspaceLocation","scripts","postinstall","yargsInstance","yargs","argv","slice","command","directories","buildFolders","catch","noUpload","newVersion","VERSION","required","address","service","IG_GFX_ASSET_SERVICE","user","IG_GFX_USER","password","IG_GFX_PWD","pushOnly","license","IG_GFX_LICENSE","authentication","fullLicensePath","content","toString","username","releaseFolder","prompter","fullOptions","banner","builder","option","handler","ignore","extract","executePostInstall","describe","dryRun","publishToNpm","version","demandCommand","pkgConf","showHelpOnFail"],"mappings":";;;;;;;;;;;AAKA,MAAMA,SAAS,GAAGC,OAAO,CAACC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAA;AAEzD,MAAMC,QAAQ,GAAGC,IAAI,CAAC;EACrBC,SAAS,EAAEC,IAAI,CAACC,IAAI,CAACV,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC;AAChDW,EAAAA,WAAW,EAAE,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ization.ts","../src/lib/error.ts","../src/lib/npmPackage.ts","../src/lib/package.ts","../src/lib/workspace.ts","../src/lib/prompter.ts","../src/cli.ts"],"sourcesContent":["import y18n from \"y18n\";\nimport * as path from \"path\";\nimport { dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst instance = y18n({\n\tdirectory: path.join(__dirname, \"..\", \"locales\"),\n\tupdateFiles: false,\n\tlocale: \"en\",\n\tfallbackToLanguage: true,\n});\n\nexport const setLocale = (locale: string) => {\n\tinstance.setLocale(locale);\n};\n\nexport const translate = (key: string, ...args: string[]) =>\n\tinstance.__(key, ...args);\n","interface NodeError extends Error {\n\tcode: string;\n}\n\nexport const getNodeErrorCode = (error: unknown) => {\n\tif (\n\t\terror !== null &&\n\t\ttypeof error === \"object\" &&\n\t\t(error as NodeError).code !== undefined\n\t) {\n\t\treturn (error as NodeError).code;\n\t}\n};\n\n/**\n * Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.\n *\n * @param {unknown} error\n */\nexport const isErrorEACCES = (error: unknown) =>\n\tgetNodeErrorCode(error) === \"EACCES\";\n\n/**\n * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.\n *\n * @param {unknown} error\n */\nexport const isErrorENOENT = (error: unknown) =>\n\tgetNodeErrorCode(error) === \"ENOENT\";\n","import * as fs from \"fs\";\nimport * as path from \"path\";\nimport { writePackageSync } from \"write-pkg\";\n\nimport { PackageJSON } from \"./packageJSON\";\n\nexport const readNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n): T => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\tconst packageJson = fs.readFileSync(packageJsonPath, {\n\t\tencoding: \"utf8\",\n\t});\n\treturn JSON.parse(packageJson);\n};\n\nexport const writeNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n\tpackageJson: T,\n) => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\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\";\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 = fs.readFileSync(packageJsonPath, { encoding: \"utf8\" });\n\tconst result: Omit<CreatorPackage, \"Scope\"> & { Scope?: string } =\n\t\tJSON.parse(packageJson);\n\treturn {\n\t\t...result,\n\t\tScope: result.Scope || result.Package,\n\t};\n};\n\nexport const writePackageCreatorManifest = (\n\tlocation: PackageLocation,\n\tcreatorPackage: CreatorPackage,\n) => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tfs.writeFileSync(\n\t\tpackageJsonPath,\n\t\tJSON.stringify(creatorPackage, null, \"\\t\") + \"\\n\",\n\t);\n};\n\nexport const readPackageCreatorIndex = (\n\tlocation: PackageLocation,\n): CreatorIndex | undefined => {\n\ttry {\n\t\tconst indexPath = path.join(location.manifestDir, INDEX_FILE);\n\t\tconst index = fs.readFileSync(indexPath, { encoding: \"utf8\" });\n\t\treturn JSON.parse(index);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writePackageCreatorIndex = (\n\tlocation: PackageLocation,\n\tindex: 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\";\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\t// \tconst executedLocalPackager =\n\t// \t\tpath.relative(process.cwd(), __filename).indexOf(\"..\") === -1;\n\n\t// \tlet repositoryPackage:\n\t// \t\t| {\n\t// \t\t\t\tdependencies?: Record<string, string>;\n\t// \t\t\t\tdevDependencies?: Record<string, string>;\n\t// \t\t }\n\t// \t\t| undefined;\n\n\t// \ttry {\n\t// \t\tconst repositoryPackageJson = fs.readFileSync(\n\t// \t\t\tpath.resolve(process.cwd(), \"package.json\"),\n\t// \t\t\t\"utf8\",\n\t// \t\t);\n\n\t// \t\trepositoryPackage = JSON.parse(repositoryPackageJson);\n\t// \t} catch (err) {}\n\n\t// \tif (\n\t// \t\trepositoryPackage?.dependencies?.[\n\t// \t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t// \t\t] ||\n\t// \t\trepositoryPackage?.devDependencies?.[\n\t// \t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t// \t\t]\n\t// \t) {\n\t// \t\tconst parts = [\"Detected locally installed ig.gfx.packager.\"];\n\n\t// \t\tif (executedLocalPackager) {\n\t// \t\t\tparts.push(\n\t// \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\t);\n\t// \t\t}\n\t// \t\tparts.push(\n\t// \t\t\t'Run \"npm uninstall @intelligentgraphics/ig.gfx.packager\" to remove the local version.',\n\t// \t\t);\n\n\t// \t\tconsole.error(parts.join(\"\\n\"));\n\t// \t\tprocess.exit(1);\n\t// \t}\n\n\t// \tif (executedLocalPackager) {\n\t// \t\tconsole.error(`Detected locally installed ig.gfx.packager.\n\t// Run \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.\n\t// Run \"npm install\" to get rid of the local packager version.`);\n\t// \t\tprocess.exit(1);\n\t// \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: false,\n\t\tdefer: true,\n\t});\n\n\tconst workspaceLocation = detectWorkspace(process.cwd());\n\n\tconst packageJson = readWorkspaceNpmManifest(workspaceLocation);\n\n\tif (packageJson === undefined) {\n\t\tthrow new Error(\n\t\t\t\"Could not load package.json file in current directory\",\n\t\t);\n\t}\n\n\tpackageJson.scripts ??= {};\n\tpackageJson.scripts.postinstall = \"packager postinstall\";\n\n\twriteWorkspaceNpmManifest(workspaceLocation, packageJson);\n};\n\nconst yargsInstance = yargs(process.argv.slice(2));\n\nyargsInstance.command(\n\t\"build [directories...]\",\n\t\"Builds the specified directories\",\n\t(argv) => argv.options(buildOptions),\n\tasync ({ directories = [], ...options }) => {\n\t\tawait preCommandCheck();\n\n\t\tconst { buildFolders } = await import(\"./commands/build\");\n\n\t\tawait buildFolders({\n\t\t\t...options,\n\t\t\tdirectories: directories as string[],\n\t\t}).catch(captureError);\n\t},\n);\n\nyargsInstance.command(\n\t\"publish [directory]\",\n\t\"Publishes the specified directory\",\n\t(argv) =>\n\t\targv.options({\n\t\t\t...buildOptions,\n\t\t\tnoUpload: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.noUpload.description\"),\n\t\t\t},\n\t\t\tdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.domain.description\"),\n\t\t\t},\n\t\t\tsubdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.subdomain.description\"),\n\t\t\t},\n\t\t\tnewVersion: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.newVersion.description\"),\n\t\t\t\tdefault: process.env.VERSION,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\taddress: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.address.description\"),\n\t\t\t\tdefault: \"localhost\",\n\t\t\t},\n\t\t\tservice: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.service.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_ASSET_SERVICE,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\tuser: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.user.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_USER,\n\t\t\t},\n\t\t\tpassword: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.password.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_PWD,\n\t\t\t},\n\t\t\tdocs: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.docs.description\"),\n\t\t\t},\n\t\t\tpushOnly: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.pushOnly.description\"),\n\t\t\t},\n\t\t\tlicense: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.license.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_LICENSE,\n\t\t\t},\n\t\t}),\n\tasync ({ directory, user, password, service, license, ...options }) => {\n\t\tawait preCommandCheck();\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!service) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\ttranslate(\n\t\t\t\t\t\t\t\"options.service.demands\",\n\t\t\t\t\t\t\t\"IG_GFX_ASSET_SERVICE\",\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!license && (!user || !password)) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected authentication to be provided through either of the following methods:\n\t - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable\n\t - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (license && !license.endsWith(\".iglic\")) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected the license path to end with the extension .iglic. Received the path \"${license}\". You may need to reload your environment variables by restarting the program you're using to execute the packager.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlet authentication: Authentication | undefined;\n\n\t\tif (license) {\n\t\t\tconst fullLicensePath = path.resolve(process.cwd(), license);\n\t\t\ttry {\n\t\t\t\tconst content = fs.readFileSync(fullLicensePath);\n\t\t\t\tauthentication = {\n\t\t\t\t\ttype: \"license\",\n\t\t\t\t\tlicense: content.toString(\"base64\"),\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tif (err?.code === \"ENOENT\") {\n\t\t\t\t\tcaptureError(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Expected to find a license file at path: ${fullLicensePath}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Failed to read license file at path: ${fullLicensePath}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (user && password) {\n\t\t\tconsole.log(\n\t\t\t\t`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`,\n\t\t\t);\n\t\t\tauthentication = {\n\t\t\t\ttype: \"credentials\",\n\t\t\t\tusername: user,\n\t\t\t\tpassword,\n\t\t\t};\n\t\t}\n\n\t\tconst { releaseFolder } = await import(\"./commands/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","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","captureError","console","log","env","NODE_ENV","buildOptions","outDir","description","coerce","input","minimize","clean","docs","preCommandCheck","notifier","updateNotifier","pkg","pjson","shouldNotifyInNpmScript","updateCheckInterval","notify","isGlobal","defer","workspaceLocation","scripts","postinstall","yargsInstance","yargs","argv","slice","command","directories","buildFolders","catch","noUpload","newVersion","VERSION","required","address","service","IG_GFX_ASSET_SERVICE","user","IG_GFX_USER","password","IG_GFX_PWD","pushOnly","license","IG_GFX_LICENSE","authentication","fullLicensePath","content","toString","username","releaseFolder","prompter","fullOptions","banner","builder","option","handler","ignore","extract","executePostInstall","describe","dryRun","publishToNpm","version","demandCommand","pkgConf","showHelpOnFail"],"mappings":";;;;;;;;;;;AAKA,MAAMA,SAAS,GAAGC,OAAO,CAACC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAA;AAEzD,MAAMC,QAAQ,GAAGC,IAAI,CAAC;EACrBC,SAAS,EAAEC,IAAI,CAACC,IAAI,CAACV,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC;AAChDW,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,CAAA;;AAUD;AACA;AACA;AACA;AACA;AACO,MAAME,aAAa,GAAIH,KAAc,IAC3CD,gBAAgB,CAACC,KAAK,CAAC,KAAK;;ACtBhBI,MAAAA,eAAe,GAC3Bf,SAAiB,IACV;EACP,MAAMgB,eAAe,GAAGf,IAAI,CAACC,IAAI,CAACF,SAAS,EAAE,cAAc,CAAC,CAAA;AAC5D,EAAA,MAAMiB,WAAW,GAAGC,EAAE,CAACC,YAAY,CAACH,eAAe,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C,eAAe,CAACC,OAAO,CAACC,GAAG,EAAE,CAAC,CAAA;IAEhD,MAAM;AAAEuF,MAAAA,YAAAA;AAAa,KAAC,GAAG,MAAM,OAAO,2BAAuB,CAAC,CAAA;AAE9D,IAAA,MAAMA,YAAY,CAAC;MAClB1H,SAAS;AACTI,MAAAA,QAAQ,EAAEL,aAAa,CAACC,SAAS,EAAEpC,SAAS,CAAW;AACvD+J,MAAAA,OAAO,EAAE/B,UAAU;AACnB6B,MAAAA,MAAAA;AACD,KAAC,CAAC,CAAC/B,KAAK,CAACjC,YAAY,CAAC,CAAA;GACtB;AACD+D,EAAAA,QAAQ,EAAE,8BAAA;AACX,CAAC,CAAC,CAAA;AAEFrC,aAAa,CACXyC,aAAa,EAAE,CACfC,OAAO,CAAC,UAAU,CAAC,CACnBC,cAAc,CAAC,KAAK,CAAC,CACrBH,OAAO,EAAE,CAACtC,IAAI;;;;;;;;"}
@@ -2,7 +2,7 @@
2
2
  import * as path from 'path';
3
3
  import * as fs from 'fs';
4
4
  import glob from 'glob';
5
- import terser from 'terser';
5
+ import * as terser from 'terser';
6
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
8
  import { g as getPackageTypescriptFiles } from '../scripts.mjs';
@@ -27,7 +27,7 @@ const tryReadTsConfig = location => {
27
27
  });
28
28
  return config;
29
29
  };
30
- const build = async location => {
30
+ const build = async (location, outputDir) => {
31
31
  const config = tryReadTsConfig(location);
32
32
  config.compilerOptions.lib = ["es5", "dom"];
33
33
  const result = ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir);
@@ -36,7 +36,9 @@ const build = async location => {
36
36
  removeComments: false,
37
37
  declaration: true,
38
38
  sourceMap: false,
39
- outFile: "out.js",
39
+ // We don't use tsc to actually emit the files, but we still need to set the correct
40
+ // output directory so the compiler can rewrite the `reference path` directives.
41
+ outFile: path.join(outputDir, "out.js"),
40
42
  target: ts.ScriptTarget.ES5,
41
43
  noEmitOnError: true
42
44
  };
@@ -90,13 +92,15 @@ const createErrorMessage = diagnostic => {
90
92
  return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
91
93
  };
92
94
 
93
- const generateDocs = async (folderPath, declarationFile, outFolder, name) => {
95
+ const generateDocs = async (location, declarationFile, outFolder, name) => {
94
96
  const app = new typedoc.Application();
95
- const mediaDir = path.join(folderPath, "Media");
97
+ const mediaDir = path.join(location.manifestDir, "Media");
96
98
  app.bootstrap({
97
99
  entryPoints: [declarationFile],
98
100
  media: mediaDir,
99
- out: outFolder
101
+ out: outFolder,
102
+ tsconfig: path.join(location.scriptsDir, "tsconfig.json"),
103
+ skipErrorChecking: true
100
104
  });
101
105
  app.options.setCompilerOptions([declarationFile], {
102
106
  target: ts.ScriptTarget.ES5
@@ -104,7 +108,7 @@ const generateDocs = async (folderPath, declarationFile, outFolder, name) => {
104
108
  app.options.setValue("name", name);
105
109
  const [readmePath] = glob.sync("**/readme.md", {
106
110
  absolute: true,
107
- cwd: folderPath
111
+ cwd: location.manifestDir
108
112
  });
109
113
  if (readmePath) {
110
114
  app.options.setValue("readme", readmePath);
@@ -150,28 +154,26 @@ const buildFolders = async options => {
150
154
  if (folders.length === 0) {
151
155
  return console.log(translate("messages.buildSkipEmpty"));
152
156
  }
153
- const sortedPackages = buildSortedPackageMap(folders);
157
+ const sortedPackages = sortPackagesByBuildOrder(folders);
154
158
  let index = 1;
155
- for (const [, {
156
- location
157
- }] of sortedPackages) {
159
+ for (const location of sortedPackages) {
158
160
  if (options.skipPackagesWithoutTsFiles && getPackageTypescriptFiles(location).length === 0) {
159
161
  continue;
160
162
  }
161
163
  ensureTsConfig(location);
162
164
  const data = readPackageCreatorManifest(location);
163
- const logStep = step => logPackageMessage(data.Package, step, index, sortedPackages.size);
165
+ const logStep = step => logPackageMessage(data.Package, step, index, folders.length);
164
166
  logStep(translate("messages.building"));
165
- const buildResult = await build(location);
167
+ const outputDirectory = options.outDir || location.scriptsDir;
168
+ fs.mkdirSync(outputDirectory, {
169
+ recursive: true
170
+ });
171
+ const buildResult = await build(location, outputDirectory);
166
172
  const banner = options.banner ? createBannerComment(options.banner) : undefined;
167
173
  if (banner) {
168
174
  buildResult.js = banner + "\n" + buildResult.js;
169
175
  buildResult.definitions = banner + "\n" + buildResult.definitions;
170
176
  }
171
- const outputDirectory = options.outDir || location.scriptsDir;
172
- fs.mkdirSync(outputDirectory, {
173
- recursive: true
174
- });
175
177
  fs.writeFileSync(path.join(outputDirectory, `${data.Package}.js`), buildResult.js, {
176
178
  encoding: "utf8"
177
179
  });
@@ -179,12 +181,9 @@ const buildFolders = async options => {
179
181
  encoding: "utf8"
180
182
  });
181
183
  if (options.minimize) {
182
- const minifyResult = terser.minify(buildResult.js, {
184
+ const minifyResult = await terser.minify(buildResult.js, {
183
185
  ecma: 5
184
186
  });
185
- if (minifyResult.error || !minifyResult.code) {
186
- console.warn("Not writing minified script version because of error", minifyResult.error);
187
- }
188
187
  const minifiedPath = path.join(outputDirectory, `${data.Package}.min.js`);
189
188
  fs.writeFileSync(minifiedPath, minifyResult.code, {
190
189
  encoding: "utf8"
@@ -201,7 +200,7 @@ const buildFolders = async options => {
201
200
  }
202
201
  if (options.docs) {
203
202
  logStep(translate("messages.docsGeneration"));
204
- await generateDocs(location.scriptsDir, path.join(options.outDir || location.scriptsDir, `${data.Package}.d.ts`), path.join(options.cwd, "docs", data.Package), data.Package);
203
+ await generateDocs(location, path.join(outputDirectory, `${data.Package}.d.ts`), path.join(options.cwd, "docs", data.Package), data.Package);
205
204
  }
206
205
 
207
206
  // logStep(translate("messages.built"));
@@ -241,7 +240,7 @@ const applyTsConfigOption = data => {
241
240
  data.compilerOptions.target = "es5";
242
241
  data.compilerOptions.lib = ["es5", "dom"];
243
242
  };
244
- const buildSortedPackageMap = folders => {
243
+ const sortPackagesByBuildOrder = folders => {
245
244
  const packages = Array.from(folders).reduce((acc, location) => {
246
245
  const data = readPackageNpmManifest(location);
247
246
  if (data !== undefined) {
@@ -271,9 +270,14 @@ const buildSortedPackageMap = folders => {
271
270
  return acc;
272
271
  }, {});
273
272
  const sortedPackages = toposort(packageDependencies);
274
- const result = new Map();
273
+ const result = [];
275
274
  for (const packageName of sortedPackages) {
276
- result.set(packageName, packages[packageName]);
275
+ const location = packages[packageName].location;
276
+ if (readPackageCreatorManifest(location).Package.endsWith(".Basics")) {
277
+ result.unshift(location);
278
+ } else {
279
+ result.push(location);
280
+ }
277
281
  }
278
282
  return result;
279
283
  };
@@ -1 +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 (location: PackageLocation) => {\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\toutFile: \"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\";\n\nexport const generateDocs = async (\n\tfolderPath: string,\n\tdeclarationFile: string,\n\toutFolder: string,\n\tname: string,\n) => {\n\tconst app = new typedoc.Application();\n\n\tconst mediaDir = path.join(folderPath, \"Media\");\n\n\tapp.bootstrap({\n\t\tentryPoints: [declarationFile],\n\t\tmedia: mediaDir,\n\t\tout: outFolder,\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: folderPath,\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 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) => 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 = buildSortedPackageMap(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, sortedPackages.size);\n\n\t\tlogStep(translate(\"messages.building\"));\n\n\t\tconst buildResult = await tscBuild(location);\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\tconst outputDirectory = options.outDir || location.scriptsDir;\n\t\tfs.mkdirSync(outputDirectory, { recursive: true });\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 = terser.minify(buildResult.js, {\n\t\t\t\tecma: 5,\n\t\t\t});\n\n\t\t\tif (minifyResult.error || !minifyResult.code) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t\"Not writing minified script version because of error\",\n\t\t\t\t\tminifyResult.error,\n\t\t\t\t);\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.scriptsDir,\n\t\t\t\tpath.join(\n\t\t\t\t\toptions.outDir || location.scriptsDir,\n\t\t\t\t\t`${data.Package}.d.ts`,\n\t\t\t\t),\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 buildSortedPackageMap = (folders: 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 = new Map<string, FolderData>();\n\n\tfor (const packageName of sortedPackages) {\n\t\tresult.set(packageName, packages[packageName]);\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","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","folderPath","declarationFile","outFolder","app","typedoc","Application","mediaDir","bootstrap","entryPoints","media","out","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","buildSortedPackageMap","skipPackagesWithoutTsFiles","ensureTsConfig","readPackageCreatorManifest","logStep","Package","size","buildResult","tscBuild","banner","createBannerComment","outputDirectory","mkdirSync","writeFileSync","encoding","minimize","minifyResult","terser","minify","ecma","code","warn","minifiedPath","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","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,EAAEH,gBAAiB,CAAMT,IAAAA,EAAAA,IAAK,EAAC,CAAC,CAAA;AAC9C;;ACPO,MAAMa,eAAe,GAAIC,QAAyB,IAAK;EAC7D,MAAM;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAGC,EAAE,CAACC,cAAc,CACnCC,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AA;IACA,IAAI9C,MAAM,CAACgD,IAAI,EAAE;MAChBJ,OAAO,CAAClE,IAAI,CAAE,CAAQsB,MAAAA,EAAAA,MAAM,CAACgD,IAAI,CAACC,WAAW,EAAG,CAAA,CAAC,CAAC,CAAA;AACnD,KAAA;AAEA,IAAA,MAAMC,WAAW,GAAGN,OAAO,CAAC/G,GAAG,CAAEO,IAAI,IAAM,CAAKA,GAAAA,EAAAA,IAAK,EAAC,CAAC,CAAC/C,IAAI,CAAC,IAAI,CAAC,CAAA;AAClE,IAAA,IAAI6J,WAAW,EAAE;AAChBR,MAAAA,WAAW,CAAChE,IAAI,CAACwE,WAAW,CAAC,CAAA;AAC9B,KAAA;AACD,GAAA;AAEA,EAAA,MAAMC,UAAU,GAAGT,WAAW,CAACrJ,IAAI,CAAC,MAAM,CAAC,CAAA;AAE3C,EAAA,IAAI8J,UAAU,EAAE;IACf,OAAQ,CAAA;AACV,EAAEA,UAAW,CAAA;AACb;AACA;AACA,EAAG,CAAA,CAAA;AACF,GAAA;AAEA,EAAA,OAAO7K,SAAS,CAAA;AACjB,CAAC;;;;;;;;;"}
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,KA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