@intelligentgraphics/ig.gfx.packager 3.0.0-alpha.9 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.mjs +48 -336
- package/build/cli.mjs.map +1 -1
- package/build/commands/build/docs.mjs +34 -0
- package/build/commands/build/docs.mjs.map +1 -0
- package/build/commands/build/index.mjs +169 -0
- package/build/commands/build/index.mjs.map +1 -0
- package/build/commands/build/tsc.mjs +84 -0
- package/build/commands/build/tsc.mjs.map +1 -0
- package/build/{generate.mjs → commands/generate.mjs} +6 -16
- package/build/commands/generate.mjs.map +1 -0
- package/build/{postinstall.mjs → commands/postinstall.mjs} +3 -10
- package/build/commands/postinstall.mjs.map +1 -0
- package/build/{index3.mjs → commands/publish/index.mjs} +20 -288
- package/build/commands/publish/index.mjs.map +1 -0
- package/build/commands/publish/zip.mjs +168 -0
- package/build/commands/publish/zip.mjs.map +1 -0
- package/build/{publishNpm.mjs → commands/publishNpm.mjs} +10 -18
- package/build/commands/publishNpm.mjs.map +1 -0
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/lib/assetService.mjs +111 -0
- package/build/lib/assetService.mjs.map +1 -0
- package/build/lib/banner.mjs +20 -0
- package/build/lib/banner.mjs.map +1 -0
- package/build/{dependencies.mjs → lib/dependencies.mjs} +9 -60
- package/build/lib/dependencies.mjs.map +1 -0
- package/build/lib/error.mjs +15 -0
- package/build/lib/error.mjs.map +1 -0
- package/build/lib/fs.mjs +19 -0
- package/build/lib/fs.mjs.map +1 -0
- package/build/lib/git.mjs +37 -0
- package/build/lib/git.mjs.map +1 -0
- package/build/lib/localization.mjs +16 -0
- package/build/lib/localization.mjs.map +1 -0
- package/build/lib/log.mjs +9 -0
- package/build/lib/log.mjs.map +1 -0
- package/build/lib/npmPackage.mjs +19 -0
- package/build/lib/npmPackage.mjs.map +1 -0
- package/build/lib/package.mjs +129 -0
- package/build/lib/package.mjs.map +1 -0
- package/build/lib/packageVersion.mjs +174 -0
- package/build/lib/packageVersion.mjs.map +1 -0
- package/build/lib/parseVersion.mjs +54 -0
- package/build/lib/parseVersion.mjs.map +1 -0
- package/build/lib/prompter.mjs +31 -0
- package/build/lib/prompter.mjs.map +1 -0
- package/build/lib/publishedPackage.mjs +66 -0
- package/build/lib/publishedPackage.mjs.map +1 -0
- package/build/{scripts.mjs → lib/scripts.mjs} +1 -2
- package/build/lib/scripts.mjs.map +1 -0
- package/build/lib/stripUtf8Bom.mjs +11 -0
- package/build/lib/stripUtf8Bom.mjs.map +1 -0
- package/build/lib/toposort.mjs +26 -0
- package/build/lib/toposort.mjs.map +1 -0
- package/build/lib/versionFile.mjs +78 -0
- package/build/lib/versionFile.mjs.map +1 -0
- package/build/lib/workspace.mjs +51 -0
- package/build/lib/workspace.mjs.map +1 -0
- package/locales/de.json +18 -18
- package/locales/en.json +37 -37
- package/package.json +2 -2
- package/readme.md +29 -2
- package/scripts/postinstall.js +22 -22
- package/build/dependencies.mjs.map +0 -1
- package/build/generate.mjs.map +0 -1
- package/build/index2.mjs +0 -326
- package/build/index2.mjs.map +0 -1
- package/build/index3.mjs.map +0 -1
- package/build/postinstall.mjs.map +0 -1
- package/build/publishNpm.mjs.map +0 -1
- package/build/scripts.mjs.map +0 -1
- package/build/versionFile.mjs +0 -365
- package/build/versionFile.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
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,EAA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AAI,CAAC,GAAG,GAAG,GAAGF,WAAW,CAACjB,OAAO,CAAA;AACnEwC,MAAAA,uBAAuB,CAACsC,eAAe,EAAEE,QAAQ,CAAC,CAAA;AACnD,KAAA;AACD,GAAA;AACD;;;;"}
|
package/build/index.mjs
CHANGED
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import \"source-map-support/register.js\";\
|
|
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"}
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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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AG,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;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;"}
|
|
@@ -1,56 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import * as fs from 'fs';
|
|
4
|
-
import resolve from 'resolve';
|
|
5
|
-
import { j as readNpmManifest, P as PACKAGE_FILE, i as isErrorENOENT, I as INDEX_FILE, f as readWorkspaceNpmManifest } from './cli.mjs';
|
|
6
|
-
|
|
7
|
-
const detectPublishedPackageByModuleName = (workspace, name) => {
|
|
8
|
-
const manifestPath = resolve.sync(name + "/package.json", {
|
|
9
|
-
basedir: workspace.path
|
|
10
|
-
});
|
|
11
|
-
const dir = path.dirname(manifestPath);
|
|
12
|
-
return detectPublishedPackage(dir);
|
|
13
|
-
};
|
|
14
|
-
const detectPublishedPackage = path => ({
|
|
15
|
-
_kind: "PublishedPackageLocation",
|
|
16
|
-
path
|
|
17
|
-
});
|
|
18
|
-
const readPublishedPackageNpmManifest = location => {
|
|
19
|
-
return readNpmManifest(location.path);
|
|
20
|
-
};
|
|
21
|
-
const readPublishedPackageCreatorManifest = location => {
|
|
22
|
-
try {
|
|
23
|
-
const packageJsonPath = path.join(location.path, PACKAGE_FILE);
|
|
24
|
-
const packageJson = fs.readFileSync(packageJsonPath, {
|
|
25
|
-
encoding: "utf8"
|
|
26
|
-
});
|
|
27
|
-
const result = JSON.parse(packageJson);
|
|
28
|
-
return {
|
|
29
|
-
...result,
|
|
30
|
-
Scope: result.Scope || result.Package
|
|
31
|
-
};
|
|
32
|
-
} catch (err) {
|
|
33
|
-
if (isErrorENOENT(err)) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
throw err;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const readPublishedPackageCreatorIndex = location => {
|
|
40
|
-
try {
|
|
41
|
-
const packageJsonPath = path.join(location.path, INDEX_FILE);
|
|
42
|
-
const packageJson = fs.readFileSync(packageJsonPath, {
|
|
43
|
-
encoding: "utf8"
|
|
44
|
-
});
|
|
45
|
-
const result = JSON.parse(packageJson);
|
|
46
|
-
return result;
|
|
47
|
-
} catch (err) {
|
|
48
|
-
if (isErrorENOENT(err)) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
throw err;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
1
|
+
import { readPublishedPackageNpmManifest, detectPublishedPackageFromPath } from './publishedPackage.mjs';
|
|
2
|
+
import { readWorkspaceNpmManifest } from './workspace.mjs';
|
|
54
3
|
|
|
55
4
|
// /**
|
|
56
5
|
// * Determines the implicit dependencies of a an actual data workspace package.
|
|
@@ -84,11 +33,11 @@ const readPublishedPackageCreatorIndex = location => {
|
|
|
84
33
|
// return results;
|
|
85
34
|
// };
|
|
86
35
|
|
|
87
|
-
/**
|
|
88
|
-
* Recursively determines all installed ig libraries for a workspace.
|
|
89
|
-
*
|
|
90
|
-
* @param {WorkspaceLocation} workspace
|
|
91
|
-
* @returns {PublishedPackageLocation[]}
|
|
36
|
+
/**
|
|
37
|
+
* Recursively determines all installed ig libraries for a workspace.
|
|
38
|
+
*
|
|
39
|
+
* @param {WorkspaceLocation} workspace
|
|
40
|
+
* @returns {PublishedPackageLocation[]}
|
|
92
41
|
*/
|
|
93
42
|
const determineWorkspaceIGLibraries = workspace => {
|
|
94
43
|
const manifest = readWorkspaceNpmManifest(workspace);
|
|
@@ -113,7 +62,7 @@ const collectIGLibraries = (workspace, manifest) => {
|
|
|
113
62
|
const result = [];
|
|
114
63
|
for (const runtimeDependency of runtimeDependencies) {
|
|
115
64
|
var _runtimeManifest$ig;
|
|
116
|
-
const location =
|
|
65
|
+
const location = detectPublishedPackageFromPath(workspace.path, runtimeDependency);
|
|
117
66
|
const runtimeManifest = readPublishedPackageNpmManifest(location);
|
|
118
67
|
|
|
119
68
|
// packages need to explicitly be marked as ig scriptingLibraries
|
|
@@ -125,5 +74,5 @@ const collectIGLibraries = (workspace, manifest) => {
|
|
|
125
74
|
return result;
|
|
126
75
|
};
|
|
127
76
|
|
|
128
|
-
export {
|
|
77
|
+
export { determineWorkspaceIGLibraries };
|
|
129
78
|
//# sourceMappingURL=dependencies.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.mjs","sources":["../../src/lib/dependencies.ts"],"sourcesContent":["import { PackageJSON } from \"./packageJSON\";\nimport {\n\tdetectPublishedPackageFromPath,\n\tPublishedPackageLocation,\n\treadPublishedPackageNpmManifest,\n} from \"./publishedPackage\";\nimport { readWorkspaceNpmManifest, WorkspaceLocation } from \"./workspace\";\n\n// /**\n// * Determines the implicit dependencies of a an actual data workspace package.\n// *\n// * An implicit dependency is a dependency that is installed for the workspace and has the same runtime environment (evaluator, interactor) as the package.\n// *\n// * @param {WorkspaceLocation} workspace\n// * @param {CreatorPackage} creatorPackage\n// * @returns {PublishedPackageLocation[]}\n// */\n// export const determinePackageImplicitDependencies = (\n// \tworkspace: WorkspaceLocation,\n// \tcreatorPackage: CreatorPackage,\n// ): PublishedPackageLocation[] => {\n// \tconst libraries = determineWorkspaceIGLibraries(workspace);\n\n// \tconst results: PublishedPackageLocation[] = [];\n// \tfor (const librarylocation of libraries) {\n// \t\tconst libraryManifest =\n// \t\t\treadPublishedPackageCreatorManifest(librarylocation);\n\n// \t\tif (\n// \t\t\tlibraryManifest !== undefined &&\n// \t\t\t(libraryManifest.Type === \"Mixed\" ||\n// \t\t\t\tlibraryManifest.RunTime === creatorPackage.RunTime)\n// \t\t) {\n// \t\t\tresults.push(librarylocation);\n// \t\t}\n// \t}\n\n// \treturn results;\n// };\n\n/**\n * Recursively determines all installed ig libraries for a workspace.\n *\n * @param {WorkspaceLocation} workspace\n * @returns {PublishedPackageLocation[]}\n */\nexport const determineWorkspaceIGLibraries = (\n\tworkspace: WorkspaceLocation,\n): PublishedPackageLocation[] => {\n\tconst manifest = readWorkspaceNpmManifest(workspace);\n\n\tif (manifest === undefined) {\n\t\treturn [];\n\t}\n\n\tconst libraries = collectIGLibraries(workspace, manifest);\n\tconst results = new Map<string, PublishedPackageLocation>();\n\n\tfor (const location of libraries) {\n\t\tconst manifest = readPublishedPackageNpmManifest(location);\n\t\tif (!results.has(manifest.name)) {\n\t\t\tresults.set(manifest.name, location);\n\t\t}\n\t}\n\n\treturn Array.from(results.values());\n};\n\nconst collectIGLibraries = (\n\tworkspace: WorkspaceLocation,\n\tmanifest: PackageJSON,\n): PublishedPackageLocation[] => {\n\tif (!manifest.dependencies) {\n\t\treturn [];\n\t}\n\n\tconst runtimeDependencies = Object.getOwnPropertyNames(\n\t\tmanifest.dependencies,\n\t);\n\n\tconst result: PublishedPackageLocation[] = [];\n\n\tfor (const runtimeDependency of runtimeDependencies) {\n\t\tconst location = detectPublishedPackageFromPath(\n\t\t\tworkspace.path,\n\t\t\truntimeDependency,\n\t\t);\n\n\t\tconst runtimeManifest = readPublishedPackageNpmManifest(location);\n\n\t\t// packages need to explicitly be marked as ig scriptingLibraries\n\t\tif (runtimeManifest.ig?.scriptingLibrary) {\n\t\t\tresult.push(location);\n\t\t\tresult.push(...collectIGLibraries(workspace, runtimeManifest));\n\t\t}\n\t}\n\n\treturn result;\n};\n"],"names":["determineWorkspaceIGLibraries","workspace","manifest","readWorkspaceNpmManifest","undefined","libraries","collectIGLibraries","results","Map","location","readPublishedPackageNpmManifest","has","name","set","Array","from","values","dependencies","runtimeDependencies","Object","getOwnPropertyNames","result","runtimeDependency","detectPublishedPackageFromPath","path","runtimeManifest","ig","scriptingLibrary","push"],"mappings":";;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;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AMG,eAAe,GAAGf,+BAA+B,CAACD,QAAQ,CAAC,CAAA;;AAEjE;AACA,IAAA,IAAA,CAAA,mBAAA,GAAIgB,eAAe,CAACC,EAAE,MAAlB,IAAA,IAAA,mBAAA,KAAA,KAAA,CAAA,IAAA,mBAAA,CAAoBC,gBAAgB,EAAE;AACzCN,MAAAA,MAAM,CAACO,IAAI,CAACnB,QAAQ,CAAC,CAAA;MACrBY,MAAM,CAACO,IAAI,CAAC,GAAGtB,kBAAkB,CAACL,SAAS,EAAEwB,eAAe,CAAC,CAAC,CAAA;AAC/D,KAAA;AACD,GAAA;AAEA,EAAA,OAAOJ,MAAM,CAAA;AACd,CAAC;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const getNodeErrorCode = error => {
|
|
2
|
+
if (error !== null && typeof error === "object" && error.code !== undefined) {
|
|
3
|
+
return error.code;
|
|
4
|
+
}
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.
|
|
9
|
+
*
|
|
10
|
+
* @param {unknown} error
|
|
11
|
+
*/
|
|
12
|
+
const isErrorENOENT = error => getNodeErrorCode(error) === "ENOENT";
|
|
13
|
+
|
|
14
|
+
export { getNodeErrorCode, isErrorENOENT };
|
|
15
|
+
//# sourceMappingURL=error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","sources":["../../src/lib/error.ts"],"sourcesContent":["interface NodeError extends Error {\n\tcode: string;\n}\n\nexport const getNodeErrorCode = (error: unknown) => {\n\tif (\n\t\terror !== null &&\n\t\ttypeof error === \"object\" &&\n\t\t(error as NodeError).code !== undefined\n\t) {\n\t\treturn (error as NodeError).code;\n\t}\n};\n\n/**\n * Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.\n *\n * @param {unknown} error\n */\nexport const isErrorEACCES = (error: unknown) =>\n\tgetNodeErrorCode(error) === \"EACCES\";\n\n/**\n * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.\n *\n * @param {unknown} error\n */\nexport const isErrorENOENT = (error: unknown) =>\n\tgetNodeErrorCode(error) === \"ENOENT\";\n"],"names":["getNodeErrorCode","error","code","undefined","isErrorENOENT"],"mappings":"AAIaA,MAAAA,gBAAgB,GAAIC,KAAc,IAAK;AACnD,EAAA,IACCA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACxBA,KAAK,CAAeC,IAAI,KAAKC,SAAS,EACtC;IACD,OAAQF,KAAK,CAAeC,IAAI,CAAA;AACjC,GAAA;AACD,EAAC;;AAUD;AACA;AACA;AACA;AACA;AACO,MAAME,aAAa,GAAIH,KAAc,IAC3CD,gBAAgB,CAACC,KAAK,CAAC,KAAK;;;;"}
|
package/build/lib/fs.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import { isErrorENOENT } from './error.mjs';
|
|
3
|
+
|
|
4
|
+
const readStringFromFile = filePath => fs.readFileSync(filePath, {
|
|
5
|
+
encoding: "utf8"
|
|
6
|
+
});
|
|
7
|
+
const readStringFromFileOrUndefined = filePath => {
|
|
8
|
+
try {
|
|
9
|
+
return readStringFromFile(filePath);
|
|
10
|
+
} catch (err) {
|
|
11
|
+
if (!isErrorENOENT(err)) {
|
|
12
|
+
throw err;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { readStringFromFile, readStringFromFileOrUndefined };
|
|
19
|
+
//# sourceMappingURL=fs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.mjs","sources":["../../src/lib/fs.ts"],"sourcesContent":["import * as fs from \"fs\";\n\nimport { isErrorENOENT } from \"./error\";\n\nexport const readStringFromFile = (filePath: string): string =>\n\tfs.readFileSync(filePath, { encoding: \"utf8\" });\n\nexport const readStringFromFileOrUndefined = (\n\tfilePath: string,\n): string | undefined => {\n\ttry {\n\t\treturn readStringFromFile(filePath);\n\t} catch (err) {\n\t\tif (!isErrorENOENT(err)) {\n\t\t\tthrow err;\n\t\t}\n\t\treturn undefined;\n\t}\n};\n"],"names":["readStringFromFile","filePath","fs","readFileSync","encoding","readStringFromFileOrUndefined","err","isErrorENOENT","undefined"],"mappings":";;;AAIO,MAAMA,kBAAkB,GAAIC,QAAgB,IAClDC,EAAE,CAACC,YAAY,CAACF,QAAQ,EAAE;AAAEG,EAAAA,QAAQ,EAAE,MAAA;AAAO,CAAC,EAAC;AAEnCC,MAAAA,6BAA6B,GACzCJ,QAAgB,IACQ;EACxB,IAAI;IACH,OAAOD,kBAAkB,CAACC,QAAQ,CAAC,CAAA;GACnC,CAAC,OAAOK,GAAG,EAAE;AACb,IAAA,IAAI,CAACC,aAAa,CAACD,GAAG,CAAC,EAAE;AACxB,MAAA,MAAMA,GAAG,CAAA;AACV,KAAA;AACA,IAAA,OAAOE,SAAS,CAAA;AACjB,GAAA;AACD;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import simpleGit from 'simple-git';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
const getVersionInformationFromGit = async (workspaceLocation, packageLocation) => {
|
|
5
|
+
try {
|
|
6
|
+
var _log$latest, _log$latest2;
|
|
7
|
+
const git = simpleGit({
|
|
8
|
+
baseDir: workspaceLocation.path
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// check wether the files for a folder are changed
|
|
12
|
+
// if so, mark as dirty
|
|
13
|
+
const diff = await git.diffSummary();
|
|
14
|
+
const dirty = diff.files.some(file => {
|
|
15
|
+
if (file.file.toLowerCase().includes("releases") || file.file.toLowerCase().endsWith("version.ts") || file.file.toLowerCase().endsWith("package.json")) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const fullPath = path.resolve(workspaceLocation.path, file.file);
|
|
19
|
+
const relativePath = path.relative(packageLocation.path, fullPath);
|
|
20
|
+
return !relativePath.startsWith("..");
|
|
21
|
+
});
|
|
22
|
+
const log = await git.log({
|
|
23
|
+
maxCount: 1
|
|
24
|
+
});
|
|
25
|
+
const commit = !((_log$latest = log.latest) !== null && _log$latest !== void 0 && _log$latest.hash) ? undefined : log.latest.hash.substring(0, 7);
|
|
26
|
+
return {
|
|
27
|
+
commit,
|
|
28
|
+
dirty,
|
|
29
|
+
commitDate: (_log$latest2 = log.latest) === null || _log$latest2 === void 0 ? void 0 : _log$latest2.date
|
|
30
|
+
};
|
|
31
|
+
} catch (err) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { getVersionInformationFromGit };
|
|
37
|
+
//# sourceMappingURL=git.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.mjs","sources":["../../src/lib/git.ts"],"sourcesContent":["import simpleGit from \"simple-git\";\nimport * as path from \"path\";\n\nimport { WorkspaceLocation } from \"./workspace\";\nimport { PackageLocation } from \"./package\";\n\nexport const getVersionInformationFromGit = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tpackageLocation: PackageLocation,\n) => {\n\ttry {\n\t\tconst git = simpleGit({\n\t\t\tbaseDir: workspaceLocation.path,\n\t\t});\n\n\t\t// check wether the files for a folder are changed\n\t\t// if so, mark as dirty\n\t\tconst diff = await git.diffSummary();\n\n\t\tconst dirty = diff.files.some((file) => {\n\t\t\tif (\n\t\t\t\tfile.file.toLowerCase().includes(\"releases\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"version.ts\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"package.json\")\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst fullPath = path.resolve(workspaceLocation.path, file.file);\n\t\t\tconst relativePath = path.relative(packageLocation.path, fullPath);\n\n\t\t\treturn !relativePath.startsWith(\"..\");\n\t\t});\n\n\t\tconst log = await git.log({ maxCount: 1 });\n\t\tconst commit = !log.latest?.hash\n\t\t\t? undefined\n\t\t\t: log.latest.hash.substring(0, 7);\n\n\t\treturn {\n\t\t\tcommit,\n\t\t\tdirty,\n\t\t\tcommitDate: log.latest?.date,\n\t\t};\n\t} catch (err) {\n\t\treturn {};\n\t}\n};\n"],"names":["getVersionInformationFromGit","workspaceLocation","packageLocation","git","simpleGit","baseDir","path","diff","diffSummary","dirty","files","some","file","toLowerCase","includes","endsWith","fullPath","resolve","relativePath","relative","startsWith","log","maxCount","commit","latest","hash","undefined","substring","commitDate","date","err"],"mappings":";;;MAMaA,4BAA4B,GAAG,OAC3CC,iBAAoC,EACpCC,eAAgC,KAC5B;EACJ,IAAI;AAAA,IAAA,IAAA,WAAA,EAAA,YAAA,CAAA;IACH,MAAMC,GAAG,GAAGC,SAAS,CAAC;MACrBC,OAAO,EAAEJ,iBAAiB,CAACK,IAAAA;AAC5B,KAAC,CAAC,CAAA;;AAEF;AACA;AACA,IAAA,MAAMC,IAAI,GAAG,MAAMJ,GAAG,CAACK,WAAW,EAAE,CAAA;IAEpC,MAAMC,KAAK,GAAGF,IAAI,CAACG,KAAK,CAACC,IAAI,CAAEC,IAAI,IAAK;AACvC,MAAA,IACCA,IAAI,CAACA,IAAI,CAACC,WAAW,EAAE,CAACC,QAAQ,CAAC,UAAU,CAAC,IAC5CF,IAAI,CAACA,IAAI,CAACC,WAAW,EAAE,CAACE,QAAQ,CAAC,YAAY,CAAC,IAC9CH,IAAI,CAACA,IAAI,CAACC,WAAW,EAAE,CAACE,QAAQ,CAAC,cAAc,CAAC,EAC/C;AACD,QAAA,OAAO,KAAK,CAAA;AACb,OAAA;AAEA,MAAA,MAAMC,QAAQ,GAAGV,IAAI,CAACW,OAAO,CAAChB,iBAAiB,CAACK,IAAI,EAAEM,IAAI,CAACA,IAAI,CAAC,CAAA;MAChE,MAAMM,YAAY,GAAGZ,IAAI,CAACa,QAAQ,CAACjB,eAAe,CAACI,IAAI,EAAEU,QAAQ,CAAC,CAAA;AAElE,MAAA,OAAO,CAACE,YAAY,CAACE,UAAU,CAAC,IAAI,CAAC,CAAA;AACtC,KAAC,CAAC,CAAA;AAEF,IAAA,MAAMC,GAAG,GAAG,MAAMlB,GAAG,CAACkB,GAAG,CAAC;AAAEC,MAAAA,QAAQ,EAAE,CAAA;AAAE,KAAC,CAAC,CAAA;IAC1C,MAAMC,MAAM,GAAG,EAACF,CAAAA,WAAAA,GAAAA,GAAG,CAACG,MAAM,MAAA,IAAA,IAAA,WAAA,KAAA,KAAA,CAAA,IAAV,WAAYC,CAAAA,IAAI,CAC7BC,GAAAA,SAAS,GACTL,GAAG,CAACG,MAAM,CAACC,IAAI,CAACE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAElC,OAAO;MACNJ,MAAM;MACNd,KAAK;AACLmB,MAAAA,UAAU,EAAEP,CAAAA,YAAAA,GAAAA,GAAG,CAACG,MAAM,iDAAV,YAAYK,CAAAA,IAAAA;KACxB,CAAA;GACD,CAAC,OAAOC,GAAG,EAAE;AACb,IAAA,OAAO,EAAE,CAAA;AACV,GAAA;AACD;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import y18n from 'y18n';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const instance = y18n({
|
|
8
|
+
directory: path.join(__dirname, "..", "locales"),
|
|
9
|
+
updateFiles: false,
|
|
10
|
+
locale: "en",
|
|
11
|
+
fallbackToLanguage: true
|
|
12
|
+
});
|
|
13
|
+
const translate = (key, ...args) => instance.__(key, ...args);
|
|
14
|
+
|
|
15
|
+
export { translate };
|
|
16
|
+
//# sourceMappingURL=localization.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localization.mjs","sources":["../../src/lib/localization.ts"],"sourcesContent":["import y18n from \"y18n\";\nimport * as path from \"path\";\nimport { dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst instance = y18n({\n\tdirectory: path.join(__dirname, \"..\", \"locales\"),\n\tupdateFiles: false,\n\tlocale: \"en\",\n\tfallbackToLanguage: true,\n});\n\nexport const setLocale = (locale: string) => {\n\tinstance.setLocale(locale);\n};\n\nexport const translate = (key: string, ...args: string[]) =>\n\tinstance.__(key, ...args);\n"],"names":["__dirname","dirname","fileURLToPath","import","meta","url","instance","y18n","directory","path","join","updateFiles","locale","fallbackToLanguage","translate","key","args","__"],"mappings":";;;;;AAKA,MAAMA,SAAS,GAAGC,OAAO,CAACC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAA;AAEzD,MAAMC,QAAQ,GAAGC,IAAI,CAAC;EACrBC,SAAS,EAAEC,IAAI,CAACC,IAAI,CAACV,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC;AAChDW,EAAAA,WAAW,EAAE,KAAK;AAClBC,EAAAA,MAAM,EAAE,IAAI;AACZC,EAAAA,kBAAkB,EAAE,IAAA;AACrB,CAAC,CAAC,CAAA;MAMWC,SAAS,GAAG,CAACC,GAAW,EAAE,GAAGC,IAAc,KACvDV,QAAQ,CAACW,EAAE,CAACF,GAAG,EAAE,GAAGC,IAAI;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const logPackageMessage = (name, step, index, total) => {
|
|
2
|
+
const numLength = total === undefined ? undefined : total.toString().length;
|
|
3
|
+
const indexString = total === undefined || total < 2 ? "" : `${index.toString().padStart(numLength, "0")}/${total} `;
|
|
4
|
+
const identifierString = `${indexString}${name.padEnd(15)}`;
|
|
5
|
+
console.log(`${identifierString} >> ${step}`);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { logPackageMessage };
|
|
9
|
+
//# sourceMappingURL=log.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.mjs","sources":["../../src/lib/log.ts"],"sourcesContent":["export const logPackageMessage = (\n\tname: string,\n\tstep: string,\n\tindex?: number,\n\ttotal?: number,\n) => {\n\tconst numLength = total === undefined ? undefined : total.toString().length;\n\n\tconst indexString =\n\t\ttotal === undefined || total < 2\n\t\t\t? \"\"\n\t\t\t: `${index!.toString().padStart(numLength!, \"0\")}/${total} `;\n\n\tconst identifierString = `${indexString}${name.padEnd(15)}`;\n\n\tconsole.log(`${identifierString} >> ${step}`);\n};\n"],"names":["logPackageMessage","name","step","index","total","numLength","undefined","toString","length","indexString","padStart","identifierString","padEnd","console","log"],"mappings":"AAAO,MAAMA,iBAAiB,GAAG,CAChCC,IAAY,EACZC,IAAY,EACZC,KAAc,EACdC,KAAc,KACV;AACJ,EAAA,MAAMC,SAAS,GAAGD,KAAK,KAAKE,SAAS,GAAGA,SAAS,GAAGF,KAAK,CAACG,QAAQ,EAAE,CAACC,MAAM,CAAA;EAE3E,MAAMC,WAAW,GAChBL,KAAK,KAAKE,SAAS,IAAIF,KAAK,GAAG,CAAC,GAC7B,EAAE,GACD,CAAA,EAAED,KAAK,CAAEI,QAAQ,EAAE,CAACG,QAAQ,CAACL,SAAS,EAAG,GAAG,CAAE,CAAGD,CAAAA,EAAAA,KAAM,CAAE,CAAA,CAAA,CAAA;EAE9D,MAAMO,gBAAgB,GAAI,CAAA,EAAEF,WAAY,CAAA,EAAER,IAAI,CAACW,MAAM,CAAC,EAAE,CAAE,CAAC,CAAA,CAAA;EAE3DC,OAAO,CAACC,GAAG,CAAE,CAAA,EAAEH,gBAAiB,CAAMT,IAAAA,EAAAA,IAAK,EAAC,CAAC,CAAA;AAC9C;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { writePackageSync } from 'write-pkg';
|
|
4
|
+
import { stripUtf8Bom } from './stripUtf8Bom.mjs';
|
|
5
|
+
|
|
6
|
+
const readNpmManifest = directory => {
|
|
7
|
+
const packageJsonPath = path.join(directory, "package.json");
|
|
8
|
+
const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, {
|
|
9
|
+
encoding: "utf8"
|
|
10
|
+
}));
|
|
11
|
+
return JSON.parse(packageJson);
|
|
12
|
+
};
|
|
13
|
+
const writeNpmManifest = (directory, packageJson) => {
|
|
14
|
+
const packageJsonPath = path.join(directory, "package.json");
|
|
15
|
+
writePackageSync(packageJsonPath, packageJson);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { readNpmManifest, writeNpmManifest };
|
|
19
|
+
//# sourceMappingURL=npmPackage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npmPackage.mjs","sources":["../../src/lib/npmPackage.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\nimport { writePackageSync } from \"write-pkg\";\n\nimport { PackageJSON } from \"./packageJSON\";\nimport { stripUtf8Bom } from \"./stripUtf8Bom\";\n\nexport const readNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n): T => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\tconst packageJson = stripUtf8Bom(\n\t\tfs.readFileSync(packageJsonPath, {\n\t\t\tencoding: \"utf8\",\n\t\t}),\n\t);\n\treturn JSON.parse(packageJson);\n};\n\nexport const writeNpmManifest = <T extends PackageJSON>(\n\tdirectory: string,\n\tpackageJson: T,\n) => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\twritePackageSync(packageJsonPath, packageJson);\n};\n"],"names":["readNpmManifest","directory","packageJsonPath","path","join","packageJson","stripUtf8Bom","fs","readFileSync","encoding","JSON","parse","writeNpmManifest","writePackageSync"],"mappings":";;;;;AAOaA,MAAAA,eAAe,GAC3BC,SAAiB,IACV;EACP,MAAMC,eAAe,GAAGC,IAAI,CAACC,IAAI,CAACH,SAAS,EAAE,cAAc,CAAC,CAAA;EAC5D,MAAMI,WAAW,GAAGC,YAAY,CAC/BC,EAAE,CAACC,YAAY,CAACN,eAAe,EAAE;AAChCO,IAAAA,QAAQ,EAAE,MAAA;AACX,GAAC,CAAC,CACF,CAAA;AACD,EAAA,OAAOC,IAAI,CAACC,KAAK,CAACN,WAAW,CAAC,CAAA;AAC/B,EAAC;MAEYO,gBAAgB,GAAG,CAC/BX,SAAiB,EACjBI,WAAc,KACV;EACJ,MAAMH,eAAe,GAAGC,IAAI,CAACC,IAAI,CAACH,SAAS,EAAE,cAAc,CAAC,CAAA;AAC5DY,EAAAA,gBAAgB,CAACX,eAAe,EAAEG,WAAW,CAAC,CAAA;AAC/C;;;;"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import { isErrorENOENT } from './error.mjs';
|
|
4
|
+
import { readNpmManifest, writeNpmManifest } from './npmPackage.mjs';
|
|
5
|
+
import { stripUtf8Bom } from './stripUtf8Bom.mjs';
|
|
6
|
+
|
|
7
|
+
// Functionality related to working with a single package.
|
|
8
|
+
const PACKAGE_FILE = "_Package.json";
|
|
9
|
+
const INDEX_FILE = "_Index.json";
|
|
10
|
+
const ANIMATION_FILE_SUFFIX = ".animation.json";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Describes the location of a single package.
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface PackageLocation
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const parseCreatorPackageName = manifest => {
|
|
20
|
+
const [domain, ...subdomainParts] = manifest.Package.split(".");
|
|
21
|
+
return {
|
|
22
|
+
domain,
|
|
23
|
+
subdomain: subdomainParts.join(".")
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Detects the package at the given directory.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} directory
|
|
30
|
+
* @returns {PackageLocation}
|
|
31
|
+
*/
|
|
32
|
+
const detectPackage = (workspace, directory) => {
|
|
33
|
+
directory = path.resolve(workspace.path, directory);
|
|
34
|
+
const scriptsPath = path.join(directory, "Scripts");
|
|
35
|
+
const tsPath = path.join(directory, "ts");
|
|
36
|
+
let location;
|
|
37
|
+
if (fs.existsSync(scriptsPath)) {
|
|
38
|
+
location = {
|
|
39
|
+
_kind: "PackageLocation",
|
|
40
|
+
path: directory,
|
|
41
|
+
scriptsDir: scriptsPath,
|
|
42
|
+
manifestDir: scriptsPath
|
|
43
|
+
};
|
|
44
|
+
} else if (fs.existsSync(tsPath)) {
|
|
45
|
+
location = {
|
|
46
|
+
_kind: "PackageLocation",
|
|
47
|
+
path: directory,
|
|
48
|
+
scriptsDir: tsPath,
|
|
49
|
+
manifestDir: directory
|
|
50
|
+
};
|
|
51
|
+
} else {
|
|
52
|
+
location = {
|
|
53
|
+
_kind: "PackageLocation",
|
|
54
|
+
path: directory,
|
|
55
|
+
scriptsDir: directory,
|
|
56
|
+
manifestDir: directory
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
readPackageCreatorManifest(location);
|
|
61
|
+
} catch (err) {
|
|
62
|
+
if (isErrorENOENT(err)) {
|
|
63
|
+
throw new Error(`No _Package.json found in ${location.manifestDir}`);
|
|
64
|
+
}
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
return location;
|
|
68
|
+
};
|
|
69
|
+
const readPackageCreatorManifest = location => {
|
|
70
|
+
const packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);
|
|
71
|
+
const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, {
|
|
72
|
+
encoding: "utf8"
|
|
73
|
+
}));
|
|
74
|
+
const result = JSON.parse(packageJson);
|
|
75
|
+
return {
|
|
76
|
+
...result,
|
|
77
|
+
Scope: result.Scope || result.Package
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const writePackageCreatorManifest = (location, creatorPackage) => {
|
|
81
|
+
const packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);
|
|
82
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(creatorPackage, null, "\t") + "\n");
|
|
83
|
+
};
|
|
84
|
+
const readPackageCreatorIndex = location => {
|
|
85
|
+
try {
|
|
86
|
+
const indexPath = path.join(location.manifestDir, INDEX_FILE);
|
|
87
|
+
const index = stripUtf8Bom(fs.readFileSync(indexPath, {
|
|
88
|
+
encoding: "utf8"
|
|
89
|
+
}));
|
|
90
|
+
return JSON.parse(index);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
if (isErrorENOENT(err)) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
throw err;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const writePackageCreatorIndex = (location, index) => {
|
|
99
|
+
const packageJsonPath = path.join(location.manifestDir, INDEX_FILE);
|
|
100
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(index, null, "\t") + "\n");
|
|
101
|
+
};
|
|
102
|
+
const readPackageNpmManifest = location => {
|
|
103
|
+
try {
|
|
104
|
+
return readNpmManifest(location.manifestDir);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
if (isErrorENOENT(err)) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const writePackageNpmManifest = (location, packageJson) => {
|
|
113
|
+
writeNpmManifest(location.manifestDir, packageJson);
|
|
114
|
+
};
|
|
115
|
+
const readPackageAnimationList = location => {
|
|
116
|
+
const directoryContent = fs.readdirSync(location.manifestDir);
|
|
117
|
+
const animationPathList = [];
|
|
118
|
+
for (const entry of directoryContent) {
|
|
119
|
+
if (entry.endsWith(ANIMATION_FILE_SUFFIX)) {
|
|
120
|
+
const animationPath = path.join(location.manifestDir, entry);
|
|
121
|
+
animationPathList.push(animationPath);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return animationPathList;
|
|
125
|
+
};
|
|
126
|
+
const getPackageReleasesDirectory = location => path.join(location.path, "Releases");
|
|
127
|
+
|
|
128
|
+
export { INDEX_FILE, PACKAGE_FILE, detectPackage, getPackageReleasesDirectory, parseCreatorPackageName, readPackageAnimationList, readPackageCreatorIndex, readPackageCreatorManifest, readPackageNpmManifest, writePackageCreatorIndex, writePackageCreatorManifest, writePackageNpmManifest };
|
|
129
|
+
//# sourceMappingURL=package.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.mjs","sources":["../../src/lib/package.ts"],"sourcesContent":["// Functionality related to working with a single package.\n\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport { isErrorENOENT } from \"./error\";\nimport { WorkspaceLocation } from \"./workspace\";\nimport { readNpmManifest, writeNpmManifest } from \"./npmPackage\";\nimport { PackageJSON } from \"./packageJSON\";\nimport { stripUtf8Bom } from \"./stripUtf8Bom\";\n\nexport const PACKAGE_FILE = \"_Package.json\";\nexport const INDEX_FILE = \"_Index.json\";\nconst ANIMATION_FILE_SUFFIX = \".animation.json\";\n\n/**\n * Describes the location of a single package.\n *\n * @export\n * @interface PackageLocation\n */\nexport interface PackageLocation {\n\t_kind: \"PackageLocation\";\n\t/**\n\t * Main directory of a package\n\t *\n\t * @type {string}\n\t */\n\tpath: string;\n\t/**\n\t * Directory containing the typescript files\n\t *\n\t * @type {string}\n\t */\n\tscriptsDir: string;\n\t/**\n\t * Diretory containing the _Package.json, _Index.json, package.json and animation.json files\n\t *\n\t * @type {string}\n\t */\n\tmanifestDir: string;\n}\n\nexport interface CreatorPackage {\n\tScope: string;\n\tPackage: string;\n\tRunTime: boolean;\n\tType: \"Interactor\" | \"Mixed\" | \"Core\" | \"Context\" | \"Evaluator\";\n}\n\nexport type CreatorIndex = CreatorIndexEntry[];\n\nexport interface CreatorIndexEntry {\n\tName: string;\n\tDescription?: string;\n\tType: \"Interactor\" | \"Evaluator\";\n\tParameters: CreatorIndexParameter[];\n}\n\nexport interface CreatorIndexParameter {\n\tName: string;\n\tType: CreatorIndexParameterType;\n\tDescription?: string;\n\tDefault?: unknown;\n\tDisplayIndex: number;\n}\n\nexport type CreatorIndexParameterType =\n\t| \"String\"\n\t| \"LengthM\"\n\t| \"Material\"\n\t| \"Boolean\"\n\t| \"Bool\"\n\t| \"ArcDEG\"\n\t| \"Integer\"\n\t| \"Int\"\n\t| \"Float\";\n\nexport const parseCreatorPackageName = (manifest: CreatorPackage) => {\n\tconst [domain, ...subdomainParts] = manifest.Package.split(\".\");\n\treturn {\n\t\tdomain,\n\t\tsubdomain: subdomainParts.join(\".\"),\n\t};\n};\n\nexport interface PackageNpmManifest extends PackageJSON {\n\tig?: {\n\t\tscriptingLibrary?: boolean;\n\t};\n}\n\n/**\n * Detects the package at the given directory.\n *\n * @param {string} directory\n * @returns {PackageLocation}\n */\nexport const detectPackage = (\n\tworkspace: WorkspaceLocation,\n\tdirectory: string,\n): PackageLocation => {\n\tdirectory = path.resolve(workspace.path, directory);\n\n\tconst scriptsPath = path.join(directory, \"Scripts\");\n\tconst tsPath = path.join(directory, \"ts\");\n\n\tlet location: PackageLocation;\n\n\tif (fs.existsSync(scriptsPath)) {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: scriptsPath,\n\t\t\tmanifestDir: scriptsPath,\n\t\t};\n\t} else if (fs.existsSync(tsPath)) {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: tsPath,\n\t\t\tmanifestDir: directory,\n\t\t};\n\t} else {\n\t\tlocation = {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directory,\n\t\t\tscriptsDir: directory,\n\t\t\tmanifestDir: directory,\n\t\t};\n\t}\n\n\ttry {\n\t\treadPackageCreatorManifest(location);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\tthrow new Error(\n\t\t\t\t`No _Package.json found in ${location.manifestDir}`,\n\t\t\t);\n\t\t}\n\t\tthrow err;\n\t}\n\n\treturn location;\n};\n\nexport const readPackageCreatorManifest = (\n\tlocation: PackageLocation,\n): CreatorPackage => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tconst packageJson = stripUtf8Bom(\n\t\tfs.readFileSync(packageJsonPath, { encoding: \"utf8\" }),\n\t);\n\tconst result: Omit<CreatorPackage, \"Scope\"> & { Scope?: string } =\n\t\tJSON.parse(packageJson);\n\treturn {\n\t\t...result,\n\t\tScope: result.Scope || result.Package,\n\t};\n};\n\nexport const writePackageCreatorManifest = (\n\tlocation: PackageLocation,\n\tcreatorPackage: CreatorPackage,\n) => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tfs.writeFileSync(\n\t\tpackageJsonPath,\n\t\tJSON.stringify(creatorPackage, null, \"\\t\") + \"\\n\",\n\t);\n};\n\nexport const readPackageCreatorIndex = (\n\tlocation: PackageLocation,\n): CreatorIndex | undefined => {\n\ttry {\n\t\tconst indexPath = path.join(location.manifestDir, INDEX_FILE);\n\t\tconst index = stripUtf8Bom(\n\t\t\tfs.readFileSync(indexPath, { encoding: \"utf8\" }),\n\t\t);\n\t\treturn JSON.parse(index);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writePackageCreatorIndex = (\n\tlocation: PackageLocation,\n\tindex: CreatorIndex,\n) => {\n\tconst packageJsonPath = path.join(location.manifestDir, INDEX_FILE);\n\tfs.writeFileSync(packageJsonPath, JSON.stringify(index, null, \"\\t\") + \"\\n\");\n};\n\nexport const readPackageNpmManifest = (\n\tlocation: PackageLocation,\n): PackageNpmManifest | undefined => {\n\ttry {\n\t\treturn readNpmManifest(location.manifestDir);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthrow err;\n\t}\n};\n\nexport const writePackageNpmManifest = (\n\tlocation: PackageLocation,\n\tpackageJson: PackageNpmManifest,\n) => {\n\twriteNpmManifest(location.manifestDir, packageJson);\n};\n\nexport const readPackageAnimationList = (location: PackageLocation) => {\n\tconst directoryContent = fs.readdirSync(location.manifestDir);\n\tconst animationPathList: string[] = [];\n\n\tfor (const entry of directoryContent) {\n\t\tif (entry.endsWith(ANIMATION_FILE_SUFFIX)) {\n\t\t\tconst animationPath = path.join(location.manifestDir, entry);\n\t\t\tanimationPathList.push(animationPath);\n\t\t}\n\t}\n\n\treturn animationPathList;\n};\n\nexport const getPackageReleasesDirectory = (location: PackageLocation) =>\n\tpath.join(location.path, \"Releases\");\n\nexport const arePackageLocationsEqual = (\n\ta: PackageLocation,\n\tb: PackageLocation,\n) => a.path === b.path;\n"],"names":["PACKAGE_FILE","INDEX_FILE","ANIMATION_FILE_SUFFIX","parseCreatorPackageName","manifest","domain","subdomainParts","Package","split","subdomain","join","detectPackage","workspace","directory","path","resolve","scriptsPath","tsPath","location","fs","existsSync","_kind","scriptsDir","manifestDir","readPackageCreatorManifest","err","isErrorENOENT","Error","packageJsonPath","packageJson","stripUtf8Bom","readFileSync","encoding","result","JSON","parse","Scope","writePackageCreatorManifest","creatorPackage","writeFileSync","stringify","readPackageCreatorIndex","indexPath","index","undefined","writePackageCreatorIndex","readPackageNpmManifest","readNpmManifest","writePackageNpmManifest","writeNpmManifest","readPackageAnimationList","directoryContent","readdirSync","animationPathList","entry","endsWith","animationPath","push","getPackageReleasesDirectory"],"mappings":";;;;;;AAAA;AAWO,MAAMA,YAAY,GAAG,gBAAe;AACpC,MAAMC,UAAU,GAAG,cAAa;AACvC,MAAMC,qBAAqB,GAAG,iBAAiB,CAAA;;AAE/C;AACA;AACA;AACA;AACA;AACA;;AA0DaC,MAAAA,uBAAuB,GAAIC,QAAwB,IAAK;AACpE,EAAA,MAAM,CAACC,MAAM,EAAE,GAAGC,cAAc,CAAC,GAAGF,QAAQ,CAACG,OAAO,CAACC,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