@intelligentgraphics/ig.gfx.packager 3.0.0-alpha.0 → 3.0.0-alpha.3
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 +593 -0
- package/build/cli.mjs.map +1 -0
- package/build/commands/{build.js → build.mjs} +74 -77
- package/build/commands/build.mjs.map +1 -0
- package/build/commands/{generate.js → generate.mjs} +32 -58
- package/build/commands/generate.mjs.map +1 -0
- package/build/commands/postinstall.mjs +49 -0
- package/build/commands/postinstall.mjs.map +1 -0
- package/build/commands/publishNpm.mjs +129 -0
- package/build/commands/publishNpm.mjs.map +1 -0
- package/build/commands/{release.js → release.mjs} +91 -119
- package/build/commands/release.mjs.map +1 -0
- package/build/{dependencies.js → dependencies.mjs} +16 -40
- package/build/dependencies.mjs.map +1 -0
- package/build/index.mjs +6 -0
- package/build/index.mjs.map +1 -0
- package/build/scripts.mjs +11 -0
- package/build/scripts.mjs.map +1 -0
- package/build/versionFile.mjs +352 -0
- package/build/versionFile.mjs.map +1 -0
- package/package.json +9 -10
- package/readme.md +12 -0
- package/build/cli.js +0 -8315
- package/build/cli.js.map +0 -1
- package/build/commands/build.js.map +0 -1
- package/build/commands/generate.js.map +0 -1
- package/build/commands/postinstall.js +0 -77
- package/build/commands/postinstall.js.map +0 -1
- package/build/commands/publishNpm.js +0 -156
- package/build/commands/publishNpm.js.map +0 -1
- package/build/commands/release.js.map +0 -1
- package/build/dependencies.js.map +0 -1
- package/build/index.js +0 -7
- package/build/index.js.map +0 -1
- package/build/scripts.js +0 -31
- package/build/scripts.js.map +0 -1
- package/build/versionFile.js +0 -181
- package/build/versionFile.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postinstall.mjs","sources":["../../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport {\n\tgetWorkspaceLibPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { readPublishedPackageNpmManifest } from \"../lib/publishedPackage\";\nimport { determineWorkspaceIGLibraries } from \"../lib/dependencies\";\n\nconst DEFINITION_FILE_HINT =\n\t\"// This file is automatically managed by the ig.gfx.packager.\";\n\nexport const executePostInstall = (workspace: WorkspaceLocation) => {\n\tconst manifest = readWorkspaceNpmManifest(workspace);\n\n\tif (manifest === undefined) {\n\t\tthrow new Error(`Expected an npm manifest to exist.`);\n\t}\n\n\tconst libPath = getWorkspaceLibPath(workspace);\n\tconst existingDefinitions = fs.readdirSync(libPath);\n\n\t// delete all existing definition files that are managed by the packager.\n\t// we'll recreate all needed definitions in the next step.\n\tfor (const existingDefinitionName of existingDefinitions) {\n\t\tconst content = fs.readFileSync(\n\t\t\tpath.join(libPath, existingDefinitionName),\n\t\t\t{ encoding: \"utf-8\" },\n\t\t);\n\n\t\tif (content.startsWith(DEFINITION_FILE_HINT)) {\n\t\t\tfs.rmSync(path.join(libPath, existingDefinitionName));\n\t\t}\n\t}\n\n\tfs.mkdirSync(libPath, { recursive: true });\n\n\tconst libraryLocations = determineWorkspaceIGLibraries(workspace);\n\n\tfor (const location of libraryLocations) {\n\t\tconst manifest = readPublishedPackageNpmManifest(location);\n\n\t\t// add a hint to the top of the file so we know it's managed by the packager.\n\t\tconst content =\n\t\t\tDEFINITION_FILE_HINT +\n\t\t\t\" \\n\" +\n\t\t\t`// This is a reference to version ${manifest.version}\\n` +\n\t\t\t`/// <reference types=\"${manifest.name}\" />`;\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(getWorkspaceLibPath(workspace), manifest.types),\n\t\t\tcontent,\n\t\t\t{\n\t\t\t\tencoding: \"utf8\",\n\t\t\t},\n\t\t);\n\t}\n};\n"],"names":["DEFINITION_FILE_HINT","executePostInstall","workspace","manifest","readWorkspaceNpmManifest","undefined","Error","libPath","getWorkspaceLibPath","existingDefinitions","fs","readdirSync","existingDefinitionName","content","readFileSync","path","join","encoding","startsWith","rmSync","mkdirSync","recursive","libraryLocations","determineWorkspaceIGLibraries","location","readPublishedPackageNpmManifest","version","name","writeFileSync","types"],"mappings":";;;;;;;;;;;;;AAWA,MAAMA,oBAAoB,GACzB,+DAA+D,CAAA;AAEnDC,MAAAA,kBAAkB,GAAIC,SAA4B,IAAK;AACnE,EAAA,MAAMC,QAAQ,GAAGC,wBAAwB,CAACF,SAAS,CAAC,CAAA;EAEpD,IAAIC,QAAQ,KAAKE,SAAS,EAAE;AAC3B,IAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,kCAAA,CAAmC,CAAC,CAAA;AACtD,GAAA;AAEA,EAAA,MAAMC,OAAO,GAAGC,mBAAmB,CAACN,SAAS,CAAC,CAAA;AAC9C,EAAA,MAAMO,mBAAmB,GAAGC,EAAE,CAACC,WAAW,CAACJ,OAAO,CAAC,CAAA;;AAEnD;AACA;AACA,EAAA,KAAK,MAAMK,sBAAsB,IAAIH,mBAAmB,EAAE;AACzD,IAAA,MAAMI,OAAO,GAAGH,EAAE,CAACI,YAAY,CAC9BC,IAAI,CAACC,IAAI,CAACT,OAAO,EAAEK,sBAAsB,CAAC,EAC1C;AAAEK,MAAAA,QAAQ,EAAE,OAAA;AAAQ,KAAC,CACrB,CAAA;AAED,IAAA,IAAIJ,OAAO,CAACK,UAAU,CAAClB,oBAAoB,CAAC,EAAE;MAC7CU,EAAE,CAACS,MAAM,CAACJ,IAAI,CAACC,IAAI,CAACT,OAAO,EAAEK,sBAAsB,CAAC,CAAC,CAAA;AACtD,KAAA;AACD,GAAA;AAEAF,EAAAA,EAAE,CAACU,SAAS,CAACb,OAAO,EAAE;AAAEc,IAAAA,SAAS,EAAE,IAAA;AAAK,GAAC,CAAC,CAAA;AAE1C,EAAA,MAAMC,gBAAgB,GAAGC,6BAA6B,CAACrB,SAAS,CAAC,CAAA;AAEjE,EAAA,KAAK,MAAMsB,QAAQ,IAAIF,gBAAgB,EAAE;AACxC,IAAA,MAAMnB,QAAQ,GAAGsB,+BAA+B,CAACD,QAAQ,CAAC,CAAA;;AAE1D;AACA,IAAA,MAAMX,OAAO,GACZb,oBAAoB,GACpB,KAAK,GACJ,CAAoCG,kCAAAA,EAAAA,QAAQ,CAACuB,OAAQ,IAAG,GACxD,CAAA,sBAAA,EAAwBvB,QAAQ,CAACwB,IAAK,CAAK,IAAA,CAAA,CAAA;AAE7CjB,IAAAA,EAAE,CAACkB,aAAa,CACfb,IAAI,CAACC,IAAI,CAACR,mBAAmB,CAACN,SAAS,CAAC,EAAEC,QAAQ,CAAC0B,KAAK,CAAC,EACzDhB,OAAO,EACP;AACCI,MAAAA,QAAQ,EAAE,MAAA;AACX,KAAC,CACD,CAAA;AACF,GAAA;AACD;;;;"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import { spawnSync } from 'child_process';
|
|
5
|
+
import { f as readWorkspaceNpmManifest, g as getWorkspaceOutputPath, r as readPackageCreatorManifest, b as readPackageNpmManifest, m as writePackageNpmManifest, e as readPackageCreatorIndex, n as iterateWorkspacePackages } from '../cli.mjs';
|
|
6
|
+
import { p as parseVersionFromString, g as getVersionFileHandler, a as getVersionInformationFromGit, b as getWorkspaceBannerText } from '../versionFile.mjs';
|
|
7
|
+
import { b as buildFolders, l as logPackageMessage } from './build.mjs';
|
|
8
|
+
import 'update-notifier';
|
|
9
|
+
import 'yargs/yargs';
|
|
10
|
+
import 'url';
|
|
11
|
+
import 'y18n';
|
|
12
|
+
import 'write-pkg';
|
|
13
|
+
import 'inquirer';
|
|
14
|
+
import 'simple-git';
|
|
15
|
+
import 'glob';
|
|
16
|
+
import 'terser';
|
|
17
|
+
import 'typescript';
|
|
18
|
+
import '../scripts.mjs';
|
|
19
|
+
import 'typedoc';
|
|
20
|
+
|
|
21
|
+
const publishToNpm = async ({
|
|
22
|
+
workspace,
|
|
23
|
+
location,
|
|
24
|
+
version: providedVersion,
|
|
25
|
+
dryRun
|
|
26
|
+
}) => {
|
|
27
|
+
let newVersion;
|
|
28
|
+
try {
|
|
29
|
+
newVersion = parseVersionFromString(providedVersion);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
throw new Error(`Please enter a version in this format 1.0.0.100`);
|
|
32
|
+
}
|
|
33
|
+
if (newVersion.buildNumber < 100) {
|
|
34
|
+
newVersion.preRelease = {
|
|
35
|
+
type: "beta",
|
|
36
|
+
version: newVersion.buildNumber
|
|
37
|
+
};
|
|
38
|
+
} else if (newVersion.buildNumber === 100) {
|
|
39
|
+
newVersion.preRelease = undefined;
|
|
40
|
+
} else {
|
|
41
|
+
throw new Error(`Refusing to publish a package with a build version larger than 100.`);
|
|
42
|
+
}
|
|
43
|
+
const workspaceManifest = readWorkspaceNpmManifest(workspace);
|
|
44
|
+
const workspaceOutputPath = getWorkspaceOutputPath(workspace);
|
|
45
|
+
const creatorPackage = readPackageCreatorManifest(location);
|
|
46
|
+
let packageJson = readPackageNpmManifest(location);
|
|
47
|
+
if (packageJson === undefined) {
|
|
48
|
+
packageJson = {
|
|
49
|
+
name: "@intelligentgraphics/3d" + creatorPackage.Package.toLowerCase(),
|
|
50
|
+
version: "1.0.0",
|
|
51
|
+
description: creatorPackage.Package
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
packageJson.version = newVersion.toVersionString({
|
|
55
|
+
buildNumber: false
|
|
56
|
+
});
|
|
57
|
+
packageJson.description = newVersion.toDescriptionString(creatorPackage.Package);
|
|
58
|
+
packageJson.main = `${creatorPackage.Package}.js`;
|
|
59
|
+
packageJson.types = `${creatorPackage.Package}.d.ts`;
|
|
60
|
+
packageJson.publishConfig ??= {};
|
|
61
|
+
packageJson.publishConfig.acccess = "public";
|
|
62
|
+
packageJson.ig = {
|
|
63
|
+
scriptingLibrary: true
|
|
64
|
+
};
|
|
65
|
+
packageJson.files = undefined;
|
|
66
|
+
const publishDir = path.join(workspaceOutputPath, "publish", creatorPackage.Package);
|
|
67
|
+
fs.rmSync(publishDir, {
|
|
68
|
+
recursive: true,
|
|
69
|
+
force: true
|
|
70
|
+
});
|
|
71
|
+
fs.mkdirSync(publishDir, {
|
|
72
|
+
recursive: true
|
|
73
|
+
});
|
|
74
|
+
writePackageNpmManifest(location, packageJson);
|
|
75
|
+
getVersionFileHandler(location).write(creatorPackage.Package, newVersion);
|
|
76
|
+
const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
|
|
77
|
+
const bannerText = workspaceManifest !== undefined ? getWorkspaceBannerText(workspaceManifest) : undefined;
|
|
78
|
+
await buildFolders({
|
|
79
|
+
cwd: workspace.path,
|
|
80
|
+
directories: [location.path],
|
|
81
|
+
minimize: true,
|
|
82
|
+
outDir: getWorkspaceOutputPath(workspace),
|
|
83
|
+
banner: {
|
|
84
|
+
text: bannerText,
|
|
85
|
+
commit: gitVersionInformation.commit,
|
|
86
|
+
commitDirty: gitVersionInformation.dirty,
|
|
87
|
+
version: newVersion.toVersionString({
|
|
88
|
+
buildNumber: true
|
|
89
|
+
}),
|
|
90
|
+
date: new Date(Date.now())
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
fs.copyFileSync(path.join(getWorkspaceOutputPath(workspace), `${creatorPackage.Package}.d.ts`), path.join(publishDir, `${creatorPackage.Package}.d.ts`));
|
|
94
|
+
fs.copyFileSync(path.join(getWorkspaceOutputPath(workspace), `${creatorPackage.Package}.min.js`), path.join(publishDir, `${creatorPackage.Package}.js`));
|
|
95
|
+
fs.copyFileSync(path.join(location.manifestDir, "package.json"), path.join(publishDir, "package.json"));
|
|
96
|
+
fs.writeFileSync(path.join(publishDir, "_Package.json"), JSON.stringify(creatorPackage, null, 2));
|
|
97
|
+
const index = readPackageCreatorIndex(location);
|
|
98
|
+
if (index !== undefined) {
|
|
99
|
+
fs.writeFileSync(path.join(publishDir, "_Index.json"), JSON.stringify(index));
|
|
100
|
+
}
|
|
101
|
+
const readmeName = fs.readdirSync(location.path).find(name => name.toLowerCase() === "readme.md");
|
|
102
|
+
if (readmeName !== undefined) {
|
|
103
|
+
fs.copyFileSync(path.join(location.path, readmeName), path.join(publishDir, readmeName));
|
|
104
|
+
}
|
|
105
|
+
const npmPublishArgs = [];
|
|
106
|
+
if (dryRun) {
|
|
107
|
+
npmPublishArgs.push("--dry-run");
|
|
108
|
+
}
|
|
109
|
+
if (newVersion.preRelease) {
|
|
110
|
+
npmPublishArgs.push("--tag", "next");
|
|
111
|
+
}
|
|
112
|
+
logPackageMessage(creatorPackage.Package, `Publishing to npm with version ${packageJson.version} using tag ${newVersion.preRelease ? "next" : "latest"}`);
|
|
113
|
+
spawnSync("npm", ["publish", ...npmPublishArgs], {
|
|
114
|
+
stdio: "inherit",
|
|
115
|
+
encoding: "utf8",
|
|
116
|
+
cwd: publishDir
|
|
117
|
+
});
|
|
118
|
+
for (const packageLocation of iterateWorkspacePackages(workspace)) {
|
|
119
|
+
var _manifest$dependencie;
|
|
120
|
+
const manifest = readPackageNpmManifest(packageLocation);
|
|
121
|
+
if ((manifest === null || manifest === void 0 ? void 0 : (_manifest$dependencie = manifest.dependencies) === null || _manifest$dependencie === void 0 ? void 0 : _manifest$dependencie[packageJson.name]) !== undefined) {
|
|
122
|
+
manifest.dependencies[packageJson.name] = "^" + packageJson.version;
|
|
123
|
+
writePackageNpmManifest(packageLocation, manifest);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export { publishToNpm };
|
|
129
|
+
//# sourceMappingURL=publishNpm.mjs.map
|
|
@@ -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\tPackageLocation,\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\tcwd: workspace.path,\n\t\tdirectories: [location.path],\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.json\"),\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.json\"),\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","cwd","directories","minimize","outDir","banner","text","commit","commitDirty","dirty","date","Date","now","copyFileSync","manifestDir","writeFileSync","JSON","stringify","index","readPackageCreatorIndex","readmeName","readdirSync","find","npmPublishArgs","push","logPackageMessage","spawnSync","stdio","encoding","packageLocation","iterateWorkspacePackages","manifest","dependencies"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCO,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,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MAAKT,SAAS,EAAE;AAC7DoE,MAAAA,QAAQ,CAACC,YAAY,CAAC9D,WAAW,CAACE,IAAI,CAAC,GAAG,GAAG,GAAGF,WAAW,CAACjB,OAAO,CAAA;AACnEwC,MAAAA,uBAAuB,CAACoC,eAAe,EAAEE,QAAQ,CAAC,CAAA;AACnD,KAAA;AACD,GAAA;AACD;;;;"}
|
|
@@ -1,56 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
require('inquirer');
|
|
27
|
-
require('glob');
|
|
28
|
-
require('typescript');
|
|
29
|
-
require('../scripts.js');
|
|
30
|
-
require('typedoc');
|
|
31
|
-
require('simple-git');
|
|
32
|
-
require('resolve');
|
|
33
|
-
|
|
34
|
-
function _interopNamespaceDefault(e) {
|
|
35
|
-
var n = Object.create(null);
|
|
36
|
-
if (e) {
|
|
37
|
-
Object.keys(e).forEach(function (k) {
|
|
38
|
-
if (k !== 'default') {
|
|
39
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
40
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () { return e[k]; }
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
n.default = e;
|
|
48
|
-
return Object.freeze(n);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
52
|
-
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
53
|
-
var terser__namespace = /*#__PURE__*/_interopNamespaceDefault(terser);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import { pipeline } from 'stream/promises';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
6
|
+
import { l as logPackageMessage, b as buildFolders } from './build.mjs';
|
|
7
|
+
import { p as parseCreatorPackageName, g as getWorkspaceOutputPath, r as readPackageCreatorManifest, w as writePackageCreatorManifest, c as readPackageAnimationList, i as isErrorENOENT, e as readPackageCreatorIndex, d as detectWorkspace, a as detectPackage, f as readWorkspaceNpmManifest, t as translate, h as getPackageReleasesDirectory } from '../cli.mjs';
|
|
8
|
+
import { g as getVersionFileHandler, p as parseVersionFromString, a as getVersionInformationFromGit, b as getWorkspaceBannerText, P as PackageVersion } from '../versionFile.mjs';
|
|
9
|
+
import axios from 'axios';
|
|
10
|
+
import { r as readPublishedPackageCreatorIndex, d as determineWorkspaceIGLibraries, a as readPublishedPackageNpmManifest, b as readPublishedPackageCreatorManifest } from '../dependencies.mjs';
|
|
11
|
+
import Ajv from 'ajv';
|
|
12
|
+
import JSZip from 'jszip';
|
|
13
|
+
import terser from 'terser';
|
|
14
|
+
import 'glob';
|
|
15
|
+
import 'typescript';
|
|
16
|
+
import '../scripts.mjs';
|
|
17
|
+
import 'typedoc';
|
|
18
|
+
import 'update-notifier';
|
|
19
|
+
import 'yargs/yargs';
|
|
20
|
+
import 'url';
|
|
21
|
+
import 'y18n';
|
|
22
|
+
import 'write-pkg';
|
|
23
|
+
import 'inquirer';
|
|
24
|
+
import 'simple-git';
|
|
25
|
+
import 'resolve';
|
|
54
26
|
|
|
55
27
|
const PLUGIN_ID = "0feba3a0-b6d1-11e6-9598-0800200c9a66";
|
|
56
28
|
/**
|
|
@@ -116,7 +88,7 @@ const getExistingPackages = async session => axios.get(`Script/GetInformation/${
|
|
|
116
88
|
}).then(({
|
|
117
89
|
data
|
|
118
90
|
}) => Array.isArray(data) ? data : undefined);
|
|
119
|
-
const uploadPackageToUrl = (url, path, zipFilePath) => axios.post(path,
|
|
91
|
+
const uploadPackageToUrl = (url, path, zipFilePath) => axios.post(path, fs.createReadStream(zipFilePath), {
|
|
120
92
|
baseURL: url
|
|
121
93
|
}).then(({
|
|
122
94
|
data,
|
|
@@ -157,11 +129,11 @@ const uploadPackageToUrl = (url, path, zipFilePath) => axios.post(path, fs__name
|
|
|
157
129
|
const buildArchiveFromPublishedPackage = (location, manifest, creatorPackage) => {
|
|
158
130
|
const archive = new JSZip();
|
|
159
131
|
archive.file("_Package.json", JSON.stringify(creatorPackage, null, 2));
|
|
160
|
-
const index =
|
|
132
|
+
const index = readPublishedPackageCreatorIndex(location);
|
|
161
133
|
if (index !== undefined) {
|
|
162
134
|
archive.file("_Index.json", JSON.stringify(index, null, 2));
|
|
163
135
|
}
|
|
164
|
-
archive.file(manifest.main,
|
|
136
|
+
archive.file(manifest.main, fs.createReadStream(path.join(location.path, manifest.main)));
|
|
165
137
|
return archive;
|
|
166
138
|
};
|
|
167
139
|
let validateSchema;
|
|
@@ -171,8 +143,8 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
|
|
|
171
143
|
const {
|
|
172
144
|
domain,
|
|
173
145
|
subdomain
|
|
174
|
-
} =
|
|
175
|
-
const logStep = step =>
|
|
146
|
+
} = parseCreatorPackageName(data);
|
|
147
|
+
const logStep = step => logPackageMessage(data.Package, step);
|
|
176
148
|
if (validateSchema === undefined) {
|
|
177
149
|
validateSchema = await axios.get("https://archive.intelligentgraphics.biz/schemas/gfx/animation.json").then(({
|
|
178
150
|
data
|
|
@@ -184,23 +156,23 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
|
|
|
184
156
|
validateSchema: "log"
|
|
185
157
|
}).compile(data));
|
|
186
158
|
}
|
|
187
|
-
const libFilePath =
|
|
159
|
+
const libFilePath = path.join(getWorkspaceOutputPath(workspaceLocation), `${data.Package}.min.js`);
|
|
188
160
|
const scriptDirectories = [packageLocation.path, packageLocation.scriptsDir];
|
|
189
161
|
if (subdomain === "GFX.Standard") {
|
|
190
162
|
logStep(`Including Images folder`);
|
|
191
|
-
scriptDirectories.push(
|
|
163
|
+
scriptDirectories.push(path.join(packageLocation.path, "Images"));
|
|
192
164
|
}
|
|
193
|
-
const manifest =
|
|
165
|
+
const manifest = readPackageCreatorManifest(packageLocation);
|
|
194
166
|
if (manifest !== undefined) {
|
|
195
167
|
if (manifest.RunTime && notRuntimeScripts.includes(manifest.Type)) {
|
|
196
168
|
logStep("Setting script RunTime to false because of script type");
|
|
197
|
-
|
|
169
|
+
writePackageCreatorManifest(packageLocation, {
|
|
198
170
|
...manifest,
|
|
199
171
|
RunTime: false
|
|
200
172
|
});
|
|
201
173
|
} else if (!manifest.RunTime && runtimeScripts.includes(manifest.Type)) {
|
|
202
174
|
logStep("Setting script RunTime to true because of script type");
|
|
203
|
-
|
|
175
|
+
writePackageCreatorManifest(packageLocation, {
|
|
204
176
|
...manifest,
|
|
205
177
|
RunTime: true
|
|
206
178
|
});
|
|
@@ -214,15 +186,15 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
|
|
|
214
186
|
// }
|
|
215
187
|
|
|
216
188
|
const animations = new Map();
|
|
217
|
-
for (const scriptFilePath of
|
|
218
|
-
const content =
|
|
189
|
+
for (const scriptFilePath of readPackageAnimationList(packageLocation)) {
|
|
190
|
+
const content = fs.readFileSync(scriptFilePath, {
|
|
219
191
|
encoding: "utf8"
|
|
220
192
|
});
|
|
221
193
|
let data;
|
|
222
194
|
try {
|
|
223
195
|
data = JSON.parse(content);
|
|
224
196
|
} catch (err) {
|
|
225
|
-
const relativePath =
|
|
197
|
+
const relativePath = path.relative(workspaceLocation.path, scriptFilePath);
|
|
226
198
|
if (err instanceof SyntaxError) {
|
|
227
199
|
throw new Error(`Encountered invalid syntax in file "${relativePath}": ${String(err)}`);
|
|
228
200
|
}
|
|
@@ -235,11 +207,11 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
|
|
|
235
207
|
}
|
|
236
208
|
let libFile;
|
|
237
209
|
try {
|
|
238
|
-
libFile =
|
|
210
|
+
libFile = fs.readFileSync(libFilePath, {
|
|
239
211
|
encoding: "utf8"
|
|
240
212
|
});
|
|
241
213
|
} catch (err) {
|
|
242
|
-
if (!
|
|
214
|
+
if (!isErrorENOENT(err)) {
|
|
243
215
|
throw err;
|
|
244
216
|
}
|
|
245
217
|
}
|
|
@@ -268,21 +240,21 @@ Packaging without a javascript file is only allowed when animation json files ar
|
|
|
268
240
|
console.log(`${name}: Added animation ${scope}.${name}`);
|
|
269
241
|
}
|
|
270
242
|
}
|
|
271
|
-
const minifyResult =
|
|
243
|
+
const minifyResult = terser.minify(library, {
|
|
272
244
|
ecma: 5
|
|
273
245
|
});
|
|
274
246
|
archive.file(`${data.Package}.js`, minifyResult.code);
|
|
275
247
|
archive.file(`_Package.json`, JSON.stringify(data, null, 2));
|
|
276
|
-
const creatorIndex =
|
|
248
|
+
const creatorIndex = readPackageCreatorIndex(packageLocation);
|
|
277
249
|
if (creatorIndex !== undefined) {
|
|
278
250
|
archive.file(`_Index.json`, JSON.stringify(creatorIndex, null, 2));
|
|
279
251
|
}
|
|
280
252
|
for (const directory of scriptDirectories) {
|
|
281
253
|
try {
|
|
282
|
-
for (const file of
|
|
254
|
+
for (const file of fs.readdirSync(directory)) {
|
|
283
255
|
const {
|
|
284
256
|
ext
|
|
285
|
-
} =
|
|
257
|
+
} = path.parse(file);
|
|
286
258
|
switch (ext) {
|
|
287
259
|
case ".png":
|
|
288
260
|
case ".jpeg":
|
|
@@ -291,7 +263,7 @@ Packaging without a javascript file is only allowed when animation json files ar
|
|
|
291
263
|
default:
|
|
292
264
|
continue;
|
|
293
265
|
}
|
|
294
|
-
archive.file(file,
|
|
266
|
+
archive.file(file, fs.createReadStream(path.join(directory, file)));
|
|
295
267
|
}
|
|
296
268
|
} catch (err) {
|
|
297
269
|
console.error(`Script directory "${directory}" does not exist`);
|
|
@@ -309,24 +281,24 @@ const createNamespace = parts => {
|
|
|
309
281
|
};
|
|
310
282
|
|
|
311
283
|
const releaseFolder = async options => {
|
|
312
|
-
const workspace =
|
|
313
|
-
const location =
|
|
284
|
+
const workspace = detectWorkspace(options.cwd);
|
|
285
|
+
const location = detectPackage(workspace, options.directory);
|
|
314
286
|
const {
|
|
315
287
|
write: writeVersionFile,
|
|
316
288
|
reset: resetVersionFile
|
|
317
|
-
} =
|
|
318
|
-
const packageDescription =
|
|
289
|
+
} = getVersionFileHandler(location);
|
|
290
|
+
const packageDescription = readPackageCreatorManifest(location);
|
|
319
291
|
const fullPackageName = packageDescription.Package;
|
|
320
292
|
const {
|
|
321
293
|
domain,
|
|
322
294
|
subdomain
|
|
323
|
-
} =
|
|
295
|
+
} = parseCreatorPackageName(packageDescription);
|
|
324
296
|
const publishDomain = options.domain ?? domain;
|
|
325
297
|
const publishSubdomain = options.subdomain ?? subdomain;
|
|
326
|
-
const sharedPackageJson =
|
|
298
|
+
const sharedPackageJson = readWorkspaceNpmManifest(workspace);
|
|
327
299
|
let newVersion;
|
|
328
300
|
try {
|
|
329
|
-
newVersion =
|
|
301
|
+
newVersion = parseVersionFromString(options.newVersion);
|
|
330
302
|
} catch (err) {
|
|
331
303
|
throw new Error(`Please enter a version in this format 1.0.0.100`);
|
|
332
304
|
}
|
|
@@ -342,14 +314,14 @@ const releaseFolder = async options => {
|
|
|
342
314
|
};
|
|
343
315
|
}
|
|
344
316
|
if (sharedPackageJson !== undefined) {
|
|
345
|
-
|
|
346
|
-
|
|
317
|
+
logPackageMessage(packageDescription.Package, `Running npm install to make sure all dependencies are up to date`);
|
|
318
|
+
execSync(`npm install`, {
|
|
347
319
|
encoding: "utf-8",
|
|
348
320
|
cwd: workspace.path
|
|
349
321
|
});
|
|
350
322
|
}
|
|
351
|
-
const binDir =
|
|
352
|
-
|
|
323
|
+
const binDir = getWorkspaceOutputPath(workspace);
|
|
324
|
+
fs.mkdirSync(binDir, {
|
|
353
325
|
recursive: true
|
|
354
326
|
});
|
|
355
327
|
let assetServerPackageDetails;
|
|
@@ -366,17 +338,17 @@ const releaseFolder = async options => {
|
|
|
366
338
|
version: newVersionString
|
|
367
339
|
};
|
|
368
340
|
}
|
|
369
|
-
const zipFilePath =
|
|
341
|
+
const zipFilePath = path.join(binDir, packageNameWithVersion + ".zip");
|
|
370
342
|
try {
|
|
371
343
|
if (options.pushOnly) {
|
|
372
|
-
if (!
|
|
344
|
+
if (!fs.existsSync(zipFilePath)) {
|
|
373
345
|
throw new Error(`Expected a zip file to exist at path ${zipFilePath} since pushOnly is specified`);
|
|
374
346
|
}
|
|
375
347
|
} else {
|
|
376
|
-
const gitVersionInformation = await
|
|
348
|
+
const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
|
|
377
349
|
writeVersionFile(fullPackageName, newVersion);
|
|
378
|
-
const bannerText = sharedPackageJson !== undefined ?
|
|
379
|
-
await
|
|
350
|
+
const bannerText = sharedPackageJson !== undefined ? getWorkspaceBannerText(sharedPackageJson) : undefined;
|
|
351
|
+
await buildFolders({
|
|
380
352
|
...options,
|
|
381
353
|
directories: [location.path],
|
|
382
354
|
skipPackagesWithoutTsFiles: true,
|
|
@@ -395,21 +367,21 @@ const releaseFolder = async options => {
|
|
|
395
367
|
});
|
|
396
368
|
newVersion.preRelease = undefined;
|
|
397
369
|
try {
|
|
398
|
-
|
|
370
|
+
fs.rmSync(zipFilePath);
|
|
399
371
|
} catch (err) {
|
|
400
|
-
if (!
|
|
372
|
+
if (!isErrorENOENT(err)) {
|
|
401
373
|
throw err;
|
|
402
374
|
}
|
|
403
375
|
}
|
|
404
376
|
const archive = await buildArchiveFromPackage(workspace, location, packageDescription);
|
|
405
|
-
const zipOutputStream =
|
|
406
|
-
await
|
|
377
|
+
const zipOutputStream = fs.createWriteStream(zipFilePath);
|
|
378
|
+
await pipeline(archive.generateNodeStream(), zipOutputStream);
|
|
407
379
|
}
|
|
408
380
|
if (!options.noUpload) {
|
|
409
381
|
if (!options.authentication) {
|
|
410
382
|
throw new Error(`Expected authentication to be available`);
|
|
411
383
|
}
|
|
412
|
-
|
|
384
|
+
logPackageMessage(packageDescription.Package, `Opening connection to asset server`);
|
|
413
385
|
const sessionManager = await createSessionManager({
|
|
414
386
|
url: options.service,
|
|
415
387
|
address: options.address,
|
|
@@ -417,14 +389,14 @@ const releaseFolder = async options => {
|
|
|
417
389
|
subDomain: publishSubdomain,
|
|
418
390
|
authentication: options.authentication
|
|
419
391
|
});
|
|
420
|
-
|
|
392
|
+
logPackageMessage(packageDescription.Package, `Making sure all dependencies are available with an acceptable version`);
|
|
421
393
|
if (!(await ensureRequiredVersions(workspace, packageDescription, sessionManager, options.prompter))) {
|
|
422
|
-
|
|
394
|
+
logPackageMessage(packageDescription.Package, "AssetService does not yet support required apis for dependency check");
|
|
423
395
|
}
|
|
424
|
-
|
|
396
|
+
logPackageMessage(packageDescription.Package, `Uploading package to ${publishDomain}.${publishSubdomain}`);
|
|
425
397
|
await uploadPackage(sessionManager.getTargetSession(), assetServerPackageDetails, zipFilePath);
|
|
426
398
|
await sessionManager.destroy().catch(err => {
|
|
427
|
-
|
|
399
|
+
logPackageMessage(packageDescription.Package, `Failed to close asset service session(s): ${err}`);
|
|
428
400
|
});
|
|
429
401
|
}
|
|
430
402
|
} catch (err) {
|
|
@@ -432,13 +404,13 @@ const releaseFolder = async options => {
|
|
|
432
404
|
throw err;
|
|
433
405
|
}
|
|
434
406
|
if (newVersion.buildNumber >= 100 && !options.pushOnly) {
|
|
435
|
-
|
|
407
|
+
logPackageMessage(fullPackageName, translate("messages.movingReleaseZip"));
|
|
436
408
|
const zipFileName = `${packageNameWithVersion}.zip`;
|
|
437
|
-
const releasesPath =
|
|
438
|
-
|
|
409
|
+
const releasesPath = getPackageReleasesDirectory(location);
|
|
410
|
+
fs.mkdirSync(releasesPath, {
|
|
439
411
|
recursive: true
|
|
440
412
|
});
|
|
441
|
-
|
|
413
|
+
fs.copyFileSync(zipFilePath, path.join(releasesPath, zipFileName));
|
|
442
414
|
}
|
|
443
415
|
};
|
|
444
416
|
const ensureRequiredVersions = async (workspaceLocation, creatorPackage, sessionManager, prompter) => {
|
|
@@ -450,7 +422,7 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
|
|
|
450
422
|
const uploadedPackages = rawUploadedPackages.map(entry => {
|
|
451
423
|
let version;
|
|
452
424
|
try {
|
|
453
|
-
version =
|
|
425
|
+
version = parseVersionFromString(entry.informalVersion);
|
|
454
426
|
} catch (err) {
|
|
455
427
|
throw new Error(`Encountered invalid format for version ${entry.informalVersion}`);
|
|
456
428
|
}
|
|
@@ -470,14 +442,14 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
|
|
|
470
442
|
version
|
|
471
443
|
};
|
|
472
444
|
});
|
|
473
|
-
const libraries =
|
|
445
|
+
const libraries = determineWorkspaceIGLibraries(workspaceLocation);
|
|
474
446
|
for (const libraryLocation of libraries) {
|
|
475
|
-
const libraryManifest =
|
|
476
|
-
const libraryCreatorPackage =
|
|
447
|
+
const libraryManifest = readPublishedPackageNpmManifest(libraryLocation);
|
|
448
|
+
const libraryCreatorPackage = readPublishedPackageCreatorManifest(libraryLocation);
|
|
477
449
|
if (libraryCreatorPackage === undefined || libraryManifest.main === undefined || libraryCreatorPackage.Package === creatorPackage.Package) {
|
|
478
450
|
continue;
|
|
479
451
|
}
|
|
480
|
-
const libraryVersion =
|
|
452
|
+
const libraryVersion = PackageVersion.extractFromLine(libraryManifest.version);
|
|
481
453
|
if (libraryVersion.preRelease) {
|
|
482
454
|
libraryVersion.buildNumber = libraryVersion.preRelease.version;
|
|
483
455
|
libraryVersion.preRelease = undefined;
|
|
@@ -496,19 +468,19 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
|
|
|
496
468
|
}
|
|
497
469
|
}
|
|
498
470
|
if (targetSession.subDomain !== "Basics" && (uploadedPackageInBasics !== undefined || uploadedPackageInTarget !== undefined)) {
|
|
499
|
-
|
|
471
|
+
logPackageMessage(creatorPackage.Package, `Package ${libraryCreatorPackage.Package} is uploaded both for Basics and ${targetSession.subDomain}. The package within ${targetSession.subDomain} will be used.`);
|
|
500
472
|
}
|
|
501
473
|
const validInBasics = uploadedPackageInBasics !== undefined && !uploadedPackageInBasics.version.isLesserThan(libraryVersion);
|
|
502
474
|
const validInTarget = uploadedPackageInTarget !== undefined && !uploadedPackageInTarget.version.isLesserThan(libraryVersion);
|
|
503
475
|
if (validInBasics || validInTarget) {
|
|
504
|
-
|
|
476
|
+
logPackageMessage(creatorPackage.Package, `Skipping upload for package ${libraryCreatorPackage.Package} as it is already uploaded and up to date.`);
|
|
505
477
|
continue;
|
|
506
478
|
}
|
|
507
479
|
if (uploadedPackageInBasics) {
|
|
508
|
-
|
|
480
|
+
logPackageMessage(creatorPackage.Package, `Found invalid version for package ${libraryCreatorPackage.Package} in Basics.`);
|
|
509
481
|
}
|
|
510
482
|
if (targetSession.subDomain !== "Basics" && uploadedPackageInTarget) {
|
|
511
|
-
|
|
483
|
+
logPackageMessage(creatorPackage.Package, `Found invalid version for package ${libraryCreatorPackage.Package} in ${targetSession.subDomain}.`);
|
|
512
484
|
}
|
|
513
485
|
const possibleTargets = ["Basics"];
|
|
514
486
|
if (targetSession.subDomain !== "Basics") {
|
|
@@ -527,18 +499,18 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
|
|
|
527
499
|
buildNumber: true
|
|
528
500
|
});
|
|
529
501
|
const packageNameWithVersion = `${libraryCreatorPackage.Package}_${newVersionString}`;
|
|
530
|
-
const zipFilePath =
|
|
502
|
+
const zipFilePath = path.join(getWorkspaceOutputPath(workspaceLocation), `${packageNameWithVersion}.zip`);
|
|
531
503
|
try {
|
|
532
|
-
|
|
504
|
+
fs.rmSync(zipFilePath);
|
|
533
505
|
} catch (err) {
|
|
534
|
-
if (!
|
|
506
|
+
if (!isErrorENOENT(err)) {
|
|
535
507
|
throw err;
|
|
536
508
|
}
|
|
537
509
|
}
|
|
538
|
-
const zipOutputStream =
|
|
539
|
-
await
|
|
510
|
+
const zipOutputStream = fs.createWriteStream(zipFilePath);
|
|
511
|
+
await pipeline(archive.generateNodeStream(), zipOutputStream);
|
|
540
512
|
const session = uploadTargetScope === "Basics" ? await sessionManager.getBasicsSession() : targetSession;
|
|
541
|
-
|
|
513
|
+
logPackageMessage(creatorPackage.Package, `Uploading package ${libraryCreatorPackage.Package} with version ${newVersionString} to ${session.domain}.${session.subDomain}`);
|
|
542
514
|
await uploadPackage(session, {
|
|
543
515
|
name: libraryCreatorPackage.Package,
|
|
544
516
|
version: newVersionString
|
|
@@ -572,5 +544,5 @@ const createSessionManager = async params => {
|
|
|
572
544
|
};
|
|
573
545
|
};
|
|
574
546
|
|
|
575
|
-
|
|
576
|
-
//# sourceMappingURL=release.
|
|
547
|
+
export { releaseFolder };
|
|
548
|
+
//# sourceMappingURL=release.mjs.map
|