@intelligentgraphics/ig.gfx.packager 3.0.0-alpha.1 → 3.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.mjs +595 -0
- package/build/cli.mjs.map +1 -0
- package/build/commands/{build.js → build.mjs} +73 -77
- package/build/commands/build.mjs.map +1 -0
- package/build/commands/{generate.js → generate.mjs} +31 -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} +101 -124
- 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 +365 -0
- package/build/versionFile.mjs.map +1 -0
- package/package.json +12 -11
- package/readme.md +12 -0
- package/build/cli.js +0 -8316
- 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 -78
- package/build/commands/postinstall.js.map +0 -1
- package/build/commands/publishNpm.js +0 -157
- 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 -8
- package/build/index.js.map +0 -1
- package/build/scripts.js +0 -32
- package/build/scripts.js.map +0 -1
- package/build/versionFile.js +0 -182
- 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\n\tfs.mkdirSync(libPath, { recursive: true });\n\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\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","fs","mkdirSync","recursive","existingDefinitions","readdirSync","existingDefinitionName","content","readFileSync","path","join","encoding","startsWith","rmSync","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;AAE9CO,EAAAA,EAAE,CAACC,SAAS,CAACH,OAAO,EAAE;AAAEI,IAAAA,SAAS,EAAE,IAAA;AAAK,GAAC,CAAC,CAAA;AAE1C,EAAA,MAAMC,mBAAmB,GAAGH,EAAE,CAACI,WAAW,CAACN,OAAO,CAAC,CAAA;;AAEnD;AACA;AACA,EAAA,KAAK,MAAMO,sBAAsB,IAAIF,mBAAmB,EAAE;AACzD,IAAA,MAAMG,OAAO,GAAGN,EAAE,CAACO,YAAY,CAC9BC,IAAI,CAACC,IAAI,CAACX,OAAO,EAAEO,sBAAsB,CAAC,EAC1C;AAAEK,MAAAA,QAAQ,EAAE,OAAA;AAAQ,KAAC,CACrB,CAAA;AAED,IAAA,IAAIJ,OAAO,CAACK,UAAU,CAACpB,oBAAoB,CAAC,EAAE;MAC7CS,EAAE,CAACY,MAAM,CAACJ,IAAI,CAACC,IAAI,CAACX,OAAO,EAAEO,sBAAsB,CAAC,CAAC,CAAA;AACtD,KAAA;AACD,GAAA;AAEA,EAAA,MAAMQ,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,MAAMT,OAAO,GACZf,oBAAoB,GACpB,KAAK,GACJ,CAAoCG,kCAAAA,EAAAA,QAAQ,CAACuB,OAAQ,IAAG,GACxD,CAAA,sBAAA,EAAwBvB,QAAQ,CAACwB,IAAK,CAAK,IAAA,CAAA,CAAA;AAE7ClB,IAAAA,EAAE,CAACmB,aAAa,CACfX,IAAI,CAACC,IAAI,CAACV,mBAAmB,CAACN,SAAS,CAAC,EAAEC,QAAQ,CAAC0B,KAAK,CAAC,EACzDd,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,57 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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('write-pkg');
|
|
27
|
-
require('inquirer');
|
|
28
|
-
require('glob');
|
|
29
|
-
require('typescript');
|
|
30
|
-
require('../scripts.js');
|
|
31
|
-
require('typedoc');
|
|
32
|
-
require('simple-git');
|
|
33
|
-
require('resolve');
|
|
34
|
-
|
|
35
|
-
function _interopNamespaceDefault(e) {
|
|
36
|
-
var n = Object.create(null);
|
|
37
|
-
if (e) {
|
|
38
|
-
Object.keys(e).forEach(function (k) {
|
|
39
|
-
if (k !== 'default') {
|
|
40
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
41
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: function () { return e[k]; }
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
n.default = e;
|
|
49
|
-
return Object.freeze(n);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
53
|
-
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
54
|
-
var terser__namespace = /*#__PURE__*/_interopNamespaceDefault(terser);
|
|
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, c as parseVersionFromNumericVersion, 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';
|
|
55
26
|
|
|
56
27
|
const PLUGIN_ID = "0feba3a0-b6d1-11e6-9598-0800200c9a66";
|
|
57
28
|
/**
|
|
@@ -117,7 +88,7 @@ const getExistingPackages = async session => axios.get(`Script/GetInformation/${
|
|
|
117
88
|
}).then(({
|
|
118
89
|
data
|
|
119
90
|
}) => Array.isArray(data) ? data : undefined);
|
|
120
|
-
const uploadPackageToUrl = (url, path, zipFilePath) => axios.post(path,
|
|
91
|
+
const uploadPackageToUrl = (url, path, zipFilePath) => axios.post(path, fs.createReadStream(zipFilePath), {
|
|
121
92
|
baseURL: url
|
|
122
93
|
}).then(({
|
|
123
94
|
data,
|
|
@@ -158,11 +129,11 @@ const uploadPackageToUrl = (url, path, zipFilePath) => axios.post(path, fs__name
|
|
|
158
129
|
const buildArchiveFromPublishedPackage = (location, manifest, creatorPackage) => {
|
|
159
130
|
const archive = new JSZip();
|
|
160
131
|
archive.file("_Package.json", JSON.stringify(creatorPackage, null, 2));
|
|
161
|
-
const index =
|
|
132
|
+
const index = readPublishedPackageCreatorIndex(location);
|
|
162
133
|
if (index !== undefined) {
|
|
163
134
|
archive.file("_Index.json", JSON.stringify(index, null, 2));
|
|
164
135
|
}
|
|
165
|
-
archive.file(manifest.main,
|
|
136
|
+
archive.file(manifest.main, fs.createReadStream(path.join(location.path, manifest.main)));
|
|
166
137
|
return archive;
|
|
167
138
|
};
|
|
168
139
|
let validateSchema;
|
|
@@ -172,8 +143,8 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
|
|
|
172
143
|
const {
|
|
173
144
|
domain,
|
|
174
145
|
subdomain
|
|
175
|
-
} =
|
|
176
|
-
const logStep = step =>
|
|
146
|
+
} = parseCreatorPackageName(data);
|
|
147
|
+
const logStep = step => logPackageMessage(data.Package, step);
|
|
177
148
|
if (validateSchema === undefined) {
|
|
178
149
|
validateSchema = await axios.get("https://archive.intelligentgraphics.biz/schemas/gfx/animation.json").then(({
|
|
179
150
|
data
|
|
@@ -185,23 +156,23 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
|
|
|
185
156
|
validateSchema: "log"
|
|
186
157
|
}).compile(data));
|
|
187
158
|
}
|
|
188
|
-
const libFilePath =
|
|
159
|
+
const libFilePath = path.join(getWorkspaceOutputPath(workspaceLocation), `${data.Package}.min.js`);
|
|
189
160
|
const scriptDirectories = [packageLocation.path, packageLocation.scriptsDir];
|
|
190
161
|
if (subdomain === "GFX.Standard") {
|
|
191
162
|
logStep(`Including Images folder`);
|
|
192
|
-
scriptDirectories.push(
|
|
163
|
+
scriptDirectories.push(path.join(packageLocation.path, "Images"));
|
|
193
164
|
}
|
|
194
|
-
const manifest =
|
|
165
|
+
const manifest = readPackageCreatorManifest(packageLocation);
|
|
195
166
|
if (manifest !== undefined) {
|
|
196
167
|
if (manifest.RunTime && notRuntimeScripts.includes(manifest.Type)) {
|
|
197
168
|
logStep("Setting script RunTime to false because of script type");
|
|
198
|
-
|
|
169
|
+
writePackageCreatorManifest(packageLocation, {
|
|
199
170
|
...manifest,
|
|
200
171
|
RunTime: false
|
|
201
172
|
});
|
|
202
173
|
} else if (!manifest.RunTime && runtimeScripts.includes(manifest.Type)) {
|
|
203
174
|
logStep("Setting script RunTime to true because of script type");
|
|
204
|
-
|
|
175
|
+
writePackageCreatorManifest(packageLocation, {
|
|
205
176
|
...manifest,
|
|
206
177
|
RunTime: true
|
|
207
178
|
});
|
|
@@ -215,15 +186,15 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
|
|
|
215
186
|
// }
|
|
216
187
|
|
|
217
188
|
const animations = new Map();
|
|
218
|
-
for (const scriptFilePath of
|
|
219
|
-
const content =
|
|
189
|
+
for (const scriptFilePath of readPackageAnimationList(packageLocation)) {
|
|
190
|
+
const content = fs.readFileSync(scriptFilePath, {
|
|
220
191
|
encoding: "utf8"
|
|
221
192
|
});
|
|
222
193
|
let data;
|
|
223
194
|
try {
|
|
224
195
|
data = JSON.parse(content);
|
|
225
196
|
} catch (err) {
|
|
226
|
-
const relativePath =
|
|
197
|
+
const relativePath = path.relative(workspaceLocation.path, scriptFilePath);
|
|
227
198
|
if (err instanceof SyntaxError) {
|
|
228
199
|
throw new Error(`Encountered invalid syntax in file "${relativePath}": ${String(err)}`);
|
|
229
200
|
}
|
|
@@ -236,11 +207,11 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
|
|
|
236
207
|
}
|
|
237
208
|
let libFile;
|
|
238
209
|
try {
|
|
239
|
-
libFile =
|
|
210
|
+
libFile = fs.readFileSync(libFilePath, {
|
|
240
211
|
encoding: "utf8"
|
|
241
212
|
});
|
|
242
213
|
} catch (err) {
|
|
243
|
-
if (!
|
|
214
|
+
if (!isErrorENOENT(err)) {
|
|
244
215
|
throw err;
|
|
245
216
|
}
|
|
246
217
|
}
|
|
@@ -266,24 +237,24 @@ Packaging without a javascript file is only allowed when animation json files ar
|
|
|
266
237
|
library += createNamespace(scopeParts);
|
|
267
238
|
for (const [name, data] of animations) {
|
|
268
239
|
library += `${scope}.${name} = ` + data + ";";
|
|
269
|
-
|
|
240
|
+
logPackageMessage(manifest.Package, `Added animation ${scope}.${name}`);
|
|
270
241
|
}
|
|
271
242
|
}
|
|
272
|
-
const minifyResult =
|
|
243
|
+
const minifyResult = terser.minify(library, {
|
|
273
244
|
ecma: 5
|
|
274
245
|
});
|
|
275
246
|
archive.file(`${data.Package}.js`, minifyResult.code);
|
|
276
247
|
archive.file(`_Package.json`, JSON.stringify(data, null, 2));
|
|
277
|
-
const creatorIndex =
|
|
248
|
+
const creatorIndex = readPackageCreatorIndex(packageLocation);
|
|
278
249
|
if (creatorIndex !== undefined) {
|
|
279
250
|
archive.file(`_Index.json`, JSON.stringify(creatorIndex, null, 2));
|
|
280
251
|
}
|
|
281
252
|
for (const directory of scriptDirectories) {
|
|
282
253
|
try {
|
|
283
|
-
for (const file of
|
|
254
|
+
for (const file of fs.readdirSync(directory)) {
|
|
284
255
|
const {
|
|
285
256
|
ext
|
|
286
|
-
} =
|
|
257
|
+
} = path.parse(file);
|
|
287
258
|
switch (ext) {
|
|
288
259
|
case ".png":
|
|
289
260
|
case ".jpeg":
|
|
@@ -292,7 +263,7 @@ Packaging without a javascript file is only allowed when animation json files ar
|
|
|
292
263
|
default:
|
|
293
264
|
continue;
|
|
294
265
|
}
|
|
295
|
-
archive.file(file,
|
|
266
|
+
archive.file(file, fs.createReadStream(path.join(directory, file)));
|
|
296
267
|
}
|
|
297
268
|
} catch (err) {
|
|
298
269
|
console.error(`Script directory "${directory}" does not exist`);
|
|
@@ -310,24 +281,24 @@ const createNamespace = parts => {
|
|
|
310
281
|
};
|
|
311
282
|
|
|
312
283
|
const releaseFolder = async options => {
|
|
313
|
-
const workspace =
|
|
314
|
-
const location =
|
|
284
|
+
const workspace = detectWorkspace(options.cwd);
|
|
285
|
+
const location = detectPackage(workspace, options.directory);
|
|
315
286
|
const {
|
|
316
287
|
write: writeVersionFile,
|
|
317
288
|
reset: resetVersionFile
|
|
318
|
-
} =
|
|
319
|
-
const packageDescription =
|
|
289
|
+
} = getVersionFileHandler(location);
|
|
290
|
+
const packageDescription = readPackageCreatorManifest(location);
|
|
320
291
|
const fullPackageName = packageDescription.Package;
|
|
321
292
|
const {
|
|
322
293
|
domain,
|
|
323
294
|
subdomain
|
|
324
|
-
} =
|
|
295
|
+
} = parseCreatorPackageName(packageDescription);
|
|
325
296
|
const publishDomain = options.domain ?? domain;
|
|
326
297
|
const publishSubdomain = options.subdomain ?? subdomain;
|
|
327
|
-
const sharedPackageJson =
|
|
298
|
+
const sharedPackageJson = readWorkspaceNpmManifest(workspace);
|
|
328
299
|
let newVersion;
|
|
329
300
|
try {
|
|
330
|
-
newVersion =
|
|
301
|
+
newVersion = parseVersionFromString(options.newVersion);
|
|
331
302
|
} catch (err) {
|
|
332
303
|
throw new Error(`Please enter a version in this format 1.0.0.100`);
|
|
333
304
|
}
|
|
@@ -343,14 +314,14 @@ const releaseFolder = async options => {
|
|
|
343
314
|
};
|
|
344
315
|
}
|
|
345
316
|
if (sharedPackageJson !== undefined) {
|
|
346
|
-
|
|
347
|
-
|
|
317
|
+
logPackageMessage(packageDescription.Package, `Running npm install to make sure all dependencies are up to date`);
|
|
318
|
+
execSync(`npm install`, {
|
|
348
319
|
encoding: "utf-8",
|
|
349
320
|
cwd: workspace.path
|
|
350
321
|
});
|
|
351
322
|
}
|
|
352
|
-
const binDir =
|
|
353
|
-
|
|
323
|
+
const binDir = getWorkspaceOutputPath(workspace);
|
|
324
|
+
fs.mkdirSync(binDir, {
|
|
354
325
|
recursive: true
|
|
355
326
|
});
|
|
356
327
|
let assetServerPackageDetails;
|
|
@@ -367,17 +338,17 @@ const releaseFolder = async options => {
|
|
|
367
338
|
version: newVersionString
|
|
368
339
|
};
|
|
369
340
|
}
|
|
370
|
-
const zipFilePath =
|
|
341
|
+
const zipFilePath = path.join(binDir, packageNameWithVersion + ".zip");
|
|
371
342
|
try {
|
|
372
343
|
if (options.pushOnly) {
|
|
373
|
-
if (!
|
|
344
|
+
if (!fs.existsSync(zipFilePath)) {
|
|
374
345
|
throw new Error(`Expected a zip file to exist at path ${zipFilePath} since pushOnly is specified`);
|
|
375
346
|
}
|
|
376
347
|
} else {
|
|
377
|
-
const gitVersionInformation = await
|
|
348
|
+
const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
|
|
378
349
|
writeVersionFile(fullPackageName, newVersion);
|
|
379
|
-
const bannerText = sharedPackageJson !== undefined ?
|
|
380
|
-
await
|
|
350
|
+
const bannerText = sharedPackageJson !== undefined ? getWorkspaceBannerText(sharedPackageJson) : undefined;
|
|
351
|
+
await buildFolders({
|
|
381
352
|
...options,
|
|
382
353
|
directories: [location.path],
|
|
383
354
|
skipPackagesWithoutTsFiles: true,
|
|
@@ -396,21 +367,21 @@ const releaseFolder = async options => {
|
|
|
396
367
|
});
|
|
397
368
|
newVersion.preRelease = undefined;
|
|
398
369
|
try {
|
|
399
|
-
|
|
370
|
+
fs.rmSync(zipFilePath);
|
|
400
371
|
} catch (err) {
|
|
401
|
-
if (!
|
|
372
|
+
if (!isErrorENOENT(err)) {
|
|
402
373
|
throw err;
|
|
403
374
|
}
|
|
404
375
|
}
|
|
405
376
|
const archive = await buildArchiveFromPackage(workspace, location, packageDescription);
|
|
406
|
-
const zipOutputStream =
|
|
407
|
-
await
|
|
377
|
+
const zipOutputStream = fs.createWriteStream(zipFilePath);
|
|
378
|
+
await pipeline(archive.generateNodeStream(), zipOutputStream);
|
|
408
379
|
}
|
|
409
380
|
if (!options.noUpload) {
|
|
410
381
|
if (!options.authentication) {
|
|
411
382
|
throw new Error(`Expected authentication to be available`);
|
|
412
383
|
}
|
|
413
|
-
|
|
384
|
+
logPackageMessage(packageDescription.Package, `Opening connection to asset server`);
|
|
414
385
|
const sessionManager = await createSessionManager({
|
|
415
386
|
url: options.service,
|
|
416
387
|
address: options.address,
|
|
@@ -418,14 +389,14 @@ const releaseFolder = async options => {
|
|
|
418
389
|
subDomain: publishSubdomain,
|
|
419
390
|
authentication: options.authentication
|
|
420
391
|
});
|
|
421
|
-
|
|
392
|
+
logPackageMessage(packageDescription.Package, `Making sure all dependencies are available with an acceptable version`);
|
|
422
393
|
if (!(await ensureRequiredVersions(workspace, packageDescription, sessionManager, options.prompter))) {
|
|
423
|
-
|
|
394
|
+
logPackageMessage(packageDescription.Package, "AssetService does not yet support required apis for dependency check");
|
|
424
395
|
}
|
|
425
|
-
|
|
396
|
+
logPackageMessage(packageDescription.Package, `Uploading package to ${publishDomain}.${publishSubdomain}`);
|
|
426
397
|
await uploadPackage(sessionManager.getTargetSession(), assetServerPackageDetails, zipFilePath);
|
|
427
398
|
await sessionManager.destroy().catch(err => {
|
|
428
|
-
|
|
399
|
+
logPackageMessage(packageDescription.Package, `Failed to close asset service session(s): ${err}`);
|
|
429
400
|
});
|
|
430
401
|
}
|
|
431
402
|
} catch (err) {
|
|
@@ -433,13 +404,13 @@ const releaseFolder = async options => {
|
|
|
433
404
|
throw err;
|
|
434
405
|
}
|
|
435
406
|
if (newVersion.buildNumber >= 100 && !options.pushOnly) {
|
|
436
|
-
|
|
407
|
+
logPackageMessage(fullPackageName, translate("messages.movingReleaseZip"));
|
|
437
408
|
const zipFileName = `${packageNameWithVersion}.zip`;
|
|
438
|
-
const releasesPath =
|
|
439
|
-
|
|
409
|
+
const releasesPath = getPackageReleasesDirectory(location);
|
|
410
|
+
fs.mkdirSync(releasesPath, {
|
|
440
411
|
recursive: true
|
|
441
412
|
});
|
|
442
|
-
|
|
413
|
+
fs.copyFileSync(zipFilePath, path.join(releasesPath, zipFileName));
|
|
443
414
|
}
|
|
444
415
|
};
|
|
445
416
|
const ensureRequiredVersions = async (workspaceLocation, creatorPackage, sessionManager, prompter) => {
|
|
@@ -451,9 +422,9 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
|
|
|
451
422
|
const uploadedPackages = rawUploadedPackages.map(entry => {
|
|
452
423
|
let version;
|
|
453
424
|
try {
|
|
454
|
-
version =
|
|
425
|
+
version = parseVersionFromNumericVersion(entry.numericVersion);
|
|
455
426
|
} catch (err) {
|
|
456
|
-
throw new Error(`Encountered invalid format for version ${entry.
|
|
427
|
+
throw new Error(`Encountered invalid format for version ${entry.numericVersion}`);
|
|
457
428
|
}
|
|
458
429
|
if (version.buildNumber < 100) {
|
|
459
430
|
version.preRelease = {
|
|
@@ -471,14 +442,14 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
|
|
|
471
442
|
version
|
|
472
443
|
};
|
|
473
444
|
});
|
|
474
|
-
const libraries =
|
|
445
|
+
const libraries = determineWorkspaceIGLibraries(workspaceLocation);
|
|
475
446
|
for (const libraryLocation of libraries) {
|
|
476
|
-
const libraryManifest =
|
|
477
|
-
const libraryCreatorPackage =
|
|
447
|
+
const libraryManifest = readPublishedPackageNpmManifest(libraryLocation);
|
|
448
|
+
const libraryCreatorPackage = readPublishedPackageCreatorManifest(libraryLocation);
|
|
478
449
|
if (libraryCreatorPackage === undefined || libraryManifest.main === undefined || libraryCreatorPackage.Package === creatorPackage.Package) {
|
|
479
450
|
continue;
|
|
480
451
|
}
|
|
481
|
-
const libraryVersion =
|
|
452
|
+
const libraryVersion = PackageVersion.extractFromLine(libraryManifest.version);
|
|
482
453
|
if (libraryVersion.preRelease) {
|
|
483
454
|
libraryVersion.buildNumber = libraryVersion.preRelease.version;
|
|
484
455
|
libraryVersion.preRelease = undefined;
|
|
@@ -496,27 +467,33 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
|
|
|
496
467
|
}
|
|
497
468
|
}
|
|
498
469
|
}
|
|
499
|
-
if (targetSession.subDomain !== "Basics" && (uploadedPackageInBasics !== undefined || uploadedPackageInTarget !== undefined)) {
|
|
500
|
-
index.logPackageMessage(creatorPackage.Package, `Package ${libraryCreatorPackage.Package} is uploaded both for Basics and ${targetSession.subDomain}. The package within ${targetSession.subDomain} will be used.`);
|
|
501
|
-
}
|
|
502
470
|
const validInBasics = uploadedPackageInBasics !== undefined && !uploadedPackageInBasics.version.isLesserThan(libraryVersion);
|
|
503
471
|
const validInTarget = uploadedPackageInTarget !== undefined && !uploadedPackageInTarget.version.isLesserThan(libraryVersion);
|
|
504
472
|
if (validInBasics || validInTarget) {
|
|
505
|
-
|
|
473
|
+
if (targetSession.subDomain !== "Basics" && (uploadedPackageInBasics !== undefined || uploadedPackageInTarget !== undefined)) {
|
|
474
|
+
logPackageMessage(creatorPackage.Package, `Package ${libraryCreatorPackage.Package} is uploaded both for Basics and ${targetSession.subDomain}. The package within ${targetSession.subDomain} will be used.`);
|
|
475
|
+
}
|
|
506
476
|
continue;
|
|
507
477
|
}
|
|
478
|
+
logPackageMessage(creatorPackage.Package, `Requested at least version ${libraryVersion.toVersionString({
|
|
479
|
+
buildNumber: true
|
|
480
|
+
})} for package ${libraryCreatorPackage.Package}`);
|
|
508
481
|
if (uploadedPackageInBasics) {
|
|
509
|
-
|
|
482
|
+
logPackageMessage(creatorPackage.Package, `Found invalid version ${uploadedPackageInBasics.version.toVersionString({
|
|
483
|
+
buildNumber: true
|
|
484
|
+
})} for package ${libraryCreatorPackage.Package} in Basics`);
|
|
510
485
|
}
|
|
511
486
|
if (targetSession.subDomain !== "Basics" && uploadedPackageInTarget) {
|
|
512
|
-
|
|
487
|
+
logPackageMessage(creatorPackage.Package, `Found invalid version ${uploadedPackageInTarget.version.toVersionString({
|
|
488
|
+
buildNumber: true
|
|
489
|
+
})} for package ${libraryCreatorPackage.Package} in ${targetSession.subDomain}`);
|
|
513
490
|
}
|
|
514
491
|
const possibleTargets = ["Basics"];
|
|
515
492
|
if (targetSession.subDomain !== "Basics") {
|
|
516
493
|
possibleTargets.push(targetSession.subDomain);
|
|
517
494
|
}
|
|
518
495
|
const uploadTargetScope = await prompter.ask({
|
|
519
|
-
message:
|
|
496
|
+
message: `Select the scope to upload the required version of ${libraryCreatorPackage.Package} to or select "skip" to skip the upload.`,
|
|
520
497
|
options: [...possibleTargets, "Skip"],
|
|
521
498
|
default: possibleTargets[0]
|
|
522
499
|
});
|
|
@@ -528,18 +505,18 @@ const ensureRequiredVersions = async (workspaceLocation, creatorPackage, session
|
|
|
528
505
|
buildNumber: true
|
|
529
506
|
});
|
|
530
507
|
const packageNameWithVersion = `${libraryCreatorPackage.Package}_${newVersionString}`;
|
|
531
|
-
const zipFilePath =
|
|
508
|
+
const zipFilePath = path.join(getWorkspaceOutputPath(workspaceLocation), `${packageNameWithVersion}.zip`);
|
|
532
509
|
try {
|
|
533
|
-
|
|
510
|
+
fs.rmSync(zipFilePath);
|
|
534
511
|
} catch (err) {
|
|
535
|
-
if (!
|
|
512
|
+
if (!isErrorENOENT(err)) {
|
|
536
513
|
throw err;
|
|
537
514
|
}
|
|
538
515
|
}
|
|
539
|
-
const zipOutputStream =
|
|
540
|
-
await
|
|
516
|
+
const zipOutputStream = fs.createWriteStream(zipFilePath);
|
|
517
|
+
await pipeline(archive.generateNodeStream(), zipOutputStream);
|
|
541
518
|
const session = uploadTargetScope === "Basics" ? await sessionManager.getBasicsSession() : targetSession;
|
|
542
|
-
|
|
519
|
+
logPackageMessage(creatorPackage.Package, `Uploading package ${libraryCreatorPackage.Package} with version ${newVersionString} to ${session.domain}.${session.subDomain}`);
|
|
543
520
|
await uploadPackage(session, {
|
|
544
521
|
name: libraryCreatorPackage.Package,
|
|
545
522
|
version: newVersionString
|
|
@@ -573,5 +550,5 @@ const createSessionManager = async params => {
|
|
|
573
550
|
};
|
|
574
551
|
};
|
|
575
552
|
|
|
576
|
-
|
|
577
|
-
//# sourceMappingURL=release.
|
|
553
|
+
export { releaseFolder };
|
|
554
|
+
//# sourceMappingURL=release.mjs.map
|