@intelligentgraphics/ig.gfx.packager 3.0.3 → 3.0.5
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-2c3347fd.js +2487 -0
- package/build/cli-2c3347fd.js.map +1 -0
- package/build/{lib/dependencies.mjs → dependencies-300450ae.js} +62 -4
- package/build/dependencies-300450ae.js.map +1 -0
- package/build/generate-97bb8b12.js +231 -0
- package/build/generate-97bb8b12.js.map +1 -0
- package/build/{commands/build/index.mjs → index-01b0ddab.js} +151 -8
- package/build/index-01b0ddab.js.map +1 -0
- package/build/{commands/publish/index.mjs → index-f59e50ec.js} +181 -16
- package/build/index-f59e50ec.js.map +1 -0
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/{commands/postinstall.mjs → postinstall-5bba19eb.js} +18 -8
- package/build/postinstall-5bba19eb.js.map +1 -0
- package/build/{commands/publishNpm.mjs → publishNpm-eb07f766.js} +21 -9
- package/build/publishNpm-eb07f766.js.map +1 -0
- package/build/versionFile-af5ed4bc.js +370 -0
- package/build/versionFile-af5ed4bc.js.map +1 -0
- package/package.json +8 -7
- package/readme.md +107 -32
- package/build/cli.mjs +0 -313
- 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 +0 -182
- 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,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,EAAE;AAC1CN,IAAAA,OAAO,CAACC,IAAI,GAAGH,cAAc,CAACS,QAAQ,CAAA;AACtCP,IAAAA,OAAO,CAACG,QAAQ,GAAGL,cAAc,CAACK,QAAQ,CAAA;AAC3C,GAAC,MAAM,IAAIL,cAAc,CAACQ,IAAI,KAAK,SAAS,EAAE;AAC7CN,IAAAA,OAAO,CAACI,OAAO,GAAGN,cAAc,CAACM,OAAO,CAAA;AACzC,GAAA;EAEA,MAAM;AACLI,IAAAA,IAAI,EAAE;AAAEC,MAAAA,OAAO,EAAEC,SAAS;AAAEC,MAAAA,KAAAA;AAAM,KAAA;AACnC,GAAC,GAAG,MAAMC,KAAK,CAACC,IAAI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ImC,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;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
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\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","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;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACaA,MAAAA,6BAA6B,GACzCC,SAA4B,IACI;AAChC,EAAA,MAAMC,QAAQ,GAAGC,wBAAwB,CAACF,SAAS,CAAC,CAAA;AACpD,EAAA,MAAMG,SAAS,GAAGC,kBAAkB,CAACJ,SAAS,EAAEC,QAAQ,CAAC,CAAA;AACzD,EAAA,MAAMI,OAAO,GAAG,IAAIC,GAAG,EAAoC,CAAA;AAE3D,EAAA,KAAK,MAAMC,QAAQ,IAAIJ,SAAS,EAAE;AACjC,IAAA,MAAMF,QAAQ,GAAGO,+BAA+B,CAACD,QAAQ,CAAC,CAAA;IAC1D,IAAI,CAACF,OAAO,CAACI,GAAG,CAACR,QAAQ,CAACS,IAAI,CAAC,EAAE;MAChCL,OAAO,CAACM,GAAG,CAACV,QAAQ,CAACS,IAAI,EAAEH,QAAQ,CAAC,CAAA;AACrC,KAAA;AACD,GAAA;EAEA,OAAOK,KAAK,CAACC,IAAI,CAACR,OAAO,CAACS,MAAM,EAAE,CAAC,CAAA;AACpC,EAAC;AAED,MAAMV,kBAAkB,GAAG,CAC1BJ,SAA4B,EAC5BC,QAAqB,KACW;AAChC,EAAA,IAAI,CAACA,QAAQ,CAACc,YAAY,EAAE;AAC3B,IAAA,OAAO,EAAE,CAAA;AACV,GAAA;EAEA,MAAMC,mBAAmB,GAAGC,MAAM,CAACC,mBAAmB,CACrDjB,QAAQ,CAACc,YAAY,CACrB,CAAA;EAED,MAAMI,MAAkC,GAAG,EAAE,CAAA;AAE7C,EAAA,KAAK,MAAMC,iBAAiB,IAAIJ,mBAAmB,EAAE;AAAA,IAAA,IAAA,mBAAA,CAAA;IACpD,MAAMT,QAAQ,GAAGc,8BAA8B,CAC9CrB,SAAS,CAACsB,IAAI,EACdF,iBAAiB,CACjB,CAAA;AAED,IAAA,MAAMG,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,CAACJ,SAAS,EAAEuB,eAAe,CAAC,CAAC,CAAA;AAC/D,KAAA;AACD,GAAA;AAEA,EAAA,OAAOJ,MAAM,CAAA;AACd,CAAC;;;;"}
|
package/build/lib/error.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
package/build/lib/error.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
package/build/lib/fs.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;;;;"}
|
package/build/lib/git.mjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
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
|
package/build/lib/git.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;;;;"}
|
package/build/lib/log.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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
|
package/build/lib/log.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;;;;"}
|
package/build/lib/npmPackage.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;;;;"}
|
package/build/lib/package.mjs
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"],"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AG,CAAA;AACV,GAAA;AACD,EAAC;MAEYuB,uBAAuB,GAAG,CACtC9B,QAAyB,EACzBW,WAA+B,KAC3B;AACJoB,EAAAA,gBAAgB,CAAC/B,QAAQ,CAACK,WAAW,EAAEM,WAAW,CAAC,CAAA;AACpD,EAAC;AAEYqB,MAAAA,wBAAwB,GAAIhC,QAAyB,IAAK;EACtE,MAAMiC,gBAAgB,GAAGhC,EAAE,CAACiC,WAAW,CAAClC,QAAQ,CAACK,WAAW,CAAC,CAAA;EAC7D,MAAM8B,iBAA2B,GAAG,EAAE,CAAA;AAEtC,EAAA,KAAK,MAAMC,KAAK,IAAIH,gBAAgB,EAAE;AACrC,IAAA,IAAIG,KAAK,CAACC,QAAQ,CAACrD,qBAAqB,CAAC,EAAE;MAC1C,MAAMsD,aAAa,GAAG1C,IAAI,CAACJ,IAAI,CAACQ,QAAQ,CAACK,WAAW,EAAE+B,KAAK,CAAC,CAAA;AAC5DD,MAAAA,iBAAiB,CAACI,IAAI,CAACD,aAAa,CAAC,CAAA;AACtC,KAAA;AACD,GAAA;AAEA,EAAA,OAAOH,iBAAiB,CAAA;AACzB,EAAC;AAEYK,MAAAA,2BAA2B,GAAIxC,QAAyB,IACpEJ,IAAI,CAACJ,IAAI,CAACQ,QAAQ,CAACJ,IAAI,EAAE,UAAU;;;;"}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
// Stolen from ig.tools.core
|
|
2
|
-
|
|
3
|
-
class PackageVersion {
|
|
4
|
-
// https://regex101.com/r/90PEY9/1
|
|
5
|
-
static fullTextMatcher = /(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?/;
|
|
6
|
-
static lineMatcher = /^(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?$/;
|
|
7
|
-
static extractFromText(input, description) {
|
|
8
|
-
if (input === undefined) {
|
|
9
|
-
throw new Error(`Can not parse version from undefined`);
|
|
10
|
-
}
|
|
11
|
-
const match = input.match(PackageVersion.fullTextMatcher);
|
|
12
|
-
if (!match) {
|
|
13
|
-
throw new Error(`Could not extract a version from input: ${input}`);
|
|
14
|
-
}
|
|
15
|
-
return PackageVersion.fromMatch(match, description);
|
|
16
|
-
}
|
|
17
|
-
static extractFromLine(input, description) {
|
|
18
|
-
if (input === undefined) {
|
|
19
|
-
throw new Error(`Can not parse version from undefined`);
|
|
20
|
-
}
|
|
21
|
-
const match = input.match(PackageVersion.lineMatcher);
|
|
22
|
-
if (!match) {
|
|
23
|
-
throw new Error(`Could not parse version from input: ${input}`);
|
|
24
|
-
}
|
|
25
|
-
return PackageVersion.fromMatch(match, description);
|
|
26
|
-
}
|
|
27
|
-
static equals(a, b, checkPrerelease = false) {
|
|
28
|
-
if (a.major !== b.major || a.minor !== b.minor || a.patch !== b.patch) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
if (checkPrerelease === false) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
if (a.preRelease === b.preRelease) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
if (a.preRelease === undefined || b.preRelease === undefined) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
return a.preRelease.type === b.preRelease.type && a.preRelease.version === b.preRelease.version;
|
|
41
|
-
}
|
|
42
|
-
static fromMatch([, major,, minor = "0",, patch = "0",, build,, preReleaseType, preReleaseNumber], description) {
|
|
43
|
-
let preRelease = undefined;
|
|
44
|
-
let buildNumber = 100;
|
|
45
|
-
if (preReleaseType && preReleaseNumber) {
|
|
46
|
-
preRelease = {
|
|
47
|
-
type: preReleaseType,
|
|
48
|
-
version: parseInt(preReleaseNumber)
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
if (build) {
|
|
52
|
-
buildNumber = Number(build);
|
|
53
|
-
} else if (description) {
|
|
54
|
-
const descriptionMatch = description.match(/(\d+)\)$/);
|
|
55
|
-
if (descriptionMatch) {
|
|
56
|
-
buildNumber = parseInt(descriptionMatch[1]);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return new PackageVersion(parseInt(major), parseInt(minor), parseInt(patch), preRelease, buildNumber);
|
|
60
|
-
}
|
|
61
|
-
static sort(a, b, ascending = true) {
|
|
62
|
-
const createSortResult = (a, b) => ascending ? a - b : b - a;
|
|
63
|
-
if (a.major !== b.major) {
|
|
64
|
-
return createSortResult(a.major, b.major);
|
|
65
|
-
}
|
|
66
|
-
if (a.minor !== b.minor) {
|
|
67
|
-
return createSortResult(a.minor, b.minor);
|
|
68
|
-
}
|
|
69
|
-
if (a.patch !== b.patch) {
|
|
70
|
-
return createSortResult(a.patch, b.patch);
|
|
71
|
-
}
|
|
72
|
-
return createSortResult(a.preRelease ? a.preRelease.version : 0, b.preRelease ? b.preRelease.version : 0);
|
|
73
|
-
}
|
|
74
|
-
static toNumber(version) {
|
|
75
|
-
return ((version.major * 1000 + version.minor) * 1000 + version.patch) * 1000 + version.buildNumber;
|
|
76
|
-
}
|
|
77
|
-
constructor(major, minor, patch, preRelease, buildNumber) {
|
|
78
|
-
this.major = major;
|
|
79
|
-
this.minor = minor;
|
|
80
|
-
this.patch = patch;
|
|
81
|
-
this.preRelease = preRelease;
|
|
82
|
-
this.buildNumber = buildNumber;
|
|
83
|
-
}
|
|
84
|
-
isPreRelease() {
|
|
85
|
-
return this.preRelease !== undefined;
|
|
86
|
-
}
|
|
87
|
-
clone() {
|
|
88
|
-
return new PackageVersion(this.major, this.minor, this.patch, this.preRelease ? {
|
|
89
|
-
...this.preRelease
|
|
90
|
-
} : undefined, this.buildNumber);
|
|
91
|
-
}
|
|
92
|
-
incrementMajor() {
|
|
93
|
-
this.preRelease = undefined;
|
|
94
|
-
this.patch = 0;
|
|
95
|
-
this.minor = 0;
|
|
96
|
-
this.major++;
|
|
97
|
-
}
|
|
98
|
-
incrementMinor() {
|
|
99
|
-
this.preRelease = undefined;
|
|
100
|
-
this.patch = 0;
|
|
101
|
-
this.minor++;
|
|
102
|
-
}
|
|
103
|
-
incrementPatch() {
|
|
104
|
-
this.preRelease = undefined;
|
|
105
|
-
this.patch++;
|
|
106
|
-
}
|
|
107
|
-
createPreRelease(type) {
|
|
108
|
-
if (!this.preRelease) {
|
|
109
|
-
this.buildNumber = 1;
|
|
110
|
-
} else {
|
|
111
|
-
this.buildNumber++;
|
|
112
|
-
}
|
|
113
|
-
if (this.preRelease && type === this.preRelease.type) {
|
|
114
|
-
this.preRelease.version++;
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this.preRelease = {
|
|
118
|
-
version: 0,
|
|
119
|
-
type
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
createRelease() {
|
|
123
|
-
this.preRelease = undefined;
|
|
124
|
-
this.buildNumber = 100;
|
|
125
|
-
}
|
|
126
|
-
toVersionString({
|
|
127
|
-
buildNumber
|
|
128
|
-
} = {}) {
|
|
129
|
-
let version = [this.major, this.minor, this.patch].join(".");
|
|
130
|
-
if (buildNumber) {
|
|
131
|
-
version += "." + this.buildNumber;
|
|
132
|
-
}
|
|
133
|
-
if (this.preRelease) {
|
|
134
|
-
version += `-${this.preRelease.type}.${this.preRelease.version}`;
|
|
135
|
-
}
|
|
136
|
-
return version;
|
|
137
|
-
}
|
|
138
|
-
toDescriptionString(packageName) {
|
|
139
|
-
const base = [this.major, this.minor, this.patch].join(".");
|
|
140
|
-
const parts = [packageName, base];
|
|
141
|
-
if (this.preRelease) {
|
|
142
|
-
parts.push(upperCaseFirst(this.preRelease.type));
|
|
143
|
-
parts.push(this.preRelease.version);
|
|
144
|
-
}
|
|
145
|
-
parts.push(`(${base}.${this.buildNumber})`);
|
|
146
|
-
return parts.join(" ");
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Determines wether the version is lesser than the input version
|
|
151
|
-
*
|
|
152
|
-
* @param {PackageVersion} version
|
|
153
|
-
* @returns
|
|
154
|
-
*/
|
|
155
|
-
isLesserThan(version) {
|
|
156
|
-
return PackageVersion.toNumber(this) < PackageVersion.toNumber(version);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Determines wether the version is greater than the input version
|
|
161
|
-
*
|
|
162
|
-
* @param {PackageVersion} version
|
|
163
|
-
* @returns
|
|
164
|
-
*/
|
|
165
|
-
isGreaterThan(version) {
|
|
166
|
-
return PackageVersion.toNumber(this) > PackageVersion.toNumber(version);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const upperCaseFirst = input => {
|
|
170
|
-
return input.slice(0, 1).toUpperCase() + input.slice(1);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
export { PackageVersion };
|
|
174
|
-
//# sourceMappingURL=packageVersion.mjs.map
|