@intelligentgraphics/ig.gfx.packager 3.0.0-alpha.7 → 3.0.0-alpha.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"versionFile.mjs","sources":["../src/lib/git.ts","../src/lib/banner.ts","../src/lib/packageVersion.ts","../src/lib/parseVersion.ts","../src/lib/fs.ts","../src/lib/versionFile.ts"],"sourcesContent":["import simpleGit from \"simple-git\";\nimport * as path from \"path\";\n\nimport { WorkspaceLocation } from \"./workspace\";\nimport { PackageLocation } from \"./package\";\n\nexport const getVersionInformationFromGit = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tpackageLocation: PackageLocation,\n) => {\n\ttry {\n\t\tconst git = simpleGit({\n\t\t\tbaseDir: workspaceLocation.path,\n\t\t});\n\n\t\t// check wether the files for a folder are changed\n\t\t// if so, mark as dirty\n\t\tconst diff = await git.diffSummary();\n\n\t\tconst dirty = diff.files.some((file) => {\n\t\t\tif (\n\t\t\t\tfile.file.toLowerCase().includes(\"releases\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"version.ts\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"package.json\")\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst fullPath = path.resolve(workspaceLocation.path, file.file);\n\t\t\tconst relativePath = path.relative(packageLocation.path, fullPath);\n\n\t\t\treturn !relativePath.startsWith(\"..\");\n\t\t});\n\n\t\tconst log = await git.log({ maxCount: 1 });\n\t\tconst commit = !log.latest?.hash\n\t\t\t? undefined\n\t\t\t: log.latest.hash.substring(0, 7);\n\n\t\treturn {\n\t\t\tcommit,\n\t\t\tdirty,\n\t\t\tcommitDate: log.latest?.date,\n\t\t};\n\t} catch (err) {\n\t\treturn {};\n\t}\n};\n","import { WorkspacePackageJSON } from \"./workspace\";\n\nexport const getWorkspaceBannerText = (manifest: WorkspacePackageJSON) => {\n\tlet bannerText = manifest?.packager?.banner;\n\n\tif (bannerText) {\n\t\tconst match = bannerText.match(/Copyright \\(C\\) (\\d+)( ?- ?(\\d+))?/);\n\n\t\tif (match !== null) {\n\t\t\tconst startYear = parseInt(match[1]);\n\t\t\tconst endYear = new Date().getFullYear();\n\n\t\t\tif (startYear !== endYear) {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear} - ${endYear}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bannerText;\n};\n","// Stolen from ig.tools.core\n\nexport interface PackageVersionToVersionStringParams {\n\tbuildNumber?: boolean;\n}\n\nexport class PackageVersion {\n\t// https://regex101.com/r/90PEY9/1\n\tpublic static fullTextMatcher =\n\t\t/(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.(\\d+))?(-([^\\.]+)\\.(\\d+))?)?)?/;\n\tpublic static lineMatcher =\n\t\t/^(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.(\\d+))?(-([^\\.]+)\\.(\\d+))?)?)?$/;\n\n\tpublic static extractFromText(input: string, description?: string) {\n\t\tif (input === undefined) {\n\t\t\tthrow new Error(`Can not parse version from undefined`);\n\t\t}\n\n\t\tconst match = input.match(PackageVersion.fullTextMatcher);\n\n\t\tif (!match) {\n\t\t\tthrow new Error(`Could not extract a version from input: ${input}`);\n\t\t}\n\n\t\treturn PackageVersion.fromMatch(match, description);\n\t}\n\n\tpublic static extractFromLine(input: string, description?: string) {\n\t\tif (input === undefined) {\n\t\t\tthrow new Error(`Can not parse version from undefined`);\n\t\t}\n\n\t\tconst match = input.match(PackageVersion.lineMatcher);\n\n\t\tif (!match) {\n\t\t\tthrow new Error(`Could not parse version from input: ${input}`);\n\t\t}\n\n\t\treturn PackageVersion.fromMatch(match, description);\n\t}\n\n\tpublic static equals(\n\t\ta: PackageVersion,\n\t\tb: PackageVersion,\n\t\tcheckPrerelease = false,\n\t) {\n\t\tif (a.major !== b.major || a.minor !== b.minor || a.patch !== b.patch) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (checkPrerelease === false) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (a.preRelease === b.preRelease) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (a.preRelease === undefined || b.preRelease === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\ta.preRelease.type === b.preRelease.type &&\n\t\t\ta.preRelease.version === b.preRelease.version\n\t\t);\n\t}\n\n\tprivate static fromMatch(\n\t\t[\n\t\t\t,\n\t\t\tmajor,\n\t\t\t,\n\t\t\tminor = \"0\",\n\t\t\t,\n\t\t\tpatch = \"0\",\n\t\t\t,\n\t\t\tbuild,\n\t\t\t,\n\t\t\tpreReleaseType,\n\t\t\tpreReleaseNumber,\n\t\t]: RegExpMatchArray,\n\t\tdescription?: string,\n\t) {\n\t\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\n\t\tlet buildNumber = 100;\n\n\t\tif (preReleaseType && preReleaseNumber) {\n\t\t\tpreRelease = {\n\t\t\t\ttype: preReleaseType,\n\t\t\t\tversion: parseInt(preReleaseNumber),\n\t\t\t};\n\t\t}\n\n\t\tif (build) {\n\t\t\tbuildNumber = Number(build);\n\t\t} else if (description) {\n\t\t\tconst descriptionMatch = description.match(/(\\d+)\\)$/);\n\n\t\t\tif (descriptionMatch) {\n\t\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\n\t\t\t}\n\t\t}\n\n\t\treturn new PackageVersion(\n\t\t\tparseInt(major),\n\t\t\tparseInt(minor),\n\t\t\tparseInt(patch),\n\t\t\tpreRelease,\n\t\t\tbuildNumber,\n\t\t);\n\t}\n\n\tpublic static sort(\n\t\ta: PackageVersion,\n\t\tb: PackageVersion,\n\t\tascending: boolean = true,\n\t) {\n\t\tconst createSortResult = (a: number, b: number) =>\n\t\t\tascending ? a - b : b - a;\n\n\t\tif (a.major !== b.major) {\n\t\t\treturn createSortResult(a.major, b.major);\n\t\t}\n\n\t\tif (a.minor !== b.minor) {\n\t\t\treturn createSortResult(a.minor, b.minor);\n\t\t}\n\n\t\tif (a.patch !== b.patch) {\n\t\t\treturn createSortResult(a.patch, b.patch);\n\t\t}\n\n\t\treturn createSortResult(\n\t\t\ta.preRelease ? a.preRelease.version : 0,\n\t\t\tb.preRelease ? b.preRelease.version : 0,\n\t\t);\n\t}\n\n\tprivate static toNumber(version: PackageVersion) {\n\t\treturn (\n\t\t\t((version.major * 1000 + version.minor) * 1000 + version.patch) *\n\t\t\t\t1000 +\n\t\t\tversion.buildNumber\n\t\t);\n\t}\n\n\tconstructor(\n\t\tpublic major: number,\n\t\tpublic minor: number,\n\t\tpublic patch: number,\n\t\tpublic preRelease: { type: string; version: number } | undefined,\n\t\tpublic buildNumber: number,\n\t) {}\n\n\tpublic isPreRelease() {\n\t\treturn this.preRelease !== undefined;\n\t}\n\n\tpublic clone() {\n\t\treturn new PackageVersion(\n\t\t\tthis.major,\n\t\t\tthis.minor,\n\t\t\tthis.patch,\n\t\t\tthis.preRelease ? { ...this.preRelease } : undefined,\n\t\t\tthis.buildNumber,\n\t\t);\n\t}\n\n\tpublic incrementMajor() {\n\t\tthis.preRelease = undefined;\n\t\tthis.patch = 0;\n\t\tthis.minor = 0;\n\t\tthis.major++;\n\t}\n\n\tpublic incrementMinor() {\n\t\tthis.preRelease = undefined;\n\t\tthis.patch = 0;\n\t\tthis.minor++;\n\t}\n\n\tpublic incrementPatch() {\n\t\tthis.preRelease = undefined;\n\t\tthis.patch++;\n\t}\n\n\tpublic createPreRelease(type: string) {\n\t\tif (!this.preRelease) {\n\t\t\tthis.buildNumber = 1;\n\t\t} else {\n\t\t\tthis.buildNumber++;\n\t\t}\n\n\t\tif (this.preRelease && type === this.preRelease.type) {\n\t\t\tthis.preRelease.version++;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.preRelease = {\n\t\t\tversion: 0,\n\t\t\ttype,\n\t\t};\n\t}\n\n\tpublic createRelease() {\n\t\tthis.preRelease = undefined;\n\t\tthis.buildNumber = 100;\n\t}\n\n\tpublic toVersionString({\n\t\tbuildNumber,\n\t}: PackageVersionToVersionStringParams = {}) {\n\t\tlet version = [this.major, this.minor, this.patch].join(\".\");\n\n\t\tif (buildNumber) {\n\t\t\tversion += \".\" + this.buildNumber;\n\t\t}\n\n\t\tif (this.preRelease) {\n\t\t\tversion += `-${this.preRelease.type}.${this.preRelease.version}`;\n\t\t}\n\n\t\treturn version;\n\t}\n\n\tpublic toDescriptionString(packageName: string) {\n\t\tconst base = [this.major, this.minor, this.patch].join(\".\");\n\t\tconst parts: (number | string)[] = [packageName, base];\n\n\t\tif (this.preRelease) {\n\t\t\tparts.push(upperCaseFirst(this.preRelease.type));\n\t\t\tparts.push(this.preRelease.version);\n\t\t}\n\n\t\tparts.push(`(${base}.${this.buildNumber})`);\n\n\t\treturn parts.join(\" \");\n\t}\n\n\t/**\n\t * Determines wether the version is lesser than the input version\n\t *\n\t * @param {PackageVersion} version\n\t * @returns\n\t */\n\tpublic isLesserThan(version: PackageVersion) {\n\t\treturn PackageVersion.toNumber(this) < PackageVersion.toNumber(version);\n\t}\n\n\t/**\n\t * Determines wether the version is greater than the input version\n\t *\n\t * @param {PackageVersion} version\n\t * @returns\n\t */\n\tpublic isGreaterThan(version: PackageVersion) {\n\t\treturn PackageVersion.toNumber(this) > PackageVersion.toNumber(version);\n\t}\n}\n\nconst upperCaseFirst = (input: string) => {\n\treturn input.slice(0, 1).toUpperCase() + input.slice(1);\n};\n","import { PackageVersion } from \"./packageVersion\";\n\nexport const parseVersionFromString = (input: string) => {\n\tif (input === undefined) {\n\t\tthrow new Error(`Can not parse version from undefined`);\n\t}\n\n\tlet match: RegExpMatchArray | null;\n\n\tlet major!: string;\n\tlet minor!: string;\n\tlet patch!: string;\n\tlet build: string | undefined;\n\tlet preReleaseType: string | undefined;\n\tlet preReleaseNumber: string | undefined;\n\n\tif (\n\t\t// first try to find a full match with build number\n\t\t(match = input.match(\n\t\t\t/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/,\n\t\t)) !== null\n\t) {\n\t\t[, major, minor, patch, build, preReleaseType, preReleaseNumber] =\n\t\t\tmatch;\n\t} else if (\n\t\t(match = input.match(/(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/)) !== null\n\t) {\n\t\t[, major, minor, patch, , preReleaseType, preReleaseNumber] = match;\n\t}\n\n\tif (match === null) {\n\t\tthrow new Error(`Could not parse version from input: ${input}`);\n\t}\n\n\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\n\tlet buildNumber = 100;\n\n\tif (preReleaseType && preReleaseNumber) {\n\t\tpreRelease = {\n\t\t\ttype: preReleaseType,\n\t\t\tversion: parseInt(preReleaseNumber),\n\t\t};\n\t}\n\n\tif (build) {\n\t\tbuildNumber = Number(build);\n\t} else if (input) {\n\t\tconst descriptionMatch = input.match(/(\\d+)\\)$/);\n\n\t\tif (descriptionMatch) {\n\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\n\t\t}\n\t}\n\n\treturn new PackageVersion(\n\t\tparseInt(major),\n\t\tparseInt(minor),\n\t\tparseInt(patch),\n\t\tpreRelease,\n\t\tbuildNumber,\n\t);\n};\n\n// 1000001001 -> 1.0.1.1\n// 1002017001 -> 1.2.17.1\nexport const parseVersionFromNumericVersion = (\n\tversion: number,\n): PackageVersion => {\n\tconst major = Math.floor(version / 1000000000);\n\tconst minor = Math.floor((version % 1000000000) / 1000000);\n\tconst patch = Math.floor((version % 1000000) / 1000);\n\tconst buildNumber = version % 1000;\n\n\treturn new PackageVersion(major, minor, patch, undefined, buildNumber);\n};\n","import * as fs from \"fs\";\n\nimport { isErrorENOENT } from \"./error\";\n\nexport const readStringFromFile = (filePath: string): string =>\n\tfs.readFileSync(filePath, { encoding: \"utf8\" });\n\nexport const readStringFromFileOrUndefined = (\n\tfilePath: string,\n): string | undefined => {\n\ttry {\n\t\treturn readStringFromFile(filePath);\n\t} catch (err) {\n\t\tif (!isErrorENOENT(err)) {\n\t\t\tthrow err;\n\t\t}\n\t\treturn undefined;\n\t}\n};\n","import * as fs from \"fs\";\nimport * as path from \"path\";\n\nimport { isErrorENOENT } from \"./error\";\nimport { readStringFromFileOrUndefined } from \"./fs\";\nimport { PackageLocation } from \"./package\";\nimport { PackageVersion } from \"./packageVersion\";\n\n// https://regex101.com/r/LtGAu5/1\nconst logRegex =\n\t/console\\.log\\(\\s*\"([\\w\\s\\.\\(\\)]+)\\ *Copyright[\\w\\s\\(\\)\\.]+(\\d{4}|\\d{4} - \\d{4})([\\w\\s\\(\\)\\.]+)?\",?\\s*\\)/i;\nconst currentYear = new Date(Date.now()).getFullYear();\n\nexport const getVersionFileHandler = (location: PackageLocation) => {\n\tconst filePath = path.join(location.scriptsDir, \"Version.ts\");\n\n\tconst invalidVersionFile = (versionFile: string | undefined) => ({\n\t\tversion: undefined,\n\t\twrite: (name: string, newVersion: PackageVersion) => {\n\t\t\tconst scriptsContent = fs.readdirSync(location.scriptsDir);\n\t\t\tconst tsFiles = scriptsContent.filter((file) =>\n\t\t\t\tfile.endsWith(\".ts\"),\n\t\t\t);\n\n\t\t\tif (tsFiles.length > 0) {\n\t\t\t\treturn createVersionFileWriter([currentYear], \"\")(\n\t\t\t\t\tname,\n\t\t\t\t\tnewVersion,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\treset: () => {\n\t\t\tif (versionFile !== undefined) {\n\t\t\t\tfs.writeFileSync(filePath, versionFile, { encoding: \"utf8\" });\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tfs.rmSync(filePath);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\ttype CopyrightRange = [number, number?];\n\n\tconst createVersionFileWriter =\n\t\t(\n\t\t\tcopyright: CopyrightRange = [currentYear],\n\t\t\tcopyrightStuff: string = \"\",\n\t\t) =>\n\t\t(name: string, newVersion: PackageVersion) => {\n\t\t\tconst descriptionText = newVersion.toDescriptionString(name);\n\t\t\tconst copyrightText = createYearString(copyright);\n\n\t\t\tconst result = `console.log(\"${descriptionText}. Copyright (C) ${copyrightText}${copyrightStuff}\");`;\n\n\t\t\tfs.writeFileSync(filePath, result, { encoding: \"utf-8\" });\n\t\t};\n\n\tlet rawVersionFile = readStringFromFileOrUndefined(filePath);\n\n\tif (rawVersionFile === undefined) {\n\t\treturn invalidVersionFile(rawVersionFile);\n\t}\n\n\tconst versionFile = rawVersionFile.replace(/\\n/g, \"\");\n\n\tconst match = versionFile.match(logRegex);\n\n\tif (!match) {\n\t\treturn invalidVersionFile(versionFile);\n\t}\n\n\tconst [_full, _description, copyright, copyrightStuff] = match as [\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t\tstring?,\n\t];\n\n\tconst copyrightYears = copyright.match(/^(\\d+)( ?- ?(\\d+))?$/);\n\n\tlet years: [number, number?];\n\n\tif (copyrightYears === null) {\n\t\tyears = [currentYear];\n\t} else {\n\t\tyears = [Number(copyrightYears[1]), currentYear];\n\t}\n\n\treturn {\n\t\twrite: createVersionFileWriter(years, copyrightStuff),\n\t\treset: () => {\n\t\t\tfs.writeFileSync(filePath, versionFile, { encoding: \"utf8\" });\n\t\t},\n\t};\n};\n\nconst createYearString = (years: [number, number?]) => {\n\tif (years[1] === undefined || years[0] === years[1]) {\n\t\treturn years[0].toString();\n\t}\n\n\treturn `${years[0]} - ${years[1]}`;\n};\n"],"names":["getVersionInformationFromGit","workspaceLocation","packageLocation","git","simpleGit","baseDir","path","diff","diffSummary","dirty","files","some","file","toLowerCase","includes","endsWith","fullPath","resolve","relativePath","relative","startsWith","log","maxCount","commit","latest","hash","undefined","substring","commitDate","date","err","getWorkspaceBannerText","manifest","bannerText","packager","banner","match","startYear","parseInt","endYear","Date","getFullYear","replace","PackageVersion","fullTextMatcher","lineMatcher","extractFromText","input","description","Error","fromMatch","extractFromLine","equals","a","b","checkPrerelease","major","minor","patch","preRelease","type","version","build","preReleaseType","preReleaseNumber","buildNumber","Number","descriptionMatch","sort","ascending","createSortResult","toNumber","constructor","isPreRelease","clone","incrementMajor","incrementMinor","incrementPatch","createPreRelease","createRelease","toVersionString","join","toDescriptionString","packageName","base","parts","push","upperCaseFirst","isLesserThan","isGreaterThan","slice","toUpperCase","parseVersionFromString","parseVersionFromNumericVersion","Math","floor","readStringFromFile","filePath","fs","readFileSync","encoding","readStringFromFileOrUndefined","isErrorENOENT","logRegex","currentYear","now","getVersionFileHandler","location","scriptsDir","invalidVersionFile","versionFile","write","name","newVersion","scriptsContent","readdirSync","tsFiles","filter","length","createVersionFileWriter","reset","writeFileSync","rmSync","copyright","copyrightStuff","descriptionText","copyrightText","createYearString","result","rawVersionFile","_full","_description","copyrightYears","years","toString"],"mappings":";;;;;;MAMaA,4BAA4B,GAAG,OAC3CC,iBAAoC,EACpCC,eAAgC,KAC5B;EACJ,IAAI;AAAA,IAAA,IAAA,WAAA,EAAA,YAAA,CAAA;IACH,MAAMC,GAAG,GAAGC,SAAS,CAAC;MACrBC,OAAO,EAAEJ,iBAAiB,CAACK,IAAAA;AAC5B,KAAC,CAAC,CAAA;;AAEF;AACA;AACA,IAAA,MAAMC,IAAI,GAAG,MAAMJ,GAAG,CAACK,WAAW,EAAE,CAAA;IAEpC,MAAMC,KAAK,GAAGF,IAAI,CAACG,KAAK,CAACC,IAAI,CAAEC,IAAI,IAAK;AACvC,MAAA,IACCA,IAAI,CAACA,IAAI,CAACC,WAAW,EAAE,CAACC,QAAQ,CAAC,UAAU,CAAC,IAC5CF,IAAI,CAACA,IAAI,CAACC,WAAW,EAAE,CAACE,QAAQ,CAAC,YAAY,CAAC,IAC9CH,IAAI,CAACA,IAAI,CAACC,WAAW,EA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B,KAAK,GAAG,CAACnE,MAAM,CAACkE,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE5B,WAAW,CAAC,CAAA;AACjD,GAAA;EAEA,OAAO;AACNO,IAAAA,KAAK,EAAEQ,uBAAuB,CAACc,KAAK,EAAET,cAAc,CAAC;AACrDJ,IAAAA,KAAK,EAAE,MAAM;AACZtB,MAAAA,EAAE,CAACuB,aAAa,CAACxB,QAAQ,EAAEa,WAAW,EAAE;AAAEV,QAAAA,QAAQ,EAAE,MAAA;AAAO,OAAC,CAAC,CAAA;AAC9D,KAAA;GACA,CAAA;AACF,EAAC;AAED,MAAM2B,gBAAgB,GAAIM,KAAwB,IAAK;AACtD,EAAA,IAAIA,KAAK,CAAC,CAAC,CAAC,KAAK3G,SAAS,IAAI2G,KAAK,CAAC,CAAC,CAAC,KAAKA,KAAK,CAAC,CAAC,CAAC,EAAE;AACpD,IAAA,OAAOA,KAAK,CAAC,CAAC,CAAC,CAACC,QAAQ,EAAE,CAAA;AAC3B,GAAA;EAEA,OAAQ,CAAA,EAAED,KAAK,CAAC,CAAC,CAAE,MAAKA,KAAK,CAAC,CAAC,CAAE,CAAC,CAAA,CAAA;AACnC,CAAC;;;;"}
1
+ {"version":3,"file":"versionFile.mjs","sources":["../src/lib/git.ts","../src/lib/banner.ts","../src/lib/packageVersion.ts","../src/lib/parseVersion.ts","../src/lib/fs.ts","../src/lib/versionFile.ts"],"sourcesContent":["import simpleGit from \"simple-git\";\r\nimport * as path from \"path\";\r\n\r\nimport { WorkspaceLocation } from \"./workspace\";\r\nimport { PackageLocation } from \"./package\";\r\n\r\nexport const getVersionInformationFromGit = async (\r\n\tworkspaceLocation: WorkspaceLocation,\r\n\tpackageLocation: PackageLocation,\r\n) => {\r\n\ttry {\r\n\t\tconst git = simpleGit({\r\n\t\t\tbaseDir: workspaceLocation.path,\r\n\t\t});\r\n\r\n\t\t// check wether the files for a folder are changed\r\n\t\t// if so, mark as dirty\r\n\t\tconst diff = await git.diffSummary();\r\n\r\n\t\tconst dirty = diff.files.some((file) => {\r\n\t\t\tif (\r\n\t\t\t\tfile.file.toLowerCase().includes(\"releases\") ||\r\n\t\t\t\tfile.file.toLowerCase().endsWith(\"version.ts\") ||\r\n\t\t\t\tfile.file.toLowerCase().endsWith(\"package.json\")\r\n\t\t\t) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tconst fullPath = path.resolve(workspaceLocation.path, file.file);\r\n\t\t\tconst relativePath = path.relative(packageLocation.path, fullPath);\r\n\r\n\t\t\treturn !relativePath.startsWith(\"..\");\r\n\t\t});\r\n\r\n\t\tconst log = await git.log({ maxCount: 1 });\r\n\t\tconst commit = !log.latest?.hash\r\n\t\t\t? undefined\r\n\t\t\t: log.latest.hash.substring(0, 7);\r\n\r\n\t\treturn {\r\n\t\t\tcommit,\r\n\t\t\tdirty,\r\n\t\t\tcommitDate: log.latest?.date,\r\n\t\t};\r\n\t} catch (err) {\r\n\t\treturn {};\r\n\t}\r\n};\r\n","import { WorkspacePackageJSON } from \"./workspace\";\r\n\r\nexport const getWorkspaceBannerText = (manifest: WorkspacePackageJSON) => {\r\n\tlet bannerText = manifest?.packager?.banner;\r\n\r\n\tif (bannerText) {\r\n\t\tconst match = bannerText.match(/Copyright \\(C\\) (\\d+)( ?- ?(\\d+))?/);\r\n\r\n\t\tif (match !== null) {\r\n\t\t\tconst startYear = parseInt(match[1]);\r\n\t\t\tconst endYear = new Date().getFullYear();\r\n\r\n\t\t\tif (startYear !== endYear) {\r\n\t\t\t\tbannerText = bannerText.replace(\r\n\t\t\t\t\tmatch[0],\r\n\t\t\t\t\t`Copyright (C) ${startYear} - ${endYear}`,\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tbannerText = bannerText.replace(\r\n\t\t\t\t\tmatch[0],\r\n\t\t\t\t\t`Copyright (C) ${startYear}`,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn bannerText;\r\n};\r\n","// Stolen from ig.tools.core\r\n\r\nexport interface PackageVersionToVersionStringParams {\r\n\tbuildNumber?: boolean;\r\n}\r\n\r\nexport class PackageVersion {\r\n\t// https://regex101.com/r/90PEY9/1\r\n\tpublic static fullTextMatcher =\r\n\t\t/(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.(\\d+))?(-([^\\.]+)\\.(\\d+))?)?)?/;\r\n\tpublic static lineMatcher =\r\n\t\t/^(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.(\\d+))?(-([^\\.]+)\\.(\\d+))?)?)?$/;\r\n\r\n\tpublic static extractFromText(input: string, description?: string) {\r\n\t\tif (input === undefined) {\r\n\t\t\tthrow new Error(`Can not parse version from undefined`);\r\n\t\t}\r\n\r\n\t\tconst match = input.match(PackageVersion.fullTextMatcher);\r\n\r\n\t\tif (!match) {\r\n\t\t\tthrow new Error(`Could not extract a version from input: ${input}`);\r\n\t\t}\r\n\r\n\t\treturn PackageVersion.fromMatch(match, description);\r\n\t}\r\n\r\n\tpublic static extractFromLine(input: string, description?: string) {\r\n\t\tif (input === undefined) {\r\n\t\t\tthrow new Error(`Can not parse version from undefined`);\r\n\t\t}\r\n\r\n\t\tconst match = input.match(PackageVersion.lineMatcher);\r\n\r\n\t\tif (!match) {\r\n\t\t\tthrow new Error(`Could not parse version from input: ${input}`);\r\n\t\t}\r\n\r\n\t\treturn PackageVersion.fromMatch(match, description);\r\n\t}\r\n\r\n\tpublic static equals(\r\n\t\ta: PackageVersion,\r\n\t\tb: PackageVersion,\r\n\t\tcheckPrerelease = false,\r\n\t) {\r\n\t\tif (a.major !== b.major || a.minor !== b.minor || a.patch !== b.patch) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (checkPrerelease === false) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tif (a.preRelease === b.preRelease) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tif (a.preRelease === undefined || b.preRelease === undefined) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn (\r\n\t\t\ta.preRelease.type === b.preRelease.type &&\r\n\t\t\ta.preRelease.version === b.preRelease.version\r\n\t\t);\r\n\t}\r\n\r\n\tprivate static fromMatch(\r\n\t\t[\r\n\t\t\t,\r\n\t\t\tmajor,\r\n\t\t\t,\r\n\t\t\tminor = \"0\",\r\n\t\t\t,\r\n\t\t\tpatch = \"0\",\r\n\t\t\t,\r\n\t\t\tbuild,\r\n\t\t\t,\r\n\t\t\tpreReleaseType,\r\n\t\t\tpreReleaseNumber,\r\n\t\t]: RegExpMatchArray,\r\n\t\tdescription?: string,\r\n\t) {\r\n\t\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\r\n\t\tlet buildNumber = 100;\r\n\r\n\t\tif (preReleaseType && preReleaseNumber) {\r\n\t\t\tpreRelease = {\r\n\t\t\t\ttype: preReleaseType,\r\n\t\t\t\tversion: parseInt(preReleaseNumber),\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tif (build) {\r\n\t\t\tbuildNumber = Number(build);\r\n\t\t} else if (description) {\r\n\t\t\tconst descriptionMatch = description.match(/(\\d+)\\)$/);\r\n\r\n\t\t\tif (descriptionMatch) {\r\n\t\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn new PackageVersion(\r\n\t\t\tparseInt(major),\r\n\t\t\tparseInt(minor),\r\n\t\t\tparseInt(patch),\r\n\t\t\tpreRelease,\r\n\t\t\tbuildNumber,\r\n\t\t);\r\n\t}\r\n\r\n\tpublic static sort(\r\n\t\ta: PackageVersion,\r\n\t\tb: PackageVersion,\r\n\t\tascending: boolean = true,\r\n\t) {\r\n\t\tconst createSortResult = (a: number, b: number) =>\r\n\t\t\tascending ? a - b : b - a;\r\n\r\n\t\tif (a.major !== b.major) {\r\n\t\t\treturn createSortResult(a.major, b.major);\r\n\t\t}\r\n\r\n\t\tif (a.minor !== b.minor) {\r\n\t\t\treturn createSortResult(a.minor, b.minor);\r\n\t\t}\r\n\r\n\t\tif (a.patch !== b.patch) {\r\n\t\t\treturn createSortResult(a.patch, b.patch);\r\n\t\t}\r\n\r\n\t\treturn createSortResult(\r\n\t\t\ta.preRelease ? a.preRelease.version : 0,\r\n\t\t\tb.preRelease ? b.preRelease.version : 0,\r\n\t\t);\r\n\t}\r\n\r\n\tprivate static toNumber(version: PackageVersion) {\r\n\t\treturn (\r\n\t\t\t((version.major * 1000 + version.minor) * 1000 + version.patch) *\r\n\t\t\t\t1000 +\r\n\t\t\tversion.buildNumber\r\n\t\t);\r\n\t}\r\n\r\n\tconstructor(\r\n\t\tpublic major: number,\r\n\t\tpublic minor: number,\r\n\t\tpublic patch: number,\r\n\t\tpublic preRelease: { type: string; version: number } | undefined,\r\n\t\tpublic buildNumber: number,\r\n\t) {}\r\n\r\n\tpublic isPreRelease() {\r\n\t\treturn this.preRelease !== undefined;\r\n\t}\r\n\r\n\tpublic clone() {\r\n\t\treturn new PackageVersion(\r\n\t\t\tthis.major,\r\n\t\t\tthis.minor,\r\n\t\t\tthis.patch,\r\n\t\t\tthis.preRelease ? { ...this.preRelease } : undefined,\r\n\t\t\tthis.buildNumber,\r\n\t\t);\r\n\t}\r\n\r\n\tpublic incrementMajor() {\r\n\t\tthis.preRelease = undefined;\r\n\t\tthis.patch = 0;\r\n\t\tthis.minor = 0;\r\n\t\tthis.major++;\r\n\t}\r\n\r\n\tpublic incrementMinor() {\r\n\t\tthis.preRelease = undefined;\r\n\t\tthis.patch = 0;\r\n\t\tthis.minor++;\r\n\t}\r\n\r\n\tpublic incrementPatch() {\r\n\t\tthis.preRelease = undefined;\r\n\t\tthis.patch++;\r\n\t}\r\n\r\n\tpublic createPreRelease(type: string) {\r\n\t\tif (!this.preRelease) {\r\n\t\t\tthis.buildNumber = 1;\r\n\t\t} else {\r\n\t\t\tthis.buildNumber++;\r\n\t\t}\r\n\r\n\t\tif (this.preRelease && type === this.preRelease.type) {\r\n\t\t\tthis.preRelease.version++;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis.preRelease = {\r\n\t\t\tversion: 0,\r\n\t\t\ttype,\r\n\t\t};\r\n\t}\r\n\r\n\tpublic createRelease() {\r\n\t\tthis.preRelease = undefined;\r\n\t\tthis.buildNumber = 100;\r\n\t}\r\n\r\n\tpublic toVersionString({\r\n\t\tbuildNumber,\r\n\t}: PackageVersionToVersionStringParams = {}) {\r\n\t\tlet version = [this.major, this.minor, this.patch].join(\".\");\r\n\r\n\t\tif (buildNumber) {\r\n\t\t\tversion += \".\" + this.buildNumber;\r\n\t\t}\r\n\r\n\t\tif (this.preRelease) {\r\n\t\t\tversion += `-${this.preRelease.type}.${this.preRelease.version}`;\r\n\t\t}\r\n\r\n\t\treturn version;\r\n\t}\r\n\r\n\tpublic toDescriptionString(packageName: string) {\r\n\t\tconst base = [this.major, this.minor, this.patch].join(\".\");\r\n\t\tconst parts: (number | string)[] = [packageName, base];\r\n\r\n\t\tif (this.preRelease) {\r\n\t\t\tparts.push(upperCaseFirst(this.preRelease.type));\r\n\t\t\tparts.push(this.preRelease.version);\r\n\t\t}\r\n\r\n\t\tparts.push(`(${base}.${this.buildNumber})`);\r\n\r\n\t\treturn parts.join(\" \");\r\n\t}\r\n\r\n\t/**\r\n\t * Determines wether the version is lesser than the input version\r\n\t *\r\n\t * @param {PackageVersion} version\r\n\t * @returns\r\n\t */\r\n\tpublic isLesserThan(version: PackageVersion) {\r\n\t\treturn PackageVersion.toNumber(this) < PackageVersion.toNumber(version);\r\n\t}\r\n\r\n\t/**\r\n\t * Determines wether the version is greater than the input version\r\n\t *\r\n\t * @param {PackageVersion} version\r\n\t * @returns\r\n\t */\r\n\tpublic isGreaterThan(version: PackageVersion) {\r\n\t\treturn PackageVersion.toNumber(this) > PackageVersion.toNumber(version);\r\n\t}\r\n}\r\n\r\nconst upperCaseFirst = (input: string) => {\r\n\treturn input.slice(0, 1).toUpperCase() + input.slice(1);\r\n};\r\n","import { PackageVersion } from \"./packageVersion\";\r\n\r\nexport const parseVersionFromString = (input: string) => {\r\n\tif (input === undefined) {\r\n\t\tthrow new Error(`Can not parse version from undefined`);\r\n\t}\r\n\r\n\tlet match: RegExpMatchArray | null;\r\n\r\n\tlet major!: string;\r\n\tlet minor!: string;\r\n\tlet patch!: string;\r\n\tlet build: string | undefined;\r\n\tlet preReleaseType: string | undefined;\r\n\tlet preReleaseNumber: string | undefined;\r\n\r\n\tif (\r\n\t\t// first try to find a full match with build number\r\n\t\t(match = input.match(\r\n\t\t\t/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/,\r\n\t\t)) !== null\r\n\t) {\r\n\t\t[, major, minor, patch, build, preReleaseType, preReleaseNumber] =\r\n\t\t\tmatch;\r\n\t} else if (\r\n\t\t(match = input.match(/(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/)) !== null\r\n\t) {\r\n\t\t[, major, minor, patch, , preReleaseType, preReleaseNumber] = match;\r\n\t}\r\n\r\n\tif (match === null) {\r\n\t\tthrow new Error(`Could not parse version from input: ${input}`);\r\n\t}\r\n\r\n\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\r\n\tlet buildNumber = 100;\r\n\r\n\tif (preReleaseType && preReleaseNumber) {\r\n\t\tpreRelease = {\r\n\t\t\ttype: preReleaseType,\r\n\t\t\tversion: parseInt(preReleaseNumber),\r\n\t\t};\r\n\t}\r\n\r\n\tif (build) {\r\n\t\tbuildNumber = Number(build);\r\n\t} else if (input) {\r\n\t\tconst descriptionMatch = input.match(/(\\d+)\\)$/);\r\n\r\n\t\tif (descriptionMatch) {\r\n\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\r\n\t\t}\r\n\t}\r\n\r\n\treturn new PackageVersion(\r\n\t\tparseInt(major),\r\n\t\tparseInt(minor),\r\n\t\tparseInt(patch),\r\n\t\tpreRelease,\r\n\t\tbuildNumber,\r\n\t);\r\n};\r\n\r\n// 1000001001 -> 1.0.1.1\r\n// 1002017001 -> 1.2.17.1\r\nexport const parseVersionFromNumericVersion = (\r\n\tversion: number,\r\n): PackageVersion => {\r\n\tconst major = Math.floor(version / 1000000000);\r\n\tconst minor = Math.floor((version % 1000000000) / 1000000);\r\n\tconst patch = Math.floor((version % 1000000) / 1000);\r\n\tconst buildNumber = version % 1000;\r\n\r\n\treturn new PackageVersion(major, minor, patch, undefined, buildNumber);\r\n};\r\n","import * as fs from \"fs\";\r\n\r\nimport { isErrorENOENT } from \"./error\";\r\n\r\nexport const readStringFromFile = (filePath: string): string =>\r\n\tfs.readFileSync(filePath, { encoding: \"utf8\" });\r\n\r\nexport const readStringFromFileOrUndefined = (\r\n\tfilePath: string,\r\n): string | undefined => {\r\n\ttry {\r\n\t\treturn readStringFromFile(filePath);\r\n\t} catch (err) {\r\n\t\tif (!isErrorENOENT(err)) {\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t\treturn undefined;\r\n\t}\r\n};\r\n","import * as fs from \"fs\";\r\nimport * as path from \"path\";\r\n\r\nimport { isErrorENOENT } from \"./error\";\r\nimport { readStringFromFileOrUndefined } from \"./fs\";\r\nimport { PackageLocation } from \"./package\";\r\nimport { PackageVersion } from \"./packageVersion\";\r\n\r\n// https://regex101.com/r/LtGAu5/1\r\nconst logRegex =\r\n\t/console\\.log\\(\\s*\"([\\w\\s\\.\\(\\)]+)\\ *Copyright[\\w\\s\\(\\)\\.]+(\\d{4}|\\d{4} - \\d{4})([\\w\\s\\(\\)\\.]+)?\",?\\s*\\)/i;\r\nconst currentYear = new Date(Date.now()).getFullYear();\r\n\r\nexport const getVersionFileHandler = (location: PackageLocation) => {\r\n\tconst filePath = path.join(location.scriptsDir, \"Version.ts\");\r\n\r\n\tconst invalidVersionFile = (versionFile: string | undefined) => ({\r\n\t\tversion: undefined,\r\n\t\twrite: (name: string, newVersion: PackageVersion) => {\r\n\t\t\tconst scriptsContent = fs.readdirSync(location.scriptsDir);\r\n\t\t\tconst tsFiles = scriptsContent.filter((file) =>\r\n\t\t\t\tfile.endsWith(\".ts\"),\r\n\t\t\t);\r\n\r\n\t\t\tif (tsFiles.length > 0) {\r\n\t\t\t\treturn createVersionFileWriter([currentYear], \"\")(\r\n\t\t\t\t\tname,\r\n\t\t\t\t\tnewVersion,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t},\r\n\t\treset: () => {\r\n\t\t\tif (versionFile !== undefined) {\r\n\t\t\t\tfs.writeFileSync(filePath, versionFile, { encoding: \"utf8\" });\r\n\t\t\t} else {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfs.rmSync(filePath);\r\n\t\t\t\t} catch (err) {\r\n\t\t\t\t\tif (!isErrorENOENT(err)) {\r\n\t\t\t\t\t\tthrow err;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n\r\n\ttype CopyrightRange = [number, number?];\r\n\r\n\tconst createVersionFileWriter =\r\n\t\t(\r\n\t\t\tcopyright: CopyrightRange = [currentYear],\r\n\t\t\tcopyrightStuff: string = \"\",\r\n\t\t) =>\r\n\t\t(name: string, newVersion: PackageVersion) => {\r\n\t\t\tconst descriptionText = newVersion.toDescriptionString(name);\r\n\t\t\tconst copyrightText = createYearString(copyright);\r\n\r\n\t\t\tconst result = `console.log(\"${descriptionText}. Copyright (C) ${copyrightText}${copyrightStuff}\");`;\r\n\r\n\t\t\tfs.writeFileSync(filePath, result, { encoding: \"utf-8\" });\r\n\t\t};\r\n\r\n\tlet rawVersionFile = readStringFromFileOrUndefined(filePath);\r\n\r\n\tif (rawVersionFile === undefined) {\r\n\t\treturn invalidVersionFile(rawVersionFile);\r\n\t}\r\n\r\n\tconst versionFile = rawVersionFile.replace(/\\n/g, \"\");\r\n\r\n\tconst match = versionFile.match(logRegex);\r\n\r\n\tif (!match) {\r\n\t\treturn invalidVersionFile(versionFile);\r\n\t}\r\n\r\n\tconst [_full, _description, copyright, copyrightStuff] = match as [\r\n\t\tstring,\r\n\t\tstring,\r\n\t\tstring,\r\n\t\tstring?,\r\n\t];\r\n\r\n\tconst copyrightYears = copyright.match(/^(\\d+)( ?- ?(\\d+))?$/);\r\n\r\n\tlet years: [number, number?];\r\n\r\n\tif (copyrightYears === null) {\r\n\t\tyears = [currentYear];\r\n\t} else {\r\n\t\tyears = [Number(copyrightYears[1]), currentYear];\r\n\t}\r\n\r\n\treturn {\r\n\t\twrite: createVersionFileWriter(years, copyrightStuff),\r\n\t\treset: () => {\r\n\t\t\tfs.writeFileSync(filePath, versionFile, { encoding: \"utf8\" });\r\n\t\t},\r\n\t};\r\n};\r\n\r\nconst createYearString = (years: [number, number?]) => {\r\n\tif (years[1] === undefined || years[0] === years[1]) {\r\n\t\treturn years[0].toString();\r\n\t}\r\n\r\n\treturn `${years[0]} - ${years[1]}`;\r\n};\r\n"],"names":["getVersionInformationFromGit","workspaceLocation","packageLocation","git","simpleGit","baseDir","path","diff","diffSummary","dirty","files","some","file","toLowerCase","includes","endsWith","fullPath","resolve","relativePath","relative","startsWith","log","maxCount","commit","latest","hash","undefined","substring","commitDate","date","err","getWorkspaceBannerText","manifest","bannerText","packager","banner","match","startYear","parseInt","endYear","Date","getFullYear","replace","PackageVersion","fullTextMatcher","lineMatcher","extractFromText","input","description","Error","fromMatch","extractFromLine","equals","a","b","checkPrerelease","major","minor","patch","preRelease","type","version","build","preReleaseType","preReleaseNumber","buildNumber","Number","descriptionMatch","sort","ascending","createSortResult","toNumber","constructor","isPreRelease","clone","incrementMajor","incrementMinor","incrementPatch","createPreRelease","createRelease","toVersionString","join","toDescriptionString","packageName","base","parts","push","upperCaseFirst","isLesserThan","isGreaterThan","slice","toUpperCase","parseVersionFromString","parseVersionFromNumericVersion","Math","floor","readStringFromFile","filePath","fs","readFileSync","encoding","readStringFromFileOrUndefined","isErrorENOENT","logRegex","currentYear","now","getVersionFileHandler","location","scriptsDir","invalidVersionFile","versionFile","write","name","newVersion","scriptsContent","readdirSync","tsFiles","filter","length","createVersionFileWriter","reset","writeFileSync","rmSync","copyright","copyrightStuff","descriptionText","copyrightText","createYearString","result","rawVersionFile","_full","_description","copyrightYears","years","toString"],"mappings":";;;;;;MAMaA,4BAA4B,GAAG,OAC3CC,iBAAoC,EACpCC,eAAgC,KAC5B;EACJ,IAAI;AAAA,IAAA,IAAA,WAAA,EAAA,YAAA,CAAA;IACH,MAAMC,GAAG,GAAGC,SAAS,CAAC;MACrBC,OAAO,EAAEJ,iBAAiB,CAACK,IAAAA;AAC5B,KAAC,CAAC,CAAA;;AAEF;AACA;AACA,IAAA,MAAMC,IAAI,GAAG,MAAMJ,GAAG,CAACK,WAAW,EAAE,CAAA;IAEpC,MAAMC,KAAK,GAAGF,IAAI,CAACG,KAAK,CAACC,IAAI,CAAEC,IAAI,IAAK;AACvC,MAAA,IACCA,IAAI,CAACA,IAAI,CAACC,WAAW,EAAE,CAACC,QAAQ,CAAC,UAAU,CAAC,IAC5CF,IAAI,CAACA,IAAI,CAACC,WAAW,EAAE,CAACE,QAAQ,CAAC,YAAY,CAAC,IAC9CH,IAAI,CAACA,IAAI,CAACC,WAAW,EAAE,CAACE,QAAQ,CAAC,cAAc,CAAC,EAC/C;AACD,QAAA,OAAO,KAAK,CAAA;AACb,OAAA;AAEA,MAAA,MAAMC,QAAQ,GAAGV,IAAI,CAACW,OAAO,CAAChB,iBAAiB,CAACK,IAAI,EAAEM,IAAI,CAACA,IAAI,CAAC,CAAA;MAChE,MAAMM,YAAY,GAAGZ,IAAI,CAACa,QAAQ,CAACjB,eAAe,CAACI,IAAI,EAAEU,QAAQ,CAAC,CAAA;AAElE,MAAA,OAAO,CAACE,YAAY,CAACE,UAAU,CAAC,IAAI,CAAC,CAAA;AACtC,KAAC,CAAC,CAAA;AAEF,IAAA,MAAMC,GAAG,GAAG,MAAMlB,GAAG,CAACkB,GAAG,CAAC;AAAEC,MAAAA,QAAQ,EAAE,CAAA;AAAE,KAAC,CAAC,CAAA;IAC1C,MAAMC,MAAM,GAAG,EAACF,CAAAA,WAAAA,GAAAA,GA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AK,CAAC,CAAC,CAAC,CAACC,QAAQ,EAAE,CAAA;AAC3B,GAAA;EAEA,OAAQ,CAAA,EAAED,KAAK,CAAC,CAAC,CAAE,MAAKA,KAAK,CAAC,CAAC,CAAE,CAAC,CAAA,CAAA;AACnC,CAAC;;;;"}
package/locales/de.json CHANGED
@@ -1,18 +1,18 @@
1
- {
2
- "options.banner": "Text, der als Kommentar über dem kompilierten Code eingefügt wird",
3
- "options.outDir": "Ziel-Verzeichnis für den kompilierten Code",
4
- "options.minimize": "Minifiziere den kompilierten Code mit Terser",
5
- "options.cwd": "Ausführungs-Verzeichnis",
6
- "options.clean": "Ziel-Ordner vor dem Kompilieren leeren",
7
- "messages.skipEmpty": "Es wurden keine Ordner beim Ausführen des Programms angegeben. Kompilation wird übersprungen",
8
- "messages.building": "Kompiliere",
9
- "messages.built": "Kompilation fertiggestellt",
10
- "messages.invalidPackageFolder": "Konnte keine _Package.json Datei in \"%s\" finden",
11
- "messages.movingReleaseZip": "Release-Zip wird in den Release-Ordner bewegt",
12
- "messages.error": "Ausführung wurde wegen folgendem Fehler gestoppt: %s",
13
- "release.newVersionQuestion": "Bitte gib die neue Versions-Nummer für %s an (Aktuell: %s)",
14
- "release.publishConfirmQuestion": "Möchtest du %s mit der Version %s veröffentlichen?",
15
- "release.domainQuestion": "Welche Domain soll verwendet werden?",
16
- "release.subdomainQuestion": "Welche Sub-Domain soll verwendet werden?",
17
- "release.noVersion": "Keine"
18
- }
1
+ {
2
+ "options.banner": "Text, der als Kommentar über dem kompilierten Code eingefügt wird",
3
+ "options.outDir": "Ziel-Verzeichnis für den kompilierten Code",
4
+ "options.minimize": "Minifiziere den kompilierten Code mit Terser",
5
+ "options.cwd": "Ausführungs-Verzeichnis",
6
+ "options.clean": "Ziel-Ordner vor dem Kompilieren leeren",
7
+ "messages.skipEmpty": "Es wurden keine Ordner beim Ausführen des Programms angegeben. Kompilation wird übersprungen",
8
+ "messages.building": "Kompiliere",
9
+ "messages.built": "Kompilation fertiggestellt",
10
+ "messages.invalidPackageFolder": "Konnte keine _Package.json Datei in \"%s\" finden",
11
+ "messages.movingReleaseZip": "Release-Zip wird in den Release-Ordner bewegt",
12
+ "messages.error": "Ausführung wurde wegen folgendem Fehler gestoppt: %s",
13
+ "release.newVersionQuestion": "Bitte gib die neue Versions-Nummer für %s an (Aktuell: %s)",
14
+ "release.publishConfirmQuestion": "Möchtest du %s mit der Version %s veröffentlichen?",
15
+ "release.domainQuestion": "Welche Domain soll verwendet werden?",
16
+ "release.subdomainQuestion": "Welche Sub-Domain soll verwendet werden?",
17
+ "release.noVersion": "Keine"
18
+ }
package/locales/en.json CHANGED
@@ -1,37 +1,37 @@
1
- {
2
- "options.banner.description": "Specify a banner which will be inserted as a comment above the code",
3
- "options.outDir.description": "Output directory",
4
- "options.minimize.description": "Minify output",
5
- "options.cwd.description": "Working directory",
6
- "options.clean.description": "Empty output dir before compiling",
7
- "options.noUpload.description": "Only zip built files",
8
- "options.newVersion.description": "Predefine the target version",
9
- "options.domain.description": "Overwrite the publish domain",
10
- "options.subdomain.description": "Overwrite the publish subdomain",
11
- "options.address.description": "Address",
12
- "options.service.description": "IG.Asset.Server url",
13
- "options.service.demands": "The IG.Asset.Server url has to either be provided using the option --service or through the \"%s\" environment variable",
14
- "options.user.description": "User",
15
- "options.user.demands": "The username has to either be provided using the option --user or through the \"%s\" environment variable",
16
- "options.password.description": "Password",
17
- "options.password.demands": "The user password has to either be provided using the option --password or through the \"%s\" environment variable",
18
- "options.pushOnly.description": "Try to upload an existing zip file without building and validating the version number",
19
- "options.noValidate.description": "Skip validation of wether newVersion is higher than the current version for releases",
20
- "options.docs.description": "Generates typedoc",
21
- "options.ignore.description": "Files to ignore while generating index",
22
- "options.license.description": "Path to a license file",
23
- "messages.buildSkipEmpty": "No build targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.",
24
- "messages.releaseSkipEmpty": "No release targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.",
25
- "messages.building": "Creating javascript files",
26
- "messages.invalidPackageFolder": "Could not find a _Package.json file in \"%s\"",
27
- "messages.movingReleaseZip": "Copying zip to releases folder",
28
- "messages.error": "Stopped execution because of the following error: %s",
29
- "messages.missingUploadArgs": "Can not upload the package because of the following issues:",
30
- "messages.basicsCopy": "Copying basics to lib folder",
31
- "messages.docsGeneration": "Generating typedoc",
32
- "release.newVersionQuestion": "Please input a new version number for %s (Current: %s)",
33
- "release.publishConfirmQuestion": "Do you want to publish %s ",
34
- "release.domainQuestion": "Which domain should be used?",
35
- "release.subdomainQuestion": "Which sub domain should be used?",
36
- "release.noVersion": "None"
37
- }
1
+ {
2
+ "options.banner.description": "Specify a banner which will be inserted as a comment above the code",
3
+ "options.outDir.description": "Output directory",
4
+ "options.minimize.description": "Minify output",
5
+ "options.cwd.description": "Working directory",
6
+ "options.clean.description": "Empty output dir before compiling",
7
+ "options.noUpload.description": "Only zip built files",
8
+ "options.newVersion.description": "Predefine the target version",
9
+ "options.domain.description": "Overwrite the publish domain",
10
+ "options.subdomain.description": "Overwrite the publish subdomain",
11
+ "options.address.description": "Address",
12
+ "options.service.description": "IG.Asset.Server url",
13
+ "options.service.demands": "The IG.Asset.Server url has to either be provided using the option --service or through the \"%s\" environment variable",
14
+ "options.user.description": "User",
15
+ "options.user.demands": "The username has to either be provided using the option --user or through the \"%s\" environment variable",
16
+ "options.password.description": "Password",
17
+ "options.password.demands": "The user password has to either be provided using the option --password or through the \"%s\" environment variable",
18
+ "options.pushOnly.description": "Try to upload an existing zip file without building and validating the version number",
19
+ "options.noValidate.description": "Skip validation of wether newVersion is higher than the current version for releases",
20
+ "options.docs.description": "Generates typedoc",
21
+ "options.ignore.description": "Files to ignore while generating index",
22
+ "options.license.description": "Path to a license file",
23
+ "messages.buildSkipEmpty": "No build targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.",
24
+ "messages.releaseSkipEmpty": "No release targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.",
25
+ "messages.building": "Creating javascript files",
26
+ "messages.invalidPackageFolder": "Could not find a _Package.json file in \"%s\"",
27
+ "messages.movingReleaseZip": "Copying zip to releases folder",
28
+ "messages.error": "Stopped execution because of the following error: %s",
29
+ "messages.missingUploadArgs": "Can not upload the package because of the following issues:",
30
+ "messages.basicsCopy": "Copying basics to lib folder",
31
+ "messages.docsGeneration": "Generating typedoc",
32
+ "release.newVersionQuestion": "Please input a new version number for %s (Current: %s)",
33
+ "release.publishConfirmQuestion": "Do you want to publish %s ",
34
+ "release.domainQuestion": "Which domain should be used?",
35
+ "release.subdomainQuestion": "Which sub domain should be used?",
36
+ "release.noVersion": "None"
37
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intelligentgraphics/ig.gfx.packager",
3
- "version": "3.0.0-alpha.7",
4
- "description": "IG.GFX.Packager 3.0.0 Alpha 7 (3.0.0.8)",
3
+ "version": "3.0.0-alpha.9",
4
+ "description": "IG.GFX.Packager 3.0.0 Alpha 9 (3.0.0.10)",
5
5
  "author": "Michael Beier <mb@intelligentgraphics.biz>",
6
6
  "main": "build/index.mjs",
7
7
  "private": false,
@@ -10,7 +10,7 @@
10
10
  "access": "public"
11
11
  },
12
12
  "engines": {
13
- "node": ">=16.0.0"
13
+ "node": ">=16.19.0"
14
14
  },
15
15
  "bin": {
16
16
  "packager": "./build/index.mjs"
@@ -25,8 +25,7 @@
25
25
  "clean": "rimraf build *.tsbuildinfo",
26
26
  "prepublishOnly": "yarn clean && yarn dist",
27
27
  "test": "vitest",
28
- "format": "prettier --write \"**/*.{ts,tsx,json}\"",
29
- "postinstall": "packager postinstall"
28
+ "format": "prettier --write \"**/*.{ts,tsx,json}\""
30
29
  },
31
30
  "dependencies": {
32
31
  "ajv": "^8.12.0",
package/readme.md CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  ## Requirements
4
4
 
5
- node.js (https://nodejs.org/en/download/) >= 16
5
+ node.js (https://nodejs.org/en/download/) >= 16.19.0
6
6
 
7
7
  ## Installation
8
8
 
9
- 1\. Install this package as a dev dependency
9
+ 1\. Install this package globally
10
10
 
11
11
  ```sh
12
- npm install --save-dev @intelligentgraphics/ig.gfx.packager@latest
12
+ npm install -g @intelligentgraphics/ig.gfx.packager@latest
13
13
  ```
14
14
 
15
- 2\. Add build, upload and postinstall commands to the package.json
15
+ 2\. Add a build and a release command to the package.json
16
16
 
17
17
  ```json
18
18
  {
@@ -21,9 +21,6 @@ npm install --save-dev @intelligentgraphics/ig.gfx.packager@latest
21
21
  "build": "packager build",
22
22
  "upload": "packager publish",
23
23
  "postinstall": "package postinstall"
24
- },
25
- "devDependencies": {
26
- "@intelligentgraphics/ig.gfx.packager": "^3.0.0"
27
24
  }
28
25
  }
29
26
  ```
@@ -38,9 +35,6 @@ npm install --save-dev @intelligentgraphics/ig.gfx.packager@latest
38
35
  "upload": "packager publish",
39
36
  "postinstall": "package postinstall"
40
37
  },
41
- "devDependencies": {
42
- "@intelligentgraphics/ig.gfx.packager": "^3.0.0"
43
- },
44
38
  "packager": {
45
39
  "banner": "This belongs to a data repo"
46
40
  }
@@ -59,9 +53,6 @@ npm install --save-dev @intelligentgraphics/ig.gfx.packager@latest
59
53
  "upload": "packager publish",
60
54
  "postinstall": "package postinstall"
61
55
  },
62
- "devDependencies": {
63
- "@intelligentgraphics/ig.gfx.packager": "^3.0.0"
64
- },
65
56
  "packager": {
66
57
  "banner": "This file is part of the IG.Graphics IGX Data Package. \n Copyright (C) 2015 - 2020 intelligentgraphics. All Rights Reserved."
67
58
  }
@@ -70,7 +61,7 @@ npm install --save-dev @intelligentgraphics/ig.gfx.packager@latest
70
61
 
71
62
  ## Update
72
63
 
73
- You can update the installed package by running `npm install --save-dev @intelligentgraphics/ig.gfx.packager@latest` again.
64
+ You can update the installed package by running `npm install -g @intelligentgraphics/ig.gfx.packager@latest` again.
74
65
 
75
66
  ## Environment configuration
76
67
 
@@ -294,7 +285,7 @@ The ts files have to adhere to a certain form to be processed.
294
285
  3. The parameters have the following JSDoc structure
295
286
  ```javascript
296
287
  /** Symbolische Angabe der Korpusbreite in der Form "W100"
297
- * Wird in der abgeleitetet Klasse kontextbezogen in den Realwert Width gemappt.
288
+ * Wird in der abgeleitet Klasse kontextbezogen in den Realwert Width gemapped.
298
289
  * @default "W50"
299
290
  * @creatorType String
300
291
  * @summary Symbolische Angabe der Korpusbreite
@@ -318,6 +309,18 @@ The ts files have to adhere to a certain form to be processed.
318
309
 
319
310
  ## History
320
311
 
312
+ **IG.GFX.Packager 3.0.0-alpha.9**
313
+
314
+ - change packager to be installed globally
315
+
316
+ **IG.GFX.Packager 3.0.0-alpha.8**
317
+
318
+ - verify that packages are built in order when npm dependencies are defined
319
+ - when multiple packages are requested to be built, first build basics if available
320
+ - fix d.ts file references not being rewritten on build
321
+ - use a narrower version range for node js
322
+ - remove accidental packager postinstall
323
+
321
324
  **IG.GFX.Packager 3.0.0-alpha.7**
322
325
 
323
326
  - fix some issues and update dependencies
@@ -375,7 +378,7 @@ The ts files have to adhere to a certain form to be processed.
375
378
 
376
379
  - handle additional white space in version log parsing
377
380
  - improve error message on invalid license path
378
- - add support for generation of index.json files for evaulators
381
+ - add support for generation of index.json files for Evaluators
379
382
 
380
383
  **IG.GFX.Packager 2.2.0**
381
384
 
@@ -1,22 +1,22 @@
1
- const path = require("path");
2
- const fs = require("fs");
3
-
4
- try {
5
- const filePath = path.join(process.cwd(), "package.json");
6
- const manifest = JSON.parse(fs.readFileSync(filePath, "utf8"));
7
-
8
- if (manifest.name !== "@intelligentgraphics/ig.gfx.packager") {
9
- if (manifest.scripts === undefined) {
10
- manifest.scripts = {};
11
- } else {
12
- if (manifest.scripts.release === "packager release") {
13
- delete manifest.scripts.release;
14
- }
15
- }
16
-
17
- manifest.scripts.build = "packager build";
18
- manifest.scripts.upload = "packager upload";
19
-
20
- fs.writeFileSync(filePath, JSON.stringify(manifest, undefined, 2));
21
- }
22
- } catch {}
1
+ const path = require("path");
2
+ const fs = require("fs");
3
+
4
+ try {
5
+ const filePath = path.join(process.cwd(), "package.json");
6
+ const manifest = JSON.parse(fs.readFileSync(filePath, "utf8"));
7
+
8
+ if (manifest.name !== "@intelligentgraphics/ig.gfx.packager") {
9
+ if (manifest.scripts === undefined) {
10
+ manifest.scripts = {};
11
+ } else {
12
+ if (manifest.scripts.release === "packager release") {
13
+ delete manifest.scripts.release;
14
+ }
15
+ }
16
+
17
+ manifest.scripts.build = "packager build";
18
+ manifest.scripts.upload = "packager upload";
19
+
20
+ fs.writeFileSync(filePath, JSON.stringify(manifest, undefined, 2));
21
+ }
22
+ } catch {}
@@ -1 +0,0 @@
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 * 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) => 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 = 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.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","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","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,IAAI,CAACC,IAAI,CAACL,QAAQ,CAACM,UAAU,EAAE,eAAe,CAAC,EAC9CF,IAAI,IAAK;IACT,IAAI;AACH,MAAA,OAAOG,EAAE,CAACC,YAA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AC/C,IAAI,CAAC,IAAI,CAAC,CAAA;AAClE,IAAA,IAAI4J,WAAW,EAAE;AAChBR,MAAAA,WAAW,CAAC/D,IAAI,CAACuE,WAAW,CAAC,CAAA;AAC9B,KAAA;AACD,GAAA;AAEA,EAAA,MAAMC,UAAU,GAAGT,WAAW,CAACpJ,IAAI,CAAC,MAAM,CAAC,CAAA;AAE3C,EAAA,IAAI6J,UAAU,EAAE;IACf,OAAQ,CAAA;AACV,EAAEA,UAAW,CAAA;AACb;AACA;AACA,EAAG,CAAA,CAAA;AACF,GAAA;AAEA,EAAA,OAAO5K,SAAS,CAAA;AACjB,CAAC;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.mjs","sources":["../../src/commands/generate.ts"],"sourcesContent":["import ts from \"typescript\";\nimport os from \"os\";\n\nimport { PackageLocation, writePackageCreatorIndex } from \"../lib/package\";\nimport { getPackageTypescriptFiles } from \"../lib/scripts\";\n\ninterface IScript {\n\tName: string;\n\tDescription: string;\n\tType: TScriptType;\n\tParameters: IScriptParameter[];\n}\n\ninterface IScriptParameter {\n\tName: string;\n\tDescription: string;\n\tType: TType;\n\tDefault: string | number | boolean | null;\n\tDisplayIndex: number;\n}\n\ntype TScriptType = \"Evaluator\" | \"Interactor\";\n\ntype TType =\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\ntype TParams = {\n\t[key: string]: string;\n};\n\nfunction findTsNode<T extends ts.Node>(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => node is T,\n): T | undefined;\nfunction findTsNode(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => boolean,\n): ts.Node | undefined;\nfunction findTsNode(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => boolean,\n): ts.Node | undefined {\n\tlet result: ts.Node | undefined;\n\n\tts.forEachChild(node, (child) => {\n\t\tif (callback(child)) {\n\t\t\tresult = child;\n\t\t\treturn true;\n\t\t}\n\t});\n\n\treturn result;\n}\n\nfunction getParamsFromJsDoc(text: string): TParams {\n\tlet lines = text.split(os.EOL);\n\tlet splitLines = lines.map((line) => line.split(\":\").map((s) => s.trim()));\n\tlet params = {};\n\tsplitLines\n\t\t.filter((line) => line.length > 1)\n\t\t.forEach((line) => {\n\t\t\tparams[line[0]] = line[1];\n\t\t});\n\n\treturn params;\n}\n\nfunction getDescFromJsDoc(text: string): string {\n\tlet lines = text.split(os.EOL);\n\tlet splitLines = lines.map((line) => line.split(\":\").map((s) => s.trim()));\n\tlet desc = \"\";\n\tsplitLines\n\t\t.filter((line) => line.length == 1)\n\t\t.forEach((line, i) => {\n\t\t\tdesc += (i == 0 ? \"\" : \" \") + line[0];\n\t\t});\n\n\treturn desc.substring(0, 98);\n}\n\nfunction capitalizeFirstLetter(string) {\n\treturn string?.charAt(0).toUpperCase() + string?.slice(1);\n}\n\nfunction parseDefault(value: string, type: string) {\n\tconst uType: TType = capitalizeFirstLetter(type);\n\tif (value === \"null\") return null;\n\tswitch (uType) {\n\t\tcase \"LengthM\":\n\t\tcase \"ArcDEG\":\n\t\tcase \"Float\":\n\t\t\treturn parseFloat(value);\n\t\tcase \"Integer\":\n\t\tcase \"Int\":\n\t\t\treturn parseInt(value);\n\t\tcase \"Boolean\":\n\t\tcase \"Bool\":\n\t\t\treturn value === \"true\";\n\t\tcase \"Material\":\n\t\tcase \"String\":\n\t\tdefault:\n\t\t\treturn value.replace(/^\"/, \"\").replace(/\"$/, \"\");\n\t}\n}\n\nfunction findEvaluatorNode(node: ts.Node): ts.ClassDeclaration | undefined {\n\tif (\n\t\tts.isModuleDeclaration(node) &&\n\t\tnode.body &&\n\t\tts.isModuleDeclaration(node.body) &&\n\t\tnode.body.body\n\t) {\n\t\tconst classDeclaration = findTsNode(\n\t\t\tnode.body.body,\n\t\t\t(child): child is ts.ClassDeclaration => {\n\t\t\t\tif (!ts.isClassDeclaration(child)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst isEvaluator = child.heritageClauses?.some((clause) => {\n\t\t\t\t\tif (clause.token !== ts.SyntaxKind.ExtendsKeyword) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn clause.types.some((type) =>\n\t\t\t\t\t\ttype.getText().includes(\"Evaluator\"),\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\treturn isEvaluator ?? false;\n\t\t\t},\n\t\t);\n\n\t\treturn classDeclaration;\n\t}\n}\n\nfunction getParameter(evaluatorNode: ts.ClassDeclaration) {\n\tlet memb = evaluatorNode.members?.find(\n\t\t(member) => member?.name?.getText().toLowerCase() == \"create\",\n\t);\n\tif (ts.isMethodDeclaration(memb!)) {\n\t\treturn memb.parameters.find(\n\t\t\t(para) => para.name.getText().toLowerCase() == \"parameters\",\n\t\t);\n\t}\n}\n\nfunction findParametersInterface(\n\tnode: ts.Node,\n\tinterfaceName: string,\n): ts.InterfaceDeclaration | undefined {\n\tif (\n\t\tts.isModuleDeclaration(node) &&\n\t\tnode.body &&\n\t\tts.isModuleDeclaration(node.body) &&\n\t\tnode.body.body\n\t) {\n\t\tconst interfaceDeclaration = findTsNode(\n\t\t\tnode.body.body,\n\t\t\t(child): child is ts.InterfaceDeclaration =>\n\t\t\t\tts.isInterfaceDeclaration(child) &&\n\t\t\t\tchild.name.getText() == interfaceName,\n\t\t);\n\n\t\treturn interfaceDeclaration;\n\t}\n\n\treturn undefined;\n}\n\nfunction getModuleName(sourceFile: ts.Node): string {\n\tlet fullName = \"\";\n\tif (ts.isModuleDeclaration(sourceFile)) {\n\t\tfullName += sourceFile.name.getText();\n\n\t\tlet packageB = sourceFile.body!;\n\t\tif (ts.isModuleDeclaration(packageB)) {\n\t\t\tfullName += \".\" + packageB.name.getText();\n\t\t}\n\t}\n\treturn fullName;\n}\n\nfunction genParameters(interfac: ts.InterfaceDeclaration): IScriptParameter[] {\n\treturn interfac.members.map((member, i) => {\n\t\tlet para = {} as IScriptParameter;\n\n\t\tpara.Name = member.name!.getText();\n\t\tif (para.Name.length > 45)\n\t\t\tthrow new Error(`Parameter name length >45 '${para.Name}'`);\n\n\t\tlet rawDocTags = ts.getJSDocTags(member);\n\t\tif (rawDocTags.length) {\n\t\t\tlet dict = getTagDict(rawDocTags);\n\t\t\tif (dict.summary) para.Description = dict.summary;\n\t\t\tif (dict.creatorType) para.Type = dict.creatorType as TType;\n\t\t\tif (dict.default && dict.creatorType)\n\t\t\t\tpara.Default = parseDefault(dict.default, dict.creatorType);\n\t\t\tpara.DisplayIndex = i + 1;\n\t\t}\n\t\treturn para;\n\t});\n}\n\ninterface IDocTags {\n\tdefault?: string;\n\tcreatorType?: string;\n\tsummary?: string;\n}\n\nfunction getTagDict(tags: any): IDocTags {\n\tlet dict = {};\n\ttags.forEach((tag) => {\n\t\tdict[tag.tagName.text] = tag.comment;\n\t});\n\treturn dict;\n}\n\nfunction findParametersInterfaceInFiles(\n\tprogram: ts.Program,\n\tfileList: string[],\n\tname: string,\n): ts.InterfaceDeclaration | undefined {\n\tfor (const file of fileList) {\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\tif (sourceFile === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`Expected a source file to exist for file name \"${file}\"`,\n\t\t\t);\n\t\t}\n\n\t\tlet interfaceDeclaration: ts.InterfaceDeclaration | undefined;\n\n\t\tts.forEachChild(sourceFile, (node) => {\n\t\t\tinterfaceDeclaration = findParametersInterface(node, name);\n\n\t\t\treturn interfaceDeclaration !== undefined;\n\t\t});\n\n\t\tif (interfaceDeclaration !== undefined) {\n\t\t\treturn interfaceDeclaration;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Extracts and returns script array for _Index.json from a src folder\n *\n * @param folderPath path to a src folder\n */\nexport function extract(location: PackageLocation, ignore: string[] = []) {\n\tconst files = getPackageTypescriptFiles(location);\n\tconst filtered = files.filter((path) => {\n\t\treturn !ignore.some((suffix) => path.endsWith(suffix));\n\t});\n\tlet arr = new Array<IScript>();\n\n\tlet program = ts.createProgram(filtered, { allowJs: true });\n\tprogram.getTypeChecker();\n\tfiltered.forEach((file) => {\n\t\t// Create a Program to represent the project, then pull out the\n\t\t// source file to parse its AST.\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\t// Loop through the root AST nodes of the file\n\t\tts.forEachChild(sourceFile!, (node) => {\n\t\t\tlet obj = {} as IScript;\n\t\t\tconst evalNode = findEvaluatorNode(node);\n\n\t\t\tif (evalNode === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet moduleName = getModuleName(node);\n\n\t\t\tif (evalNode.name === undefined) {\n\t\t\t\tthrow new Error(`Expected evaluator class to have a name`);\n\t\t\t}\n\n\t\t\tobj.Name = moduleName + \".\" + evalNode.name.getText();\n\t\t\tif (obj.Name.length > 45)\n\t\t\t\tthrow new Error(`Package name length >45 '${obj.Name}'`);\n\n\t\t\tlet para = getParameter(evalNode);\n\t\t\tlet paraName = (para?.type as any).typeName.getText();\n\t\t\tlet interfac = findParametersInterfaceInFiles(\n\t\t\t\tprogram,\n\t\t\t\tfiltered,\n\t\t\t\tparaName,\n\t\t\t);\n\n\t\t\tif (interfac === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to find parameters type declaration for evaluator ${evalNode.name.getText()}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tlet rawDocTags = ts.getJSDocTags(evalNode);\n\t\t\tif (rawDocTags.length) {\n\t\t\t\tlet dict = getTagDict(rawDocTags);\n\t\t\t\tif (dict.summary) obj.Description = dict.summary;\n\t\t\t\tif (dict.creatorType)\n\t\t\t\t\tobj.Type = dict.creatorType as TScriptType;\n\t\t\t}\n\n\t\t\tobj.Parameters = genParameters(interfac);\n\t\t\tarr.push(obj);\n\t\t});\n\t});\n\n\twritePackageCreatorIndex(location, arr);\n}\n"],"names":["findTsNode","node","callback","result","ts","forEachChild","child","capitalizeFirstLetter","string","charAt","toUpperCase","slice","parseDefault","value","type","uType","parseFloat","parseInt","replace","findEvaluatorNode","isModuleDeclaration","body","classDeclaration","isClassDeclaration","isEvaluator","heritageClauses","some","clause","token","SyntaxKind","ExtendsKeyword","types","getText","includes","getParameter","evaluatorNode","memb","members","find","member","name","toLowerCase","isMethodDeclaration","parameters","para","findParametersInterface","interfaceName","interfaceDeclaration","isInterfaceDeclaration","undefined","getModuleName","sourceFile","fullName","packageB","genParameters","interfac","map","i","Name","length","Error","rawDocTags","getJSDocTags","dict","getTagDict","summary","Description","creatorType","Type","default","Default","DisplayIndex","tags","forEach","tag","tagName","text","comment","findParametersInterfaceInFiles","program","fileList","file","getSourceFile","extract","location","ignore","files","getPackageTypescriptFiles","filtered","filter","path","suffix","endsWith","arr","Array","createProgram","allowJs","getTypeChecker","obj","evalNode","moduleName","paraName","typeName","Parameters","push","writePackageCreatorIndex"],"mappings":";;;;;;;;;;;;;;;AA8CA,SAASA,UAAU,CAClBC,IAAa,EACbC,QAAoC,EACd;AACtB,EAAA,IAAIC,MAA2B,CAAA;AAE/BC,EAAAA,EAAE,CAACC,YAAY,CAACJ,IAAI,EAAGK,KAAK,IAAK;AAChC,IAAA,IAAIJ,QAAQ,CAACI,KAAK,CAAC,EAAE;AACpBH,MAAAA,MAAM,GAAGG,KAAK,CAAA;AACd,MAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AACD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,MAAM,CAAA;AACd,CAAA;AA4BA,SAASI,qBAAqB,CAACC,MAAM,EAAE;EACtC,OAAO,CAAAA,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,KAAGF,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEG,KAAK,CAAC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,EACRa,QAAQ,CACR,CAAA;MAED,IAAI9C,QAAQ,KAAKN,SAAS,EAAE;QAC3B,MAAM,IAAIW,KAAK,CACb,CAA2DuC,yDAAAA,EAAAA,QAAQ,CAAC3D,IAAI,CAACR,OAAO,EAAG,CAAA,CAAC,CACrF,CAAA;AACF,OAAA;AAEA,MAAA,IAAI6B,UAAU,GAAGzD,EAAE,CAAC0D,YAAY,CAACqC,QAAQ,CAAC,CAAA;MAC1C,IAAItC,UAAU,CAACF,MAAM,EAAE;AACtB,QAAA,IAAII,IAAI,GAAGC,UAAU,CAACH,UAAU,CAAC,CAAA;QACjC,IAAIE,IAAI,CAACE,OAAO,EAAEiC,GAAG,CAAChC,WAAW,GAAGH,IAAI,CAACE,OAAO,CAAA;QAChD,IAAIF,IAAI,CAACI,WAAW,EACnB+B,GAAG,CAAC9B,IAAI,GAAGL,IAAI,CAACI,WAA0B,CAAA;AAC5C,OAAA;AAEA+B,MAAAA,GAAG,CAACK,UAAU,GAAGjD,aAAa,CAACC,QAAQ,CAAC,CAAA;AACxCsC,MAAAA,GAAG,CAACW,IAAI,CAACN,GAAG,CAAC,CAAA;AACd,KAAC,CAAC,CAAA;AACH,GAAC,CAAC,CAAA;AAEFO,EAAAA,wBAAwB,CAACrB,QAAQ,EAAES,GAAG,CAAC,CAAA;AACxC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"postinstall.mjs","sources":["../../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport {\n\tgetWorkspaceLibPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { readPublishedPackageNpmManifest } from \"../lib/publishedPackage\";\nimport { determineWorkspaceIGLibraries } from \"../lib/dependencies\";\n\nconst DEFINITION_FILE_HINT =\n\t\"// This file is automatically managed by the ig.gfx.packager.\";\n\nexport const executePostInstall = (workspace: WorkspaceLocation) => {\n\tconst manifest = readWorkspaceNpmManifest(workspace);\n\n\tif (manifest === undefined) {\n\t\tthrow new Error(`Expected an npm manifest to exist.`);\n\t}\n\n\tconst libPath = getWorkspaceLibPath(workspace);\n\n\tfs.mkdirSync(libPath, { recursive: true });\n\n\tconst existingDefinitions = fs.readdirSync(libPath);\n\n\t// delete all existing definition files that are managed by the packager.\n\t// we'll recreate all needed definitions in the next step.\n\tfor (const existingDefinitionName of existingDefinitions) {\n\t\tconst content = fs.readFileSync(\n\t\t\tpath.join(libPath, existingDefinitionName),\n\t\t\t{ encoding: \"utf-8\" },\n\t\t);\n\n\t\tif (content.startsWith(DEFINITION_FILE_HINT)) {\n\t\t\tfs.rmSync(path.join(libPath, existingDefinitionName));\n\t\t}\n\t}\n\n\tconst libraryLocations = determineWorkspaceIGLibraries(workspace);\n\n\tfor (const location of libraryLocations) {\n\t\tconst manifest = readPublishedPackageNpmManifest(location);\n\n\t\t// add a hint to the top of the file so we know it's managed by the packager.\n\t\tconst content =\n\t\t\tDEFINITION_FILE_HINT +\n\t\t\t\" \\n\" +\n\t\t\t`// This is a reference to version ${manifest.version}\\n` +\n\t\t\t`/// <reference types=\"${manifest.name}\" />`;\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(getWorkspaceLibPath(workspace), manifest.types),\n\t\t\tcontent,\n\t\t\t{\n\t\t\t\tencoding: \"utf8\",\n\t\t\t},\n\t\t);\n\t}\n};\n"],"names":["DEFINITION_FILE_HINT","executePostInstall","workspace","manifest","readWorkspaceNpmManifest","undefined","Error","libPath","getWorkspaceLibPath","fs","mkdirSync","recursive","existingDefinitions","readdirSync","existingDefinitionName","content","readFileSync","path","join","encoding","startsWith","rmSync","libraryLocations","determineWorkspaceIGLibraries","location","readPublishedPackageNpmManifest","version","name","writeFileSync","types"],"mappings":";;;;;;;;;;;;;AAWA,MAAMA,oBAAoB,GACzB,+DAA+D,CAAA;AAEnDC,MAAAA,kBAAkB,GAAIC,SAA4B,IAAK;AACnE,EAAA,MAAMC,QAAQ,GAAGC,wBAAwB,CAACF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