@intelligentgraphics/ig.gfx.packager 3.0.0 → 3.0.2
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 +22 -23
- package/build/cli.mjs.map +1 -1
- package/build/commands/build/index.mjs +3 -7
- package/build/commands/build/index.mjs.map +1 -1
- package/build/commands/postinstall.mjs +16 -4
- package/build/commands/postinstall.mjs.map +1 -1
- package/build/commands/publish/index.mjs +1 -2
- package/build/commands/publish/index.mjs.map +1 -1
- package/package.json +3 -6
- package/readme.md +20 -9
- package/build/lib/localization.mjs +0 -16
- package/build/lib/localization.mjs.map +0 -1
- package/locales/de.json +0 -18
- package/locales/en.json +0 -37
- package/scripts/postinstall.js +0 -22
package/build/cli.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import * as path from 'path';
|
|
|
4
4
|
import yargs from 'yargs/yargs';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import glob from 'glob';
|
|
7
|
-
import { translate } from './lib/localization.mjs';
|
|
8
7
|
import { detectPackage } from './lib/package.mjs';
|
|
9
8
|
import { detectWorkspace, readWorkspaceNpmManifest, writeWorkspaceNpmManifest } from './lib/workspace.mjs';
|
|
10
9
|
import { createDefaultPrompter } from './lib/prompter.mjs';
|
|
@@ -18,28 +17,28 @@ const captureError = err => {
|
|
|
18
17
|
if (process.env.NODE_ENV !== "production") {
|
|
19
18
|
console.error(err);
|
|
20
19
|
} else {
|
|
21
|
-
console.error(
|
|
20
|
+
console.error("Stopped execution because of the following error: " + err.message);
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
23
|
const buildOptions = {
|
|
25
24
|
outDir: {
|
|
26
|
-
description:
|
|
25
|
+
description: "Output directory",
|
|
27
26
|
type: "string",
|
|
28
27
|
default: "bin",
|
|
29
28
|
coerce: input => input === undefined || input === null ? undefined : path.resolve(process.cwd(), input)
|
|
30
29
|
},
|
|
31
30
|
minimize: {
|
|
32
|
-
description:
|
|
31
|
+
description: "Minify output",
|
|
33
32
|
type: "boolean",
|
|
34
33
|
default: true
|
|
35
34
|
},
|
|
36
35
|
cwd: {
|
|
37
|
-
description:
|
|
36
|
+
description: "Working directory",
|
|
38
37
|
type: "string",
|
|
39
38
|
default: process.cwd()
|
|
40
39
|
},
|
|
41
40
|
clean: {
|
|
42
|
-
description:
|
|
41
|
+
description: "Empty output dir before compiling",
|
|
43
42
|
type: "boolean",
|
|
44
43
|
default: false
|
|
45
44
|
},
|
|
@@ -112,12 +111,12 @@ yargsInstance.command("build [directories...]", "Builds the specified directorie
|
|
|
112
111
|
const workspace = detectWorkspace(options.cwd);
|
|
113
112
|
const folders = resolvePackagesWithTypescriptFromMaybePatterns(directories, workspace);
|
|
114
113
|
await preCommandCheck(workspace);
|
|
114
|
+
if (folders.length === 0) {
|
|
115
|
+
return console.log("No build targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.");
|
|
116
|
+
}
|
|
115
117
|
const {
|
|
116
118
|
buildFolders
|
|
117
119
|
} = await import('./commands/build/index.mjs');
|
|
118
|
-
if (folders.length === 0) {
|
|
119
|
-
return console.log(translate("messages.buildSkipEmpty"));
|
|
120
|
-
}
|
|
121
120
|
await buildFolders({
|
|
122
121
|
...options,
|
|
123
122
|
packages: folders,
|
|
@@ -129,56 +128,56 @@ yargsInstance.command("publish [directory]", "Publishes the specified directory"
|
|
|
129
128
|
noUpload: {
|
|
130
129
|
type: "boolean",
|
|
131
130
|
default: false,
|
|
132
|
-
description:
|
|
131
|
+
description: "Only zip built files and do not upload them"
|
|
133
132
|
},
|
|
134
133
|
domain: {
|
|
135
134
|
type: "string",
|
|
136
|
-
description:
|
|
135
|
+
description: "Overwrite the publish domain. Defaults to the one in the _Package.json"
|
|
137
136
|
},
|
|
138
137
|
subdomain: {
|
|
139
138
|
type: "string",
|
|
140
|
-
description:
|
|
139
|
+
description: "Overwrite the publish subdomain. Defaults to the one in the _Package.json"
|
|
141
140
|
},
|
|
142
141
|
newVersion: {
|
|
143
142
|
type: "string",
|
|
144
|
-
description:
|
|
143
|
+
description: "The name of the new version",
|
|
145
144
|
default: process.env.VERSION,
|
|
146
145
|
required: true
|
|
147
146
|
},
|
|
148
147
|
address: {
|
|
149
148
|
type: "string",
|
|
150
|
-
description:
|
|
149
|
+
description: "Address",
|
|
151
150
|
default: "localhost"
|
|
152
151
|
},
|
|
153
152
|
service: {
|
|
154
153
|
type: "string",
|
|
155
|
-
description:
|
|
154
|
+
description: "IG.Asset.Server url",
|
|
156
155
|
default: process.env.IG_GFX_ASSET_SERVICE,
|
|
157
156
|
required: true
|
|
158
157
|
},
|
|
159
158
|
user: {
|
|
160
159
|
type: "string",
|
|
161
|
-
description:
|
|
160
|
+
description: "User",
|
|
162
161
|
default: process.env.IG_GFX_USER
|
|
163
162
|
},
|
|
164
163
|
password: {
|
|
165
164
|
type: "string",
|
|
166
|
-
description:
|
|
165
|
+
description: "Password",
|
|
167
166
|
default: process.env.IG_GFX_PWD
|
|
168
167
|
},
|
|
169
168
|
docs: {
|
|
170
169
|
type: "boolean",
|
|
171
170
|
default: false,
|
|
172
|
-
description:
|
|
171
|
+
description: "Generate typedoc documentation"
|
|
173
172
|
},
|
|
174
173
|
pushOnly: {
|
|
175
174
|
type: "boolean",
|
|
176
175
|
default: false,
|
|
177
|
-
description:
|
|
176
|
+
description: "Try to upload an existing zip file without building and validating the version number"
|
|
178
177
|
},
|
|
179
178
|
license: {
|
|
180
179
|
type: "string",
|
|
181
|
-
description:
|
|
180
|
+
description: "Path to a license file",
|
|
182
181
|
default: process.env.IG_GFX_LICENSE
|
|
183
182
|
}
|
|
184
183
|
}), async ({
|
|
@@ -194,7 +193,7 @@ yargsInstance.command("publish [directory]", "Publishes the specified directory"
|
|
|
194
193
|
await preCommandCheck(workspace);
|
|
195
194
|
if (!options.noUpload) {
|
|
196
195
|
if (!service) {
|
|
197
|
-
captureError(new Error(
|
|
196
|
+
captureError(new Error('The IG.Asset.Server url has to either be provided using the option --service or through the "IG_GFX_ASSET_SERVICE" environment variable'));
|
|
198
197
|
return;
|
|
199
198
|
}
|
|
200
199
|
if (!license && (!user || !password)) {
|
|
@@ -255,7 +254,7 @@ yargsInstance.command({
|
|
|
255
254
|
return argv.option("ignore", {
|
|
256
255
|
type: "array",
|
|
257
256
|
default: [],
|
|
258
|
-
description:
|
|
257
|
+
description: "Files to ignore while generating index"
|
|
259
258
|
});
|
|
260
259
|
},
|
|
261
260
|
handler: async ({
|
|
@@ -287,7 +286,7 @@ yargsInstance.command({
|
|
|
287
286
|
builder: argv => argv.options({
|
|
288
287
|
newVersion: {
|
|
289
288
|
type: "string",
|
|
290
|
-
description:
|
|
289
|
+
description: "Name of the new version",
|
|
291
290
|
default: process.env.VERSION,
|
|
292
291
|
required: true
|
|
293
292
|
},
|
package/build/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["import updateNotifier from \"update-notifier\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport yargs from \"yargs/yargs\";\nimport { fileURLToPath } from \"url\";\nimport glob from \"glob\";\n\nimport { translate } from \"./lib/localization\";\nimport { Authentication } from \"./lib/authentication\";\nimport { detectPackage, PackageLocation } from \"./lib/package\";\nimport {\n\tdetectWorkspace,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n\twriteWorkspaceNpmManifest,\n} from \"./lib/workspace\";\nimport type { ReleaseFolderOptions } from \"./commands/publish\";\nimport { createDefaultPrompter } from \"./lib/prompter\";\nimport { PackageJSON } from \"./lib/packageJSON\";\nimport { getPackageTypescriptFiles } from \"./lib/scripts\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst pjson: PackageJSON = JSON.parse(\n\tfs.readFileSync(path.join(__dirname, \"..\", \"package.json\"), \"utf8\"),\n);\n\nconst captureError = (err: Error) => {\n\tconsole.log(\"\");\n\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconsole.error(err);\n\t} else {\n\t\tconsole.error(translate(\"messages.error\", err.message));\n\t}\n};\n\nconst buildOptions = {\n\toutDir: {\n\t\tdescription: translate(\"options.outDir.description\"),\n\t\ttype: \"string\",\n\t\tdefault: \"bin\",\n\t\tcoerce: (input: string | undefined | null) =>\n\t\t\tinput === undefined || input === null\n\t\t\t\t? undefined\n\t\t\t\t: path.resolve(process.cwd(), input),\n\t},\n\tminimize: {\n\t\tdescription: translate(\"options.minimize.description\"),\n\t\ttype: \"boolean\",\n\t\tdefault: true,\n\t},\n\tcwd: {\n\t\tdescription: translate(\"options.cwd.description\"),\n\t\ttype: \"string\",\n\t\tdefault: process.cwd(),\n\t},\n\tclean: {\n\t\tdescription: translate(\"options.clean.description\"),\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t},\n\tdocs: {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t},\n} as const;\n\nconst preCommandCheck = async (workspaceLocation: WorkspaceLocation) => {\n\tconst executedLocalPackager =\n\t\tpath.relative(process.cwd(), __filename).indexOf(\"..\") === -1;\n\n\tlet repositoryPackage: PackageJSON | undefined;\n\n\ttry {\n\t\trepositoryPackage = readWorkspaceNpmManifest(workspaceLocation);\n\t} catch (err) {}\n\n\tif (\n\t\trepositoryPackage?.dependencies?.[\n\t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t\t] ||\n\t\trepositoryPackage?.devDependencies?.[\n\t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t\t]\n\t) {\n\t\tconst parts = [\"Detected locally installed ig.gfx.packager.\"];\n\n\t\tif (executedLocalPackager) {\n\t\t\tparts.push(\n\t\t\t\t'Run \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.',\n\t\t\t);\n\t\t}\n\t\tparts.push(\n\t\t\t'Run \"npm uninstall @intelligentgraphics/ig.gfx.packager\" to remove the local version.',\n\t\t);\n\n\t\tconsole.error(parts.join(\"\\n\"));\n\t\tprocess.exit(1);\n\t}\n\n\tif (executedLocalPackager) {\n\t\tconsole.error(`Detected locally installed ig.gfx.packager.\nRun \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.\nRun \"npm install\" to get rid of the local packager version.`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst notifier = updateNotifier({\n\t\tpkg: pjson,\n\t\tshouldNotifyInNpmScript: true,\n\t\tupdateCheckInterval: 1000 * 60,\n\t});\n\n\tnotifier.notify({\n\t\tisGlobal: true,\n\t\tdefer: true,\n\t});\n\n\tif (repositoryPackage === undefined) {\n\t\tthrow new Error(\n\t\t\t\"Could not load package.json file in current directory\",\n\t\t);\n\t}\n\n\trepositoryPackage.scripts ??= {};\n\trepositoryPackage.scripts.postinstall = \"packager postinstall\";\n\n\twriteWorkspaceNpmManifest(workspaceLocation, repositoryPackage);\n};\n\nconst yargsInstance = yargs(process.argv.slice(2));\n\nconst resolvePackagesWithTypescriptFromMaybePatterns = (\n\targs: string[] = [],\n\tworkspace: WorkspaceLocation,\n) => {\n\tconst folders = new Map<string, PackageLocation>();\n\n\tfor (const arg of args) {\n\t\tglob.sync(arg, { cwd: workspace.path, absolute: true }).forEach(\n\t\t\t(folder) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst location = detectPackage(workspace, folder);\n\n\t\t\t\t\tif (getPackageTypescriptFiles(location).length === 0) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tfolders.set(folder, location);\n\t\t\t\t} catch (err) {}\n\t\t\t},\n\t\t);\n\t}\n\n\treturn Array.from(folders.values());\n};\n\nyargsInstance.command(\n\t\"build [directories...]\",\n\t\"Builds the specified directories\",\n\t(argv) => argv.options(buildOptions),\n\tasync ({ directories = [], ...options }) => {\n\t\tconst workspace = detectWorkspace(options.cwd);\n\t\tconst folders = resolvePackagesWithTypescriptFromMaybePatterns(\n\t\t\tdirectories as string[],\n\t\t\tworkspace,\n\t\t);\n\n\t\tawait preCommandCheck(workspace);\n\n\t\tconst { buildFolders } = await import(\"./commands/build\");\n\n\t\tif (folders.length === 0) {\n\t\t\treturn console.log(translate(\"messages.buildSkipEmpty\"));\n\t\t}\n\n\t\tawait buildFolders({\n\t\t\t...options,\n\t\t\tpackages: folders,\n\t\t\tworkspace,\n\t\t}).catch(captureError);\n\t},\n);\n\nyargsInstance.command(\n\t\"publish [directory]\",\n\t\"Publishes the specified directory\",\n\t(argv) =>\n\t\targv.options({\n\t\t\t...buildOptions,\n\t\t\tnoUpload: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.noUpload.description\"),\n\t\t\t},\n\t\t\tdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.domain.description\"),\n\t\t\t},\n\t\t\tsubdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.subdomain.description\"),\n\t\t\t},\n\t\t\tnewVersion: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.newVersion.description\"),\n\t\t\t\tdefault: process.env.VERSION,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\taddress: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.address.description\"),\n\t\t\t\tdefault: \"localhost\",\n\t\t\t},\n\t\t\tservice: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.service.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_ASSET_SERVICE,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\tuser: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.user.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_USER,\n\t\t\t},\n\t\t\tpassword: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.password.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_PWD,\n\t\t\t},\n\t\t\tdocs: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.docs.description\"),\n\t\t\t},\n\t\t\tpushOnly: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: translate(\"options.pushOnly.description\"),\n\t\t\t},\n\t\t\tlicense: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.license.description\"),\n\t\t\t\tdefault: process.env.IG_GFX_LICENSE,\n\t\t\t},\n\t\t}),\n\tasync ({ directory, user, password, service, license, ...options }) => {\n\t\tconst workspace = detectWorkspace(options.cwd);\n\t\tconst folder = detectPackage(workspace, directory as string);\n\n\t\tawait preCommandCheck(workspace);\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!service) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\ttranslate(\n\t\t\t\t\t\t\t\"options.service.demands\",\n\t\t\t\t\t\t\t\"IG_GFX_ASSET_SERVICE\",\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!license && (!user || !password)) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected authentication to be provided through either of the following methods:\n\t - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable\n\t - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (license && !license.endsWith(\".iglic\")) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected the license path to end with the extension .iglic. Received the path \"${license}\". You may need to reload your environment variables by restarting the program you're using to execute the packager.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlet authentication: Authentication | undefined;\n\n\t\tif (license) {\n\t\t\tconst fullLicensePath = path.resolve(process.cwd(), license);\n\t\t\ttry {\n\t\t\t\tconst content = fs.readFileSync(fullLicensePath);\n\t\t\t\tauthentication = {\n\t\t\t\t\ttype: \"license\",\n\t\t\t\t\tlicense: content.toString(\"base64\"),\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tif (err?.code === \"ENOENT\") {\n\t\t\t\t\tcaptureError(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Expected to find a license file at path: ${fullLicensePath}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Failed to read license file at path: ${fullLicensePath}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (user && password) {\n\t\t\tconsole.log(\n\t\t\t\t`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`,\n\t\t\t);\n\t\t\tauthentication = {\n\t\t\t\ttype: \"credentials\",\n\t\t\t\tusername: user,\n\t\t\t\tpassword,\n\t\t\t};\n\t\t}\n\n\t\tconst { releaseFolder } = await import(\"./commands/publish\");\n\n\t\tconst prompter = createDefaultPrompter();\n\n\t\tconst fullOptions: ReleaseFolderOptions = {\n\t\t\t...options,\n\t\t\tauthentication,\n\t\t\tservice: service!,\n\t\t\tdirectory: folder,\n\t\t\tbanner: true,\n\t\t\tprompter,\n\t\t\tnewVersion: options.newVersion!,\n\t\t\tworkspace,\n\t\t};\n\n\t\tawait releaseFolder(fullOptions).catch(captureError);\n\t},\n);\n\nyargsInstance.command({\n\tcommand: \"generateIndex [directory]\",\n\tbuilder: (argv) => {\n\t\treturn argv.option(\"ignore\", {\n\t\t\ttype: \"array\",\n\t\t\tdefault: [],\n\t\t\tdescription: translate(\"options.ignore.description\"),\n\t\t});\n\t},\n\thandler: async ({ directory, ignore }) => {\n\t\tconst workspace = detectWorkspace(process.cwd());\n\n\t\tawait preCommandCheck(workspace);\n\n\t\tconst { extract } = await import(\"./commands/generate\");\n\n\t\tconst location = detectPackage(workspace, directory as string);\n\n\t\textract(location, ignore as string[]);\n\t},\n});\n\nyargsInstance.command({\n\tcommand: \"postinstall\",\n\tbuilder: (argv) => argv,\n\thandler: async () => {\n\t\tconst { executePostInstall } = await import(\"./commands/postinstall\");\n\n\t\texecutePostInstall(detectWorkspace(process.cwd()));\n\t},\n\tdescribe: \"Runs postinstall tasks\",\n});\n\nyargsInstance.command({\n\tcommand: \"publishNpm [directory]\",\n\tbuilder: (argv) =>\n\t\targv.options({\n\t\t\tnewVersion: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: translate(\"options.newVersion.description\"),\n\t\t\t\tdefault: process.env.VERSION,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\tdryRun: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t}),\n\thandler: async ({ directory, newVersion, dryRun }) => {\n\t\tconst workspace = detectWorkspace(process.cwd());\n\n\t\tconst { publishToNpm } = await import(\"./commands/publishNpm\");\n\n\t\tawait publishToNpm({\n\t\t\tworkspace,\n\t\t\tlocation: detectPackage(workspace, directory as string),\n\t\t\tversion: newVersion,\n\t\t\tdryRun,\n\t\t}).catch(captureError);\n\t},\n\tdescribe: \"Publishes the package to npm\",\n});\n\nyargsInstance\n\t.demandCommand()\n\t.pkgConf(\"packager\")\n\t.showHelpOnFail(false)\n\t.version().argv;\n"],"names":["__filename","fileURLToPath","import","meta","url","__dirname","path","dirname","pjson","JSON","parse","fs","readFileSync","join","captureError","err","console","log","process","env","NODE_ENV","error","translate","message","buildOptions","outDir","description","type","default","coerce","input","undefined","resolve","cwd","minimize","clean","docs","preCommandCheck","workspaceLocation","executedLocalPackager","relative","indexOf","repositoryPackage","readWorkspaceNpmManifest","dependencies","devDependencies","parts","push","exit","notifier","updateNotifier","pkg","shouldNotifyInNpmScript","updateCheckInterval","notify","isGlobal","defer","Error","scripts","postinstall","writeWorkspaceNpmManifest","yargsInstance","yargs","argv","slice","resolvePackagesWithTypescriptFromMaybePatterns","args","workspace","folders","Map","arg","glob","sync","absolute","forEach","folder","location","detectPackage","getPackageTypescriptFiles","length","set","Array","from","values","command","options","directories","detectWorkspace","buildFolders","packages","catch","noUpload","domain","subdomain","newVersion","VERSION","required","address","service","IG_GFX_ASSET_SERVICE","user","IG_GFX_USER","password","IG_GFX_PWD","pushOnly","license","IG_GFX_LICENSE","directory","endsWith","authentication","fullLicensePath","content","toString","code","username","releaseFolder","prompter","createDefaultPrompter","fullOptions","banner","builder","option","handler","ignore","extract","executePostInstall","describe","dryRun","publishToNpm","version","demandCommand","pkgConf","showHelpOnFail"],"mappings":";;;;;;;;;;;;AAqBA,MAAMA,UAAU,GAAGC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAA;AACjD,MAAMC,SAAS,GAAGC,IAAI,CAACC,OAAO,CAACP,UAAU,CAAC,CAAA;AAE1C,MAAMQ,KAAkB,GAAGC,IAAI,CAACC,KAAK,CACpCC,EAAE,CAACC,YAAY,CAACN,IAAI,CAACO,IAAI,CAACR,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CACnE,CAAA;AAED,MAAMS,YAAY,GAAIC,GAAU,IAAK;AACpCC,EAAAA,OAAO,CAACC,GAAG,CAAC,EAAE,CAAC,CAAA;AAEf,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;AAC1CJ,IAAAA,OAAO,CAACK,KAAK,CAACN,GAAG,CAAC,CAAA;AACnB,GAAC,MAAM;IACNC,OAAO,CAACK,KAAK,CAACC,SAAS,CAAC,gBAAgB,EAAEP,GAAG,CAACQ,OAAO,CAAC,CAAC,CAAA;AACxD,GAAA;AACD,CAAC,CAAA;AAED,MAAMC,YAAY,GAAG;AACpBC,EAAAA,MAAM,EAAE;AACPC,IAAAA,WAAW,EAAEJ,SAAS,CAAC,4BAA4B,CAAC;AACpDK,IAAAA,IAAI,E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AAE,CAAClE,IAAI"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["import updateNotifier from \"update-notifier\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport yargs from \"yargs/yargs\";\nimport { fileURLToPath } from \"url\";\nimport glob from \"glob\";\n\nimport { Authentication } from \"./lib/authentication\";\nimport { detectPackage, PackageLocation } from \"./lib/package\";\nimport {\n\tdetectWorkspace,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n\twriteWorkspaceNpmManifest,\n} from \"./lib/workspace\";\nimport type { ReleaseFolderOptions } from \"./commands/publish\";\nimport { createDefaultPrompter } from \"./lib/prompter\";\nimport { PackageJSON } from \"./lib/packageJSON\";\nimport { getPackageTypescriptFiles } from \"./lib/scripts\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst pjson: PackageJSON = JSON.parse(\n\tfs.readFileSync(path.join(__dirname, \"..\", \"package.json\"), \"utf8\"),\n);\n\nconst captureError = (err: Error) => {\n\tconsole.log(\"\");\n\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconsole.error(err);\n\t} else {\n\t\tconsole.error(\n\t\t\t\"Stopped execution because of the following error: \" + err.message,\n\t\t);\n\t}\n};\n\nconst buildOptions = {\n\toutDir: {\n\t\tdescription: \"Output directory\",\n\t\ttype: \"string\",\n\t\tdefault: \"bin\",\n\t\tcoerce: (input: string | undefined | null) =>\n\t\t\tinput === undefined || input === null\n\t\t\t\t? undefined\n\t\t\t\t: path.resolve(process.cwd(), input),\n\t},\n\tminimize: {\n\t\tdescription: \"Minify output\",\n\t\ttype: \"boolean\",\n\t\tdefault: true,\n\t},\n\tcwd: {\n\t\tdescription: \"Working directory\",\n\t\ttype: \"string\",\n\t\tdefault: process.cwd(),\n\t},\n\tclean: {\n\t\tdescription: \"Empty output dir before compiling\",\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t},\n\tdocs: {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t},\n} as const;\n\nconst preCommandCheck = async (workspaceLocation: WorkspaceLocation) => {\n\tconst executedLocalPackager =\n\t\tpath.relative(process.cwd(), __filename).indexOf(\"..\") === -1;\n\n\tlet repositoryPackage: PackageJSON | undefined;\n\n\ttry {\n\t\trepositoryPackage = readWorkspaceNpmManifest(workspaceLocation);\n\t} catch (err) {}\n\n\tif (\n\t\trepositoryPackage?.dependencies?.[\n\t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t\t] ||\n\t\trepositoryPackage?.devDependencies?.[\n\t\t\t\"@intelligentgraphics/ig.gfx.packager\"\n\t\t]\n\t) {\n\t\tconst parts = [\"Detected locally installed ig.gfx.packager.\"];\n\n\t\tif (executedLocalPackager) {\n\t\t\tparts.push(\n\t\t\t\t'Run \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.',\n\t\t\t);\n\t\t}\n\t\tparts.push(\n\t\t\t'Run \"npm uninstall @intelligentgraphics/ig.gfx.packager\" to remove the local version.',\n\t\t);\n\n\t\tconsole.error(parts.join(\"\\n\"));\n\t\tprocess.exit(1);\n\t}\n\n\tif (executedLocalPackager) {\n\t\tconsole.error(`Detected locally installed ig.gfx.packager.\nRun \"npm install -g @intelligentgraphics/ig.gfx.packager@latest\" to install the global version, if it is not yet installed.\nRun \"npm install\" to get rid of the local packager version.`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst notifier = updateNotifier({\n\t\tpkg: pjson,\n\t\tshouldNotifyInNpmScript: true,\n\t\tupdateCheckInterval: 1000 * 60,\n\t});\n\n\tnotifier.notify({\n\t\tisGlobal: true,\n\t\tdefer: true,\n\t});\n\n\tif (repositoryPackage === undefined) {\n\t\tthrow new Error(\n\t\t\t\"Could not load package.json file in current directory\",\n\t\t);\n\t}\n\n\trepositoryPackage.scripts ??= {};\n\trepositoryPackage.scripts.postinstall = \"packager postinstall\";\n\n\twriteWorkspaceNpmManifest(workspaceLocation, repositoryPackage);\n};\n\nconst yargsInstance = yargs(process.argv.slice(2));\n\nconst resolvePackagesWithTypescriptFromMaybePatterns = (\n\targs: string[] = [],\n\tworkspace: WorkspaceLocation,\n) => {\n\tconst folders = new Map<string, PackageLocation>();\n\n\tfor (const arg of args) {\n\t\tglob.sync(arg, { cwd: workspace.path, absolute: true }).forEach(\n\t\t\t(folder) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst location = detectPackage(workspace, folder);\n\n\t\t\t\t\tif (getPackageTypescriptFiles(location).length === 0) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tfolders.set(folder, location);\n\t\t\t\t} catch (err) {}\n\t\t\t},\n\t\t);\n\t}\n\n\treturn Array.from(folders.values());\n};\n\nyargsInstance.command(\n\t\"build [directories...]\",\n\t\"Builds the specified directories\",\n\t(argv) => argv.options(buildOptions),\n\tasync ({ directories = [], ...options }) => {\n\t\tconst workspace = detectWorkspace(options.cwd);\n\t\tconst folders = resolvePackagesWithTypescriptFromMaybePatterns(\n\t\t\tdirectories as string[],\n\t\t\tworkspace,\n\t\t);\n\n\t\tawait preCommandCheck(workspace);\n\n\t\tif (folders.length === 0) {\n\t\t\treturn console.log(\n\t\t\t\t\"No build targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.\",\n\t\t\t);\n\t\t}\n\n\t\tconst { buildFolders } = await import(\"./commands/build\");\n\n\t\tawait buildFolders({\n\t\t\t...options,\n\t\t\tpackages: folders,\n\t\t\tworkspace,\n\t\t}).catch(captureError);\n\t},\n);\n\nyargsInstance.command(\n\t\"publish [directory]\",\n\t\"Publishes the specified directory\",\n\t(argv) =>\n\t\targv.options({\n\t\t\t...buildOptions,\n\t\t\tnoUpload: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: \"Only zip built files and do not upload them\",\n\t\t\t},\n\t\t\tdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Overwrite the publish domain. Defaults to the one in the _Package.json\",\n\t\t\t},\n\t\t\tsubdomain: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Overwrite the publish subdomain. Defaults to the one in the _Package.json\",\n\t\t\t},\n\t\t\tnewVersion: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: \"The name of the new version\",\n\t\t\t\tdefault: process.env.VERSION,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\taddress: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: \"Address\",\n\t\t\t\tdefault: \"localhost\",\n\t\t\t},\n\t\t\tservice: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: \"IG.Asset.Server url\",\n\t\t\t\tdefault: process.env.IG_GFX_ASSET_SERVICE,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\tuser: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: \"User\",\n\t\t\t\tdefault: process.env.IG_GFX_USER,\n\t\t\t},\n\t\t\tpassword: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: \"Password\",\n\t\t\t\tdefault: process.env.IG_GFX_PWD,\n\t\t\t},\n\t\t\tdocs: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: \"Generate typedoc documentation\",\n\t\t\t},\n\t\t\tpushOnly: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t\tdefault: false,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Try to upload an existing zip file without building and validating the version number\",\n\t\t\t},\n\t\t\tlicense: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: \"Path to a license file\",\n\t\t\t\tdefault: process.env.IG_GFX_LICENSE,\n\t\t\t},\n\t\t}),\n\tasync ({ directory, user, password, service, license, ...options }) => {\n\t\tconst workspace = detectWorkspace(options.cwd);\n\t\tconst folder = detectPackage(workspace, directory as string);\n\n\t\tawait preCommandCheck(workspace);\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!service) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t'The IG.Asset.Server url has to either be provided using the option --service or through the \"IG_GFX_ASSET_SERVICE\" environment variable',\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!license && (!user || !password)) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected authentication to be provided through either of the following methods:\n\t - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable\n\t - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (license && !license.endsWith(\".iglic\")) {\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Expected the license path to end with the extension .iglic. Received the path \"${license}\". You may need to reload your environment variables by restarting the program you're using to execute the packager.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlet authentication: Authentication | undefined;\n\n\t\tif (license) {\n\t\t\tconst fullLicensePath = path.resolve(process.cwd(), license);\n\t\t\ttry {\n\t\t\t\tconst content = fs.readFileSync(fullLicensePath);\n\t\t\t\tauthentication = {\n\t\t\t\t\ttype: \"license\",\n\t\t\t\t\tlicense: content.toString(\"base64\"),\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tif (err?.code === \"ENOENT\") {\n\t\t\t\t\tcaptureError(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Expected to find a license file at path: ${fullLicensePath}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcaptureError(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`Failed to read license file at path: ${fullLicensePath}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (user && password) {\n\t\t\tconsole.log(\n\t\t\t\t`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`,\n\t\t\t);\n\t\t\tauthentication = {\n\t\t\t\ttype: \"credentials\",\n\t\t\t\tusername: user,\n\t\t\t\tpassword,\n\t\t\t};\n\t\t}\n\n\t\tconst { releaseFolder } = await import(\"./commands/publish\");\n\n\t\tconst prompter = createDefaultPrompter();\n\n\t\tconst fullOptions: ReleaseFolderOptions = {\n\t\t\t...options,\n\t\t\tauthentication,\n\t\t\tservice: service!,\n\t\t\tdirectory: folder,\n\t\t\tbanner: true,\n\t\t\tprompter,\n\t\t\tnewVersion: options.newVersion!,\n\t\t\tworkspace,\n\t\t};\n\n\t\tawait releaseFolder(fullOptions).catch(captureError);\n\t},\n);\n\nyargsInstance.command({\n\tcommand: \"generateIndex [directory]\",\n\tbuilder: (argv) => {\n\t\treturn argv.option(\"ignore\", {\n\t\t\ttype: \"array\",\n\t\t\tdefault: [],\n\t\t\tdescription: \"Files to ignore while generating index\",\n\t\t});\n\t},\n\thandler: async ({ directory, ignore }) => {\n\t\tconst workspace = detectWorkspace(process.cwd());\n\n\t\tawait preCommandCheck(workspace);\n\n\t\tconst { extract } = await import(\"./commands/generate\");\n\n\t\tconst location = detectPackage(workspace, directory as string);\n\n\t\textract(location, ignore as string[]);\n\t},\n});\n\nyargsInstance.command({\n\tcommand: \"postinstall\",\n\tbuilder: (argv) => argv,\n\thandler: async () => {\n\t\tconst { executePostInstall } = await import(\"./commands/postinstall\");\n\n\t\texecutePostInstall(detectWorkspace(process.cwd()));\n\t},\n\tdescribe: \"Runs postinstall tasks\",\n});\n\nyargsInstance.command({\n\tcommand: \"publishNpm [directory]\",\n\tbuilder: (argv) =>\n\t\targv.options({\n\t\t\tnewVersion: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: \"Name of the new version\",\n\t\t\t\tdefault: process.env.VERSION,\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\tdryRun: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t}),\n\thandler: async ({ directory, newVersion, dryRun }) => {\n\t\tconst workspace = detectWorkspace(process.cwd());\n\n\t\tconst { publishToNpm } = await import(\"./commands/publishNpm\");\n\n\t\tawait publishToNpm({\n\t\t\tworkspace,\n\t\t\tlocation: detectPackage(workspace, directory as string),\n\t\t\tversion: newVersion,\n\t\t\tdryRun,\n\t\t}).catch(captureError);\n\t},\n\tdescribe: \"Publishes the package to npm\",\n});\n\nyargsInstance\n\t.demandCommand()\n\t.pkgConf(\"packager\")\n\t.showHelpOnFail(false)\n\t.version().argv;\n"],"names":["__filename","fileURLToPath","import","meta","url","__dirname","path","dirname","pjson","JSON","parse","fs","readFileSync","join","captureError","err","console","log","process","env","NODE_ENV","error","message","buildOptions","outDir","description","type","default","coerce","input","undefined","resolve","cwd","minimize","clean","docs","preCommandCheck","workspaceLocation","executedLocalPackager","relative","indexOf","repositoryPackage","readWorkspaceNpmManifest","dependencies","devDependencies","parts","push","exit","notifier","updateNotifier","pkg","shouldNotifyInNpmScript","updateCheckInterval","notify","isGlobal","defer","Error","scripts","postinstall","writeWorkspaceNpmManifest","yargsInstance","yargs","argv","slice","resolvePackagesWithTypescriptFromMaybePatterns","args","workspace","folders","Map","arg","glob","sync","absolute","forEach","folder","location","detectPackage","getPackageTypescriptFiles","length","set","Array","from","values","command","options","directories","detectWorkspace","buildFolders","packages","catch","noUpload","domain","subdomain","newVersion","VERSION","required","address","service","IG_GFX_ASSET_SERVICE","user","IG_GFX_USER","password","IG_GFX_PWD","pushOnly","license","IG_GFX_LICENSE","directory","endsWith","authentication","fullLicensePath","content","toString","code","username","releaseFolder","prompter","createDefaultPrompter","fullOptions","banner","builder","option","handler","ignore","extract","executePostInstall","describe","dryRun","publishToNpm","version","demandCommand","pkgConf","showHelpOnFail"],"mappings":";;;;;;;;;;;AAoBA,MAAMA,UAAU,GAAGC,aAAa,CAACC,MAAM,CAACC,IAAI,CAAC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MAAAA,QAAQ,EAAEC,aAAa,CAACV,SAAS,EAAEwC,SAAS,CAAW;AACvDsB,MAAAA,OAAO,EAAEnC,UAAU;AACnBiC,MAAAA,MAAAA;AACD,KAAC,CAAC,CAACrC,KAAK,CAAC3E,YAAY,CAAC,CAAA;GACtB;AACD+G,EAAAA,QAAQ,EAAE,8BAAA;AACX,CAAC,CAAC,CAAA;AAEFjE,aAAa,CACXqE,aAAa,EAAE,CACfC,OAAO,CAAC,UAAU,CAAC,CACnBC,cAAc,CAAC,KAAK,CAAC,CACrBH,OAAO,EAAE,CAAClE,IAAI"}
|
|
@@ -2,7 +2,6 @@ import * as path from 'path';
|
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as terser from 'terser';
|
|
4
4
|
import { logPackageMessage } from '../../lib/log.mjs';
|
|
5
|
-
import { translate } from '../../lib/localization.mjs';
|
|
6
5
|
import { build } from './tsc.mjs';
|
|
7
6
|
import { generateDocs } from './docs.mjs';
|
|
8
7
|
import { readPackageCreatorManifest, readPackageNpmManifest } from '../../lib/package.mjs';
|
|
@@ -26,7 +25,7 @@ const buildFolders = async options => {
|
|
|
26
25
|
ensureTsConfig(location);
|
|
27
26
|
const data = readPackageCreatorManifest(location);
|
|
28
27
|
const logStep = step => logPackageMessage(data.Package, step, index, folders.length);
|
|
29
|
-
logStep(
|
|
28
|
+
logStep("Compiling typescript to javascript");
|
|
30
29
|
const outputDirectory = options.outDir || location.scriptsDir;
|
|
31
30
|
fs.mkdirSync(outputDirectory, {
|
|
32
31
|
recursive: true
|
|
@@ -56,18 +55,15 @@ const buildFolders = async options => {
|
|
|
56
55
|
fs.mkdirSync(path.join(workspace.path, "lib"), {
|
|
57
56
|
recursive: true
|
|
58
57
|
});
|
|
59
|
-
logStep(
|
|
58
|
+
logStep("Copying basics definition file to the lib folder");
|
|
60
59
|
fs.writeFileSync(path.join(workspace.path, "lib", `${data.Package}.d.ts`), buildResult.definitions, {
|
|
61
60
|
encoding: "utf8"
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
if (options.docs) {
|
|
65
|
-
logStep(
|
|
64
|
+
logStep("Generating typedoc documentation");
|
|
66
65
|
await generateDocs(location, path.join(outputDirectory, `${data.Package}.d.ts`), path.join(workspace.path, "docs", data.Package), data.Package);
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
// logStep(translate("messages.built"));
|
|
70
|
-
|
|
71
67
|
index++;
|
|
72
68
|
}
|
|
73
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/commands/build/index.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport * as terser from \"terser\";\n\nimport { logPackageMessage } from \"../../lib/log\";\nimport { translate } from \"../../lib/localization\";\nimport { build as tscBuild } from \"./tsc\";\nimport { generateDocs } from \"./docs\";\nimport {\n\tPackageLocation,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n} from \"../../lib/package\";\nimport { WorkspaceLocation } from \"../../lib/workspace\";\nimport { getPackageTypescriptFiles } from \"../../lib/scripts\";\nimport { toposort } from \"../../lib/toposort\";\nimport { PackageJSON } from \"../../lib/packageJSON\";\n\nexport interface BannerOptions {\n\ttext: string | undefined;\n\tversion: string | undefined;\n\tcommit: string | undefined;\n\tcommitDirty: boolean | undefined;\n\tdate: Date | undefined;\n}\n\nexport interface BuildFoldersOptions {\n\tworkspace: WorkspaceLocation;\n\tpackages: PackageLocation[];\n\toutDir?: string;\n\tminimize: boolean;\n\tbanner?: BannerOptions;\n\tclean?: boolean;\n\tdocs?: boolean;\n\tskipPackagesWithoutTsFiles?: boolean;\n}\n\nexport interface BuildFolderOptions extends BuildFoldersOptions {\n\toutFile: string;\n}\n\nexport interface FolderBuilderResult {\n\tjs: string;\n\tdefinitions: string;\n}\n\nexport type FolderBuilder = (\n\tlocation: PackageLocation,\n\toutputDir: string,\n) => Promise<FolderBuilderResult>;\n\ntype FolderData = {\n\tlocation: PackageLocation;\n\tdata?: PackageJSON;\n};\n\nexport const buildFolders = async (options: BuildFoldersOptions) => {\n\tif (options.outDir !== undefined && options.clean) {\n\t\tfs.rmSync(options.outDir, { recursive: true });\n\t}\n\n\tconst workspace = options.workspace;\n\tconst folders = options.packages;\n\n\tconst sortedPackages = sortPackagesByBuildOrder(folders);\n\n\tlet index = 1;\n\n\tfor (const location of sortedPackages) {\n\t\tif (\n\t\t\toptions.skipPackagesWithoutTsFiles &&\n\t\t\tgetPackageTypescriptFiles(location).length === 0\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tensureTsConfig(location);\n\n\t\tconst data = readPackageCreatorManifest(location);\n\n\t\tconst logStep = (step: string) =>\n\t\t\tlogPackageMessage(data.Package, step, index, folders.length);\n\n\t\tlogStep(translate(\"messages.building\"));\n\n\t\tconst outputDirectory = options.outDir || location.scriptsDir;\n\t\tfs.mkdirSync(outputDirectory, { recursive: true });\n\n\t\tconst buildResult = await tscBuild(location, outputDirectory);\n\t\tconst banner = options.banner\n\t\t\t? createBannerComment(options.banner)\n\t\t\t: undefined;\n\n\t\tif (banner) {\n\t\t\tbuildResult.js = banner + \"\\n\" + buildResult.js;\n\t\t\tbuildResult.definitions = banner + \"\\n\" + buildResult.definitions;\n\t\t}\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(outputDirectory, `${data.Package}.js`),\n\t\t\tbuildResult.js,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\t\tfs.writeFileSync(\n\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\tbuildResult.definitions,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\n\t\tif (options.minimize) {\n\t\t\tconst minifyResult = await terser.minify(buildResult.js, {\n\t\t\t\tecma: 5,\n\t\t\t});\n\n\t\t\tconst minifiedPath = path.join(\n\t\t\t\toutputDirectory,\n\t\t\t\t`${data.Package}.min.js`,\n\t\t\t);\n\t\t\tfs.writeFileSync(minifiedPath, minifyResult.code!, {\n\t\t\t\tencoding: \"utf8\",\n\t\t\t});\n\t\t}\n\n\t\tif (location.path.includes(\"Basics\")) {\n\t\t\tfs.mkdirSync(path.join(workspace.path, \"lib\"), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\n\t\t\tlogStep(translate(\"messages.basicsCopy\"));\n\t\t\tfs.writeFileSync(\n\t\t\t\tpath.join(workspace.path, \"lib\", `${data.Package}.d.ts`),\n\t\t\t\tbuildResult.definitions,\n\t\t\t\t{ encoding: \"utf8\" },\n\t\t\t);\n\t\t}\n\n\t\tif (options.docs) {\n\t\t\tlogStep(translate(\"messages.docsGeneration\"));\n\t\t\tawait generateDocs(\n\t\t\t\tlocation,\n\t\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\t\tpath.join(workspace.path, \"docs\", data.Package),\n\t\t\t\tdata.Package,\n\t\t\t);\n\t\t}\n\n\t\t// logStep(translate(\"messages.built\"));\n\n\t\tindex++;\n\t}\n};\n\nconst ensureTsConfig = (location: PackageLocation) => {\n\tconst tsconfigPath = path.join(location.scriptsDir, \"tsconfig.json\");\n\n\tif (!fs.existsSync(tsconfigPath)) {\n\t\tconst content = {};\n\t\tapplyTsConfigOption(content);\n\n\t\tfs.writeFileSync(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\t} else {\n\t\tconst content = JSON.parse(fs.readFileSync(tsconfigPath, \"utf8\"));\n\t\tapplyTsConfigOption(content);\n\t\tfs.writeFileSync(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n};\n\nconst applyTsConfigOption = (data: {\n\tcompilerOptions?: { target?: string; lib?: string[] };\n}) => {\n\tdata.compilerOptions = data.compilerOptions ?? {};\n\tdata.compilerOptions.target = \"es5\";\n\tdata.compilerOptions.lib = [\"es5\", \"dom\"];\n};\n\nconst sortPackagesByBuildOrder = (\n\tfolders: PackageLocation[],\n): PackageLocation[] => {\n\tconst packages = Array.from(folders).reduce(\n\t\t(\n\t\t\tacc: Record<string, FolderData>,\n\t\t\tlocation,\n\t\t): Record<string, FolderData> => {\n\t\t\tconst data = readPackageNpmManifest(location);\n\n\t\t\tif (data !== undefined) {\n\t\t\t\tacc[data.name] = {\n\t\t\t\t\tdata,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tacc[location.path] = {\n\t\t\t\t\tdata: undefined,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst packageDependencies = Object.getOwnPropertyNames(packages).reduce(\n\t\t(acc, packageName) => {\n\t\t\tconst packageData = packages[packageName];\n\n\t\t\tif (packageData.data === undefined) {\n\t\t\t\tacc[packageName] = [];\n\t\t\t} else {\n\t\t\t\tacc[packageName] = Object.getOwnPropertyNames({\n\t\t\t\t\t...packageData.data.devDependencies,\n\t\t\t\t\t...packageData.data.dependencies,\n\t\t\t\t\t...packageData.data.peerDependencies,\n\t\t\t\t}).filter((packageName) => packages[packageName] !== undefined);\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst sortedPackages = toposort(packageDependencies);\n\tconst result: PackageLocation[] = [];\n\n\tfor (const packageName of sortedPackages) {\n\t\tconst location = packages[packageName].location;\n\n\t\tif (readPackageCreatorManifest(location).Package.endsWith(\".Basics\")) {\n\t\t\tresult.unshift(location);\n\t\t} else {\n\t\t\tresult.push(location);\n\t\t}\n\t}\n\n\treturn result;\n};\n\nconst createBannerComment = (banner: BannerOptions) => {\n\tconst bannerParts: string[] = [];\n\n\tif (banner.text) {\n\t\tbannerParts.push(\" * \" + banner.text);\n\t}\n\n\t{\n\t\tconst details: string[] = [];\n\n\t\tif (banner.version) {\n\t\t\tdetails.push(`Version: ${banner.version}`);\n\t\t}\n\t\tif (banner.commit) {\n\t\t\tif (banner.commitDirty) {\n\t\t\t\tdetails.push(`Commit: ${banner.commit} (dirty)`);\n\t\t\t} else {\n\t\t\t\tdetails.push(`Commit: ${banner.commit}`);\n\t\t\t}\n\t\t}\n\t\tif (banner.date) {\n\t\t\tdetails.push(`Date: ${banner.date.toISOString()}`);\n\t\t}\n\n\t\tconst detailsText = details.map((line) => ` * ${line}`).join(\"\\n\");\n\t\tif (detailsText) {\n\t\t\tbannerParts.push(detailsText);\n\t\t}\n\t}\n\n\tconst bannerText = bannerParts.join(\"\\n\\n\");\n\n\tif (bannerText) {\n\t\treturn `/*\n${bannerText}\n*\n* @preserve\t\t\t\n*/`;\n\t}\n\n\treturn undefined;\n};\n"],"names":["buildFolders","options","outDir","undefined","clean","fs","rmSync","recursive","workspace","folders","packages","sortedPackages","sortPackagesByBuildOrder","index","location","skipPackagesWithoutTsFiles","getPackageTypescriptFiles","length","ensureTsConfig","data","readPackageCreatorManifest","logStep","step","logPackageMessage","Package","translate","outputDirectory","scriptsDir","mkdirSync","buildResult","tscBuild","banner","createBannerComment","js","definitions","writeFileSync","path","join","encoding","minimize","minifyResult","terser","minify","ecma","minifiedPath","code","includes","docs","generateDocs","tsconfigPath","existsSync","content","applyTsConfigOption","JSON","stringify","parse","readFileSync","compilerOptions","target","lib","Array","from","reduce","acc","readPackageNpmManifest","name","packageDependencies","Object","getOwnPropertyNames","packageName","packageData","devDependencies","dependencies","peerDependencies","filter","toposort","result","endsWith","unshift","push","bannerParts","text","details","version","commit","commitDirty","date","toISOString","detailsText","map","line","bannerText"],"mappings":";;;;;;;;;;;AAwDaA,MAAAA,YAAY,GAAG,MAAOC,OAA4B,IAAK;EACnE,IAAIA,OAAO,CAACC,MAAM,KAAKC,SAAS,IAAIF,OAAO,CAACG,KAAK,EAAE;AAClDC,IAAAA,EAAE,CAACC,MAAM,CAACL,OAAO,CAACC,MAAM,EAAE;AAAEK,MAAAA,SAAS,EAAE,IAAA;AAAK,KAAC,CAAC,CAAA;AAC/C,GAAA;AAEA,EAAA,MA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UAAW,CAAA;AACb;AACA;AACA,EAAG,CAAA,CAAA;AACF,GAAA;AAEA,EAAA,OAAOxF,SAAS,CAAA;AACjB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/commands/build/index.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport * as terser from \"terser\";\n\nimport { logPackageMessage } from \"../../lib/log\";\nimport { build as tscBuild } from \"./tsc\";\nimport { generateDocs } from \"./docs\";\nimport {\n\tPackageLocation,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n} from \"../../lib/package\";\nimport { WorkspaceLocation } from \"../../lib/workspace\";\nimport { getPackageTypescriptFiles } from \"../../lib/scripts\";\nimport { toposort } from \"../../lib/toposort\";\nimport { PackageJSON } from \"../../lib/packageJSON\";\n\nexport interface BannerOptions {\n\ttext: string | undefined;\n\tversion: string | undefined;\n\tcommit: string | undefined;\n\tcommitDirty: boolean | undefined;\n\tdate: Date | undefined;\n}\n\nexport interface BuildFoldersOptions {\n\tworkspace: WorkspaceLocation;\n\tpackages: PackageLocation[];\n\toutDir?: string;\n\tminimize: boolean;\n\tbanner?: BannerOptions;\n\tclean?: boolean;\n\tdocs?: boolean;\n\tskipPackagesWithoutTsFiles?: boolean;\n}\n\nexport interface BuildFolderOptions extends BuildFoldersOptions {\n\toutFile: string;\n}\n\nexport interface FolderBuilderResult {\n\tjs: string;\n\tdefinitions: string;\n}\n\nexport type FolderBuilder = (\n\tlocation: PackageLocation,\n\toutputDir: string,\n) => Promise<FolderBuilderResult>;\n\ntype FolderData = {\n\tlocation: PackageLocation;\n\tdata?: PackageJSON;\n};\n\nexport const buildFolders = async (options: BuildFoldersOptions) => {\n\tif (options.outDir !== undefined && options.clean) {\n\t\tfs.rmSync(options.outDir, { recursive: true });\n\t}\n\n\tconst workspace = options.workspace;\n\tconst folders = options.packages;\n\n\tconst sortedPackages = sortPackagesByBuildOrder(folders);\n\n\tlet index = 1;\n\n\tfor (const location of sortedPackages) {\n\t\tif (\n\t\t\toptions.skipPackagesWithoutTsFiles &&\n\t\t\tgetPackageTypescriptFiles(location).length === 0\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tensureTsConfig(location);\n\n\t\tconst data = readPackageCreatorManifest(location);\n\n\t\tconst logStep = (step: string) =>\n\t\t\tlogPackageMessage(data.Package, step, index, folders.length);\n\n\t\tlogStep(\"Compiling typescript to javascript\");\n\n\t\tconst outputDirectory = options.outDir || location.scriptsDir;\n\t\tfs.mkdirSync(outputDirectory, { recursive: true });\n\n\t\tconst buildResult = await tscBuild(location, outputDirectory);\n\t\tconst banner = options.banner\n\t\t\t? createBannerComment(options.banner)\n\t\t\t: undefined;\n\n\t\tif (banner) {\n\t\t\tbuildResult.js = banner + \"\\n\" + buildResult.js;\n\t\t\tbuildResult.definitions = banner + \"\\n\" + buildResult.definitions;\n\t\t}\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(outputDirectory, `${data.Package}.js`),\n\t\t\tbuildResult.js,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\t\tfs.writeFileSync(\n\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\tbuildResult.definitions,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\n\t\tif (options.minimize) {\n\t\t\tconst minifyResult = await terser.minify(buildResult.js, {\n\t\t\t\tecma: 5,\n\t\t\t});\n\n\t\t\tconst minifiedPath = path.join(\n\t\t\t\toutputDirectory,\n\t\t\t\t`${data.Package}.min.js`,\n\t\t\t);\n\t\t\tfs.writeFileSync(minifiedPath, minifyResult.code!, {\n\t\t\t\tencoding: \"utf8\",\n\t\t\t});\n\t\t}\n\n\t\tif (location.path.includes(\"Basics\")) {\n\t\t\tfs.mkdirSync(path.join(workspace.path, \"lib\"), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\n\t\t\tlogStep(\"Copying basics definition file to the lib folder\");\n\t\t\tfs.writeFileSync(\n\t\t\t\tpath.join(workspace.path, \"lib\", `${data.Package}.d.ts`),\n\t\t\t\tbuildResult.definitions,\n\t\t\t\t{ encoding: \"utf8\" },\n\t\t\t);\n\t\t}\n\n\t\tif (options.docs) {\n\t\t\tlogStep(\"Generating typedoc documentation\");\n\t\t\tawait generateDocs(\n\t\t\t\tlocation,\n\t\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\t\tpath.join(workspace.path, \"docs\", data.Package),\n\t\t\t\tdata.Package,\n\t\t\t);\n\t\t}\n\n\t\tindex++;\n\t}\n};\n\nconst ensureTsConfig = (location: PackageLocation) => {\n\tconst tsconfigPath = path.join(location.scriptsDir, \"tsconfig.json\");\n\n\tif (!fs.existsSync(tsconfigPath)) {\n\t\tconst content = {};\n\t\tapplyTsConfigOption(content);\n\n\t\tfs.writeFileSync(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\t} else {\n\t\tconst content = JSON.parse(fs.readFileSync(tsconfigPath, \"utf8\"));\n\t\tapplyTsConfigOption(content);\n\t\tfs.writeFileSync(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n};\n\nconst applyTsConfigOption = (data: {\n\tcompilerOptions?: { target?: string; lib?: string[] };\n}) => {\n\tdata.compilerOptions = data.compilerOptions ?? {};\n\tdata.compilerOptions.target = \"es5\";\n\tdata.compilerOptions.lib = [\"es5\", \"dom\"];\n};\n\nconst sortPackagesByBuildOrder = (\n\tfolders: PackageLocation[],\n): PackageLocation[] => {\n\tconst packages = Array.from(folders).reduce(\n\t\t(\n\t\t\tacc: Record<string, FolderData>,\n\t\t\tlocation,\n\t\t): Record<string, FolderData> => {\n\t\t\tconst data = readPackageNpmManifest(location);\n\n\t\t\tif (data !== undefined) {\n\t\t\t\tacc[data.name] = {\n\t\t\t\t\tdata,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tacc[location.path] = {\n\t\t\t\t\tdata: undefined,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst packageDependencies = Object.getOwnPropertyNames(packages).reduce(\n\t\t(acc, packageName) => {\n\t\t\tconst packageData = packages[packageName];\n\n\t\t\tif (packageData.data === undefined) {\n\t\t\t\tacc[packageName] = [];\n\t\t\t} else {\n\t\t\t\tacc[packageName] = Object.getOwnPropertyNames({\n\t\t\t\t\t...packageData.data.devDependencies,\n\t\t\t\t\t...packageData.data.dependencies,\n\t\t\t\t\t...packageData.data.peerDependencies,\n\t\t\t\t}).filter((packageName) => packages[packageName] !== undefined);\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst sortedPackages = toposort(packageDependencies);\n\tconst result: PackageLocation[] = [];\n\n\tfor (const packageName of sortedPackages) {\n\t\tconst location = packages[packageName].location;\n\n\t\tif (readPackageCreatorManifest(location).Package.endsWith(\".Basics\")) {\n\t\t\tresult.unshift(location);\n\t\t} else {\n\t\t\tresult.push(location);\n\t\t}\n\t}\n\n\treturn result;\n};\n\nconst createBannerComment = (banner: BannerOptions) => {\n\tconst bannerParts: string[] = [];\n\n\tif (banner.text) {\n\t\tbannerParts.push(\" * \" + banner.text);\n\t}\n\n\t{\n\t\tconst details: string[] = [];\n\n\t\tif (banner.version) {\n\t\t\tdetails.push(`Version: ${banner.version}`);\n\t\t}\n\t\tif (banner.commit) {\n\t\t\tif (banner.commitDirty) {\n\t\t\t\tdetails.push(`Commit: ${banner.commit} (dirty)`);\n\t\t\t} else {\n\t\t\t\tdetails.push(`Commit: ${banner.commit}`);\n\t\t\t}\n\t\t}\n\t\tif (banner.date) {\n\t\t\tdetails.push(`Date: ${banner.date.toISOString()}`);\n\t\t}\n\n\t\tconst detailsText = details.map((line) => ` * ${line}`).join(\"\\n\");\n\t\tif (detailsText) {\n\t\t\tbannerParts.push(detailsText);\n\t\t}\n\t}\n\n\tconst bannerText = bannerParts.join(\"\\n\\n\");\n\n\tif (bannerText) {\n\t\treturn `/*\n${bannerText}\n*\n* @preserve\t\t\t\n*/`;\n\t}\n\n\treturn undefined;\n};\n"],"names":["buildFolders","options","outDir","undefined","clean","fs","rmSync","recursive","workspace","folders","packages","sortedPackages","sortPackagesByBuildOrder","index","location","skipPackagesWithoutTsFiles","getPackageTypescriptFiles","length","ensureTsConfig","data","readPackageCreatorManifest","logStep","step","logPackageMessage","Package","outputDirectory","scriptsDir","mkdirSync","buildResult","tscBuild","banner","createBannerComment","js","definitions","writeFileSync","path","join","encoding","minimize","minifyResult","terser","minify","ecma","minifiedPath","code","includes","docs","generateDocs","tsconfigPath","existsSync","content","applyTsConfigOption","JSON","stringify","parse","readFileSync","compilerOptions","target","lib","Array","from","reduce","acc","readPackageNpmManifest","name","packageDependencies","Object","getOwnPropertyNames","packageName","packageData","devDependencies","dependencies","peerDependencies","filter","toposort","result","endsWith","unshift","push","bannerParts","text","details","version","commit","commitDirty","date","toISOString","detailsText","map","line","bannerText"],"mappings":";;;;;;;;;;AAuDaA,MAAAA,YAAY,GAAG,MAAOC,OAA4B,IAAK;EACnE,IAAIA,OAAO,CAACC,MAAM,KAAKC,SAAS,IAAIF,OAAO,CAACG,KAAK,EAAE;AAClDC,IAAAA,EAAE,CAACC,MAAM,CAACL,OAAO,CAACC,MAAM,EAAE;AAAEK,MAAAA,SAAS,EAAE,IAAA;AAAK,KAAC,CAAC,CAAA;AAC/C,GAAA;AAEA,EAAA,MAAMC,SAAS,GAAGP,OAAO,CAACO,SAAS,CAAA;AACnC,EAAA,MAAMC,OAAO,GAAGR,OAAO,CAACS,QAAQ,CAAA;AAEhC,EAAA,MAAMC,cAAc,GAAGC,wBAAwB,CAACH,OAAO,CAAC,CAAA;EAExD,IAAII,KAAK,GAAG,CAAC,CAAA;AAEb,EAAA,KAAK,MAAMC,QAAQ,IAAIH,cAAc,EAAE;AACtC,IA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C,CAAA;AAC3C,KAAA;IACA,IAAIpD,MAAM,CAACqD,MAAM,EAAE;MAClB,IAAIrD,MAAM,CAACsD,WAAW,EAAE;QACvBH,OAAO,CAACH,IAAI,CAAE,CAAA,QAAA,EAAUhD,MAAM,CAACqD,MAAO,UAAS,CAAC,CAAA;AACjD,OAAC,MAAM;QACNF,OAAO,CAACH,IAAI,CAAE,CAAA,QAAA,EAAUhD,MAAM,CAACqD,MAAO,EAAC,CAAC,CAAA;AACzC,OAAA;AACD,KAAA;IACA,IAAIrD,MAAM,CAACuD,IAAI,EAAE;MAChBJ,OAAO,CAACH,IAAI,CAAE,CAAQhD,MAAAA,EAAAA,MAAM,CAACuD,IAAI,CAACC,WAAW,EAAG,CAAA,CAAC,CAAC,CAAA;AACnD,KAAA;AAEA,IAAA,MAAMC,WAAW,GAAGN,OAAO,CAACO,GAAG,CAAEC,IAAI,IAAM,CAAKA,GAAAA,EAAAA,IAAK,EAAC,CAAC,CAACrD,IAAI,CAAC,IAAI,CAAC,CAAA;AAClE,IAAA,IAAImD,WAAW,EAAE;AAChBR,MAAAA,WAAW,CAACD,IAAI,CAACS,WAAW,CAAC,CAAA;AAC9B,KAAA;AACD,GAAA;AAEA,EAAA,MAAMG,UAAU,GAAGX,WAAW,CAAC3C,IAAI,CAAC,MAAM,CAAC,CAAA;AAE3C,EAAA,IAAIsD,UAAU,EAAE;IACf,OAAQ,CAAA;AACV,EAAEA,UAAW,CAAA;AACb;AACA;AACA,EAAG,CAAA,CAAA;AACF,GAAA;AAEA,EAAA,OAAOvF,SAAS,CAAA;AACjB,CAAC;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
|
+
import glob from 'glob';
|
|
3
4
|
import { readWorkspaceNpmManifest, getWorkspaceLibPath } from '../lib/workspace.mjs';
|
|
4
5
|
import { readPublishedPackageNpmManifest } from '../lib/publishedPackage.mjs';
|
|
5
6
|
import { determineWorkspaceIGLibraries } from '../lib/dependencies.mjs';
|
|
@@ -14,21 +15,32 @@ const executePostInstall = workspace => {
|
|
|
14
15
|
fs.mkdirSync(libPath, {
|
|
15
16
|
recursive: true
|
|
16
17
|
});
|
|
17
|
-
const existingDefinitions =
|
|
18
|
+
const existingDefinitions = glob.sync("**/*.d.ts", {
|
|
19
|
+
cwd: libPath,
|
|
20
|
+
absolute: true
|
|
21
|
+
});
|
|
18
22
|
|
|
19
23
|
// delete all existing definition files that are managed by the packager.
|
|
20
24
|
// we'll recreate all needed definitions in the next step.
|
|
21
|
-
for (const
|
|
22
|
-
const content = fs.readFileSync(
|
|
25
|
+
for (const existingDefinitionPath of existingDefinitions) {
|
|
26
|
+
const content = fs.readFileSync(existingDefinitionPath, {
|
|
23
27
|
encoding: "utf-8"
|
|
24
28
|
});
|
|
25
29
|
if (content.startsWith(DEFINITION_FILE_HINT)) {
|
|
26
|
-
fs.rmSync(
|
|
30
|
+
fs.rmSync(existingDefinitionPath);
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
const libraryLocations = determineWorkspaceIGLibraries(workspace);
|
|
30
34
|
for (const location of libraryLocations) {
|
|
31
35
|
const manifest = readPublishedPackageNpmManifest(location);
|
|
36
|
+
for (const existingDefinitionPath of existingDefinitions) {
|
|
37
|
+
const basename = path.basename(existingDefinitionPath);
|
|
38
|
+
if (basename === manifest.types) {
|
|
39
|
+
fs.rmSync(existingDefinitionPath, {
|
|
40
|
+
force: true
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
32
44
|
|
|
33
45
|
// add a hint to the top of the file so we know it's managed by the packager.
|
|
34
46
|
const content = `${DEFINITION_FILE_HINT}
|
|
@@ -1 +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 =
|
|
1
|
+
{"version":3,"file":"postinstall.mjs","sources":["../../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport glob from \"glob\";\n\nimport {\n\tgetWorkspaceLibPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { readPublishedPackageNpmManifest } from \"../lib/publishedPackage\";\nimport { determineWorkspaceIGLibraries } from \"../lib/dependencies\";\n\nconst DEFINITION_FILE_HINT =\n\t\"// This file is automatically managed by the ig.gfx.packager.\";\n\nexport const executePostInstall = (workspace: WorkspaceLocation) => {\n\tconst manifest = readWorkspaceNpmManifest(workspace);\n\n\tif (manifest === undefined) {\n\t\tthrow new Error(`Expected an npm manifest to exist.`);\n\t}\n\n\tconst libPath = getWorkspaceLibPath(workspace);\n\n\tfs.mkdirSync(libPath, { recursive: true });\n\n\tconst existingDefinitions = glob.sync(\"**/*.d.ts\", {\n\t\tcwd: libPath,\n\t\tabsolute: true,\n\t});\n\n\t// delete all existing definition files that are managed by the packager.\n\t// we'll recreate all needed definitions in the next step.\n\tfor (const existingDefinitionPath of existingDefinitions) {\n\t\tconst content = fs.readFileSync(existingDefinitionPath, {\n\t\t\tencoding: \"utf-8\",\n\t\t});\n\n\t\tif (content.startsWith(DEFINITION_FILE_HINT)) {\n\t\t\tfs.rmSync(existingDefinitionPath);\n\t\t}\n\t}\n\n\tconst libraryLocations = determineWorkspaceIGLibraries(workspace);\n\n\tfor (const location of libraryLocations) {\n\t\tconst manifest = readPublishedPackageNpmManifest(location);\n\n\t\tfor (const existingDefinitionPath of existingDefinitions) {\n\t\t\tconst basename = path.basename(existingDefinitionPath);\n\n\t\t\tif (basename === manifest.types) {\n\t\t\t\tfs.rmSync(existingDefinitionPath, { force: true });\n\t\t\t}\n\t\t}\n\n\t\t// add a hint to the top of the file so we know it's managed by the packager.\n\t\tconst content = `${DEFINITION_FILE_HINT}\n// This is a reference to version ${manifest.version}.\n// Run \"npm install\" to install the types if they are missing or not up to date.\n/// <reference types=\"${manifest.name}\" />`;\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(getWorkspaceLibPath(workspace), manifest.types),\n\t\t\tcontent,\n\t\t\t{\n\t\t\t\tencoding: \"utf8\",\n\t\t\t},\n\t\t);\n\t}\n};\n"],"names":["DEFINITION_FILE_HINT","executePostInstall","workspace","manifest","readWorkspaceNpmManifest","undefined","Error","libPath","getWorkspaceLibPath","fs","mkdirSync","recursive","existingDefinitions","glob","sync","cwd","absolute","existingDefinitionPath","content","readFileSync","encoding","startsWith","rmSync","libraryLocations","determineWorkspaceIGLibraries","location","readPublishedPackageNpmManifest","basename","path","types","force","version","name","writeFileSync","join"],"mappings":";;;;;;;AAYA,MAAMA,oBAAoB,GACzB,+DAA+D,CAAA;AAEnDC,MAAAA,kBAAkB,GAAIC,SAA4B,IAAK;AACnE,EAAA,MAAMC,QAAQ,GAAGC,wBAAwB,CAACF,SAAS,CAAC,CAAA;EAEpD,IAAIC,QAAQ,KAAKE,SAAS,EAAE;AAC3B,IAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,kCAAA,CAAmC,CAAC,CAAA;AACtD,GAAA;AAEA,EAAA,MAAMC,OAAO,GAAGC,mBAAmB,CAACN,SAAS,CAAC,CAAA;AAE9CO,EAAAA,EAAE,CAACC,SAAS,CAACH,OAAO,EAAE;AAAEI,IAAA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IAAK,CAAK,IAAA,CAAA,CAAA;AAEzCvB,IAAAA,EAAE,CAACwB,aAAa,CACfL,IAAI,CAACM,IAAI,CAAC1B,mBAAmB,CAACN,SAAS,CAAC,EAAEC,QAAQ,CAAC0B,KAAK,CAAC,EACzDX,OAAO,EACP;AACCE,MAAAA,QAAQ,EAAE,MAAA;AACX,KAAC,CACD,CAAA;AACF,GAAA;AACD;;;;"}
|
|
@@ -3,7 +3,6 @@ import * as fs from 'fs';
|
|
|
3
3
|
import { pipeline } from 'stream/promises';
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
5
|
import { logPackageMessage } from '../../lib/log.mjs';
|
|
6
|
-
import { translate } from '../../lib/localization.mjs';
|
|
7
6
|
import { readPackageCreatorManifest, parseCreatorPackageName, getPackageReleasesDirectory } from '../../lib/package.mjs';
|
|
8
7
|
import { readWorkspaceNpmManifest, getWorkspaceOutputPath } from '../../lib/workspace.mjs';
|
|
9
8
|
import { getVersionInformationFromGit } from '../../lib/git.mjs';
|
|
@@ -142,7 +141,7 @@ const releaseFolder = async options => {
|
|
|
142
141
|
throw err;
|
|
143
142
|
}
|
|
144
143
|
if (newVersion.buildNumber >= 100 && !options.pushOnly) {
|
|
145
|
-
logPackageMessage(fullPackageName,
|
|
144
|
+
logPackageMessage(fullPackageName, "Copying zip to releases folder");
|
|
146
145
|
const zipFileName = `${packageNameWithVersion}.zip`;
|
|
147
146
|
const releasesPath = getPackageReleasesDirectory(location);
|
|
148
147
|
fs.mkdirSync(releasesPath, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/commands/publish/index.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport { pipeline } from \"stream/promises\";\nimport { execSync } from \"child_process\";\n\nimport { logPackageMessage } from \"../../lib/log\";\nimport { translate } from \"../../lib/localization\";\nimport { Authentication } from \"../../lib/authentication\";\nimport {\n\tCreatorPackage,\n\tdetectPackage,\n\tgetPackageReleasesDirectory,\n\tPackageLocation,\n\tparseCreatorPackageName,\n\treadPackageCreatorManifest,\n} from \"../../lib/package\";\nimport {\n\tdetectWorkspace,\n\tgetWorkspaceOutputPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../../lib/git\";\nimport { getWorkspaceBannerText } from \"../../lib/banner\";\nimport {\n\tparseVersionFromNumericVersion,\n\tparseVersionFromString,\n} from \"../../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../../lib/versionFile\";\nimport * as AssetService from \"../../lib/assetService\";\nimport { isErrorENOENT } from \"../../lib/error\";\nimport { determineWorkspaceIGLibraries } from \"../../lib/dependencies\";\nimport {\n\treadPublishedPackageCreatorManifest,\n\treadPublishedPackageNpmManifest,\n} from \"../../lib/publishedPackage\";\nimport { Prompter } from \"../../lib/prompter\";\nimport { PackageVersion } from \"../../lib/packageVersion\";\n\nimport { BuildFoldersOptions, buildFolders } from \"../build\";\nimport {\n\tbuildArchiveFromPackage,\n\tbuildArchiveFromPublishedPackage,\n} from \"./zip\";\n\nexport interface ReleaseFolderOptions\n\textends Omit<\n\t\tBuildFoldersOptions,\n\t\t\"skipPackagesWithoutTsFiles\" | \"banner\" | \"packages\"\n\t> {\n\tdirectory: PackageLocation;\n\tnoUpload: boolean;\n\tnewVersion: string;\n\tdomain?: string;\n\tsubdomain?: string;\n\taddress?: string;\n\tservice: string;\n\tauthentication?: Authentication;\n\tpushOnly: boolean;\n\tbanner?: boolean;\n\tprompter: Prompter;\n}\n\nexport const releaseFolder = async (options: ReleaseFolderOptions) => {\n\tconst workspace = options.workspace;\n\tconst location = options.directory;\n\n\tconst { write: writeVersionFile, reset: resetVersionFile } =\n\t\tgetVersionFileHandler(location);\n\n\tconst packageDescription = readPackageCreatorManifest(location);\n\tconst fullPackageName = packageDescription.Package;\n\tconst { domain, subdomain } = parseCreatorPackageName(packageDescription);\n\n\tconst publishDomain = options.domain ?? domain;\n\tconst publishSubdomain = options.subdomain ?? subdomain;\n\n\tconst sharedPackageJson = readWorkspaceNpmManifest(workspace);\n\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(options.newVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber > 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"patch\",\n\t\t\tversion: newVersion.buildNumber - 100,\n\t\t};\n\t}\n\n\tif (sharedPackageJson !== undefined) {\n\t\tlogPackageMessage(\n\t\t\tpackageDescription.Package,\n\t\t\t`Running npm install to make sure all dependencies are up to date`,\n\t\t);\n\t\texecSync(`npm install`, { encoding: \"utf-8\", cwd: workspace.path });\n\t}\n\n\tconst binDir = getWorkspaceOutputPath(workspace);\n\tfs.mkdirSync(binDir, { recursive: true });\n\n\tlet assetServerPackageDetails: AssetService.UploadPackageDetails;\n\n\tlet packageNameWithVersion: string;\n\n\t{\n\t\tconst versionWithoutPrelease = newVersion.clone();\n\t\tversionWithoutPrelease.preRelease = undefined;\n\t\tconst newVersionString = versionWithoutPrelease.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\t\tpackageNameWithVersion = `${packageDescription.Package}_${newVersionString}`;\n\n\t\tassetServerPackageDetails = {\n\t\t\tname: packageDescription.Package,\n\t\t\tversion: newVersionString,\n\t\t};\n\t}\n\n\tconst zipFilePath = path.join(binDir, packageNameWithVersion + \".zip\");\n\n\ttry {\n\t\tif (options.pushOnly) {\n\t\t\tif (!fs.existsSync(zipFilePath)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Expected a zip file to exist at path ${zipFilePath} since pushOnly is specified`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\t\t\tworkspace,\n\t\t\t\tlocation,\n\t\t\t);\n\n\t\t\twriteVersionFile(fullPackageName, newVersion);\n\n\t\t\tconst bannerText =\n\t\t\t\tsharedPackageJson !== undefined\n\t\t\t\t\t? getWorkspaceBannerText(sharedPackageJson)\n\t\t\t\t\t: undefined;\n\n\t\t\tawait buildFolders({\n\t\t\t\t...options,\n\t\t\t\tpackages: [location],\n\t\t\t\tskipPackagesWithoutTsFiles: true,\n\t\t\t\tbanner: options.banner\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttext: bannerText,\n\t\t\t\t\t\t\tcommit: gitVersionInformation.commit,\n\t\t\t\t\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\t\t\t\t\tversion: newVersion.toVersionString({\n\t\t\t\t\t\t\t\tbuildNumber: true,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tdate: new Date(Date.now()),\n\t\t\t\t\t\t\t// gitVersionInformation.commitDate\n\t\t\t\t\t\t\t// \t? new Date(gitVersionInformation.commitDate)\n\t\t\t\t\t\t\t// \t: new Date(Date.now()),\n\t\t\t\t\t }\n\t\t\t\t\t: undefined,\n\t\t\t});\n\n\t\t\tnewVersion.preRelease = undefined;\n\n\t\t\ttry {\n\t\t\t\tfs.rmSync(zipFilePath);\n\t\t\t} catch (err) {\n\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst archive = await buildArchiveFromPackage(\n\t\t\t\tworkspace,\n\t\t\t\tlocation,\n\t\t\t\tpackageDescription,\n\t\t\t);\n\n\t\t\tconst zipOutputStream = fs.createWriteStream(zipFilePath);\n\t\t\tawait pipeline(archive.generateNodeStream(), zipOutputStream);\n\t\t}\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!options.authentication) {\n\t\t\t\tthrow new Error(`Expected authentication to be available`);\n\t\t\t}\n\n\t\t\tlogPackageMessage(\n\t\t\t\tpackageDescription.Package,\n\t\t\t\t`Opening connection to IG.Asset.Server`,\n\t\t\t);\n\n\t\t\tconst sessionManager = await createSessionManager({\n\t\t\t\turl: options.service,\n\t\t\t\taddress: options.address,\n\t\t\t\tdomain: publishDomain,\n\t\t\t\tsubDomain: publishSubdomain,\n\t\t\t\tauthentication: options.authentication,\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tawait ensureRequiredVersions(\n\t\t\t\t\tworkspace,\n\t\t\t\t\tpackageDescription,\n\t\t\t\t\tsessionManager,\n\t\t\t\t\toptions.prompter,\n\t\t\t\t);\n\n\t\t\t\tlogPackageMessage(\n\t\t\t\t\tpackageDescription.Package,\n\t\t\t\t\t`Uploading package to ${publishDomain}.${publishSubdomain}`,\n\t\t\t\t);\n\n\t\t\t\tawait AssetService.uploadPackage(\n\t\t\t\t\tsessionManager.getTargetSession(),\n\t\t\t\t\tassetServerPackageDetails,\n\t\t\t\t\tzipFilePath,\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tawait sessionManager.destroy().catch((err) => {\n\t\t\t\t\tlogPackageMessage(\n\t\t\t\t\t\tpackageDescription.Package,\n\t\t\t\t\t\t`Failed to close IG.Asset.Server session(s): ${err}`,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\tresetVersionFile();\n\t\tthrow err;\n\t}\n\n\tif (newVersion.buildNumber >= 100 && !options.pushOnly) {\n\t\tlogPackageMessage(\n\t\t\tfullPackageName,\n\t\t\ttranslate(\"messages.movingReleaseZip\"),\n\t\t);\n\n\t\tconst zipFileName = `${packageNameWithVersion}.zip`;\n\t\tconst releasesPath = getPackageReleasesDirectory(location);\n\n\t\tfs.mkdirSync(releasesPath, { recursive: true });\n\t\tfs.copyFileSync(zipFilePath, path.join(releasesPath, zipFileName));\n\t}\n};\n\nconst ensureRequiredVersions = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tcreatorPackage: CreatorPackage,\n\tsessionManager: SessionManager,\n\tprompter: Prompter,\n) => {\n\tinterface UploadedPackage\n\t\textends Omit<AssetService.ExistingPackage, \"version\"> {\n\t\tversion: PackageVersion;\n\t}\n\n\tconst libraries = determineWorkspaceIGLibraries(workspaceLocation);\n\n\t// If there are no libraries, we don't need to check for required versions\n\tif (libraries.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst targetSession = sessionManager.getTargetSession();\n\n\tconst rawUploadedPackages = await AssetService.getExistingPackages(\n\t\ttargetSession,\n\t);\n\n\tconst uploadedPackages = rawUploadedPackages.map(\n\t\t(entry): UploadedPackage => {\n\t\t\tlet version: PackageVersion;\n\n\t\t\ttry {\n\t\t\t\tversion = parseVersionFromNumericVersion(entry.numericVersion);\n\t\t\t} catch (err) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Encountered invalid format for version ${entry.numericVersion}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (version.buildNumber < 100) {\n\t\t\t\tversion.preRelease = {\n\t\t\t\t\ttype: \"beta\",\n\t\t\t\t\tversion: version.buildNumber,\n\t\t\t\t};\n\t\t\t} else if (version.buildNumber > 100) {\n\t\t\t\tversion.preRelease = {\n\t\t\t\t\ttype: \"patch\",\n\t\t\t\t\tversion: version.buildNumber - 100,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...entry,\n\t\t\t\tversion,\n\t\t\t};\n\t\t},\n\t);\n\n\tfor (const libraryLocation of libraries) {\n\t\tconst libraryManifest =\n\t\t\treadPublishedPackageNpmManifest(libraryLocation);\n\t\tconst libraryCreatorPackage =\n\t\t\treadPublishedPackageCreatorManifest(libraryLocation);\n\n\t\tif (\n\t\t\tlibraryCreatorPackage === undefined ||\n\t\t\tlibraryManifest.main === undefined ||\n\t\t\tlibraryCreatorPackage.Package === creatorPackage.Package\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst libraryVersion = PackageVersion.extractFromLine(\n\t\t\tlibraryManifest.version,\n\t\t);\n\n\t\tif (libraryVersion.preRelease) {\n\t\t\tlibraryVersion.buildNumber = libraryVersion.preRelease.version;\n\t\t\tlibraryVersion.preRelease = undefined;\n\t\t} else {\n\t\t\tlibraryVersion.buildNumber = 100;\n\t\t}\n\n\t\tlet uploadedPackageInBasics: UploadedPackage | undefined;\n\t\tlet uploadedPackageInTarget: UploadedPackage | undefined;\n\n\t\tfor (const uploadedPackage of uploadedPackages) {\n\t\t\tif (uploadedPackage.scope === libraryCreatorPackage.Package) {\n\t\t\t\tif (uploadedPackage.support) {\n\t\t\t\t\tuploadedPackageInBasics = uploadedPackage;\n\t\t\t\t} else {\n\t\t\t\t\tuploadedPackageInTarget = uploadedPackage;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst validInBasics =\n\t\t\tuploadedPackageInBasics !== undefined &&\n\t\t\t!uploadedPackageInBasics.version.isLesserThan(libraryVersion);\n\t\tconst validInTarget =\n\t\t\tuploadedPackageInTarget !== undefined &&\n\t\t\t!uploadedPackageInTarget.version.isLesserThan(libraryVersion);\n\n\t\tif (validInBasics || validInTarget) {\n\t\t\tif (\n\t\t\t\ttargetSession.subDomain !== \"Basics\" &&\n\t\t\t\t(uploadedPackageInBasics !== undefined ||\n\t\t\t\t\tuploadedPackageInTarget !== undefined)\n\t\t\t) {\n\t\t\t\tlogPackageMessage(\n\t\t\t\t\tcreatorPackage.Package,\n\t\t\t\t\t`Package ${libraryCreatorPackage.Package} is uploaded both for Basics and ${targetSession.subDomain}. The package within ${targetSession.subDomain} will be used.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tlogPackageMessage(\n\t\t\tcreatorPackage.Package,\n\t\t\t`Requested at least version ${libraryVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t})} for package ${libraryCreatorPackage.Package}`,\n\t\t);\n\n\t\tif (targetSession.subDomain !== \"Basics\" && uploadedPackageInTarget) {\n\t\t\tconst version = uploadedPackageInTarget.version.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t});\n\n\t\t\tlogPackageMessage(\n\t\t\t\tcreatorPackage.Package,\n\t\t\t\t`Found invalid version ${version} for package ${libraryCreatorPackage.Package} in ${targetSession.subDomain}`,\n\t\t\t);\n\t\t}\n\t\tif (uploadedPackageInBasics) {\n\t\t\tconst version = uploadedPackageInBasics.version.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t});\n\n\t\t\tlet message = `Found invalid version ${version} for package ${libraryCreatorPackage.Package} in Basics`;\n\n\t\t\tif (\n\t\t\t\ttargetSession.subDomain !== \"Basics\" &&\n\t\t\t\tuploadedPackageInTarget\n\t\t\t) {\n\t\t\t\tmessage += `. This version will not be used since the package also exists in ${targetSession.subDomain}`;\n\t\t\t}\n\n\t\t\tlogPackageMessage(creatorPackage.Package, message);\n\t\t}\n\n\t\tconst possibleTargets: string[] = [\"Basics\"];\n\n\t\tif (targetSession.subDomain !== \"Basics\") {\n\t\t\tpossibleTargets.push(targetSession.subDomain);\n\t\t}\n\n\t\tconst uploadTargetScope = await prompter.ask({\n\t\t\tmessage: `Select the scope to upload the required version of ${libraryCreatorPackage.Package} to or select \"skip\" to skip the upload.`,\n\t\t\toptions: [...possibleTargets, \"Skip\"],\n\t\t\tdefault: possibleTargets[0],\n\t\t});\n\n\t\tif (uploadTargetScope === \"Skip\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst archive = buildArchiveFromPublishedPackage(\n\t\t\tlibraryLocation,\n\t\t\tlibraryManifest,\n\t\t\tlibraryCreatorPackage,\n\t\t);\n\n\t\tconst newVersionString = libraryVersion.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\t\tconst packageNameWithVersion = `${libraryCreatorPackage.Package}_${newVersionString}`;\n\n\t\tconst zipFilePath = path.join(\n\t\t\tgetWorkspaceOutputPath(workspaceLocation),\n\t\t\t`${packageNameWithVersion}.zip`,\n\t\t);\n\n\t\ttry {\n\t\t\tfs.rmSync(zipFilePath);\n\t\t} catch (err) {\n\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\n\t\tconst zipOutputStream = fs.createWriteStream(zipFilePath);\n\t\tawait pipeline(archive.generateNodeStream(), zipOutputStream);\n\n\t\tconst session =\n\t\t\tuploadTargetScope === \"Basics\"\n\t\t\t\t? await sessionManager.getBasicsSession()\n\t\t\t\t: targetSession;\n\n\t\tlogPackageMessage(\n\t\t\tcreatorPackage.Package,\n\t\t\t`Uploading package ${libraryCreatorPackage.Package} with version ${newVersionString} to ${session.domain}.${session.subDomain}`,\n\t\t);\n\n\t\tawait AssetService.uploadPackage(\n\t\t\tsession,\n\t\t\t{\n\t\t\t\tname: libraryCreatorPackage.Package,\n\t\t\t\tversion: newVersionString,\n\t\t\t},\n\t\t\tzipFilePath,\n\t\t);\n\t}\n};\n\ninterface SessionManager {\n\tgetBasicsSession: () => Promise<AssetService.Session>;\n\tgetTargetSession: () => AssetService.Session;\n\tdestroy: () => Promise<void>;\n}\n\nconst createSessionManager = async (\n\tparams: AssetService.SessionStartParams,\n): Promise<SessionManager> => {\n\tconst targetSession = await AssetService.startSession(params);\n\tlet basicsSession: AssetService.Session | undefined;\n\n\treturn {\n\t\tgetBasicsSession: async () => {\n\t\t\tif (targetSession.subDomain === \"Basics\") {\n\t\t\t\treturn targetSession;\n\t\t\t}\n\n\t\t\tif (basicsSession === undefined) {\n\t\t\t\tbasicsSession = await AssetService.startSession({\n\t\t\t\t\t...params,\n\t\t\t\t\tsubDomain: \"Basics\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn basicsSession;\n\t\t},\n\n\t\tgetTargetSession: () => targetSession,\n\n\t\tdestroy: async () => {\n\t\t\tawait AssetService.closeSession(targetSession);\n\n\t\t\tif (basicsSession !== undefined) {\n\t\t\t\tawait AssetService.closeSession(basicsSession);\n\t\t\t}\n\t\t},\n\t};\n};\n"],"names":["releaseFolder","options","workspace","location","directory","write","writeVersionFile","reset","resetVersionFile","getVersionFileHandler","packageDescription","readPackageCreatorManifest","fullPackageName","Package","domain","subdomain","parseCreatorPackageName","publishDomain","publishSubdomain","sharedPackageJson","readWorkspaceNpmManifest","newVersion","parseVersionFromString","err","Error","buildNumber","preRelease","type","version","undefined","logPackageMessage","execSync","encoding","cwd","path","binDir","getWorkspaceOutputPath","fs","mkdirSync","recursive","assetServerPackageDetails","packageNameWithVersion","versionWithoutPrelease","clone","newVersionString","toVersionString","name","zipFilePath","join","pushOnly","existsSync","gitVersionInformation","getVersionInformationFromGit","bannerText","getWorkspaceBannerText","buildFolders","packages","skipPackagesWithoutTsFiles","banner","text","commit","commitDirty","dirty","date","Date","now","rmSync","isErrorENOENT","archive","buildArchiveFromPackage","zipOutputStream","createWriteStream","pipeline","generateNodeStream","noUpload","authentication","sessionManager","createSessionManager","url","service","address","subDomain","ensureRequiredVersions","prompter","AssetService","getTargetSession","destroy","catch","translate","zipFileName","releasesPath","getPackageReleasesDirectory","copyFileSync","workspaceLocation","creatorPackage","libraries","determineWorkspaceIGLibraries","length","targetSession","rawUploadedPackages","uploadedPackages","map","entry","parseVersionFromNumericVersion","numericVersion","libraryLocation","libraryManifest","readPublishedPackageNpmManifest","libraryCreatorPackage","readPublishedPackageCreatorManifest","main","libraryVersion","PackageVersion","extractFromLine","uploadedPackageInBasics","uploadedPackageInTarget","uploadedPackage","scope","support","validInBasics","isLesserThan","validInTarget","message","possibleTargets","push","uploadTargetScope","ask","default","buildArchiveFromPublishedPackage","session","getBasicsSession","params","basicsSession"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+DaA,MAAAA,aAAa,GAAG,MAAOC,OAA6B,IAAK;AACrE,EAAA,MAAMC,SAAS,GAAGD,OAAO,CAACC,SAAS,CAAA;AACnC,EAAA,MAAMC,QAAQ,GAAGF,OAAO,CAACG,SAAS,CAAA;EAElC,MAAM;AAAEC,IAAAA,KAAK,EAAEC,gBAAgB;AAAEC,IAAAA,KAAK,EAAEC,gBAAAA;AAAiB,GAAC,GACzDC,qBAAqB,CAACN,QAAQ,CAAC,CAAA;AAEh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AAA;AACF,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/commands/publish/index.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport { pipeline } from \"stream/promises\";\nimport { execSync } from \"child_process\";\n\nimport { logPackageMessage } from \"../../lib/log\";\nimport { Authentication } from \"../../lib/authentication\";\nimport {\n\tCreatorPackage,\n\tgetPackageReleasesDirectory,\n\tPackageLocation,\n\tparseCreatorPackageName,\n\treadPackageCreatorManifest,\n} from \"../../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../../lib/git\";\nimport { getWorkspaceBannerText } from \"../../lib/banner\";\nimport {\n\tparseVersionFromNumericVersion,\n\tparseVersionFromString,\n} from \"../../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../../lib/versionFile\";\nimport * as AssetService from \"../../lib/assetService\";\nimport { isErrorENOENT } from \"../../lib/error\";\nimport { determineWorkspaceIGLibraries } from \"../../lib/dependencies\";\nimport {\n\treadPublishedPackageCreatorManifest,\n\treadPublishedPackageNpmManifest,\n} from \"../../lib/publishedPackage\";\nimport { Prompter } from \"../../lib/prompter\";\nimport { PackageVersion } from \"../../lib/packageVersion\";\n\nimport { BuildFoldersOptions, buildFolders } from \"../build\";\nimport {\n\tbuildArchiveFromPackage,\n\tbuildArchiveFromPublishedPackage,\n} from \"./zip\";\n\nexport interface ReleaseFolderOptions\n\textends Omit<\n\t\tBuildFoldersOptions,\n\t\t\"skipPackagesWithoutTsFiles\" | \"banner\" | \"packages\"\n\t> {\n\tdirectory: PackageLocation;\n\tnoUpload: boolean;\n\tnewVersion: string;\n\tdomain?: string;\n\tsubdomain?: string;\n\taddress?: string;\n\tservice: string;\n\tauthentication?: Authentication;\n\tpushOnly: boolean;\n\tbanner?: boolean;\n\tprompter: Prompter;\n}\n\nexport const releaseFolder = async (options: ReleaseFolderOptions) => {\n\tconst workspace = options.workspace;\n\tconst location = options.directory;\n\n\tconst { write: writeVersionFile, reset: resetVersionFile } =\n\t\tgetVersionFileHandler(location);\n\n\tconst packageDescription = readPackageCreatorManifest(location);\n\tconst fullPackageName = packageDescription.Package;\n\tconst { domain, subdomain } = parseCreatorPackageName(packageDescription);\n\n\tconst publishDomain = options.domain ?? domain;\n\tconst publishSubdomain = options.subdomain ?? subdomain;\n\n\tconst sharedPackageJson = readWorkspaceNpmManifest(workspace);\n\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(options.newVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber > 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"patch\",\n\t\t\tversion: newVersion.buildNumber - 100,\n\t\t};\n\t}\n\n\tif (sharedPackageJson !== undefined) {\n\t\tlogPackageMessage(\n\t\t\tpackageDescription.Package,\n\t\t\t`Running npm install to make sure all dependencies are up to date`,\n\t\t);\n\t\texecSync(`npm install`, { encoding: \"utf-8\", cwd: workspace.path });\n\t}\n\n\tconst binDir = getWorkspaceOutputPath(workspace);\n\tfs.mkdirSync(binDir, { recursive: true });\n\n\tlet assetServerPackageDetails: AssetService.UploadPackageDetails;\n\n\tlet packageNameWithVersion: string;\n\n\t{\n\t\tconst versionWithoutPrelease = newVersion.clone();\n\t\tversionWithoutPrelease.preRelease = undefined;\n\t\tconst newVersionString = versionWithoutPrelease.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\t\tpackageNameWithVersion = `${packageDescription.Package}_${newVersionString}`;\n\n\t\tassetServerPackageDetails = {\n\t\t\tname: packageDescription.Package,\n\t\t\tversion: newVersionString,\n\t\t};\n\t}\n\n\tconst zipFilePath = path.join(binDir, packageNameWithVersion + \".zip\");\n\n\ttry {\n\t\tif (options.pushOnly) {\n\t\t\tif (!fs.existsSync(zipFilePath)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Expected a zip file to exist at path ${zipFilePath} since pushOnly is specified`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\t\t\tworkspace,\n\t\t\t\tlocation,\n\t\t\t);\n\n\t\t\twriteVersionFile(fullPackageName, newVersion);\n\n\t\t\tconst bannerText =\n\t\t\t\tsharedPackageJson !== undefined\n\t\t\t\t\t? getWorkspaceBannerText(sharedPackageJson)\n\t\t\t\t\t: undefined;\n\n\t\t\tawait buildFolders({\n\t\t\t\t...options,\n\t\t\t\tpackages: [location],\n\t\t\t\tskipPackagesWithoutTsFiles: true,\n\t\t\t\tbanner: options.banner\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttext: bannerText,\n\t\t\t\t\t\t\tcommit: gitVersionInformation.commit,\n\t\t\t\t\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\t\t\t\t\tversion: newVersion.toVersionString({\n\t\t\t\t\t\t\t\tbuildNumber: true,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tdate: new Date(Date.now()),\n\t\t\t\t\t\t\t// gitVersionInformation.commitDate\n\t\t\t\t\t\t\t// \t? new Date(gitVersionInformation.commitDate)\n\t\t\t\t\t\t\t// \t: new Date(Date.now()),\n\t\t\t\t\t }\n\t\t\t\t\t: undefined,\n\t\t\t});\n\n\t\t\tnewVersion.preRelease = undefined;\n\n\t\t\ttry {\n\t\t\t\tfs.rmSync(zipFilePath);\n\t\t\t} catch (err) {\n\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst archive = await buildArchiveFromPackage(\n\t\t\t\tworkspace,\n\t\t\t\tlocation,\n\t\t\t\tpackageDescription,\n\t\t\t);\n\n\t\t\tconst zipOutputStream = fs.createWriteStream(zipFilePath);\n\t\t\tawait pipeline(archive.generateNodeStream(), zipOutputStream);\n\t\t}\n\n\t\tif (!options.noUpload) {\n\t\t\tif (!options.authentication) {\n\t\t\t\tthrow new Error(`Expected authentication to be available`);\n\t\t\t}\n\n\t\t\tlogPackageMessage(\n\t\t\t\tpackageDescription.Package,\n\t\t\t\t`Opening connection to IG.Asset.Server`,\n\t\t\t);\n\n\t\t\tconst sessionManager = await createSessionManager({\n\t\t\t\turl: options.service,\n\t\t\t\taddress: options.address,\n\t\t\t\tdomain: publishDomain,\n\t\t\t\tsubDomain: publishSubdomain,\n\t\t\t\tauthentication: options.authentication,\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tawait ensureRequiredVersions(\n\t\t\t\t\tworkspace,\n\t\t\t\t\tpackageDescription,\n\t\t\t\t\tsessionManager,\n\t\t\t\t\toptions.prompter,\n\t\t\t\t);\n\n\t\t\t\tlogPackageMessage(\n\t\t\t\t\tpackageDescription.Package,\n\t\t\t\t\t`Uploading package to ${publishDomain}.${publishSubdomain}`,\n\t\t\t\t);\n\n\t\t\t\tawait AssetService.uploadPackage(\n\t\t\t\t\tsessionManager.getTargetSession(),\n\t\t\t\t\tassetServerPackageDetails,\n\t\t\t\t\tzipFilePath,\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tawait sessionManager.destroy().catch((err) => {\n\t\t\t\t\tlogPackageMessage(\n\t\t\t\t\t\tpackageDescription.Package,\n\t\t\t\t\t\t`Failed to close IG.Asset.Server session(s): ${err}`,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\tresetVersionFile();\n\t\tthrow err;\n\t}\n\n\tif (newVersion.buildNumber >= 100 && !options.pushOnly) {\n\t\tlogPackageMessage(fullPackageName, \"Copying zip to releases folder\");\n\n\t\tconst zipFileName = `${packageNameWithVersion}.zip`;\n\t\tconst releasesPath = getPackageReleasesDirectory(location);\n\n\t\tfs.mkdirSync(releasesPath, { recursive: true });\n\t\tfs.copyFileSync(zipFilePath, path.join(releasesPath, zipFileName));\n\t}\n};\n\nconst ensureRequiredVersions = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tcreatorPackage: CreatorPackage,\n\tsessionManager: SessionManager,\n\tprompter: Prompter,\n) => {\n\tinterface UploadedPackage\n\t\textends Omit<AssetService.ExistingPackage, \"version\"> {\n\t\tversion: PackageVersion;\n\t}\n\n\tconst libraries = determineWorkspaceIGLibraries(workspaceLocation);\n\n\t// If there are no libraries, we don't need to check for required versions\n\tif (libraries.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst targetSession = sessionManager.getTargetSession();\n\n\tconst rawUploadedPackages = await AssetService.getExistingPackages(\n\t\ttargetSession,\n\t);\n\n\tconst uploadedPackages = rawUploadedPackages.map(\n\t\t(entry): UploadedPackage => {\n\t\t\tlet version: PackageVersion;\n\n\t\t\ttry {\n\t\t\t\tversion = parseVersionFromNumericVersion(entry.numericVersion);\n\t\t\t} catch (err) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Encountered invalid format for version ${entry.numericVersion}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (version.buildNumber < 100) {\n\t\t\t\tversion.preRelease = {\n\t\t\t\t\ttype: \"beta\",\n\t\t\t\t\tversion: version.buildNumber,\n\t\t\t\t};\n\t\t\t} else if (version.buildNumber > 100) {\n\t\t\t\tversion.preRelease = {\n\t\t\t\t\ttype: \"patch\",\n\t\t\t\t\tversion: version.buildNumber - 100,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...entry,\n\t\t\t\tversion,\n\t\t\t};\n\t\t},\n\t);\n\n\tfor (const libraryLocation of libraries) {\n\t\tconst libraryManifest =\n\t\t\treadPublishedPackageNpmManifest(libraryLocation);\n\t\tconst libraryCreatorPackage =\n\t\t\treadPublishedPackageCreatorManifest(libraryLocation);\n\n\t\tif (\n\t\t\tlibraryCreatorPackage === undefined ||\n\t\t\tlibraryManifest.main === undefined ||\n\t\t\tlibraryCreatorPackage.Package === creatorPackage.Package\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst libraryVersion = PackageVersion.extractFromLine(\n\t\t\tlibraryManifest.version,\n\t\t);\n\n\t\tif (libraryVersion.preRelease) {\n\t\t\tlibraryVersion.buildNumber = libraryVersion.preRelease.version;\n\t\t\tlibraryVersion.preRelease = undefined;\n\t\t} else {\n\t\t\tlibraryVersion.buildNumber = 100;\n\t\t}\n\n\t\tlet uploadedPackageInBasics: UploadedPackage | undefined;\n\t\tlet uploadedPackageInTarget: UploadedPackage | undefined;\n\n\t\tfor (const uploadedPackage of uploadedPackages) {\n\t\t\tif (uploadedPackage.scope === libraryCreatorPackage.Package) {\n\t\t\t\tif (uploadedPackage.support) {\n\t\t\t\t\tuploadedPackageInBasics = uploadedPackage;\n\t\t\t\t} else {\n\t\t\t\t\tuploadedPackageInTarget = uploadedPackage;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst validInBasics =\n\t\t\tuploadedPackageInBasics !== undefined &&\n\t\t\t!uploadedPackageInBasics.version.isLesserThan(libraryVersion);\n\t\tconst validInTarget =\n\t\t\tuploadedPackageInTarget !== undefined &&\n\t\t\t!uploadedPackageInTarget.version.isLesserThan(libraryVersion);\n\n\t\tif (validInBasics || validInTarget) {\n\t\t\tif (\n\t\t\t\ttargetSession.subDomain !== \"Basics\" &&\n\t\t\t\t(uploadedPackageInBasics !== undefined ||\n\t\t\t\t\tuploadedPackageInTarget !== undefined)\n\t\t\t) {\n\t\t\t\tlogPackageMessage(\n\t\t\t\t\tcreatorPackage.Package,\n\t\t\t\t\t`Package ${libraryCreatorPackage.Package} is uploaded both for Basics and ${targetSession.subDomain}. The package within ${targetSession.subDomain} will be used.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tlogPackageMessage(\n\t\t\tcreatorPackage.Package,\n\t\t\t`Requested at least version ${libraryVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t})} for package ${libraryCreatorPackage.Package}`,\n\t\t);\n\n\t\tif (targetSession.subDomain !== \"Basics\" && uploadedPackageInTarget) {\n\t\t\tconst version = uploadedPackageInTarget.version.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t});\n\n\t\t\tlogPackageMessage(\n\t\t\t\tcreatorPackage.Package,\n\t\t\t\t`Found invalid version ${version} for package ${libraryCreatorPackage.Package} in ${targetSession.subDomain}`,\n\t\t\t);\n\t\t}\n\t\tif (uploadedPackageInBasics) {\n\t\t\tconst version = uploadedPackageInBasics.version.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t});\n\n\t\t\tlet message = `Found invalid version ${version} for package ${libraryCreatorPackage.Package} in Basics`;\n\n\t\t\tif (\n\t\t\t\ttargetSession.subDomain !== \"Basics\" &&\n\t\t\t\tuploadedPackageInTarget\n\t\t\t) {\n\t\t\t\tmessage += `. This version will not be used since the package also exists in ${targetSession.subDomain}`;\n\t\t\t}\n\n\t\t\tlogPackageMessage(creatorPackage.Package, message);\n\t\t}\n\n\t\tconst possibleTargets: string[] = [\"Basics\"];\n\n\t\tif (targetSession.subDomain !== \"Basics\") {\n\t\t\tpossibleTargets.push(targetSession.subDomain);\n\t\t}\n\n\t\tconst uploadTargetScope = await prompter.ask({\n\t\t\tmessage: `Select the scope to upload the required version of ${libraryCreatorPackage.Package} to or select \"skip\" to skip the upload.`,\n\t\t\toptions: [...possibleTargets, \"Skip\"],\n\t\t\tdefault: possibleTargets[0],\n\t\t});\n\n\t\tif (uploadTargetScope === \"Skip\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst archive = buildArchiveFromPublishedPackage(\n\t\t\tlibraryLocation,\n\t\t\tlibraryManifest,\n\t\t\tlibraryCreatorPackage,\n\t\t);\n\n\t\tconst newVersionString = libraryVersion.toVersionString({\n\t\t\tbuildNumber: true,\n\t\t});\n\t\tconst packageNameWithVersion = `${libraryCreatorPackage.Package}_${newVersionString}`;\n\n\t\tconst zipFilePath = path.join(\n\t\t\tgetWorkspaceOutputPath(workspaceLocation),\n\t\t\t`${packageNameWithVersion}.zip`,\n\t\t);\n\n\t\ttry {\n\t\t\tfs.rmSync(zipFilePath);\n\t\t} catch (err) {\n\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\n\t\tconst zipOutputStream = fs.createWriteStream(zipFilePath);\n\t\tawait pipeline(archive.generateNodeStream(), zipOutputStream);\n\n\t\tconst session =\n\t\t\tuploadTargetScope === \"Basics\"\n\t\t\t\t? await sessionManager.getBasicsSession()\n\t\t\t\t: targetSession;\n\n\t\tlogPackageMessage(\n\t\t\tcreatorPackage.Package,\n\t\t\t`Uploading package ${libraryCreatorPackage.Package} with version ${newVersionString} to ${session.domain}.${session.subDomain}`,\n\t\t);\n\n\t\tawait AssetService.uploadPackage(\n\t\t\tsession,\n\t\t\t{\n\t\t\t\tname: libraryCreatorPackage.Package,\n\t\t\t\tversion: newVersionString,\n\t\t\t},\n\t\t\tzipFilePath,\n\t\t);\n\t}\n};\n\ninterface SessionManager {\n\tgetBasicsSession: () => Promise<AssetService.Session>;\n\tgetTargetSession: () => AssetService.Session;\n\tdestroy: () => Promise<void>;\n}\n\nconst createSessionManager = async (\n\tparams: AssetService.SessionStartParams,\n): Promise<SessionManager> => {\n\tconst targetSession = await AssetService.startSession(params);\n\tlet basicsSession: AssetService.Session | undefined;\n\n\treturn {\n\t\tgetBasicsSession: async () => {\n\t\t\tif (targetSession.subDomain === \"Basics\") {\n\t\t\t\treturn targetSession;\n\t\t\t}\n\n\t\t\tif (basicsSession === undefined) {\n\t\t\t\tbasicsSession = await AssetService.startSession({\n\t\t\t\t\t...params,\n\t\t\t\t\tsubDomain: \"Basics\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn basicsSession;\n\t\t},\n\n\t\tgetTargetSession: () => targetSession,\n\n\t\tdestroy: async () => {\n\t\t\tawait AssetService.closeSession(targetSession);\n\n\t\t\tif (basicsSession !== undefined) {\n\t\t\t\tawait AssetService.closeSession(basicsSession);\n\t\t\t}\n\t\t},\n\t};\n};\n"],"names":["releaseFolder","options","workspace","location","directory","write","writeVersionFile","reset","resetVersionFile","getVersionFileHandler","packageDescription","readPackageCreatorManifest","fullPackageName","Package","domain","subdomain","parseCreatorPackageName","publishDomain","publishSubdomain","sharedPackageJson","readWorkspaceNpmManifest","newVersion","parseVersionFromString","err","Error","buildNumber","preRelease","type","version","undefined","logPackageMessage","execSync","encoding","cwd","path","binDir","getWorkspaceOutputPath","fs","mkdirSync","recursive","assetServerPackageDetails","packageNameWithVersion","versionWithoutPrelease","clone","newVersionString","toVersionString","name","zipFilePath","join","pushOnly","existsSync","gitVersionInformation","getVersionInformationFromGit","bannerText","getWorkspaceBannerText","buildFolders","packages","skipPackagesWithoutTsFiles","banner","text","commit","commitDirty","dirty","date","Date","now","rmSync","isErrorENOENT","archive","buildArchiveFromPackage","zipOutputStream","createWriteStream","pipeline","generateNodeStream","noUpload","authentication","sessionManager","createSessionManager","url","service","address","subDomain","ensureRequiredVersions","prompter","AssetService","getTargetSession","destroy","catch","zipFileName","releasesPath","getPackageReleasesDirectory","copyFileSync","workspaceLocation","creatorPackage","libraries","determineWorkspaceIGLibraries","length","targetSession","rawUploadedPackages","uploadedPackages","map","entry","parseVersionFromNumericVersion","numericVersion","libraryLocation","libraryManifest","readPublishedPackageNpmManifest","libraryCreatorPackage","readPublishedPackageCreatorManifest","main","libraryVersion","PackageVersion","extractFromLine","uploadedPackageInBasics","uploadedPackageInTarget","uploadedPackage","scope","support","validInBasics","isLesserThan","validInTarget","message","possibleTargets","push","uploadTargetScope","ask","default","buildArchiveFromPublishedPackage","session","getBasicsSession","params","basicsSession"],"mappings":";;;;;;;;;;;;;;;;;;;AA4DaA,MAAAA,aAAa,GAAG,MAAOC,OAA6B,IAAK;AACrE,EAAA,MAAMC,SAAS,GAAGD,OAAO,CAACC,SAAS,CA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,EAAE,YAAY;AACpB,MAAA,MAAMF,YAAyB,CAACa,aAAa,CAAC,CAAA;MAE9C,IAAIkC,aAAa,KAAKtG,SAAS,EAAE;AAChC,QAAA,MAAMuD,YAAyB,CAAC+C,aAAa,CAAC,CAAA;AAC/C,OAAA;AACD,KAAA;GACA,CAAA;AACF,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intelligentgraphics/ig.gfx.packager",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "IG.GFX.Packager 3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
|
+
"description": "IG.GFX.Packager 3.0.2 (3.0.2.100)",
|
|
5
5
|
"author": "Michael Beier <mb@intelligentgraphics.biz>",
|
|
6
6
|
"main": "build/index.mjs",
|
|
7
7
|
"private": false,
|
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
"packager": "./build/index.mjs"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
|
-
"build"
|
|
20
|
-
"locales",
|
|
21
|
-
"scripts"
|
|
19
|
+
"build"
|
|
22
20
|
],
|
|
23
21
|
"scripts": {
|
|
24
22
|
"dist": "rollup -c rollup.config.mjs",
|
|
@@ -44,7 +42,6 @@
|
|
|
44
42
|
"update-notifier": "^6.0.2",
|
|
45
43
|
"v8-compile-cache": "^2.3.0",
|
|
46
44
|
"write-pkg": "^5.1.0",
|
|
47
|
-
"y18n": "^5.0.8",
|
|
48
45
|
"yargs": "^17.6.2"
|
|
49
46
|
},
|
|
50
47
|
"devDependencies": {
|
package/readme.md
CHANGED
|
@@ -141,11 +141,12 @@ This command also allows the address and service to be overwritten. A list of al
|
|
|
141
141
|
npm run upload -- --help
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
###
|
|
144
|
+
### Using ig libraries
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
**Installation**
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
To use ig libraries like IG.GFX.Standard or IGX.Eval you need to install them as an npm package. They can be installed for the workspace either by manually adding them to the package.json of the workspace or by executing `npm install {packagename}`.
|
|
149
|
+
Make sure to register a postinstall command in the workspace package.json, if it's not yet set, as shown in the installation examples.
|
|
149
150
|
|
|
150
151
|
The following packages can be installed:
|
|
151
152
|
|
|
@@ -163,6 +164,8 @@ The following packages can be installed:
|
|
|
163
164
|
|
|
164
165
|
To install the package `IG.GFX.Standard` you can execute the command `npm install @intelligentgraphics/3d.ig.gfx.standard`.
|
|
165
166
|
|
|
167
|
+
**Using the installed packages**
|
|
168
|
+
|
|
166
169
|
In order to use the types of an installed package, a reference needs to be added to a typescript file of a package (generally an include.ts file).
|
|
167
170
|
You can add a reference by including the following comment at the top of the file:
|
|
168
171
|
|
|
@@ -170,9 +173,13 @@ You can add a reference by including the following comment at the top of the fil
|
|
|
170
173
|
/// <reference types="@intelligentgraphics/3d.ig.gfx.standard" />
|
|
171
174
|
```
|
|
172
175
|
|
|
173
|
-
The packager also replaces the content of the legacy definition files within the lib folder with a reference to the installed definition
|
|
176
|
+
The packager also replaces the content of the legacy definition files within the lib folder with a reference to the installed definition files. The files are created when executing `npm install` or `npm run postinstall`.
|
|
174
177
|
Old packages do not need to be updated to use these new dependencies.
|
|
175
178
|
|
|
179
|
+
**Adding the required packages to the creator**
|
|
180
|
+
|
|
181
|
+
After declaring these dependencies in the package.json, the ig.gfx.packager will automatically ensure the required packages are available for the target subdomain when uploading a package.
|
|
182
|
+
|
|
176
183
|
### Migrating to ig.gfx.packager 3.0
|
|
177
184
|
|
|
178
185
|
The preferred installation method of the ig.gfx.packager has changed with version 3.0. The packager should now be installed as a global dependency once rather than as a local dependency for every single workspace.
|
|
@@ -319,6 +326,15 @@ The ts files have to adhere to a certain form to be processed.
|
|
|
319
326
|
|
|
320
327
|
## History
|
|
321
328
|
|
|
329
|
+
**IG.GFX.Packager 3.0.2**
|
|
330
|
+
|
|
331
|
+
- handle folders in lib directory
|
|
332
|
+
|
|
333
|
+
**IG.GFX.Packager 3.0.0**
|
|
334
|
+
|
|
335
|
+
- change packager to be installed globally (see [Migrating to ig.gfx.packager 3.0](#Migrating-to-ig.gfx.packager-3.0))
|
|
336
|
+
- offer to upload dependencies, that are defined in the workspace package json, to a creator sub domain if they are not available or outdated (see [Declaring dependencies on ig libraries](#declaring-dependencies-on-ig-libraries))
|
|
337
|
+
|
|
322
338
|
**IG.GFX.Packager 3.0.0-beta.3**
|
|
323
339
|
|
|
324
340
|
- fix build command
|
|
@@ -333,11 +349,6 @@ The ts files have to adhere to a certain form to be processed.
|
|
|
333
349
|
- restructure to fix release on windows
|
|
334
350
|
- preserve original module structure for output
|
|
335
351
|
|
|
336
|
-
**IG.GFX.Packager 3.0.0**
|
|
337
|
-
|
|
338
|
-
- change packager to be installed globally (see [Migrating to ig.gfx.packager 3.0](#Migrating-to-ig.gfx.packager-3.0))
|
|
339
|
-
- offer to upload dependencies, that are defined in the workspace package json, to a creator sub domain if they are not available or outdated (see [Declaring dependencies on ig libraries](#declaring-dependencies-on-ig-libraries))
|
|
340
|
-
|
|
341
352
|
**IG.GFX.Packager 3.0.0-beta.0**
|
|
342
353
|
|
|
343
354
|
- update readme
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import y18n from 'y18n';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { dirname } from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
|
|
6
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
const instance = y18n({
|
|
8
|
-
directory: path.join(__dirname, "..", "..", "locales"),
|
|
9
|
-
updateFiles: false,
|
|
10
|
-
locale: "en",
|
|
11
|
-
fallbackToLanguage: true
|
|
12
|
-
});
|
|
13
|
-
const translate = (key, ...args) => instance.__(key, ...args);
|
|
14
|
-
|
|
15
|
-
export { translate };
|
|
16
|
-
//# sourceMappingURL=localization.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localization.mjs","sources":["../../src/lib/localization.ts"],"sourcesContent":["import y18n from \"y18n\";\nimport * as path from \"path\";\nimport { dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst instance = y18n({\n\tdirectory: path.join(__dirname, \"..\", \"..\", \"locales\"),\n\tupdateFiles: false,\n\tlocale: \"en\",\n\tfallbackToLanguage: true,\n});\n\nexport const setLocale = (locale: string) => {\n\tinstance.setLocale(locale);\n};\n\nexport const translate = (key: string, ...args: string[]) =>\n\tinstance.__(key, ...args);\n"],"names":["__dirname","dirname","fileURLToPath","import","meta","url","instance","y18n","directory","path","join","updateFiles","locale","fallbackToLanguage","translate","key","args","__"],"mappings":";;;;;AAKA,MAAMA,SAAS,GAAGC,OAAO,CAACC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAA;AAEzD,MAAMC,QAAQ,GAAGC,IAAI,CAAC;AACrBC,EAAAA,SAAS,EAAEC,IAAI,CAACC,IAAI,CAACV,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC;AACtDW,EAAAA,WAAW,EAAE,KAAK;AAClBC,EAAAA,MAAM,EAAE,IAAI;AACZC,EAAAA,kBAAkB,EAAE,IAAA;AACrB,CAAC,CAAC,CAAA;MAMWC,SAAS,GAAG,CAACC,GAAW,EAAE,GAAGC,IAAc,KACvDV,QAAQ,CAACW,EAAE,CAACF,GAAG,EAAE,GAAGC,IAAI;;;;"}
|
package/locales/de.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"options.banner": "Text, der als Kommentar über dem kompilierten Code eingefügt wird",
|
|
3
|
-
"options.outDir": "Ziel-Verzeichnis für den kompilierten Code",
|
|
4
|
-
"options.minimize": "Minifiziere den kompilierten Code mit Terser",
|
|
5
|
-
"options.cwd": "Ausführungs-Verzeichnis",
|
|
6
|
-
"options.clean": "Ziel-Ordner vor dem Kompilieren leeren",
|
|
7
|
-
"messages.skipEmpty": "Es wurden keine Ordner beim Ausführen des Programms angegeben. Kompilation wird übersprungen",
|
|
8
|
-
"messages.building": "Kompiliere",
|
|
9
|
-
"messages.built": "Kompilation fertiggestellt",
|
|
10
|
-
"messages.invalidPackageFolder": "Konnte keine _Package.json Datei in \"%s\" finden",
|
|
11
|
-
"messages.movingReleaseZip": "Release-Zip wird in den Release-Ordner bewegt",
|
|
12
|
-
"messages.error": "Ausführung wurde wegen folgendem Fehler gestoppt: %s",
|
|
13
|
-
"release.newVersionQuestion": "Bitte gib die neue Versions-Nummer für %s an (Aktuell: %s)",
|
|
14
|
-
"release.publishConfirmQuestion": "Möchtest du %s mit der Version %s veröffentlichen?",
|
|
15
|
-
"release.domainQuestion": "Welche Domain soll verwendet werden?",
|
|
16
|
-
"release.subdomainQuestion": "Welche Sub-Domain soll verwendet werden?",
|
|
17
|
-
"release.noVersion": "Keine"
|
|
18
|
-
}
|
package/locales/en.json
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"options.banner.description": "Specify a banner which will be inserted as a comment above the code",
|
|
3
|
-
"options.outDir.description": "Output directory",
|
|
4
|
-
"options.minimize.description": "Minify output",
|
|
5
|
-
"options.cwd.description": "Working directory",
|
|
6
|
-
"options.clean.description": "Empty output dir before compiling",
|
|
7
|
-
"options.noUpload.description": "Only zip built files",
|
|
8
|
-
"options.newVersion.description": "Predefine the target version",
|
|
9
|
-
"options.domain.description": "Overwrite the publish domain",
|
|
10
|
-
"options.subdomain.description": "Overwrite the publish subdomain",
|
|
11
|
-
"options.address.description": "Address",
|
|
12
|
-
"options.service.description": "IG.Asset.Server url",
|
|
13
|
-
"options.service.demands": "The IG.Asset.Server url has to either be provided using the option --service or through the \"%s\" environment variable",
|
|
14
|
-
"options.user.description": "User",
|
|
15
|
-
"options.user.demands": "The username has to either be provided using the option --user or through the \"%s\" environment variable",
|
|
16
|
-
"options.password.description": "Password",
|
|
17
|
-
"options.password.demands": "The user password has to either be provided using the option --password or through the \"%s\" environment variable",
|
|
18
|
-
"options.pushOnly.description": "Try to upload an existing zip file without building and validating the version number",
|
|
19
|
-
"options.noValidate.description": "Skip validation of wether newVersion is higher than the current version for releases",
|
|
20
|
-
"options.docs.description": "Generates typedoc",
|
|
21
|
-
"options.ignore.description": "Files to ignore while generating index",
|
|
22
|
-
"options.license.description": "Path to a license file",
|
|
23
|
-
"messages.buildSkipEmpty": "No build targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.",
|
|
24
|
-
"messages.releaseSkipEmpty": "No release targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.",
|
|
25
|
-
"messages.building": "Creating javascript files",
|
|
26
|
-
"messages.invalidPackageFolder": "Could not find a _Package.json file in \"%s\"",
|
|
27
|
-
"messages.movingReleaseZip": "Copying zip to releases folder",
|
|
28
|
-
"messages.error": "Stopped execution because of the following error: %s",
|
|
29
|
-
"messages.missingUploadArgs": "Can not upload the package because of the following issues:",
|
|
30
|
-
"messages.basicsCopy": "Copying basics to lib folder",
|
|
31
|
-
"messages.docsGeneration": "Generating typedoc",
|
|
32
|
-
"release.newVersionQuestion": "Please input a new version number for %s (Current: %s)",
|
|
33
|
-
"release.publishConfirmQuestion": "Do you want to publish %s ",
|
|
34
|
-
"release.domainQuestion": "Which domain should be used?",
|
|
35
|
-
"release.subdomainQuestion": "Which sub domain should be used?",
|
|
36
|
-
"release.noVersion": "None"
|
|
37
|
-
}
|
package/scripts/postinstall.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
|
|
4
|
-
try {
|
|
5
|
-
const filePath = path.join(process.cwd(), "package.json");
|
|
6
|
-
const manifest = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
7
|
-
|
|
8
|
-
if (manifest.name !== "@intelligentgraphics/ig.gfx.packager") {
|
|
9
|
-
if (manifest.scripts === undefined) {
|
|
10
|
-
manifest.scripts = {};
|
|
11
|
-
} else {
|
|
12
|
-
if (manifest.scripts.release === "packager release") {
|
|
13
|
-
delete manifest.scripts.release;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
manifest.scripts.build = "packager build";
|
|
18
|
-
manifest.scripts.upload = "packager upload";
|
|
19
|
-
|
|
20
|
-
fs.writeFileSync(filePath, JSON.stringify(manifest, undefined, 2));
|
|
21
|
-
}
|
|
22
|
-
} catch {}
|