@intelligentgraphics/ig.gfx.packager 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/build/cli-5332deff.js +2486 -0
  2. package/build/cli-5332deff.js.map +1 -0
  3. package/build/{lib/dependencies.mjs → dependencies-227aca50.js} +62 -7
  4. package/build/dependencies-227aca50.js.map +1 -0
  5. package/build/{commands/generate.mjs → generate-a3a16031.js} +17 -3
  6. package/build/generate-a3a16031.js.map +1 -0
  7. package/build/{commands/publish/index.mjs → index-5d595f56.js} +199 -17
  8. package/build/index-5d595f56.js.map +1 -0
  9. package/build/{commands/build/index.mjs → index-92b6ba5c.js} +151 -8
  10. package/build/index-92b6ba5c.js.map +1 -0
  11. package/build/index.mjs +1 -1
  12. package/build/index.mjs.map +1 -1
  13. package/build/{commands/postinstall.mjs → postinstall-7e50da37.js} +19 -12
  14. package/build/postinstall-7e50da37.js.map +1 -0
  15. package/build/{commands/publishNpm.mjs → publishNpm-e2c8347f.js} +22 -10
  16. package/build/publishNpm-e2c8347f.js.map +1 -0
  17. package/build/versionFile-b3a65dc8.js +370 -0
  18. package/build/versionFile-b3a65dc8.js.map +1 -0
  19. package/package.json +8 -7
  20. package/readme.md +23 -3
  21. package/build/cli.mjs +0 -316
  22. package/build/cli.mjs.map +0 -1
  23. package/build/commands/build/docs.mjs +0 -34
  24. package/build/commands/build/docs.mjs.map +0 -1
  25. package/build/commands/build/index.mjs.map +0 -1
  26. package/build/commands/build/tsc.mjs +0 -84
  27. package/build/commands/build/tsc.mjs.map +0 -1
  28. package/build/commands/generate.mjs.map +0 -1
  29. package/build/commands/postinstall.mjs.map +0 -1
  30. package/build/commands/publish/index.mjs.map +0 -1
  31. package/build/commands/publish/zip.mjs +0 -168
  32. package/build/commands/publish/zip.mjs.map +0 -1
  33. package/build/commands/publishNpm.mjs.map +0 -1
  34. package/build/lib/assetService.mjs +0 -111
  35. package/build/lib/assetService.mjs.map +0 -1
  36. package/build/lib/banner.mjs +0 -20
  37. package/build/lib/banner.mjs.map +0 -1
  38. package/build/lib/dependencies.mjs.map +0 -1
  39. package/build/lib/error.mjs +0 -15
  40. package/build/lib/error.mjs.map +0 -1
  41. package/build/lib/fs.mjs +0 -19
  42. package/build/lib/fs.mjs.map +0 -1
  43. package/build/lib/git.mjs +0 -37
  44. package/build/lib/git.mjs.map +0 -1
  45. package/build/lib/log.mjs +0 -9
  46. package/build/lib/log.mjs.map +0 -1
  47. package/build/lib/npmPackage.mjs +0 -19
  48. package/build/lib/npmPackage.mjs.map +0 -1
  49. package/build/lib/package.mjs +0 -129
  50. package/build/lib/package.mjs.map +0 -1
  51. package/build/lib/packageVersion.mjs +0 -174
  52. package/build/lib/packageVersion.mjs.map +0 -1
  53. package/build/lib/parseVersion.mjs +0 -54
  54. package/build/lib/parseVersion.mjs.map +0 -1
  55. package/build/lib/prompter.mjs +0 -31
  56. package/build/lib/prompter.mjs.map +0 -1
  57. package/build/lib/publishedPackage.mjs +0 -66
  58. package/build/lib/publishedPackage.mjs.map +0 -1
  59. package/build/lib/scripts.mjs +0 -10
  60. package/build/lib/scripts.mjs.map +0 -1
  61. package/build/lib/stripUtf8Bom.mjs +0 -11
  62. package/build/lib/stripUtf8Bom.mjs.map +0 -1
  63. package/build/lib/toposort.mjs +0 -26
  64. package/build/lib/toposort.mjs.map +0 -1
  65. package/build/lib/versionFile.mjs +0 -78
  66. package/build/lib/versionFile.mjs.map +0 -1
  67. package/build/lib/workspace.mjs +0 -51
  68. package/build/lib/workspace.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-92b6ba5c.js","sources":["../../tools.core/build/log.mjs","../src/commands/build/tsc.ts","../src/commands/build/docs.ts","../src/lib/toposort.ts","../src/commands/build/index.ts"],"sourcesContent":["const logPackageMessage = (name, step, index, total) => {\n const numLength = total === undefined ? undefined : total.toString().length;\n const indexString = total === undefined || total < 2 ? \"\" : `${index.toString().padStart(numLength, \"0\")}/${total} `;\n const identifierString = `${indexString}${name.padEnd(15)}`;\n console.log(`${identifierString} >> ${step}`);\n};\n\nexport { logPackageMessage };\n//# sourceMappingURL=log.mjs.map\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 * as terser from \"terser\";\n\nimport { logPackageMessage } from \"../../lib/log\";\nimport { build as tscBuild } from \"./tsc\";\nimport { generateDocs } from \"./docs\";\nimport {\n\tPackageLocation,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n} from \"../../lib/package\";\nimport { 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\tworkspace: WorkspaceLocation;\n\tpackages: PackageLocation[];\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 = options.workspace;\n\tconst folders = options.packages;\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(\"Compiling typescript to javascript\");\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(workspace.path, \"lib\"), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\n\t\t\tlogStep(\"Copying basics definition file to the lib folder\");\n\t\t\tfs.writeFileSync(\n\t\t\t\tpath.join(workspace.path, \"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(\"Generating typedoc documentation\");\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(workspace.path, \"docs\", data.Package),\n\t\t\t\tdata.Package,\n\t\t\t);\n\t\t}\n\n\t\tindex++;\n\t}\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","folders","sortedPackages","sortPackagesByBuildOrder","skipPackagesWithoutTsFiles","ensureTsConfig","readPackageCreatorManifest","logStep","Package","outputDirectory","mkdirSync","buildResult","tscBuild","banner","createBannerComment","writeFileSync","encoding","minimize","minifyResult","terser","minify","ecma","minifiedPath","code","docs","tsconfigPath","existsSync","content","applyTsConfigOption","JSON","stringify","parse","Array","from","reduce","acc","readPackageNpmManifest","packageDependencies","packageName","packageData","devDependencies","peerDependencies","filter","unshift","bannerParts","text","details","version","commit","commitDirty","date","toISOString","detailsText","bannerText"],"mappings":";;;;;;;;;;;;;AAAaA,MAAAA,iBAAiB,GAAGA,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,GAAED,KAAK,CAAEI,QAAQ,EAAE,CAACG,QAAQ,CAACL,SAAS,EAAG,GAAG,CAAK,CAAA,CAAA,EAAAD,KAAQ,CAAA,CAAA,CAAA,CAAA;EAE9D,MAAMO,gBAAgB,GAAI,CAAA,EAAEF,WAAY,CAAA,EAAER,IAAI,CAACW,MAAM,CAAC,EAAE,CAAG,CAAA,CAAA,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CAAA;AACb;AACA;AACA,EAAG,CAAA,CAAA;AACF,GAAA;AAEA,EAAA,OAAOlK,SAAS,CAAA;AACjB,CAAC;;;;;;;;;"}
package/build/index.mjs CHANGED
@@ -2,5 +2,5 @@
2
2
  import 'source-map-support/register.js';
3
3
  import 'v8-compile-cache';
4
4
 
5
- import('./cli.mjs');
5
+ import('./cli-5332deff.js').then(function (n) { return n.t; });
6
6
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import \"source-map-support/register.js\";\nimport \"v8-compile-cache\";\n\nimport(\"./cli\");\n"],"names":[],"mappings":";;;;AAGA,OAAO,WAAO,CAAC"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import \"source-map-support/register.js\";\nimport \"v8-compile-cache\";\n\nimport(\"./cli\");\n"],"names":[],"mappings":";;;;AAGA,OAAO,mBAAO,oCAAC"}
@@ -1,16 +1,25 @@
1
1
  import * as path from 'path';
2
2
  import * as fs from 'fs';
3
3
  import glob from 'glob';
4
- import { readWorkspaceNpmManifest, getWorkspaceLibPath } from '../lib/workspace.mjs';
5
- import { readPublishedPackageNpmManifest } from '../lib/publishedPackage.mjs';
6
- import { determineWorkspaceIGLibraries } from '../lib/dependencies.mjs';
4
+ import * as os from 'os';
5
+ import { d as determineWorkspaceIGLibraries, a as readPublishedPackageNpmManifest } from './dependencies-227aca50.js';
6
+ import 'write-pkg';
7
+ import { c as readWorkspaceNpmManifest, k as getWorkspaceLibPath } from './cli-5332deff.js';
8
+ import 'node:path';
9
+ import 'node:fs';
10
+ import 'axios';
11
+ import 'resolve';
12
+ import 'update-notifier';
13
+ import 'yargs/yargs';
14
+ import 'url';
15
+ import 'assert';
16
+ import 'events';
17
+ import 'util';
18
+ import 'inquirer';
7
19
 
8
20
  const DEFINITION_FILE_HINT = "// This file is automatically managed by the ig.gfx.packager.";
9
21
  const executePostInstall = workspace => {
10
- const manifest = readWorkspaceNpmManifest(workspace);
11
- if (manifest === undefined) {
12
- throw new Error(`Expected an npm manifest to exist.`);
13
- }
22
+ readWorkspaceNpmManifest(workspace);
14
23
  const libPath = getWorkspaceLibPath(workspace);
15
24
  fs.mkdirSync(libPath, {
16
25
  recursive: true
@@ -43,10 +52,8 @@ const executePostInstall = workspace => {
43
52
  }
44
53
 
45
54
  // add a hint to the top of the file so we know it's managed by the packager.
46
- const content = `${DEFINITION_FILE_HINT}
47
- // This is a reference to version ${manifest.version}.
48
- // Run "npm install" to install the types if they are missing or not up to date.
49
- /// <reference types="${manifest.name}" />`;
55
+
56
+ const content = [DEFINITION_FILE_HINT, `// This is a reference to version ${manifest.version}.`, `// Run "npm install" to install the types if they are missing or not up to date.`, `/// <reference types="${manifest.name}" />`].join(os.EOL);
50
57
  fs.writeFileSync(path.join(getWorkspaceLibPath(workspace), manifest.types), content, {
51
58
  encoding: "utf8"
52
59
  });
@@ -54,4 +61,4 @@ const executePostInstall = workspace => {
54
61
  };
55
62
 
56
63
  export { executePostInstall };
57
- //# sourceMappingURL=postinstall.mjs.map
64
+ //# sourceMappingURL=postinstall-7e50da37.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postinstall-7e50da37.js","sources":["../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport glob from \"glob\";\nimport * as os from \"os\";\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\tconst libPath = getWorkspaceLibPath(workspace);\n\n\tfs.mkdirSync(libPath, { recursive: true });\n\n\tconst existingDefinitions = glob.sync(\"**/*.d.ts\", {\n\t\tcwd: libPath,\n\t\tabsolute: true,\n\t});\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 existingDefinitionPath of existingDefinitions) {\n\t\tconst content = fs.readFileSync(existingDefinitionPath, {\n\t\t\tencoding: \"utf-8\",\n\t\t});\n\n\t\tif (content.startsWith(DEFINITION_FILE_HINT)) {\n\t\t\tfs.rmSync(existingDefinitionPath);\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\tfor (const existingDefinitionPath of existingDefinitions) {\n\t\t\tconst basename = path.basename(existingDefinitionPath);\n\n\t\t\tif (basename === manifest.types) {\n\t\t\t\tfs.rmSync(existingDefinitionPath, { force: true });\n\t\t\t}\n\t\t}\n\n\t\t// add a hint to the top of the file so we know it's managed by the packager.\n\n\t\tconst content = [\n\t\t\tDEFINITION_FILE_HINT,\n\t\t\t`// This is a reference to version ${manifest.version}.`,\n\t\t\t`// Run \"npm install\" to install the types if they are missing or not up to date.`,\n\t\t\t`/// <reference types=\"${manifest.name}\" />`,\n\t\t].join(os.EOL);\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","readWorkspaceNpmManifest","libPath","getWorkspaceLibPath","fs","mkdirSync","recursive","existingDefinitions","glob","sync","cwd","absolute","existingDefinitionPath","content","readFileSync","encoding","startsWith","rmSync","libraryLocations","determineWorkspaceIGLibraries","location","manifest","readPublishedPackageNpmManifest","basename","path","types","force","version","name","join","os","EOL","writeFileSync"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,MAAMA,oBAAoB,GACzB,+DAA+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,EAAE,IAAA;AAAK,SAAC,CAAC,CAAA;AACnD,OAAA;AACD,KAAA;;AAEA;;IAEA,MAAMb,OAAO,GAAG,CACff,oBAAoB,EACnB,qCAAoCuB,QAAQ,CAACM,OAAQ,CAAA,CAAA,CAAE,EACvD,CAAA,gFAAA,CAAiF,EACjF,CAAwBN,sBAAAA,EAAAA,QAAQ,CAACO,IAAK,CAAK,IAAA,CAAA,CAC5C,CAACC,IAAI,CAACC,EAAE,CAACC,GAAG,CAAC,CAAA;AAEd3B,IAAAA,EAAE,CAAC4B,aAAa,CACfR,IAAI,CAACK,IAAI,CAAC1B,mBAAmB,CAACH,SAAS,CAAC,EAAEqB,QAAQ,CAACI,KAAK,CAAC,EACzDZ,OAAO,EACP;AACCE,MAAAA,QAAQ,EAAE,MAAA;AACX,KAAC,CACD,CAAA;AACF,GAAA;AACD;;;;"}
@@ -1,14 +1,26 @@
1
1
  import * as path from 'path';
2
2
  import * as fs from 'fs';
3
3
  import { spawnSync } from 'child_process';
4
- import { readPackageCreatorManifest, readPackageNpmManifest, writePackageNpmManifest, PACKAGE_FILE, readPackageCreatorIndex, INDEX_FILE } from '../lib/package.mjs';
5
- import { readWorkspaceNpmManifest, getWorkspaceOutputPath, iterateWorkspacePackages } from '../lib/workspace.mjs';
6
- import { getVersionInformationFromGit } from '../lib/git.mjs';
7
- import { getWorkspaceBannerText } from '../lib/banner.mjs';
8
- import { parseVersionFromString } from '../lib/parseVersion.mjs';
9
- import { getVersionFileHandler } from '../lib/versionFile.mjs';
10
- import { logPackageMessage } from '../lib/log.mjs';
11
- import { buildFolders } from './build/index.mjs';
4
+ import 'resolve';
5
+ import 'write-pkg';
6
+ import { c as readWorkspaceNpmManifest, g as getWorkspaceOutputPath, r as readPackageCreatorManifest, n as readPackageNpmManifest, o as writePackageNpmManifest, P as PACKAGE_FILE, b as readPackageCreatorIndex, I as INDEX_FILE, q as iterateWorkspacePackages } from './cli-5332deff.js';
7
+ import { b as buildFolders, l as logPackageMessage } from './index-92b6ba5c.js';
8
+ import 'glob';
9
+ import 'node:path';
10
+ import 'node:fs';
11
+ import 'axios';
12
+ import { p as parseVersionFromString, g as getVersionFileHandler, a as getVersionInformationFromGit, b as getWorkspaceBannerText } from './versionFile-b3a65dc8.js';
13
+ import 'update-notifier';
14
+ import 'yargs/yargs';
15
+ import 'url';
16
+ import 'assert';
17
+ import 'events';
18
+ import 'util';
19
+ import 'inquirer';
20
+ import 'terser';
21
+ import 'typescript';
22
+ import 'typedoc';
23
+ import 'simple-git';
12
24
 
13
25
  const publishToNpm = async ({
14
26
  workspace,
@@ -66,7 +78,7 @@ const publishToNpm = async ({
66
78
  writePackageNpmManifest(location, packageJson);
67
79
  getVersionFileHandler(location).write(creatorPackage.Package, newVersion);
68
80
  const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
69
- const bannerText = workspaceManifest !== undefined ? getWorkspaceBannerText(workspaceManifest) : undefined;
81
+ const bannerText = getWorkspaceBannerText(workspaceManifest);
70
82
  await buildFolders({
71
83
  workspace,
72
84
  packages: [location],
@@ -118,4 +130,4 @@ const publishToNpm = async ({
118
130
  };
119
131
 
120
132
  export { publishToNpm };
121
- //# sourceMappingURL=publishNpm.mjs.map
133
+ //# sourceMappingURL=publishNpm-e2c8347f.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishNpm-e2c8347f.js","sources":["../src/commands/publishNpm.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport { spawnSync } from \"child_process\";\n\nimport { PackageVersion } from \"../lib/packageVersion\";\nimport {\n\tINDEX_FILE,\n\tPackageLocation,\n\tPACKAGE_FILE,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n\twritePackageNpmManifest,\n} from \"../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\titerateWorkspacePackages,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../lib/git\";\nimport { getWorkspaceBannerText } from \"../lib/banner\";\nimport { parseVersionFromString } from \"../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../lib/versionFile\";\nimport { logPackageMessage } from \"../lib/log\";\n\nimport { buildFolders } from \"./build\";\n\nexport interface PublishToNpmSettings {\n\tworkspace: WorkspaceLocation;\n\tlocation: PackageLocation;\n\tversion: string;\n\tdryRun?: boolean;\n}\n\nexport const publishToNpm = async ({\n\tworkspace,\n\tlocation,\n\tversion: providedVersion,\n\tdryRun,\n}: PublishToNpmSettings) => {\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(providedVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber === 100) {\n\t\tnewVersion.preRelease = undefined;\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Refusing to publish a package with a build version larger than 100.`,\n\t\t);\n\t}\n\n\tconst workspaceManifest = readWorkspaceNpmManifest(workspace);\n\tconst workspaceOutputPath = getWorkspaceOutputPath(workspace);\n\tconst creatorPackage = readPackageCreatorManifest(location);\n\tlet packageJson = readPackageNpmManifest(location);\n\n\tif (packageJson === undefined) {\n\t\tpackageJson = {\n\t\t\tname:\n\t\t\t\t\"@intelligentgraphics/3d\" +\n\t\t\t\tcreatorPackage.Package.toLowerCase(),\n\t\t\tversion: \"1.0.0\",\n\t\t\tdescription: creatorPackage.Package,\n\t\t};\n\t}\n\n\tpackageJson.version = newVersion.toVersionString({\n\t\tbuildNumber: false,\n\t});\n\tpackageJson.description = newVersion.toDescriptionString(\n\t\tcreatorPackage.Package,\n\t);\n\tpackageJson.main = `${creatorPackage.Package}.js`;\n\tpackageJson.types = `${creatorPackage.Package}.d.ts`;\n\tpackageJson.publishConfig ??= {};\n\tpackageJson.publishConfig.acccess = \"public\";\n\tpackageJson.ig = {\n\t\tscriptingLibrary: true,\n\t};\n\tpackageJson.files = undefined;\n\n\tconst publishDir = path.join(\n\t\tworkspaceOutputPath,\n\t\t\"publish\",\n\t\tcreatorPackage.Package,\n\t);\n\tfs.rmSync(publishDir, { recursive: true, force: true });\n\tfs.mkdirSync(publishDir, { recursive: true });\n\n\twritePackageNpmManifest(location, packageJson);\n\n\tgetVersionFileHandler(location).write(creatorPackage.Package, newVersion);\n\n\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\tworkspace,\n\t\tlocation,\n\t);\n\n\tconst bannerText = getWorkspaceBannerText(workspaceManifest);\n\n\tawait buildFolders({\n\t\tworkspace,\n\t\tpackages: [location],\n\t\tminimize: true,\n\t\toutDir: getWorkspaceOutputPath(workspace),\n\t\tbanner: {\n\t\t\ttext: bannerText,\n\t\t\tcommit: gitVersionInformation.commit,\n\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\tversion: newVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t}),\n\t\t\tdate: new Date(Date.now()),\n\t\t},\n\t});\n\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.d.ts`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.d.ts`),\n\t);\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.min.js`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.js`),\n\t);\n\n\tfs.copyFileSync(\n\t\tpath.join(location.manifestDir, \"package.json\"),\n\t\tpath.join(publishDir, \"package.json\"),\n\t);\n\n\tfs.writeFileSync(\n\t\tpath.join(publishDir, PACKAGE_FILE),\n\t\tJSON.stringify(creatorPackage, null, 2),\n\t);\n\n\tconst index = readPackageCreatorIndex(location);\n\n\tif (index !== undefined) {\n\t\tfs.writeFileSync(\n\t\t\tpath.join(publishDir, INDEX_FILE),\n\t\t\tJSON.stringify(index),\n\t\t);\n\t}\n\n\tconst readmeName = fs\n\t\t.readdirSync(location.path)\n\t\t.find((name) => name.toLowerCase() === \"readme.md\");\n\n\tif (readmeName !== undefined) {\n\t\tfs.copyFileSync(\n\t\t\tpath.join(location.path, readmeName),\n\t\t\tpath.join(publishDir, readmeName),\n\t\t);\n\t}\n\n\tconst npmPublishArgs: string[] = [];\n\n\tif (dryRun) {\n\t\tnpmPublishArgs.push(\"--dry-run\");\n\t}\n\n\tif (newVersion.preRelease) {\n\t\tnpmPublishArgs.push(\"--tag\", \"next\");\n\t}\n\n\tlogPackageMessage(\n\t\tcreatorPackage.Package,\n\t\t`Publishing to npm with version ${packageJson.version} using tag ${\n\t\t\tnewVersion.preRelease ? \"next\" : \"latest\"\n\t\t}`,\n\t);\n\n\tspawnSync(\"npm\", [\"publish\", ...npmPublishArgs], {\n\t\tstdio: \"inherit\",\n\t\tencoding: \"utf8\",\n\t\tcwd: publishDir,\n\t});\n\n\tfor (const packageLocation of iterateWorkspacePackages(workspace)) {\n\t\tconst manifest = readPackageNpmManifest(packageLocation);\n\n\t\tif (manifest?.dependencies?.[packageJson.name] !== undefined) {\n\t\t\tmanifest.dependencies[packageJson.name] = \"^\" + packageJson.version;\n\t\t\twritePackageNpmManifest(packageLocation, manifest);\n\t\t}\n\t}\n};\n"],"names":["publishToNpm","workspace","location","version","providedVersion","dryRun","newVersion","parseVersionFromString","err","Error","buildNumber","preRelease","type","undefined","workspaceManifest","readWorkspaceNpmManifest","workspaceOutputPath","getWorkspaceOutputPath","creatorPackage","readPackageCreatorManifest","packageJson","readPackageNpmManifest","name","Package","toLowerCase","description","toVersionString","toDescriptionString","main","types","publishConfig","acccess","ig","scriptingLibrary","files","publishDir","path","join","fs","rmSync","recursive","force","mkdirSync","writePackageNpmManifest","getVersionFileHandler","write","gitVersionInformation","getVersionInformationFromGit","bannerText","getWorkspaceBannerText","buildFolders","packages","minimize","outDir","banner","text","commit","commitDirty","dirty","date","Date","now","copyFileSync","manifestDir","writeFileSync","PACKAGE_FILE","JSON","stringify","index","readPackageCreatorIndex","INDEX_FILE","readmeName","readdirSync","find","npmPublishArgs","push","logPackageMessage","spawnSync","stdio","encoding","cwd","packageLocation","iterateWorkspacePackages","_manifest$dependencie","manifest","dependencies"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmCaA,MAAAA,YAAY,GAAG,OAAO;EAClCC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,EAAEC,eAAe;AACxBC,EAAAA,MAAAA;AACqB,CAAC,KAAK;AAC3B,EAAA,IAAIC,UAA0B,CAAA;EAC9B,IAAI;AACHA,IAAAA,UAAU,GAAGC,sBAAsB,CAACH,eAAe,CAAC,CAAA;GACpD,CAAC,OAAOI,GAAG,EAAE;AACb,IAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,+CAAA,CAAgD,CAAC,CAAA;AACnE,GAAA;AAEA,EAAA,IAAIH,UAAU,CAACI,WAAW,GAAG,GAAG,EAAE;IACjCJ,UAAU,CAACK,UAAU,GAAG;AACvBC,MAAAA,IAAI,EAAE,MAAM;MACZT,OAAO,EAAEG,UAAU,CAACI,WAAAA;KACpB,CAAA;AACF,GAAC,MAAM,IAAIJ,UAAU,CAACI,WAAW,KAAK,GAAG,EAAE;IAC1CJ,UAAU,CAACK,UAAU,GAAGE,SAAS,CAAA;AAClC,GAAC,MAAM;AACN,IAAA,MAAM,IAAIJ,KAAK,CACb,CAAA,mEAAA,CAAoE,CACrE,CAAA;AACF,GAAA;AAEA,EAAA,MAAMK,iBAAiB,GAAGC,wBAAwB,CAACd,SAAS,CAAC,CAAA;AAC7D,EAAA,MAAMe,mBAAmB,GAAGC,sBAAsB,CAAChB,SAAS,CAAC,CAAA;AAC7D,EAAA,MAAMiB,cAAc,GAAGC,0BAA0B,CAACjB,QAAQ,CAAC,CAAA;AAC3D,EAAA,IAAIkB,WAAW,GAAGC,sBAAs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'simple-git';
2
+ import * as path from 'path';
3
+ import * as fs from 'fs';
4
+ import 'resolve';
5
+ import 'write-pkg';
6
+ import { i as isErrorENOENT } from './cli-5332deff.js';
7
+ import 'glob';
8
+ import 'node:path';
9
+ import 'node:fs';
10
+ import 'axios';
11
+
12
+ const readStringFromFile = filePath => fs.readFileSync(filePath, {
13
+ encoding: "utf8"
14
+ });
15
+ const readStringFromFileOrUndefined = filePath => {
16
+ try {
17
+ return readStringFromFile(filePath);
18
+ } catch (err) {
19
+ if (!isErrorENOENT(err)) {
20
+ throw err;
21
+ }
22
+ return undefined;
23
+ }
24
+ };
25
+
26
+ const getVersionInformationFromGit = async (workspaceLocation, packageLocation) => {
27
+ try {
28
+ var _log$latest, _log$latest2;
29
+ const git = simpleGit({
30
+ baseDir: workspaceLocation.path
31
+ });
32
+
33
+ // check wether the files for a folder are changed
34
+ // if so, mark as dirty
35
+ const diff = await git.diffSummary();
36
+ const dirty = diff.files.some(file => {
37
+ if (file.file.toLowerCase().includes("releases") || file.file.toLowerCase().endsWith("version.ts") || file.file.toLowerCase().endsWith("package.json")) {
38
+ return false;
39
+ }
40
+ const fullPath = path.resolve(workspaceLocation.path, file.file);
41
+ const relativePath = path.relative(packageLocation.path, fullPath);
42
+ return !relativePath.startsWith("..");
43
+ });
44
+ const log = await git.log({
45
+ maxCount: 1
46
+ });
47
+ const commit = !((_log$latest = log.latest) !== null && _log$latest !== void 0 && _log$latest.hash) ? undefined : log.latest.hash.substring(0, 7);
48
+ return {
49
+ commit,
50
+ dirty,
51
+ commitDate: (_log$latest2 = log.latest) === null || _log$latest2 === void 0 ? void 0 : _log$latest2.date
52
+ };
53
+ } catch (err) {
54
+ return {};
55
+ }
56
+ };
57
+
58
+ const getWorkspaceBannerText = manifest => {
59
+ var _manifest$packager;
60
+ let bannerText = manifest === null || manifest === void 0 ? void 0 : (_manifest$packager = manifest.packager) === null || _manifest$packager === void 0 ? void 0 : _manifest$packager.banner;
61
+ if (bannerText) {
62
+ const match = bannerText.match(/Copyright \(C\) (\d+)( ?- ?(\d+))?/);
63
+ if (match !== null) {
64
+ const startYear = parseInt(match[1]);
65
+ const endYear = new Date().getFullYear();
66
+ if (startYear !== endYear) {
67
+ bannerText = bannerText.replace(match[0], `Copyright (C) ${startYear} - ${endYear}`);
68
+ } else {
69
+ bannerText = bannerText.replace(match[0], `Copyright (C) ${startYear}`);
70
+ }
71
+ }
72
+ }
73
+ return bannerText;
74
+ };
75
+
76
+ // Stolen from ig.tools.core
77
+
78
+ class PackageVersion {
79
+ // https://regex101.com/r/90PEY9/1
80
+ static fullTextMatcher = /(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?/;
81
+ static lineMatcher = /^(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?$/;
82
+ static extractFromText(input, description) {
83
+ if (input === undefined) {
84
+ throw new Error(`Can not parse version from undefined`);
85
+ }
86
+ const match = input.match(PackageVersion.fullTextMatcher);
87
+ if (!match) {
88
+ throw new Error(`Could not extract a version from input: ${input}`);
89
+ }
90
+ return PackageVersion.fromMatch(match, description);
91
+ }
92
+ static extractFromLine(input, description) {
93
+ if (input === undefined) {
94
+ throw new Error(`Can not parse version from undefined`);
95
+ }
96
+ const match = input.match(PackageVersion.lineMatcher);
97
+ if (!match) {
98
+ throw new Error(`Could not parse version from input: ${input}`);
99
+ }
100
+ return PackageVersion.fromMatch(match, description);
101
+ }
102
+ static equals(a, b, checkPrerelease = false) {
103
+ if (a.major !== b.major || a.minor !== b.minor || a.patch !== b.patch) {
104
+ return false;
105
+ }
106
+ if (checkPrerelease === false) {
107
+ return true;
108
+ }
109
+ if (a.preRelease === b.preRelease) {
110
+ return true;
111
+ }
112
+ if (a.preRelease === undefined || b.preRelease === undefined) {
113
+ return false;
114
+ }
115
+ return a.preRelease.type === b.preRelease.type && a.preRelease.version === b.preRelease.version;
116
+ }
117
+ static fromMatch([, major,, minor = "0",, patch = "0",, build,, preReleaseType, preReleaseNumber], description) {
118
+ let preRelease = undefined;
119
+ let buildNumber = 100;
120
+ if (preReleaseType && preReleaseNumber) {
121
+ preRelease = {
122
+ type: preReleaseType,
123
+ version: parseInt(preReleaseNumber)
124
+ };
125
+ }
126
+ if (build) {
127
+ buildNumber = Number(build);
128
+ } else if (description) {
129
+ const descriptionMatch = description.match(/(\d+)\)$/);
130
+ if (descriptionMatch) {
131
+ buildNumber = parseInt(descriptionMatch[1]);
132
+ }
133
+ }
134
+ return new PackageVersion(parseInt(major), parseInt(minor), parseInt(patch), preRelease, buildNumber);
135
+ }
136
+ static sort(a, b, ascending = true) {
137
+ const createSortResult = (a, b) => ascending ? a - b : b - a;
138
+ if (a.major !== b.major) {
139
+ return createSortResult(a.major, b.major);
140
+ }
141
+ if (a.minor !== b.minor) {
142
+ return createSortResult(a.minor, b.minor);
143
+ }
144
+ if (a.patch !== b.patch) {
145
+ return createSortResult(a.patch, b.patch);
146
+ }
147
+ return createSortResult(a.preRelease ? a.preRelease.version : 0, b.preRelease ? b.preRelease.version : 0);
148
+ }
149
+ static toNumber(version) {
150
+ return ((version.major * 1000 + version.minor) * 1000 + version.patch) * 1000 + version.buildNumber;
151
+ }
152
+ constructor(major, minor, patch, preRelease, buildNumber) {
153
+ this.major = major;
154
+ this.minor = minor;
155
+ this.patch = patch;
156
+ this.preRelease = preRelease;
157
+ this.buildNumber = buildNumber;
158
+ }
159
+ isPreRelease() {
160
+ return this.preRelease !== undefined;
161
+ }
162
+ clone() {
163
+ return new PackageVersion(this.major, this.minor, this.patch, this.preRelease ? {
164
+ ...this.preRelease
165
+ } : undefined, this.buildNumber);
166
+ }
167
+ incrementMajor() {
168
+ this.preRelease = undefined;
169
+ this.patch = 0;
170
+ this.minor = 0;
171
+ this.major++;
172
+ }
173
+ incrementMinor() {
174
+ this.preRelease = undefined;
175
+ this.patch = 0;
176
+ this.minor++;
177
+ }
178
+ incrementPatch() {
179
+ this.preRelease = undefined;
180
+ this.patch++;
181
+ }
182
+ createPreRelease(type) {
183
+ if (!this.preRelease) {
184
+ this.buildNumber = 1;
185
+ } else {
186
+ this.buildNumber++;
187
+ }
188
+ if (this.preRelease && type === this.preRelease.type) {
189
+ this.preRelease.version++;
190
+ return;
191
+ }
192
+ this.preRelease = {
193
+ version: 0,
194
+ type
195
+ };
196
+ }
197
+ createRelease() {
198
+ this.preRelease = undefined;
199
+ this.buildNumber = 100;
200
+ }
201
+ toVersionString({
202
+ buildNumber
203
+ } = {}) {
204
+ let version = [this.major, this.minor, this.patch].join(".");
205
+ if (buildNumber) {
206
+ version += "." + this.buildNumber;
207
+ }
208
+ if (this.preRelease) {
209
+ version += `-${this.preRelease.type}.${this.preRelease.version}`;
210
+ }
211
+ return version;
212
+ }
213
+ toDescriptionString(packageName) {
214
+ const base = [this.major, this.minor, this.patch].join(".");
215
+ const parts = [packageName, base];
216
+ if (this.preRelease) {
217
+ parts.push(upperCaseFirst(this.preRelease.type));
218
+ parts.push(this.preRelease.version);
219
+ }
220
+ parts.push(`(${base}.${this.buildNumber})`);
221
+ return parts.join(" ");
222
+ }
223
+
224
+ /**
225
+ * Determines wether the version is lesser than the input version
226
+ *
227
+ * @param {PackageVersion} version
228
+ * @returns
229
+ */
230
+ isLesserThan(version) {
231
+ return PackageVersion.toNumber(this) < PackageVersion.toNumber(version);
232
+ }
233
+
234
+ /**
235
+ * Determines wether the version is greater than the input version
236
+ *
237
+ * @param {PackageVersion} version
238
+ * @returns
239
+ */
240
+ isGreaterThan(version) {
241
+ return PackageVersion.toNumber(this) > PackageVersion.toNumber(version);
242
+ }
243
+ }
244
+ const upperCaseFirst = input => {
245
+ return input.slice(0, 1).toUpperCase() + input.slice(1);
246
+ };
247
+
248
+ const parseVersionFromString = input => {
249
+ if (input === undefined) {
250
+ throw new Error(`Can not parse version from undefined`);
251
+ }
252
+ let match;
253
+ let major;
254
+ let minor;
255
+ let patch;
256
+ let build;
257
+ let preReleaseType;
258
+ let preReleaseNumber;
259
+ if (
260
+ // first try to find a full match with build number
261
+ (match = input.match(/(\d+)\.(\d+)\.(\d+)\.(\d+)(-([^\.]+)\.(\d+))?/)) !== null) {
262
+ [, major, minor, patch, build, preReleaseType, preReleaseNumber] = match;
263
+ } else if ((match = input.match(/(\d+)\.(\d+)\.(\d+)(-([^\.]+)\.(\d+))?/)) !== null) {
264
+ [, major, minor, patch,, preReleaseType, preReleaseNumber] = match;
265
+ }
266
+ if (match === null) {
267
+ throw new Error(`Could not parse version from input: ${input}`);
268
+ }
269
+ let preRelease = undefined;
270
+ let buildNumber = 100;
271
+ if (preReleaseType && preReleaseNumber) {
272
+ preRelease = {
273
+ type: preReleaseType,
274
+ version: parseInt(preReleaseNumber)
275
+ };
276
+ }
277
+ if (build) {
278
+ buildNumber = Number(build);
279
+ } else if (input) {
280
+ const descriptionMatch = input.match(/(\d+)\)$/);
281
+ if (descriptionMatch) {
282
+ buildNumber = parseInt(descriptionMatch[1]);
283
+ }
284
+ }
285
+ return new PackageVersion(parseInt(major), parseInt(minor), parseInt(patch), preRelease, buildNumber);
286
+ };
287
+
288
+ // 1000001001 -> 1.0.1.1
289
+ // 1002017001 -> 1.2.17.1
290
+ const parseVersionFromNumericVersion = version => {
291
+ const major = Math.floor(version / 1000000000);
292
+ const minor = Math.floor(version % 1000000000 / 1000000);
293
+ const patch = Math.floor(version % 1000000 / 1000);
294
+ const buildNumber = version % 1000;
295
+ return new PackageVersion(major, minor, patch, undefined, buildNumber);
296
+ };
297
+
298
+ // https://regex101.com/r/LtGAu5/1
299
+ const logRegex = /console\.log\(\s*"([\w\s\.\(\)]+)\ *Copyright[\w\s\(\)\.]+(\d{4}|\d{4} - \d{4})([\w\s\(\)\.]+)?",?\s*\)/i;
300
+ const currentYear = new Date(Date.now()).getFullYear();
301
+ const getVersionFileHandler = location => {
302
+ const filePath = path.join(location.scriptsDir, "Version.ts");
303
+ const invalidVersionFile = versionFile => ({
304
+ version: undefined,
305
+ write: (name, newVersion) => {
306
+ const scriptsContent = fs.readdirSync(location.scriptsDir);
307
+ const tsFiles = scriptsContent.filter(file => file.endsWith(".ts"));
308
+ if (tsFiles.length > 0) {
309
+ return createVersionFileWriter([currentYear], "")(name, newVersion);
310
+ }
311
+ },
312
+ reset: () => {
313
+ if (versionFile !== undefined) {
314
+ fs.writeFileSync(filePath, versionFile, {
315
+ encoding: "utf8"
316
+ });
317
+ } else {
318
+ try {
319
+ fs.rmSync(filePath);
320
+ } catch (err) {
321
+ if (!isErrorENOENT(err)) {
322
+ throw err;
323
+ }
324
+ }
325
+ }
326
+ }
327
+ });
328
+ const createVersionFileWriter = (copyright = [currentYear], copyrightStuff = "") => (name, newVersion) => {
329
+ const descriptionText = newVersion.toDescriptionString(name);
330
+ const copyrightText = createYearString(copyright);
331
+ const result = `console.log("${descriptionText}. Copyright (C) ${copyrightText}${copyrightStuff}");`;
332
+ fs.writeFileSync(filePath, result, {
333
+ encoding: "utf-8"
334
+ });
335
+ };
336
+ let rawVersionFile = readStringFromFileOrUndefined(filePath);
337
+ if (rawVersionFile === undefined) {
338
+ return invalidVersionFile(rawVersionFile);
339
+ }
340
+ const versionFile = rawVersionFile.replace(/\n/g, "");
341
+ const match = versionFile.match(logRegex);
342
+ if (!match) {
343
+ return invalidVersionFile(versionFile);
344
+ }
345
+ const [_full, _description, copyright, copyrightStuff] = match;
346
+ const copyrightYears = copyright.match(/^(\d+)( ?- ?(\d+))?$/);
347
+ let years;
348
+ if (copyrightYears === null) {
349
+ years = [currentYear];
350
+ } else {
351
+ years = [Number(copyrightYears[1]), currentYear];
352
+ }
353
+ return {
354
+ write: createVersionFileWriter(years, copyrightStuff),
355
+ reset: () => {
356
+ fs.writeFileSync(filePath, versionFile, {
357
+ encoding: "utf8"
358
+ });
359
+ }
360
+ };
361
+ };
362
+ const createYearString = years => {
363
+ if (years[1] === undefined || years[0] === years[1]) {
364
+ return years[0].toString();
365
+ }
366
+ return `${years[0]} - ${years[1]}`;
367
+ };
368
+
369
+ export { PackageVersion as P, getVersionInformationFromGit as a, getWorkspaceBannerText as b, parseVersionFromNumericVersion as c, getVersionFileHandler as g, parseVersionFromString as p };
370
+ //# sourceMappingURL=versionFile-b3a65dc8.js.map