@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.
- package/build/cli-5332deff.js +2486 -0
- package/build/cli-5332deff.js.map +1 -0
- package/build/{lib/dependencies.mjs → dependencies-227aca50.js} +62 -7
- package/build/dependencies-227aca50.js.map +1 -0
- package/build/{commands/generate.mjs → generate-a3a16031.js} +17 -3
- package/build/generate-a3a16031.js.map +1 -0
- package/build/{commands/publish/index.mjs → index-5d595f56.js} +199 -17
- package/build/index-5d595f56.js.map +1 -0
- package/build/{commands/build/index.mjs → index-92b6ba5c.js} +151 -8
- package/build/index-92b6ba5c.js.map +1 -0
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/{commands/postinstall.mjs → postinstall-7e50da37.js} +19 -12
- package/build/postinstall-7e50da37.js.map +1 -0
- package/build/{commands/publishNpm.mjs → publishNpm-e2c8347f.js} +22 -10
- package/build/publishNpm-e2c8347f.js.map +1 -0
- package/build/versionFile-b3a65dc8.js +370 -0
- package/build/versionFile-b3a65dc8.js.map +1 -0
- package/package.json +8 -7
- package/readme.md +23 -3
- package/build/cli.mjs +0 -316
- package/build/cli.mjs.map +0 -1
- package/build/commands/build/docs.mjs +0 -34
- package/build/commands/build/docs.mjs.map +0 -1
- package/build/commands/build/index.mjs.map +0 -1
- package/build/commands/build/tsc.mjs +0 -84
- package/build/commands/build/tsc.mjs.map +0 -1
- package/build/commands/generate.mjs.map +0 -1
- package/build/commands/postinstall.mjs.map +0 -1
- package/build/commands/publish/index.mjs.map +0 -1
- package/build/commands/publish/zip.mjs +0 -168
- package/build/commands/publish/zip.mjs.map +0 -1
- package/build/commands/publishNpm.mjs.map +0 -1
- package/build/lib/assetService.mjs +0 -111
- package/build/lib/assetService.mjs.map +0 -1
- package/build/lib/banner.mjs +0 -20
- package/build/lib/banner.mjs.map +0 -1
- package/build/lib/dependencies.mjs.map +0 -1
- package/build/lib/error.mjs +0 -15
- package/build/lib/error.mjs.map +0 -1
- package/build/lib/fs.mjs +0 -19
- package/build/lib/fs.mjs.map +0 -1
- package/build/lib/git.mjs +0 -37
- package/build/lib/git.mjs.map +0 -1
- package/build/lib/log.mjs +0 -9
- package/build/lib/log.mjs.map +0 -1
- package/build/lib/npmPackage.mjs +0 -19
- package/build/lib/npmPackage.mjs.map +0 -1
- package/build/lib/package.mjs +0 -129
- package/build/lib/package.mjs.map +0 -1
- package/build/lib/packageVersion.mjs +0 -174
- package/build/lib/packageVersion.mjs.map +0 -1
- package/build/lib/parseVersion.mjs +0 -54
- package/build/lib/parseVersion.mjs.map +0 -1
- package/build/lib/prompter.mjs +0 -31
- package/build/lib/prompter.mjs.map +0 -1
- package/build/lib/publishedPackage.mjs +0 -66
- package/build/lib/publishedPackage.mjs.map +0 -1
- package/build/lib/scripts.mjs +0 -10
- package/build/lib/scripts.mjs.map +0 -1
- package/build/lib/stripUtf8Bom.mjs +0 -11
- package/build/lib/stripUtf8Bom.mjs.map +0 -1
- package/build/lib/toposort.mjs +0 -26
- package/build/lib/toposort.mjs.map +0 -1
- package/build/lib/versionFile.mjs +0 -78
- package/build/lib/versionFile.mjs.map +0 -1
- package/build/lib/workspace.mjs +0 -51
- package/build/lib/workspace.mjs.map +0 -1
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import * as fs from 'fs';
|
|
4
|
-
import { getPackageTypescriptFiles } from '../../lib/scripts.mjs';
|
|
5
|
-
|
|
6
|
-
const tryReadTsConfig = location => {
|
|
7
|
-
const {
|
|
8
|
-
config
|
|
9
|
-
} = ts.readConfigFile(path.join(location.scriptsDir, "tsconfig.json"), path => {
|
|
10
|
-
try {
|
|
11
|
-
return fs.readFileSync(path, "utf8");
|
|
12
|
-
} catch {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return config;
|
|
17
|
-
};
|
|
18
|
-
const build = async (location, outputDir) => {
|
|
19
|
-
const config = tryReadTsConfig(location);
|
|
20
|
-
config.compilerOptions.lib = ["es5", "dom"];
|
|
21
|
-
const result = ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir);
|
|
22
|
-
const compilerOptions = {
|
|
23
|
-
...result.options,
|
|
24
|
-
removeComments: false,
|
|
25
|
-
declaration: true,
|
|
26
|
-
sourceMap: false,
|
|
27
|
-
// We don't use tsc to actually emit the files, but we still need to set the correct
|
|
28
|
-
// output directory so the compiler can rewrite the `reference path` directives.
|
|
29
|
-
outFile: path.join(outputDir, "out.js"),
|
|
30
|
-
target: ts.ScriptTarget.ES5,
|
|
31
|
-
noEmitOnError: true
|
|
32
|
-
};
|
|
33
|
-
const host = ts.createCompilerHost(compilerOptions);
|
|
34
|
-
host.getCurrentDirectory = () => location.scriptsDir;
|
|
35
|
-
let js;
|
|
36
|
-
let definitions;
|
|
37
|
-
host.writeFile = (fileName, data, writeByteOrderMark) => {
|
|
38
|
-
if (fileName.endsWith(".js")) {
|
|
39
|
-
js = data;
|
|
40
|
-
} else if (fileName.endsWith(".d.ts")) {
|
|
41
|
-
definitions = data;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const files = getPackageTypescriptFiles(location);
|
|
45
|
-
if (files.length === 0) {
|
|
46
|
-
throw new Error(`Expected typescript files to exist when building a package. Packages only consisting of animation jsons do not need to be built.`);
|
|
47
|
-
}
|
|
48
|
-
const programOptions = {
|
|
49
|
-
rootNames: files,
|
|
50
|
-
options: compilerOptions,
|
|
51
|
-
host
|
|
52
|
-
};
|
|
53
|
-
const program = ts.createProgram(programOptions);
|
|
54
|
-
const emitResult = program.emit();
|
|
55
|
-
const allDiagnostics = ts.getPreEmitDiagnostics(program);
|
|
56
|
-
if (!emitResult.emitSkipped) {
|
|
57
|
-
if (allDiagnostics.length > 0) {
|
|
58
|
-
console.log(allDiagnostics.map(createErrorMessage).join("\n"));
|
|
59
|
-
}
|
|
60
|
-
if (js === undefined || definitions === undefined) {
|
|
61
|
-
throw new Error(`Unexpected: no js or definitions were created`);
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
js,
|
|
65
|
-
definitions
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
const error = allDiagnostics.map(createErrorMessage).join("\n");
|
|
69
|
-
throw new Error(error);
|
|
70
|
-
};
|
|
71
|
-
const createErrorMessage = diagnostic => {
|
|
72
|
-
if (!diagnostic.file) {
|
|
73
|
-
return `${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`;
|
|
74
|
-
}
|
|
75
|
-
const {
|
|
76
|
-
line,
|
|
77
|
-
character
|
|
78
|
-
} = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
79
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
80
|
-
return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export { build, tryReadTsConfig };
|
|
84
|
-
//# sourceMappingURL=tsc.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsc.mjs","sources":["../../../src/commands/build/tsc.ts"],"sourcesContent":["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"],"names":["tryReadTsConfig","location","config","ts","readConfigFile","path","join","scriptsDir","fs","readFileSync","undefined","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","length","Error","programOptions","rootNames","program","createProgram","emitResult","emit","allDiagnostics","getPreEmitDiagnostics","emitSkipped","console","log","map","createErrorMessage","error","diagnostic","file","flattenDiagnosticMessageText","messageText","line","character","getLineAndCharacterOfPosition","start","message"],"mappings":";;;;;AASaA,MAAAA,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,YAAY,CAACJ,IAAI,EAAE,MAAM,CAAC,CAAA;AACrC,KAAC,CAAC,MAAM;AACP,MAAA,OAAOK,SAAS,CAAA;AACjB,KAAA;AACD,GAAC,CACD,CAAA;AAED,EAAA,OAAOR,MAAM,CAAA;AAGd,EAAC;MAEYS,KAAoB,GAAG,OAC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IAAI,EAAE;IACrB,OAAQ,CAAA,EAAEpD,EAAE,CAACqD,4BAA4B,CACxCF,UAAU,CAACG,WAAW,EACtB,IAAI,CACH,CAAC,CAAA,CAAA;AACJ,GAAA;EAEA,MAAM;IAAEC,IAAI;AAAEC,IAAAA,SAAAA;GAAW,GAAGL,UAAU,CAACC,IAAI,CAACK,6BAA6B,CACxEN,UAAU,CAACO,KAAK,CAChB,CAAA;EAED,MAAMC,OAAO,GAAG3D,EAAE,CAACqD,4BAA4B,CAC9CF,UAAU,CAACG,WAAW,EACtB,IAAI,CACJ,CAAA;AAED,EAAA,OAAQ,GAAEH,UAAU,CAACC,IAAI,CAACvB,QAAS,CAAI0B,EAAAA,EAAAA,IAAI,GAAG,CAAE,IAC/CC,SAAS,GAAG,CACZ,CAAA,GAAA,EAAKG,OAAQ,CAAC,CAAA,CAAA;AAChB,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate.mjs","sources":["../../src/commands/generate.ts"],"sourcesContent":["import ts from \"typescript\";\n\nimport {\n\tPackageLocation,\n\twritePackageCreatorIndex,\n\treadPackageCreatorIndex,\n} from \"../lib/package\";\nimport { getPackageTypescriptFiles } from \"../lib/scripts\";\nimport {\n\tCreatorIndexEntry,\n\tCreatorIndexParameter,\n\tCreatorIndexParameterType,\n} from \"../lib/package\";\n\nfunction findTsNode<T extends ts.Node>(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => node is T,\n): T | undefined;\nfunction findTsNode(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => boolean,\n): ts.Node | undefined;\nfunction findTsNode(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => boolean,\n): ts.Node | undefined {\n\tlet result: ts.Node | undefined;\n\n\tts.forEachChild(node, (child) => {\n\t\tif (callback(child)) {\n\t\t\tresult = child;\n\t\t\treturn true;\n\t\t}\n\t});\n\n\treturn result;\n}\n\nfunction capitalizeFirstLetter(string) {\n\treturn string?.charAt(0).toUpperCase() + string?.slice(1);\n}\n\nfunction parseDefault(value: string, type: string) {\n\tconst uType: CreatorIndexParameterType = capitalizeFirstLetter(type);\n\tif (value === \"null\") return null;\n\tswitch (uType) {\n\t\tcase \"LengthM\":\n\t\tcase \"ArcDEG\":\n\t\tcase \"Float\":\n\t\t\treturn parseFloat(value);\n\t\tcase \"Integer\":\n\t\tcase \"Int\":\n\t\t\treturn parseInt(value);\n\t\tcase \"Boolean\":\n\t\tcase \"Bool\":\n\t\t\treturn value === \"true\";\n\t\tcase \"Material\":\n\t\tcase \"String\":\n\t\tdefault:\n\t\t\treturn value.replace(/^\"/, \"\").replace(/\"$/, \"\");\n\t}\n}\n\nfunction findEvaluatorNode(node: ts.Node): ts.ClassDeclaration | undefined {\n\tif (\n\t\tts.isModuleDeclaration(node) &&\n\t\tnode.body &&\n\t\tts.isModuleDeclaration(node.body) &&\n\t\tnode.body.body\n\t) {\n\t\tconst classDeclaration = findTsNode(\n\t\t\tnode.body.body,\n\t\t\t(child): child is ts.ClassDeclaration => {\n\t\t\t\tif (!ts.isClassDeclaration(child)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst isEvaluator = child.heritageClauses?.some((clause) => {\n\t\t\t\t\tif (clause.token !== ts.SyntaxKind.ExtendsKeyword) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn clause.types.some((type) =>\n\t\t\t\t\t\ttype.getText().includes(\"Evaluator\"),\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\treturn isEvaluator ?? false;\n\t\t\t},\n\t\t);\n\n\t\treturn classDeclaration;\n\t}\n}\n\nfunction getParameter(evaluatorNode: ts.ClassDeclaration) {\n\tlet memb = evaluatorNode.members?.find(\n\t\t(member) => member?.name?.getText().toLowerCase() == \"create\",\n\t);\n\tif (ts.isMethodDeclaration(memb!)) {\n\t\treturn memb.parameters.find(\n\t\t\t(para) => para.name.getText().toLowerCase() == \"parameters\",\n\t\t);\n\t}\n}\n\nfunction findParametersInterface(\n\tnode: ts.Node,\n\tinterfaceName: string,\n): ts.InterfaceDeclaration | undefined {\n\tif (\n\t\tts.isModuleDeclaration(node) &&\n\t\tnode.body &&\n\t\tts.isModuleDeclaration(node.body) &&\n\t\tnode.body.body\n\t) {\n\t\tconst interfaceDeclaration = findTsNode(\n\t\t\tnode.body.body,\n\t\t\t(child): child is ts.InterfaceDeclaration =>\n\t\t\t\tts.isInterfaceDeclaration(child) &&\n\t\t\t\tchild.name.getText() == interfaceName,\n\t\t);\n\n\t\treturn interfaceDeclaration;\n\t}\n\n\treturn undefined;\n}\n\nfunction getModuleName(sourceFile: ts.Node): string {\n\tlet fullName = \"\";\n\tif (ts.isModuleDeclaration(sourceFile)) {\n\t\tfullName += sourceFile.name.getText();\n\n\t\tlet packageB = sourceFile.body!;\n\t\tif (ts.isModuleDeclaration(packageB)) {\n\t\t\tfullName += \".\" + packageB.name.getText();\n\t\t}\n\t}\n\treturn fullName;\n}\n\nfunction genParameters(\n\tinterfac: ts.InterfaceDeclaration,\n): CreatorIndexParameter[] {\n\treturn interfac.members.map((member, i) => {\n\t\tlet para = {} as CreatorIndexParameter;\n\n\t\tpara.Name = member.name!.getText();\n\t\tif (para.Name.length > 45)\n\t\t\tthrow new Error(`Parameter name length >45 '${para.Name}'`);\n\n\t\tlet rawDocTags = ts.getJSDocTags(member);\n\t\tif (rawDocTags.length) {\n\t\t\tlet dict = getTagDict(rawDocTags);\n\t\t\tif (dict.summary) para.Description = dict.summary;\n\t\t\tif (dict.creatorType)\n\t\t\t\tpara.Type = dict.creatorType as CreatorIndexParameterType;\n\t\t\tif (dict.default && dict.creatorType)\n\t\t\t\tpara.Default = parseDefault(dict.default, dict.creatorType);\n\t\t\tpara.DisplayIndex = i + 1;\n\t\t}\n\t\treturn para;\n\t});\n}\n\ninterface IDocTags {\n\tdefault?: string;\n\tcreatorType?: string;\n\tsummary?: string;\n}\n\nfunction getTagDict(tags: any): IDocTags {\n\tlet dict = {};\n\ttags.forEach((tag) => {\n\t\tdict[tag.tagName.text] = tag.comment;\n\t});\n\treturn dict;\n}\n\nfunction findParametersInterfaceInFiles(\n\tprogram: ts.Program,\n\tfileList: string[],\n\tname: string,\n): ts.InterfaceDeclaration | undefined {\n\tfor (const file of fileList) {\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\tif (sourceFile === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`Expected a source file to exist for file name \"${file}\"`,\n\t\t\t);\n\t\t}\n\n\t\tlet interfaceDeclaration: ts.InterfaceDeclaration | undefined;\n\n\t\tts.forEachChild(sourceFile, (node) => {\n\t\t\tinterfaceDeclaration = findParametersInterface(node, name);\n\n\t\t\treturn interfaceDeclaration !== undefined;\n\t\t});\n\n\t\tif (interfaceDeclaration !== undefined) {\n\t\t\treturn interfaceDeclaration;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Extracts and returns script array for _Index.json from a src folder\n *\n * @param folderPath path to a src folder\n */\nexport function extract(location: PackageLocation, ignore: string[] = []) {\n\tconst files = getPackageTypescriptFiles(location);\n\tconst filtered = files.filter((path) => {\n\t\treturn !ignore.some((suffix) => path.endsWith(suffix));\n\t});\n\tlet arr = new Array<CreatorIndexEntry>();\n\n\tlet program = ts.createProgram(filtered, { allowJs: true });\n\tprogram.getTypeChecker();\n\tfiltered.forEach((file) => {\n\t\t// Create a Program to represent the project, then pull out the\n\t\t// source file to parse its AST.\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\t// Loop through the root AST nodes of the file\n\t\tts.forEachChild(sourceFile!, (node) => {\n\t\t\tconst evalNode = findEvaluatorNode(node);\n\n\t\t\tif (evalNode === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet moduleName = getModuleName(node);\n\n\t\t\tif (evalNode.name === undefined) {\n\t\t\t\tthrow new Error(`Expected evaluator class to have a name`);\n\t\t\t}\n\n\t\t\tconst name = moduleName + \".\" + evalNode.name.getText();\n\n\t\t\tif (name.length > 45)\n\t\t\t\tthrow new Error(`Package name length >45 '${name}'`);\n\n\t\t\tlet para = getParameter(evalNode);\n\t\t\tlet paraName = (para?.type as any).typeName.getText();\n\t\t\tlet interfac = findParametersInterfaceInFiles(\n\t\t\t\tprogram,\n\t\t\t\tfiltered,\n\t\t\t\tparaName,\n\t\t\t);\n\n\t\t\tif (interfac === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to find parameters type declaration for evaluator ${evalNode.name.getText()}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst obj: CreatorIndexEntry = {\n\t\t\t\tName: name,\n\t\t\t\tParameters: [],\n\t\t\t\tType: \"Evaluator\",\n\t\t\t};\n\n\t\t\tlet rawDocTags = ts.getJSDocTags(evalNode);\n\t\t\tif (rawDocTags.length) {\n\t\t\t\tlet dict = getTagDict(rawDocTags);\n\t\t\t\tif (dict.summary) obj.Description = dict.summary;\n\t\t\t\tif (dict.creatorType)\n\t\t\t\t\tobj.Type = dict.creatorType as \"Interactor\" | \"Evaluator\";\n\t\t\t}\n\n\t\t\tobj.Parameters = genParameters(interfac);\n\n\t\t\tarr.push(obj);\n\t\t});\n\t});\n\n\twritePackageCreatorIndex(location, arr);\n}\n"],"names":["findTsNode","node","callback","result","ts","forEachChild","child","capitalizeFirstLetter","string","charAt","toUpperCase","slice","parseDefault","value","type","uType","parseFloat","parseInt","replace","findEvaluatorNode","isModuleDeclaration","body","classDeclaration","isClassDeclaration","isEvaluator","heritageClauses","some","clause","token","SyntaxKind","ExtendsKeyword","types","getText","includes","getParameter","evaluatorNode","memb","members","find","member","name","toLowerCase","isMethodDeclaration","parameters","para","findParametersInterface","interfaceName","interfaceDeclaration","isInterfaceDeclaration","undefined","getModuleName","sourceFile","fullName","packageB","genParameters","interfac","map","i","Name","length","Error","rawDocTags","getJSDocTags","dict","getTagDict","summary","Description","creatorType","Type","default","Default","DisplayIndex","tags","forEach","tag","tagName","text","comment","findParametersInterfaceInFiles","program","fileList","file","getSourceFile","extract","location","ignore","files","getPackageTypescriptFiles","filtered","filter","path","suffix","endsWith","arr","Array","createProgram","allowJs","getTypeChecker","evalNode","moduleName","paraName","typeName","obj","Parameters","push","writePackageCreatorIndex"],"mappings":";;;;AAsBA,SAASA,UAAU,CAClBC,IAAa,EACbC,QAAoC,EACd;AACtB,EAAA,IAAIC,MAA2B,CAAA;AAE/BC,EAAAA,EAAE,CAACC,YAAY,CAACJ,IAAI,EAAGK,KAAK,IAAK;AAChC,IAAA,IAAIJ,QAAQ,CAACI,KAAK,CAAC,EAAE;AACpBH,MAAAA,MAAM,GAAGG,KAAK,CAAA;AACd,MAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AACD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,MAAM,CAAA;AACd,CAAA;AAEA,SAASI,qBAAqB,CAACC,MAAM,EAAE;EACtC,OAAO,CAAAA,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,KAAGF,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEG,KAAK,CAAC,CAAC,CAAC,CAAA,CAAA;AAC1D,CAAA;AAEA,SAASC,YAAY,CAACC,KAAa,EAAEC,IAAY,EAAE;AAClD,EAAA,MAAMC,KAAgC,GAAGR,qBAAqB,CAACO,IAAI,CAAC,CAAA;AACpE,EAAA,IAAID,KAAK,KAAK,MAAM,EAAE,OAAO,IAAI,CAAA;AACjC,EAAA,QAAQE,KAAK;AACZ,IAAA,KAAK,SAAS,CAAA;AACd,IAAA,KAAK,QAAQ,CAAA;AACb,IAAA,KAAK,OAAO;MACX,OAAOC,UAAU,CAACH,KAAK,CAAC,CAAA;AACzB,IAAA,KAAK,SAAS,CAAA;AACd,IAAA,KAAK,KAAK;MACT,OAAOI,QAAQ,CAACJ,K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AAA;QACjC,IAAIE,IAAI,CAACE,OAAO,EAAEqC,GAAG,CAACpC,WAAW,GAAGH,IAAI,CAACE,OAAO,CAAA;QAChD,IAAIF,IAAI,CAACI,WAAW,EACnBmC,GAAG,CAAClC,IAAI,GAAGL,IAAI,CAACI,WAAyC,CAAA;AAC3D,OAAA;AAEAmC,MAAAA,GAAG,CAACC,UAAU,GAAGjD,aAAa,CAACC,QAAQ,CAAC,CAAA;AAExCsC,MAAAA,GAAG,CAACW,IAAI,CAACF,GAAG,CAAC,CAAA;AACd,KAAC,CAAC,CAAA;AACH,GAAC,CAAC,CAAA;AAEFG,EAAAA,wBAAwB,CAACrB,QAAQ,EAAES,GAAG,CAAC,CAAA;AACxC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall.mjs","sources":["../../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport glob from \"glob\";\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 = 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\t\tconst content = `${DEFINITION_FILE_HINT}\n// This is a reference to version ${manifest.version}.\n// Run \"npm install\" to install the types if they are missing or not up to date.\n/// <reference types=\"${manifest.name}\" />`;\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(getWorkspaceLibPath(workspace), manifest.types),\n\t\t\tcontent,\n\t\t\t{\n\t\t\t\tencoding: \"utf8\",\n\t\t\t},\n\t\t);\n\t}\n};\n"],"names":["DEFINITION_FILE_HINT","executePostInstall","workspace","manifest","readWorkspaceNpmManifest","undefined","Error","libPath","getWorkspaceLibPath","fs","mkdirSync","recursive","existingDefinitions","glob","sync","cwd","absolute","existingDefinitionPath","content","readFileSync","encoding","startsWith","rmSync","libraryLocations","determineWorkspaceIGLibraries","location","readPublishedPackageNpmManifest","basename","path","types","force","version","name","writeFileSync","join"],"mappings":";;;;;;;AAYA,MAAMA,oBAAoB,GACzB,+DAA+D,CAAA;AAEnDC,MAAAA,kBAAkB,GAAIC,SAA4B,IAAK;AACnE,EAAA,MAAMC,QAAQ,GAAGC,wBAAwB,CAACF,SAAS,CAAC,CAAA;EAEpD,IAAIC,QAAQ,KAAKE,SAAS,EAAE;AAC3B,IAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,kCAAA,CAAmC,CAAC,CAAA;AACtD,GAAA;AAEA,EAAA,MAAMC,OAAO,GAAGC,m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C1C,kCAAoCG,EAAAA,QAAQ,CAAC4B,OAAQ,CAAA;AACrD;AACA,sBAAwB5B,EAAAA,QAAQ,CAAC6B,IAAK,CAAK,IAAA,CAAA,CAAA;AAEzCvB,IAAAA,EAAE,CAACwB,aAAa,CACfL,IAAI,CAACM,IAAI,CAAC1B,mBAAmB,CAACN,SAAS,CAAC,EAAEC,QAAQ,CAAC0B,KAAK,CAAC,EACzDX,OAAO,EACP;AACCE,MAAAA,QAAQ,EAAE,MAAA;AACX,KAAC,CACD,CAAA;AACF,GAAA;AACD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/commands/publish/index.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport { pipeline } from \"stream/promises\";\nimport { execSync } from \"child_process\";\n\nimport { logPackageMessage } from \"../../lib/log\";\nimport { Authentication } from \"../../lib/authentication\";\nimport {\n\tCreatorPackage,\n\tgetPackageReleasesDirectory,\n\tPackageLocation,\n\tparseCreatorPackageName,\n\treadPackageCreatorManifest,\n} from \"../../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../../lib/git\";\nimport { getWorkspaceBannerText } from \"../../lib/banner\";\nimport {\n\tparseVersionFromNumericVersion,\n\tparseVersionFromString,\n} from \"../../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../../lib/versionFile\";\nimport * as AssetService from \"../../lib/assetService\";\nimport { isErrorENOENT } from \"../../lib/error\";\nimport { determineWorkspaceIGLibraries } from \"../../lib/dependencies\";\nimport {\n\treadPublishedPackageCreatorManifest,\n\treadPublishedPackageNpmManifest,\n} from \"../../lib/publishedPackage\";\nimport { Prompter } from \"../../lib/prompter\";\nimport { PackageVersion } from \"../../lib/packageVersion\";\n\nimport { BuildFoldersOptions, buildFolders } from \"../build\";\nimport {\n\tbuildArchiveFromPackage,\n\tbuildArchiveFromPublishedPackage,\n} from \"./zip\";\n\nexport interface ReleaseFolderOptions\n\textends Omit<\n\t\tBuildFoldersOptions,\n\t\t\"skipPackagesWithoutTsFiles\" | \"banner\" | \"packages\"\n\t> {\n\tdirectory: PackageLocation;\n\tnoUpload: boolean;\n\tnewVersion: string;\n\tdomain?: string;\n\tsubdomain?: string;\n\taddress?: string;\n\tservice: string;\n\tauthentication?: Authentication;\n\tpushOnly: boolean;\n\tbanner?: boolean;\n\tprompter: Prompter;\n}\n\nexport const releaseFolder = async (options: ReleaseFolderOptions) => {\n\tconst workspace = options.workspace;\n\tconst location = options.directory;\n\n\tconst { write: writeVersionFile, reset: resetVersionFile } =\n\t\tgetVersionFileHandler(location);\n\n\tconst packageDescription = readPackageCreatorManifest(location);\n\tconst fullPackageName = packageDescription.Package;\n\tconst { domain, subdomain } = parseCreatorPackageName(packageDescription);\n\n\tconst publishDomain = options.domain ?? domain;\n\tconst publishSubdomain = options.subdomain ?? subdomain;\n\n\tconst sharedPackageJson = readWorkspaceNpmManifest(workspace);\n\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(options.newVersion);\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 = {\n\t\t\ttype: \"patch\",\n\t\t\tversion: newVersion.buildNumber - 100,\n\t\t};\n\t}\n\n\tif (sharedPackageJson !== undefined) {\n\t\tlogPackageMessage(\n\t\t\tpackageDescription.Package,\n\t\t\t`Running npm install to make sure all dependencies are up to date`,\n\t\t);\n\t\texecSync(`npm install`, { encoding: \"utf-8\", cwd: workspace.path });\n\t}\n\n\tconst binDir = getWorkspaceOutputPath(workspace);\n\tfs.mkdirSync(binDir, { recursive: true });\n\n\tlet assetServerPackageDetails: AssetService.UploadPackageDetails;\n\n\tlet packageNameWithVersion: string;\n\n\t{\n\t\tconst versionWithoutPrelease = newVersion.clone();\n\t\tversionWithoutPrelease.preRelease = undefined;\n\t\tconst newVersionString = versionWithoutPrelease.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\t\tpackageNameWithVersion = `${packageDescription.Package}_${newVersionString}`;\n\n\t\tassetServerPackageDetails = {\n\t\t\tname: packageDescription.Package,\n\t\t\tversion: newVersionString,\n\t\t};\n\t}\n\n\tconst zipFilePath = path.join(binDir, packageNameWithVersion + \".zip\");\n\n\ttry {\n\t\tif (options.pushOnly) {\n\t\t\tif (!fs.existsSync(zipFilePath)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Expected a zip file to exist at path ${zipFilePath} since pushOnly is specified`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\t\t\tworkspace,\n\t\t\t\tlocation,\n\t\t\t);\n\n\t\t\twriteVersionFile(fullPackageName, newVersion);\n\n\t\t\tconst bannerText =\n\t\t\t\tsharedPackageJson !== undefined\n\t\t\t\t\t? getWorkspaceBannerText(sharedPackageJson)\n\t\t\t\t\t: undefined;\n\n\t\t\tawait buildFolders({\n\t\t\t\t...options,\n\t\t\t\tpackages: [location],\n\t\t\t\tskipPackagesWithoutTsFiles: true,\n\t\t\t\tbanner: options.banner\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttext: bannerText,\n\t\t\t\t\t\t\tcommit: gitVersionInformation.commit,\n\t\t\t\t\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\t\t\t\t\tversion: newVersion.toVersionString({\n\t\t\t\t\t\t\t\tbuildNumber: true,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tdate: new Date(Date.now()),\n\t\t\t\t\t\t\t// gitVersionInformation.commitDate\n\t\t\t\t\t\t\t// \t? new Date(gitVersionInformation.commitDate)\n\t\t\t\t\t\t\t// \t: new Date(Date.now()),\n\t\t\t\t\t }\n\t\t\t\t\t: undefined,\n\t\t\t});\n\n\t\t\tnewVersion.preRelease = undefined;\n\n\t\t\ttry {\n\t\t\t\tfs.rmSync(zipFilePath);\n\t\t\t} catch (err) {\n\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst archive = await buildArchiveFromPackage(\n\t\t\t\tworkspace,\n\t\t\t\tlocation,\n\t\t\t\tpackageDescription,\n\t\t\t);\n\n\t\t\tconst zipOutputStream = fs.createWriteStream(zipFilePath);\n\t\t\tawait pipeline(archive.generateNodeStream(), zipOutputStream);\n\t\t}\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!options.authentication) {\n\t\t\t\tthrow new Error(`Expected authentication to be available`);\n\t\t\t}\n\n\t\t\tlogPackageMessage(\n\t\t\t\tpackageDescription.Package,\n\t\t\t\t`Opening connection to IG.Asset.Server`,\n\t\t\t);\n\n\t\t\tconst sessionManager = await createSessionManager({\n\t\t\t\turl: options.service,\n\t\t\t\taddress: options.address,\n\t\t\t\tdomain: publishDomain,\n\t\t\t\tsubDomain: publishSubdomain,\n\t\t\t\tauthentication: options.authentication,\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tawait ensureRequiredVersions(\n\t\t\t\t\tworkspace,\n\t\t\t\t\tpackageDescription,\n\t\t\t\t\tsessionManager,\n\t\t\t\t\toptions.prompter,\n\t\t\t\t);\n\n\t\t\t\tlogPackageMessage(\n\t\t\t\t\tpackageDescription.Package,\n\t\t\t\t\t`Uploading package to ${publishDomain}.${publishSubdomain}`,\n\t\t\t\t);\n\n\t\t\t\tawait AssetService.uploadPackage(\n\t\t\t\t\tsessionManager.getTargetSession(),\n\t\t\t\t\tassetServerPackageDetails,\n\t\t\t\t\tzipFilePath,\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tawait sessionManager.destroy().catch((err) => {\n\t\t\t\t\tlogPackageMessage(\n\t\t\t\t\t\tpackageDescription.Package,\n\t\t\t\t\t\t`Failed to close IG.Asset.Server session(s): ${err}`,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\tresetVersionFile();\n\t\tthrow err;\n\t}\n\n\tif (newVersion.buildNumber >= 100 && !options.pushOnly) {\n\t\tlogPackageMessage(fullPackageName, \"Copying zip to releases folder\");\n\n\t\tconst zipFileName = `${packageNameWithVersion}.zip`;\n\t\tconst releasesPath = getPackageReleasesDirectory(location);\n\n\t\tfs.mkdirSync(releasesPath, { recursive: true });\n\t\tfs.copyFileSync(zipFilePath, path.join(releasesPath, zipFileName));\n\t}\n};\n\nconst ensureRequiredVersions = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tcreatorPackage: CreatorPackage,\n\tsessionManager: SessionManager,\n\tprompter: Prompter,\n) => {\n\tinterface UploadedPackage\n\t\textends Omit<AssetService.ExistingPackage, \"version\"> {\n\t\tversion: PackageVersion;\n\t}\n\n\tconst libraries = determineWorkspaceIGLibraries(workspaceLocation);\n\n\t// If there are no libraries, we don't need to check for required versions\n\tif (libraries.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst targetSession = sessionManager.getTargetSession();\n\n\tconst rawUploadedPackages = await AssetService.getExistingPackages(\n\t\ttargetSession,\n\t);\n\n\tconst uploadedPackages = rawUploadedPackages.map(\n\t\t(entry): UploadedPackage => {\n\t\t\tlet version: PackageVersion;\n\n\t\t\ttry {\n\t\t\t\tversion = parseVersionFromNumericVersion(entry.numericVersion);\n\t\t\t} catch (err) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Encountered invalid format for version ${entry.numericVersion}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (version.buildNumber < 100) {\n\t\t\t\tversion.preRelease = {\n\t\t\t\t\ttype: \"beta\",\n\t\t\t\t\tversion: version.buildNumber,\n\t\t\t\t};\n\t\t\t} else if (version.buildNumber > 100) {\n\t\t\t\tversion.preRelease = {\n\t\t\t\t\ttype: \"patch\",\n\t\t\t\t\tversion: version.buildNumber - 100,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...entry,\n\t\t\t\tversion,\n\t\t\t};\n\t\t},\n\t);\n\n\tfor (const libraryLocation of libraries) {\n\t\tconst libraryManifest =\n\t\t\treadPublishedPackageNpmManifest(libraryLocation);\n\t\tconst libraryCreatorPackage =\n\t\t\treadPublishedPackageCreatorManifest(libraryLocation);\n\n\t\tif (\n\t\t\tlibraryCreatorPackage === undefined ||\n\t\t\tlibraryManifest.main === undefined ||\n\t\t\tlibraryCreatorPackage.Package === creatorPackage.Package\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst libraryVersion = PackageVersion.extractFromLine(\n\t\t\tlibraryManifest.version,\n\t\t);\n\n\t\tif (libraryVersion.preRelease) {\n\t\t\tlibraryVersion.buildNumber = libraryVersion.preRelease.version;\n\t\t\tlibraryVersion.preRelease = undefined;\n\t\t} else {\n\t\t\tlibraryVersion.buildNumber = 100;\n\t\t}\n\n\t\tlet uploadedPackageInBasics: UploadedPackage | undefined;\n\t\tlet uploadedPackageInTarget: UploadedPackage | undefined;\n\n\t\tfor (const uploadedPackage of uploadedPackages) {\n\t\t\tif (uploadedPackage.scope === libraryCreatorPackage.Package) {\n\t\t\t\tif (uploadedPackage.support) {\n\t\t\t\t\tuploadedPackageInBasics = uploadedPackage;\n\t\t\t\t} else {\n\t\t\t\t\tuploadedPackageInTarget = uploadedPackage;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst validInBasics =\n\t\t\tuploadedPackageInBasics !== undefined &&\n\t\t\t!uploadedPackageInBasics.version.isLesserThan(libraryVersion);\n\t\tconst validInTarget =\n\t\t\tuploadedPackageInTarget !== undefined &&\n\t\t\t!uploadedPackageInTarget.version.isLesserThan(libraryVersion);\n\n\t\tif (validInBasics || validInTarget) {\n\t\t\tif (\n\t\t\t\ttargetSession.subDomain !== \"Basics\" &&\n\t\t\t\t(uploadedPackageInBasics !== undefined ||\n\t\t\t\t\tuploadedPackageInTarget !== undefined)\n\t\t\t) {\n\t\t\t\tlogPackageMessage(\n\t\t\t\t\tcreatorPackage.Package,\n\t\t\t\t\t`Package ${libraryCreatorPackage.Package} is uploaded both for Basics and ${targetSession.subDomain}. The package within ${targetSession.subDomain} will be used.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tlogPackageMessage(\n\t\t\tcreatorPackage.Package,\n\t\t\t`Requested at least version ${libraryVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t})} for package ${libraryCreatorPackage.Package}`,\n\t\t);\n\n\t\tif (targetSession.subDomain !== \"Basics\" && uploadedPackageInTarget) {\n\t\t\tconst version = uploadedPackageInTarget.version.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t});\n\n\t\t\tlogPackageMessage(\n\t\t\t\tcreatorPackage.Package,\n\t\t\t\t`Found invalid version ${version} for package ${libraryCreatorPackage.Package} in ${targetSession.subDomain}`,\n\t\t\t);\n\t\t}\n\t\tif (uploadedPackageInBasics) {\n\t\t\tconst version = uploadedPackageInBasics.version.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t});\n\n\t\t\tlet message = `Found invalid version ${version} for package ${libraryCreatorPackage.Package} in Basics`;\n\n\t\t\tif (\n\t\t\t\ttargetSession.subDomain !== \"Basics\" &&\n\t\t\t\tuploadedPackageInTarget\n\t\t\t) {\n\t\t\t\tmessage += `. This version will not be used since the package also exists in ${targetSession.subDomain}`;\n\t\t\t}\n\n\t\t\tlogPackageMessage(creatorPackage.Package, message);\n\t\t}\n\n\t\tconst possibleTargets: string[] = [\"Basics\"];\n\n\t\tif (targetSession.subDomain !== \"Basics\") {\n\t\t\tpossibleTargets.push(targetSession.subDomain);\n\t\t}\n\n\t\tconst uploadTargetScope = await prompter.ask({\n\t\t\tmessage: `Select the scope to upload the required version of ${libraryCreatorPackage.Package} to or select \"skip\" to skip the upload.`,\n\t\t\toptions: [...possibleTargets, \"Skip\"],\n\t\t\tdefault: possibleTargets[0],\n\t\t});\n\n\t\tif (uploadTargetScope === \"Skip\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst archive = buildArchiveFromPublishedPackage(\n\t\t\tlibraryLocation,\n\t\t\tlibraryManifest,\n\t\t\tlibraryCreatorPackage,\n\t\t);\n\n\t\tconst newVersionString = libraryVersion.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\t\tconst packageNameWithVersion = `${libraryCreatorPackage.Package}_${newVersionString}`;\n\n\t\tconst zipFilePath = path.join(\n\t\t\tgetWorkspaceOutputPath(workspaceLocation),\n\t\t\t`${packageNameWithVersion}.zip`,\n\t\t);\n\n\t\ttry {\n\t\t\tfs.rmSync(zipFilePath);\n\t\t} catch (err) {\n\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\n\t\tconst zipOutputStream = fs.createWriteStream(zipFilePath);\n\t\tawait pipeline(archive.generateNodeStream(), zipOutputStream);\n\n\t\tconst session =\n\t\t\tuploadTargetScope === \"Basics\"\n\t\t\t\t? await sessionManager.getBasicsSession()\n\t\t\t\t: targetSession;\n\n\t\tlogPackageMessage(\n\t\t\tcreatorPackage.Package,\n\t\t\t`Uploading package ${libraryCreatorPackage.Package} with version ${newVersionString} to ${session.domain}.${session.subDomain}`,\n\t\t);\n\n\t\tawait AssetService.uploadPackage(\n\t\t\tsession,\n\t\t\t{\n\t\t\t\tname: libraryCreatorPackage.Package,\n\t\t\t\tversion: newVersionString,\n\t\t\t},\n\t\t\tzipFilePath,\n\t\t);\n\t}\n};\n\ninterface SessionManager {\n\tgetBasicsSession: () => Promise<AssetService.Session>;\n\tgetTargetSession: () => AssetService.Session;\n\tdestroy: () => Promise<void>;\n}\n\nconst createSessionManager = async (\n\tparams: AssetService.SessionStartParams,\n): Promise<SessionManager> => {\n\tconst targetSession = await AssetService.startSession(params);\n\tlet basicsSession: AssetService.Session | undefined;\n\n\treturn {\n\t\tgetBasicsSession: async () => {\n\t\t\tif (targetSession.subDomain === \"Basics\") {\n\t\t\t\treturn targetSession;\n\t\t\t}\n\n\t\t\tif (basicsSession === undefined) {\n\t\t\t\tbasicsSession = await AssetService.startSession({\n\t\t\t\t\t...params,\n\t\t\t\t\tsubDomain: \"Basics\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn basicsSession;\n\t\t},\n\n\t\tgetTargetSession: () => targetSession,\n\n\t\tdestroy: async () => {\n\t\t\tawait AssetService.closeSession(targetSession);\n\n\t\t\tif (basicsSession !== undefined) {\n\t\t\t\tawait AssetService.closeSession(basicsSession);\n\t\t\t}\n\t\t},\n\t};\n};\n"],"names":["releaseFolder","options","workspace","location","directory","write","writeVersionFile","reset","resetVersionFile","getVersionFileHandler","packageDescription","readPackageCreatorManifest","fullPackageName","Package","domain","subdomain","parseCreatorPackageName","publishDomain","publishSubdomain","sharedPackageJson","readWorkspaceNpmManifest","newVersion","parseVersionFromString","err","Error","buildNumber","preRelease","type","version","undefined","logPackageMessage","execSync","encoding","cwd","path","binDir","getWorkspaceOutputPath","fs","mkdirSync","recursive","assetServerPackageDetails","packageNameWithVersion","versionWithoutPrelease","clone","newVersionString","toVersionString","name","zipFilePath","join","pushOnly","existsSync","gitVersionInformation","getVersionInformationFromGit","bannerText","getWorkspaceBannerText","buildFolders","packages","skipPackagesWithoutTsFiles","banner","text","commit","commitDirty","dirty","date","Date","now","rmSync","isErrorENOENT","archive","buildArchiveFromPackage","zipOutputStream","createWriteStream","pipeline","generateNodeStream","noUpload","authentication","sessionManager","createSessionManager","url","service","address","subDomain","ensureRequiredVersions","prompter","AssetService","getTargetSession","destroy","catch","zipFileName","releasesPath","getPackageReleasesDirectory","copyFileSync","workspaceLocation","creatorPackage","libraries","determineWorkspaceIGLibraries","length","targetSession","rawUploadedPackages","uploadedPackages","map","entry","parseVersionFromNumericVersion","numericVersion","libraryLocation","libraryManifest","readPublishedPackageNpmManifest","libraryCreatorPackage","readPublishedPackageCreatorManifest","main","libraryVersion","PackageVersion","extractFromLine","uploadedPackageInBasics","uploadedPackageInTarget","uploadedPackage","scope","support","validInBasics","isLesserThan","validInTarget","message","possibleTargets","push","uploadTargetScope","ask","default","buildArchiveFromPublishedPackage","session","getBasicsSession","params","basicsSession"],"mappings":";;;;;;;;;;;;;;;;;;;AA4DaA,MAAAA,aAAa,GAAG,MAAOC,OAA6B,IAAK;AACrE,EAAA,MAAMC,SAAS,GAAGD,OAAO,CAACC,SAAS,CAAA;AACnC,EAAA,MAAMC,QAAQ,GAAGF,OAAO,CAACG,SAAS,CAAA;EAElC,MAAM;AAAEC,IAAAA,KAAK,EAAEC,gBAAgB;AAAEC,IAAAA,KAAK,EAAEC,gBAAAA;AAAiB,GAAC,GACzDC,qBAAqB,CAACN,QAAQ,CAAC,CAAA;AAEhC,EAAA,MAAMO,kBAAkB,GAAGC,0BAA0B,CAACR,QAAQ,CAAC,CAAA;AAC/D,EAAA,MAAMS,eAAe,GAAGF,kBAAkB,CAACG,OAAO,CAAA;EAClD,MAAM;IAAEC,MAAM;AAAEC,IAAAA,SAAAA;AAAU,GAAC,GAAGC,uBAAuB,CAACN,kBAAkB,CAAC,CAAA;AAEzE,EAAA,MAAMO,aAAa,GAAGhB,OAAO,CAACa,MAAM,IAAIA,MAAM,CAAA;AAC9C,EAAA,MAAMI,gBAAgB,GAAGjB,OAAO,CAACc,SAAS,IAAIA,SAAS,CAAA;AAEvD,EAAA,MAAMI,iBAAiB,GAAGC,wBAAwB,CAAClB,SAAS,CAAC,CAAA;AAE7D,EAAA,IAAImB,UAA0B,CAAA;EAC9B,IAAI;AACHA,IAAAA,UAAU,GAAGC,sBAAsB,CAACrB,OAAO,CAACoB,UAAU,CAAC,CAAA;GACvD,CAAC,OAAOE,GAAG,EAAE;AACb,IAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,+CAAA,CAAgD,CAAC,CAAA;AACnE,GAAA;A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ChB,SAAS,KAAK,QAAQ,EAAE;AACzC,QAAA,OAAOgB,aAAa,CAAA;AACrB,OAAA;MAEA,IAAIkC,aAAa,KAAKtG,SAAS,EAAE;AAChCsG,QAAAA,aAAa,GAAG,MAAM/C,YAAyB,CAAC;AAC/C,UAAA,GAAG8C,MAAM;AACTjD,UAAAA,SAAS,EAAE,QAAA;AACZ,SAAC,CAAC,CAAA;AACH,OAAA;AAEA,MAAA,OAAOkD,aAAa,CAAA;KACpB;IAED9C,gBAAgB,EAAE,MAAMY,aAAa;AAErCX,IAAAA,OAAO,EAAE,YAAY;AACpB,MAAA,MAAMF,YAAyB,CAACa,aAAa,CAAC,CAAA;MAE9C,IAAIkC,aAAa,KAAKtG,SAAS,EAAE;AAChC,QAAA,MAAMuD,YAAyB,CAAC+C,aAAa,CAAC,CAAA;AAC/C,OAAA;AACD,KAAA;GACA,CAAA;AACF,CAAC;;;;"}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import Ajv from 'ajv';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import JSZip from 'jszip';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import * as fs from 'fs';
|
|
6
|
-
import * as terser from 'terser';
|
|
7
|
-
import { isErrorENOENT } from '../../lib/error.mjs';
|
|
8
|
-
import { logPackageMessage } from '../../lib/log.mjs';
|
|
9
|
-
import { PACKAGE_FILE, INDEX_FILE, parseCreatorPackageName, readPackageCreatorManifest, writePackageCreatorManifest, readPackageAnimationList, readPackageCreatorIndex } from '../../lib/package.mjs';
|
|
10
|
-
import { getWorkspaceOutputPath } from '../../lib/workspace.mjs';
|
|
11
|
-
import { readPublishedPackageCreatorIndex } from '../../lib/publishedPackage.mjs';
|
|
12
|
-
|
|
13
|
-
const buildArchiveFromPublishedPackage = (location, manifest, creatorPackage) => {
|
|
14
|
-
const archive = new JSZip();
|
|
15
|
-
archive.file(PACKAGE_FILE, JSON.stringify(creatorPackage, null, 2));
|
|
16
|
-
const index = readPublishedPackageCreatorIndex(location);
|
|
17
|
-
if (index !== undefined) {
|
|
18
|
-
archive.file(INDEX_FILE, JSON.stringify(index, null, 2));
|
|
19
|
-
}
|
|
20
|
-
archive.file(manifest.main, fs.createReadStream(path.join(location.path, manifest.main)));
|
|
21
|
-
return archive;
|
|
22
|
-
};
|
|
23
|
-
let validateSchema;
|
|
24
|
-
const runtimeScripts = ["Interactor", "Core", "Mixed"];
|
|
25
|
-
const notRuntimeScripts = ["Context", "Evaluator"];
|
|
26
|
-
const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data) => {
|
|
27
|
-
const {
|
|
28
|
-
domain,
|
|
29
|
-
subdomain
|
|
30
|
-
} = parseCreatorPackageName(data);
|
|
31
|
-
const logStep = step => logPackageMessage(data.Package, step);
|
|
32
|
-
if (validateSchema === undefined) {
|
|
33
|
-
validateSchema = await axios.get("https://archive.intelligentgraphics.biz/schemas/gfx/animation.json").then(({
|
|
34
|
-
data
|
|
35
|
-
}) => new Ajv({
|
|
36
|
-
coerceTypes: true,
|
|
37
|
-
allErrors: true,
|
|
38
|
-
removeAdditional: true,
|
|
39
|
-
useDefaults: "empty",
|
|
40
|
-
validateSchema: "log"
|
|
41
|
-
}).compile(data));
|
|
42
|
-
}
|
|
43
|
-
const libFilePath = path.join(getWorkspaceOutputPath(workspaceLocation), `${data.Package}.min.js`);
|
|
44
|
-
const scriptDirectories = [packageLocation.path, packageLocation.scriptsDir];
|
|
45
|
-
if (subdomain === "GFX.Standard") {
|
|
46
|
-
logStep(`Including Images folder`);
|
|
47
|
-
scriptDirectories.push(path.join(packageLocation.path, "Images"));
|
|
48
|
-
}
|
|
49
|
-
const manifest = readPackageCreatorManifest(packageLocation);
|
|
50
|
-
if (manifest !== undefined) {
|
|
51
|
-
if (manifest.RunTime && notRuntimeScripts.includes(manifest.Type)) {
|
|
52
|
-
logStep("Setting script RunTime to false because of script type");
|
|
53
|
-
writePackageCreatorManifest(packageLocation, {
|
|
54
|
-
...manifest,
|
|
55
|
-
RunTime: false
|
|
56
|
-
});
|
|
57
|
-
} else if (!manifest.RunTime && runtimeScripts.includes(manifest.Type)) {
|
|
58
|
-
logStep("Setting script RunTime to true because of script type");
|
|
59
|
-
writePackageCreatorManifest(packageLocation, {
|
|
60
|
-
...manifest,
|
|
61
|
-
RunTime: true
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// if (index === undefined) {
|
|
67
|
-
// throw new Error(
|
|
68
|
-
// `Could not find an "${INDEX_FILE}" file in "${primaryScriptDir}"`,
|
|
69
|
-
// );
|
|
70
|
-
// }
|
|
71
|
-
|
|
72
|
-
const animations = new Map();
|
|
73
|
-
for (const scriptFilePath of readPackageAnimationList(packageLocation)) {
|
|
74
|
-
const content = fs.readFileSync(scriptFilePath, {
|
|
75
|
-
encoding: "utf8"
|
|
76
|
-
});
|
|
77
|
-
let data;
|
|
78
|
-
try {
|
|
79
|
-
data = JSON.parse(content);
|
|
80
|
-
} catch (err) {
|
|
81
|
-
const relativePath = path.relative(workspaceLocation.path, scriptFilePath);
|
|
82
|
-
if (err instanceof SyntaxError) {
|
|
83
|
-
throw new Error(`Encountered invalid syntax in file "${relativePath}": ${String(err)}`);
|
|
84
|
-
}
|
|
85
|
-
throw new Error(`Encountered an unexpected error while parsing animation json file at path "${relativePath}"`, {
|
|
86
|
-
cause: err
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
validateSchema(data);
|
|
90
|
-
animations.set(data.Id, JSON.stringify(data));
|
|
91
|
-
}
|
|
92
|
-
let libFile;
|
|
93
|
-
try {
|
|
94
|
-
libFile = fs.readFileSync(libFilePath, {
|
|
95
|
-
encoding: "utf8"
|
|
96
|
-
});
|
|
97
|
-
} catch (err) {
|
|
98
|
-
if (!isErrorENOENT(err)) {
|
|
99
|
-
throw err;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (libFile === undefined) {
|
|
103
|
-
if (animations.size === 0) {
|
|
104
|
-
throw new Error(`Could not find a javascript file at "${libFilePath}".
|
|
105
|
-
Packaging without a javascript file is only allowed when animation json files are available`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
const archive = new JSZip();
|
|
109
|
-
let library = "";
|
|
110
|
-
if (libFile) {
|
|
111
|
-
library = libFile;
|
|
112
|
-
}
|
|
113
|
-
if (!library) {
|
|
114
|
-
const date = new Date(Date.now());
|
|
115
|
-
library = `/* This file is part of the ${domain} Data Packages.
|
|
116
|
-
* Copyright (C) ${date.getFullYear()} intelligentgraphics. All Rights Reserved. */`;
|
|
117
|
-
}
|
|
118
|
-
if (animations.size > 0) {
|
|
119
|
-
const scopeParts = data.Scope.split(".");
|
|
120
|
-
const scope = data.Scope;
|
|
121
|
-
library += createNamespace(scopeParts);
|
|
122
|
-
for (const [name, data] of animations) {
|
|
123
|
-
library += `${scope}.${name} = ` + data + ";";
|
|
124
|
-
logPackageMessage(manifest.Package, `Added animation ${scope}.${name}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const minifyResult = await terser.minify(library, {
|
|
128
|
-
ecma: 5
|
|
129
|
-
});
|
|
130
|
-
archive.file(`${data.Package}.js`, minifyResult.code);
|
|
131
|
-
archive.file(PACKAGE_FILE, JSON.stringify(data, null, 2));
|
|
132
|
-
const creatorIndex = readPackageCreatorIndex(packageLocation);
|
|
133
|
-
if (creatorIndex !== undefined) {
|
|
134
|
-
archive.file(INDEX_FILE, JSON.stringify(creatorIndex, null, 2));
|
|
135
|
-
}
|
|
136
|
-
for (const directory of scriptDirectories) {
|
|
137
|
-
try {
|
|
138
|
-
for (const file of fs.readdirSync(directory)) {
|
|
139
|
-
const {
|
|
140
|
-
ext
|
|
141
|
-
} = path.parse(file);
|
|
142
|
-
switch (ext) {
|
|
143
|
-
case ".png":
|
|
144
|
-
case ".jpeg":
|
|
145
|
-
case ".jpg":
|
|
146
|
-
break;
|
|
147
|
-
default:
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
archive.file(file, fs.createReadStream(path.join(directory, file)));
|
|
151
|
-
}
|
|
152
|
-
} catch (err) {
|
|
153
|
-
console.error(`Script directory "${directory}" does not exist`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return archive;
|
|
157
|
-
};
|
|
158
|
-
const createNamespace = parts => {
|
|
159
|
-
let code = `var ${parts[0]};`;
|
|
160
|
-
for (let index = 0; index < parts.length; index++) {
|
|
161
|
-
const path = parts.slice(0, index + 1).join(".");
|
|
162
|
-
code += `\n(${path} = ${path} || {});`;
|
|
163
|
-
}
|
|
164
|
-
return code;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export { buildArchiveFromPackage, buildArchiveFromPublishedPackage };
|
|
168
|
-
//# sourceMappingURL=zip.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zip.mjs","sources":["../../../src/commands/publish/zip.ts"],"sourcesContent":["import Ajv, { ValidateFunction } from \"ajv\";\nimport axios from \"axios\";\nimport JSZip from \"jszip\";\nimport * as path from \"path\";\nimport * as fs from \"fs\";\nimport * as terser from \"terser\";\n\nimport { isErrorENOENT } from \"../../lib/error\";\nimport { logPackageMessage } from \"../../lib/log\";\nimport {\n\tCreatorPackage,\n\treadPackageCreatorManifest,\n\twritePackageCreatorManifest,\n\treadPackageAnimationList,\n\treadPackageCreatorIndex,\n\tparseCreatorPackageName,\n\tPackageLocation,\n\tPackageNpmManifest,\n\tINDEX_FILE,\n\tPACKAGE_FILE,\n} from \"../../lib/package\";\nimport { getWorkspaceOutputPath, WorkspaceLocation } from \"../../lib/workspace\";\nimport {\n\tPublishedPackageLocation,\n\treadPublishedPackageCreatorIndex,\n} from \"../../lib/publishedPackage\";\n\nexport const buildArchiveFromPublishedPackage = (\n\tlocation: PublishedPackageLocation,\n\tmanifest: PackageNpmManifest,\n\tcreatorPackage: CreatorPackage,\n) => {\n\tconst archive = new JSZip();\n\n\tarchive.file(PACKAGE_FILE, JSON.stringify(creatorPackage, null, 2));\n\n\tconst index = readPublishedPackageCreatorIndex(location);\n\n\tif (index !== undefined) {\n\t\tarchive.file(INDEX_FILE, JSON.stringify(index, null, 2));\n\t}\n\n\tarchive.file(\n\t\tmanifest.main,\n\t\tfs.createReadStream(path.join(location.path, manifest.main)),\n\t);\n\n\treturn archive;\n};\n\nlet validateSchema: ValidateFunction | undefined;\n\nconst runtimeScripts: CreatorPackage[\"Type\"][] = [\n\t\"Interactor\",\n\t\"Core\",\n\t\"Mixed\",\n];\n\nconst notRuntimeScripts: CreatorPackage[\"Type\"][] = [\"Context\", \"Evaluator\"];\n\nexport const buildArchiveFromPackage = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tpackageLocation: PackageLocation,\n\tdata: CreatorPackage,\n) => {\n\tconst { domain, subdomain } = parseCreatorPackageName(data);\n\n\tconst logStep = (step: string) => logPackageMessage(data.Package, step);\n\n\tif (validateSchema === undefined) {\n\t\tvalidateSchema = await axios\n\t\t\t.get(\n\t\t\t\t\"https://archive.intelligentgraphics.biz/schemas/gfx/animation.json\",\n\t\t\t)\n\t\t\t.then(({ data }) =>\n\t\t\t\tnew Ajv({\n\t\t\t\t\tcoerceTypes: true,\n\t\t\t\t\tallErrors: true,\n\t\t\t\t\tremoveAdditional: true,\n\t\t\t\t\tuseDefaults: \"empty\",\n\t\t\t\t\tvalidateSchema: \"log\",\n\t\t\t\t}).compile(data),\n\t\t\t);\n\t}\n\n\tconst libFilePath = path.join(\n\t\tgetWorkspaceOutputPath(workspaceLocation),\n\t\t`${data.Package}.min.js`,\n\t);\n\n\tconst scriptDirectories: string[] = [\n\t\tpackageLocation.path,\n\t\tpackageLocation.scriptsDir,\n\t];\n\n\tif (subdomain === \"GFX.Standard\") {\n\t\tlogStep(`Including Images folder`);\n\t\tscriptDirectories.push(path.join(packageLocation.path, \"Images\"));\n\t}\n\n\tconst manifest = readPackageCreatorManifest(packageLocation);\n\n\tif (manifest !== undefined) {\n\t\tif (manifest.RunTime && notRuntimeScripts.includes(manifest.Type)) {\n\t\t\tlogStep(\"Setting script RunTime to false because of script type\");\n\t\t\twritePackageCreatorManifest(packageLocation, {\n\t\t\t\t...manifest,\n\t\t\t\tRunTime: false,\n\t\t\t});\n\t\t} else if (\n\t\t\t!manifest.RunTime &&\n\t\t\truntimeScripts.includes(manifest.Type)\n\t\t) {\n\t\t\tlogStep(\"Setting script RunTime to true because of script type\");\n\t\t\twritePackageCreatorManifest(packageLocation, {\n\t\t\t\t...manifest,\n\t\t\t\tRunTime: true,\n\t\t\t});\n\t\t}\n\t}\n\n\t// if (index === undefined) {\n\t// \tthrow new Error(\n\t// \t\t`Could not find an \"${INDEX_FILE}\" file in \"${primaryScriptDir}\"`,\n\t// \t);\n\t// }\n\n\tconst animations = new Map<string, string>();\n\n\tfor (const scriptFilePath of readPackageAnimationList(packageLocation)) {\n\t\tconst content = fs.readFileSync(scriptFilePath, { encoding: \"utf8\" })!;\n\n\t\tlet data: { Id: string };\n\n\t\ttry {\n\t\t\tdata = JSON.parse(content);\n\t\t} catch (err) {\n\t\t\tconst relativePath = path.relative(\n\t\t\t\tworkspaceLocation.path,\n\t\t\t\tscriptFilePath,\n\t\t\t);\n\n\t\t\tif (err instanceof SyntaxError) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Encountered invalid syntax in file \"${relativePath}\": ${String(\n\t\t\t\t\t\terr,\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new Error(\n\t\t\t\t`Encountered an unexpected error while parsing animation json file at path \"${relativePath}\"`,\n\t\t\t\t{\n\t\t\t\t\tcause: err,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tvalidateSchema!(data);\n\n\t\tanimations.set(data.Id, JSON.stringify(data));\n\t}\n\n\tlet libFile: string | undefined;\n\n\ttry {\n\t\tlibFile = fs.readFileSync(libFilePath, { encoding: \"utf8\" });\n\t} catch (err) {\n\t\tif (!isErrorENOENT(err)) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tif (libFile === undefined) {\n\t\tif (animations.size === 0) {\n\t\t\tthrow new Error(`Could not find a javascript file at \"${libFilePath}\".\nPackaging without a javascript file is only allowed when animation json files are available`);\n\t\t}\n\t}\n\n\tconst archive = new JSZip();\n\n\tlet library: string = \"\";\n\n\tif (libFile) {\n\t\tlibrary = libFile;\n\t}\n\n\tif (!library) {\n\t\tconst date = new Date(Date.now());\n\t\tlibrary = `/* This file is part of the ${domain} Data Packages.\n\t\t* Copyright (C) ${date.getFullYear()} intelligentgraphics. All Rights Reserved. */`;\n\t}\n\n\tif (animations.size > 0) {\n\t\tconst scopeParts = data.Scope.split(\".\");\n\t\tconst scope = data.Scope;\n\n\t\tlibrary += createNamespace(scopeParts);\n\n\t\tfor (const [name, data] of animations) {\n\t\t\tlibrary += `${scope}.${name} = ` + data + \";\";\n\t\t\tlogPackageMessage(\n\t\t\t\tmanifest.Package,\n\t\t\t\t`Added animation ${scope}.${name}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst minifyResult = await terser.minify(library, { ecma: 5 });\n\n\tarchive.file(`${data.Package}.js`, minifyResult.code!);\n\tarchive.file(PACKAGE_FILE, JSON.stringify(data, null, 2));\n\n\tconst creatorIndex = readPackageCreatorIndex(packageLocation);\n\n\tif (creatorIndex !== undefined) {\n\t\tarchive.file(INDEX_FILE, JSON.stringify(creatorIndex, null, 2));\n\t}\n\n\tfor (const directory of scriptDirectories) {\n\t\ttry {\n\t\t\tfor (const file of fs.readdirSync(directory)) {\n\t\t\t\tconst { ext } = path.parse(file);\n\n\t\t\t\tswitch (ext) {\n\t\t\t\t\tcase \".png\":\n\t\t\t\t\tcase \".jpeg\":\n\t\t\t\t\tcase \".jpg\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tarchive.file(\n\t\t\t\t\tfile,\n\t\t\t\t\tfs.createReadStream(path.join(directory, file)),\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconsole.error(`Script directory \"${directory}\" does not exist`);\n\t\t}\n\t}\n\n\treturn archive;\n};\n\nconst createNamespace = (parts: string[]) => {\n\tlet code = `var ${parts[0]};`;\n\n\tfor (let index = 0; index < parts.length; index++) {\n\t\tconst path = parts.slice(0, index + 1).join(\".\");\n\n\t\tcode += `\\n(${path} = ${path} || {});`;\n\t}\n\n\treturn code;\n};\n"],"names":["buildArchiveFromPublishedPackage","location","manifest","creatorPackage","archive","JSZip","file","PACKAGE_FILE","JSON","stringify","index","readPublishedPackageCreatorIndex","undefined","INDEX_FILE","main","fs","createReadStream","path","join","validateSchema","runtimeScripts","notRuntimeScripts","buildArchiveFromPackage","workspaceLocation","packageLocation","data","domain","subdomain","parseCreatorPackageName","logStep","step","logPackageMessage","Package","axios","get","then","Ajv","coerceTypes","allErrors","removeAdditional","useDefaults","compile","libFilePath","getWorkspaceOutputPath","scriptDirectories","scriptsDir","push","readPackageCreatorManifest","RunTime","includes","Type","writePackageCreatorManifest","animations","Map","scriptFilePath","readPackageAnimationList","content","readFileSync","encoding","parse","err","relativePath","relative","SyntaxError","Error","String","cause","set","Id","libFile","isErrorENOENT","size","library","date","Date","now","getFullYear","scopeParts","Scope","split","scope","createNamespace","name","minifyResult","terser","minify","ecma","code","creatorIndex","readPackageCreatorIndex","directory","readdirSync","ext","console","error","parts","length","slice"],"mappings":";;;;;;;;;;;;AA2BO,MAAMA,gCAAgC,GAAG,CAC/CC,QAAkC,EAClCC,QAA4B,EAC5BC,cAA8B,KAC1B;AACJ,EAAA,MAAMC,OAAO,GAAG,IAAIC,KAAK,EAAE,CAAA;AAE3BD,EAAAA,OAAO,CAACE,IAAI,CAACC,YAAY,EAAEC,IAAI,CAACC,SAAS,CAACN,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AAEnE,EAAA,MAAMO,KAAK,GAAGC,gCAAgC,CAACV,QAAQ,CAAC,CAAA;EAExD,IAAIS,KAAK,KAAKE,SAAS,EAAE;A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AE;AACbiC,MAAAA,OAAO,CAACC,KAAK,CAAE,CAAoBJ,kBAAAA,EAAAA,SAAU,kBAAiB,CAAC,CAAA;AAChE,KAAA;AACD,GAAA;AAEA,EAAA,OAAOtF,OAAO,CAAA;AACf,EAAC;AAED,MAAM6E,eAAe,GAAIc,KAAe,IAAK;AAC5C,EAAA,IAAIR,IAAI,GAAI,CAAA,IAAA,EAAMQ,KAAK,CAAC,CAAC,CAAE,CAAE,CAAA,CAAA,CAAA;AAE7B,EAAA,KAAK,IAAIrF,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGqF,KAAK,CAACC,MAAM,EAAEtF,KAAK,EAAE,EAAE;AAClD,IAAA,MAAMO,IAAI,GAAG8E,KAAK,CAACE,KAAK,CAAC,CAAC,EAAEvF,KAAK,GAAG,CAAC,CAAC,CAACQ,IAAI,CAAC,GAAG,CAAC,CAAA;AAEhDqE,IAAAA,IAAI,IAAK,CAAA,GAAA,EAAKtE,IAAK,CAAA,GAAA,EAAKA,IAAK,CAAS,QAAA,CAAA,CAAA;AACvC,GAAA;AAEA,EAAA,OAAOsE,IAAI,CAAA;AACZ,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publishNpm.mjs","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 =\n\t\tworkspaceManifest !== undefined\n\t\t\t? getWorkspaceBannerText(workspaceManifest)\n\t\t\t: undefined;\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","dependencies"],"mappings":";;;;;;;;;;;;AAmCO,MAAMA,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,sBAAsB,CAACnB,QAAQ,CAAC,CAAA;EAElD,IAA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AA;AACD;;;;"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
|
|
4
|
-
const PLUGIN_ID = "0feba3a0-b6d1-11e6-9598-0800200c9a66";
|
|
5
|
-
/**
|
|
6
|
-
* Starts an IG.Asset.Server session and returns the sessionId
|
|
7
|
-
*
|
|
8
|
-
* @param {SessionStartParams} params
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
const startSession = async ({
|
|
12
|
-
url,
|
|
13
|
-
authentication,
|
|
14
|
-
...params
|
|
15
|
-
}) => {
|
|
16
|
-
const payload = {
|
|
17
|
-
...params,
|
|
18
|
-
user: undefined,
|
|
19
|
-
password: undefined,
|
|
20
|
-
license: undefined,
|
|
21
|
-
plugin: PLUGIN_ID
|
|
22
|
-
};
|
|
23
|
-
if (authentication.type === "credentials") {
|
|
24
|
-
payload.user = authentication.username;
|
|
25
|
-
payload.password = authentication.password;
|
|
26
|
-
} else if (authentication.type === "license") {
|
|
27
|
-
payload.license = authentication.license;
|
|
28
|
-
}
|
|
29
|
-
const {
|
|
30
|
-
data: {
|
|
31
|
-
session: sessionId,
|
|
32
|
-
state
|
|
33
|
-
}
|
|
34
|
-
} = await axios.post(`Session/Start2`, JSON.stringify(payload), {
|
|
35
|
-
baseURL: url
|
|
36
|
-
});
|
|
37
|
-
if (state !== "SUCCESS") {
|
|
38
|
-
throw new Error(`Could not start session: IG.Asset.Server responded with ${state}`);
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
url,
|
|
42
|
-
sessionId,
|
|
43
|
-
domain: params.domain,
|
|
44
|
-
subDomain: params.subDomain
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
const closeSession = async session => {
|
|
48
|
-
await axios.get(`Session/Close/${session.sessionId}`, {
|
|
49
|
-
baseURL: session.url
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
const uploadPackage = async (session, {
|
|
53
|
-
name,
|
|
54
|
-
version
|
|
55
|
-
}, zipFilePath) => {
|
|
56
|
-
try {
|
|
57
|
-
await uploadPackageToUrl(session.url, `UploadPackage/${session.sessionId}/${name}_${version}`, zipFilePath);
|
|
58
|
-
} catch (err) {
|
|
59
|
-
await uploadPackageToUrl(session.url, `UploadPackage/${session.sessionId}/${name}_${version}/`, zipFilePath);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const getExistingPackages = async session => {
|
|
63
|
-
const {
|
|
64
|
-
data
|
|
65
|
-
} = await axios.get(`Script/GetInformation/${session.sessionId}`, {
|
|
66
|
-
baseURL: session.url,
|
|
67
|
-
validateStatus: status => status === 404 || status === 200
|
|
68
|
-
});
|
|
69
|
-
return data;
|
|
70
|
-
};
|
|
71
|
-
const uploadPackageToUrl = async (url, path, zipFilePath) => {
|
|
72
|
-
const {
|
|
73
|
-
data,
|
|
74
|
-
status
|
|
75
|
-
} = await axios.post(path, fs.createReadStream(zipFilePath), {
|
|
76
|
-
baseURL: url
|
|
77
|
-
});
|
|
78
|
-
let objectBody;
|
|
79
|
-
if (typeof data === "string") {
|
|
80
|
-
try {
|
|
81
|
-
objectBody = JSON.parse(data);
|
|
82
|
-
} catch (err) {}
|
|
83
|
-
} else if (typeof data === "object") {
|
|
84
|
-
objectBody = data;
|
|
85
|
-
}
|
|
86
|
-
if (objectBody !== undefined) {
|
|
87
|
-
if ("state" in objectBody && objectBody.state !== "SUCCESS") {
|
|
88
|
-
throw new Error(objectBody.response ?? objectBody.state);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (status >= 400) {
|
|
92
|
-
if (objectBody !== undefined) {
|
|
93
|
-
let text_1 = "";
|
|
94
|
-
for (const key in objectBody) {
|
|
95
|
-
text_1 += key + ": \n";
|
|
96
|
-
if (typeof objectBody[key] === "object") {
|
|
97
|
-
text_1 += JSON.stringify(objectBody[key], undefined, 2);
|
|
98
|
-
} else {
|
|
99
|
-
text_1 += objectBody[key];
|
|
100
|
-
}
|
|
101
|
-
text_1 += "\n\n";
|
|
102
|
-
}
|
|
103
|
-
throw new Error(text_1);
|
|
104
|
-
}
|
|
105
|
-
throw new Error(data);
|
|
106
|
-
}
|
|
107
|
-
return data;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export { closeSession, getExistingPackages, startSession, uploadPackage };
|
|
111
|
-
//# sourceMappingURL=assetService.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assetService.mjs","sources":["../../src/lib/assetService.ts"],"sourcesContent":["import axios, { AxiosResponse } from \"axios\";\nimport * as fs from \"fs\";\n\nimport { Authentication } from \"./authentication\";\n\nexport interface SessionStartParams\n\textends Omit<\n\t\tSessionStartPayload,\n\t\t\"user\" | \"password\" | \"license\" | \"plugin\"\n\t> {\n\tauthentication: Authentication;\n\turl: string;\n}\n\nexport interface SessionStartPayload {\n\tplugin: string;\n\taddress: string | undefined;\n\tdomain: string;\n\tsubDomain: string;\n\tuser: string | undefined;\n\tpassword: string | undefined;\n\tlicense: string | undefined;\n}\n\nexport interface SessionStartResponse {\n\tsession: string;\n\tstate: string;\n}\n\nconst PLUGIN_ID = \"0feba3a0-b6d1-11e6-9598-0800200c9a66\";\n\nexport interface Session {\n\turl: string;\n\tsessionId: string;\n\tdomain: string;\n\tsubDomain: string;\n}\n\n/**\n * Starts an IG.Asset.Server session and returns the sessionId\n *\n * @param {SessionStartParams} params\n * @returns\n */\nexport const startSession = async ({\n\turl,\n\tauthentication,\n\t...params\n}: SessionStartParams): Promise<Session> => {\n\tconst payload: SessionStartPayload = {\n\t\t...params,\n\t\tuser: undefined,\n\t\tpassword: undefined,\n\t\tlicense: undefined,\n\t\tplugin: PLUGIN_ID,\n\t};\n\n\tif (authentication.type === \"credentials\") {\n\t\tpayload.user = authentication.username;\n\t\tpayload.password = authentication.password;\n\t} else if (authentication.type === \"license\") {\n\t\tpayload.license = authentication.license;\n\t}\n\n\tconst {\n\t\tdata: { session: sessionId, state },\n\t} = await axios.post<\n\t\tSessionStartResponse,\n\t\tAxiosResponse<SessionStartResponse>\n\t>(`Session/Start2`, JSON.stringify(payload), {\n\t\tbaseURL: url,\n\t});\n\n\tif (state !== \"SUCCESS\") {\n\t\tthrow new Error(\n\t\t\t`Could not start session: IG.Asset.Server responded with ${state}`,\n\t\t);\n\t}\n\n\treturn {\n\t\turl,\n\t\tsessionId,\n\t\tdomain: params.domain,\n\t\tsubDomain: params.subDomain,\n\t};\n};\n\nexport const closeSession = async (session: Session) => {\n\tawait axios.get(`Session/Close/${session.sessionId}`, {\n\t\tbaseURL: session.url,\n\t});\n};\n\nexport interface UploadPackageDetails {\n\tname: string;\n\tversion: string;\n}\n\nexport const uploadPackage = async (\n\tsession: Session,\n\t{ name, version }: UploadPackageDetails,\n\tzipFilePath: string,\n) => {\n\ttry {\n\t\tawait uploadPackageToUrl(\n\t\t\tsession.url,\n\t\t\t`UploadPackage/${session.sessionId}/${name}_${version}`,\n\t\t\tzipFilePath,\n\t\t);\n\t} catch (err) {\n\t\tawait uploadPackageToUrl(\n\t\t\tsession.url,\n\t\t\t`UploadPackage/${session.sessionId}/${name}_${version}/`,\n\t\t\tzipFilePath,\n\t\t);\n\t}\n};\n\nexport interface ExistingPackage {\n\tscope: string;\n\tinformalVersion: string;\n\tsupport: boolean;\n\tnumericVersion: number;\n}\n\nexport const getExistingPackages = async (\n\tsession: Session,\n): Promise<ExistingPackage[]> => {\n\tconst { data } = await axios.get(\n\t\t`Script/GetInformation/${session.sessionId}`,\n\t\t{\n\t\t\tbaseURL: session.url,\n\t\t\tvalidateStatus: (status) => status === 404 || status === 200,\n\t\t},\n\t);\n\n\treturn data;\n};\n\nconst uploadPackageToUrl = async (\n\turl: string,\n\tpath: string,\n\tzipFilePath: string,\n) => {\n\tconst { data, status } = await axios.post(\n\t\tpath,\n\t\tfs.createReadStream(zipFilePath),\n\t\t{\n\t\t\tbaseURL: url,\n\t\t},\n\t);\n\n\tlet objectBody: any;\n\tif (typeof data === \"string\") {\n\t\ttry {\n\t\t\tobjectBody = JSON.parse(data);\n\t\t} catch (err) {}\n\t} else if (typeof data === \"object\") {\n\t\tobjectBody = data;\n\t}\n\tif (objectBody !== undefined) {\n\t\tif (\"state\" in objectBody && objectBody.state !== \"SUCCESS\") {\n\t\t\tthrow new Error(objectBody.response ?? objectBody.state);\n\t\t}\n\t}\n\tif (status >= 400) {\n\t\tif (objectBody !== undefined) {\n\t\t\tlet text_1 = \"\";\n\n\t\t\tfor (const key in objectBody) {\n\t\t\t\ttext_1 += key + \": \\n\";\n\t\t\t\tif (typeof objectBody[key] === \"object\") {\n\t\t\t\t\ttext_1 += JSON.stringify(objectBody[key], undefined, 2);\n\t\t\t\t} else {\n\t\t\t\t\ttext_1 += objectBody[key];\n\t\t\t\t}\n\t\t\t\ttext_1 += \"\\n\\n\";\n\t\t\t}\n\n\t\t\tthrow new Error(text_1);\n\t\t}\n\n\t\tthrow new Error(data);\n\t}\n\treturn data;\n};\n"],"names":["PLUGIN_ID","startSession","url","authentication","params","payload","user","undefined","password","license","plugin","type","username","data","session","sessionId","state","axios","post","JSON","stringify","baseURL","Error","domain","subDomain","closeSession","get","uploadPackage","name","version","zipFilePath","uploadPackageToUrl","err","getExistingPackages","validateStatus","status","path","fs","createReadStream","objectBody","parse","response","text_1","key"],"mappings":";;;AA6BA,MAAMA,SAAS,GAAG,sCAAsC,CAAA;AASxD;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,GAAG,OAAO;EAClCC,GAAG;EACHC,cAAc;EACd,GAAGC,MAAAA;AACgB,CAAC,KAAuB;AAC3C,EAAA,MAAMC,OAA4B,GAAG;AACpC,IAAA,GAAGD,MAAM;AACTE,IAAAA,IAAI,EAAEC,SAAS;AACfC,IAAAA,QAAQ,EAAED,SAAS;AACnBE,IAAAA,OAAO,EAAEF,SAAS;AAClBG,IAAAA,MAAM,EAAEV,SAAAA;GACR,CAAA;AAED,EAAA,IAAIG,cAAc,CAACQ,IAAI,KAAK,aAAa,EA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GAAC,MAAM,IAAI,OAAOnB,IAAI,KAAK,QAAQ,EAAE;AACpC0B,IAAAA,UAAU,GAAG1B,IAAI,CAAA;AAClB,GAAA;EACA,IAAI0B,UAAU,KAAKhC,SAAS,EAAE;IAC7B,IAAI,OAAO,IAAIgC,UAAU,IAAIA,UAAU,CAACvB,KAAK,KAAK,SAAS,EAAE;MAC5D,MAAM,IAAIM,KAAK,CAACiB,UAAU,CAACE,QAAQ,IAAIF,UAAU,CAACvB,KAAK,CAAC,CAAA;AACzD,KAAA;AACD,GAAA;EACA,IAAImB,MAAM,IAAI,GAAG,EAAE;IAClB,IAAII,UAAU,KAAKhC,SAAS,EAAE;MAC7B,IAAImC,MAAM,GAAG,EAAE,CAAA;AAEf,MAAA,KAAK,MAAMC,GAAG,IAAIJ,UAAU,EAAE;QAC7BG,MAAM,IAAIC,GAAG,GAAG,MAAM,CAAA;AACtB,QAAA,IAAI,OAAOJ,UAAU,CAACI,GAAG,CAAC,KAAK,QAAQ,EAAE;AACxCD,UAAAA,MAAM,IAAIvB,IAAI,CAACC,SAAS,CAACmB,UAAU,CAACI,GAAG,CAAC,EAAEpC,SAAS,EAAE,CAAC,CAAC,CAAA;AACxD,SAAC,MAAM;AACNmC,UAAAA,MAAM,IAAIH,UAAU,CAACI,GAAG,CAAC,CAAA;AAC1B,SAAA;AACAD,QAAAA,MAAM,IAAI,MAAM,CAAA;AACjB,OAAA;AAEA,MAAA,MAAM,IAAIpB,KAAK,CAACoB,MAAM,CAAC,CAAA;AACxB,KAAA;AAEA,IAAA,MAAM,IAAIpB,KAAK,CAACT,IAAI,CAAC,CAAA;AACtB,GAAA;AACA,EAAA,OAAOA,IAAI,CAAA;AACZ,CAAC;;;;"}
|
package/build/lib/banner.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const getWorkspaceBannerText = manifest => {
|
|
2
|
-
var _manifest$packager;
|
|
3
|
-
let bannerText = manifest === null || manifest === void 0 ? void 0 : (_manifest$packager = manifest.packager) === null || _manifest$packager === void 0 ? void 0 : _manifest$packager.banner;
|
|
4
|
-
if (bannerText) {
|
|
5
|
-
const match = bannerText.match(/Copyright \(C\) (\d+)( ?- ?(\d+))?/);
|
|
6
|
-
if (match !== null) {
|
|
7
|
-
const startYear = parseInt(match[1]);
|
|
8
|
-
const endYear = new Date().getFullYear();
|
|
9
|
-
if (startYear !== endYear) {
|
|
10
|
-
bannerText = bannerText.replace(match[0], `Copyright (C) ${startYear} - ${endYear}`);
|
|
11
|
-
} else {
|
|
12
|
-
bannerText = bannerText.replace(match[0], `Copyright (C) ${startYear}`);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return bannerText;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { getWorkspaceBannerText };
|
|
20
|
-
//# sourceMappingURL=banner.mjs.map
|
package/build/lib/banner.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"banner.mjs","sources":["../../src/lib/banner.ts"],"sourcesContent":["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"],"names":["getWorkspaceBannerText","manifest","bannerText","packager","banner","match","startYear","parseInt","endYear","Date","getFullYear","replace"],"mappings":"AAEaA,MAAAA,sBAAsB,GAAIC,QAA8B,IAAK;AAAA,EAAA,IAAA,kBAAA,CAAA;EACzE,IAAIC,UAAU,GAAGD,QAAQ,KAARA,IAAAA,IAAAA,QAAQ,KAARA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,kBAAAA,GAAAA,QAAQ,CAAEE,QAAQ,MAAlB,IAAA,IAAA,kBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,kBAAA,CAAoBC,MAAM,CAAA;AAE3C,EAAA,IAAIF,UAAU,EAAE;AACf,IAAA,MAAMG,KAAK,GAAGH,UAAU,CAACG,KAAK,CAAC,oCAAoC,CAAC,CAAA;IAEpE,IAAIA,KAAK,KAAK,IAAI,EAAE;MACnB,MAAMC,SAAS,GAAGC,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACpC,MAAA,MAAMG,OAAO,GAAG,IAAIC,IAAI,EAAE,CAACC,WAAW,EAAE,CAAA;MAExC,IAAIJ,SAAS,KAAKE,OAAO,EAAE;AAC1BN,QAAAA,UAAU,GAAGA,UAAU,CAACS,OAAO,CAC9BN,KAAK,CAAC,CAAC,CAAC,EACP,CAAgBC,cAAAA,EAAAA,SAAU,CAAKE,GAAAA,EAAAA,OAAQ,EAAC,CACzC,CAAA;AACF,OAAC,MAAM;AACNN,QAAAA,UAAU,GAAGA,UAAU,CAACS,OAAO,CAC9BN,KAAK,CAAC,CAAC,CAAC,EACP,CAAgBC,cAAAA,EAAAA,SAAU,EAAC,CAC5B,CAAA;AACF,OAAA;AACD,KAAA;AACD,GAAA;AAEA,EAAA,OAAOJ,UAAU,CAAA;AAClB;;;;"}
|