@intelligentgraphics/ig.gfx.packager 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli-5332deff.js +2486 -0
- package/build/cli-5332deff.js.map +1 -0
- package/build/{lib/dependencies.mjs → dependencies-227aca50.js} +62 -4
- package/build/dependencies-227aca50.js.map +1 -0
- package/build/{commands/generate.mjs → generate-a3a16031.js} +17 -3
- package/build/generate-a3a16031.js.map +1 -0
- package/build/{commands/publish/index.mjs → index-5d595f56.js} +181 -16
- package/build/index-5d595f56.js.map +1 -0
- package/build/{commands/build/index.mjs → index-92b6ba5c.js} +151 -8
- package/build/index-92b6ba5c.js.map +1 -0
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/{commands/postinstall.mjs → postinstall-7e50da37.js} +18 -8
- package/build/postinstall-7e50da37.js.map +1 -0
- package/build/{commands/publishNpm.mjs → publishNpm-e2c8347f.js} +21 -9
- package/build/publishNpm-e2c8347f.js.map +1 -0
- package/build/versionFile-b3a65dc8.js +370 -0
- package/build/versionFile-b3a65dc8.js.map +1 -0
- package/package.json +8 -7
- package/readme.md +16 -3
- package/build/cli.mjs +0 -313
- package/build/cli.mjs.map +0 -1
- package/build/commands/build/docs.mjs +0 -34
- package/build/commands/build/docs.mjs.map +0 -1
- package/build/commands/build/index.mjs.map +0 -1
- package/build/commands/build/tsc.mjs +0 -84
- package/build/commands/build/tsc.mjs.map +0 -1
- package/build/commands/generate.mjs.map +0 -1
- package/build/commands/postinstall.mjs.map +0 -1
- package/build/commands/publish/index.mjs.map +0 -1
- package/build/commands/publish/zip.mjs +0 -168
- package/build/commands/publish/zip.mjs.map +0 -1
- package/build/commands/publishNpm.mjs.map +0 -1
- package/build/lib/assetService.mjs +0 -111
- package/build/lib/assetService.mjs.map +0 -1
- package/build/lib/banner.mjs +0 -20
- package/build/lib/banner.mjs.map +0 -1
- package/build/lib/dependencies.mjs.map +0 -1
- package/build/lib/error.mjs +0 -15
- package/build/lib/error.mjs.map +0 -1
- package/build/lib/fs.mjs +0 -19
- package/build/lib/fs.mjs.map +0 -1
- package/build/lib/git.mjs +0 -37
- package/build/lib/git.mjs.map +0 -1
- package/build/lib/log.mjs +0 -9
- package/build/lib/log.mjs.map +0 -1
- package/build/lib/npmPackage.mjs +0 -19
- package/build/lib/npmPackage.mjs.map +0 -1
- package/build/lib/package.mjs +0 -129
- package/build/lib/package.mjs.map +0 -1
- package/build/lib/packageVersion.mjs +0 -174
- package/build/lib/packageVersion.mjs.map +0 -1
- package/build/lib/parseVersion.mjs +0 -54
- package/build/lib/parseVersion.mjs.map +0 -1
- package/build/lib/prompter.mjs +0 -31
- package/build/lib/prompter.mjs.map +0 -1
- package/build/lib/publishedPackage.mjs +0 -66
- package/build/lib/publishedPackage.mjs.map +0 -1
- package/build/lib/scripts.mjs +0 -10
- package/build/lib/scripts.mjs.map +0 -1
- package/build/lib/stripUtf8Bom.mjs +0 -11
- package/build/lib/stripUtf8Bom.mjs.map +0 -1
- package/build/lib/toposort.mjs +0 -26
- package/build/lib/toposort.mjs.map +0 -1
- package/build/lib/versionFile.mjs +0 -78
- package/build/lib/versionFile.mjs.map +0 -1
- package/build/lib/workspace.mjs +0 -51
- package/build/lib/workspace.mjs.map +0 -1
package/readme.md
CHANGED
|
@@ -20,7 +20,7 @@ npm install -g @intelligentgraphics/ig.gfx.packager@latest
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "packager build",
|
|
22
22
|
"upload": "packager publish",
|
|
23
|
-
"postinstall": "
|
|
23
|
+
"postinstall": "packager postinstall"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
```
|
|
@@ -33,7 +33,7 @@ npm install -g @intelligentgraphics/ig.gfx.packager@latest
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "packager build",
|
|
35
35
|
"upload": "packager publish",
|
|
36
|
-
"postinstall": "
|
|
36
|
+
"postinstall": "packager postinstall"
|
|
37
37
|
},
|
|
38
38
|
"packager": {
|
|
39
39
|
"banner": "This belongs to a data repo"
|
|
@@ -51,7 +51,7 @@ npm install -g @intelligentgraphics/ig.gfx.packager@latest
|
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "packager build",
|
|
53
53
|
"upload": "packager publish",
|
|
54
|
-
"postinstall": "
|
|
54
|
+
"postinstall": "packager postinstall"
|
|
55
55
|
},
|
|
56
56
|
"packager": {
|
|
57
57
|
"banner": "This file is part of the IG.Graphics IGX Data Package. \n Copyright (C) 2015 - 2020 intelligentgraphics. All Rights Reserved."
|
|
@@ -324,8 +324,21 @@ The ts files have to adhere to a certain form to be processed.
|
|
|
324
324
|
6. Parameter and Package name length need to be <=45
|
|
325
325
|
7. Description is cut off after 99 characters
|
|
326
326
|
|
|
327
|
+
## Troubleshoot
|
|
328
|
+
|
|
329
|
+
### Definitions for ig libraries are not available even though they are registered as dependencies in the package.json
|
|
330
|
+
|
|
331
|
+
The definitions need to be installed by running `npm install` within the root folder of the git repository.
|
|
332
|
+
Afterwards you may need to reload your editor in order for the installed files to be picked up.
|
|
333
|
+
|
|
327
334
|
## History
|
|
328
335
|
|
|
336
|
+
**IG.GFX.Packager 3.0.4**
|
|
337
|
+
|
|
338
|
+
- start a troubleshoot section
|
|
339
|
+
- use platform line ending when writing definition files
|
|
340
|
+
- wrap errors that occur when loading existing packages
|
|
341
|
+
|
|
329
342
|
**IG.GFX.Packager 3.0.3**
|
|
330
343
|
|
|
331
344
|
- set explicit version for yargs
|
package/build/cli.mjs
DELETED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import updateNotifier from 'update-notifier';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import yargs from 'yargs/yargs';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
import glob from 'glob';
|
|
7
|
-
import { detectPackage } from './lib/package.mjs';
|
|
8
|
-
import { detectWorkspace, readWorkspaceNpmManifest, writeWorkspaceNpmManifest } from './lib/workspace.mjs';
|
|
9
|
-
import { createDefaultPrompter } from './lib/prompter.mjs';
|
|
10
|
-
import { getPackageTypescriptFiles } from './lib/scripts.mjs';
|
|
11
|
-
|
|
12
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const __dirname = path.dirname(__filename);
|
|
14
|
-
const pjson = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"));
|
|
15
|
-
const captureError = err => {
|
|
16
|
-
console.log("");
|
|
17
|
-
if (process.env.NODE_ENV !== "production") {
|
|
18
|
-
console.error(err);
|
|
19
|
-
} else {
|
|
20
|
-
console.error("Stopped execution because of the following error: " + err.message);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const buildOptions = {
|
|
24
|
-
outDir: {
|
|
25
|
-
description: "Output directory",
|
|
26
|
-
type: "string",
|
|
27
|
-
default: "bin",
|
|
28
|
-
coerce: input => input === undefined || input === null ? undefined : path.resolve(process.cwd(), input)
|
|
29
|
-
},
|
|
30
|
-
minimize: {
|
|
31
|
-
description: "Minify output",
|
|
32
|
-
type: "boolean",
|
|
33
|
-
default: true
|
|
34
|
-
},
|
|
35
|
-
cwd: {
|
|
36
|
-
description: "Working directory",
|
|
37
|
-
type: "string",
|
|
38
|
-
default: process.cwd()
|
|
39
|
-
},
|
|
40
|
-
clean: {
|
|
41
|
-
description: "Empty output dir before compiling",
|
|
42
|
-
type: "boolean",
|
|
43
|
-
default: false
|
|
44
|
-
},
|
|
45
|
-
docs: {
|
|
46
|
-
type: "boolean",
|
|
47
|
-
default: false
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const preCommandCheck = async workspaceLocation => {
|
|
51
|
-
var _repositoryPackage$de, _repositoryPackage$de2;
|
|
52
|
-
const executedLocalPackager = path.relative(process.cwd(), __filename).indexOf("..") === -1;
|
|
53
|
-
const repositoryPackage = readWorkspaceNpmManifest(workspaceLocation);
|
|
54
|
-
if (repositoryPackage !== null && repositoryPackage !== void 0 && (_repositoryPackage$de = repositoryPackage.dependencies) !== null && _repositoryPackage$de !== void 0 && _repositoryPackage$de["@intelligentgraphics/ig.gfx.packager"] || repositoryPackage !== null && repositoryPackage !== void 0 && (_repositoryPackage$de2 = repositoryPackage.devDependencies) !== null && _repositoryPackage$de2 !== void 0 && _repositoryPackage$de2["@intelligentgraphics/ig.gfx.packager"]) {
|
|
55
|
-
const parts = ["Detected locally installed ig.gfx.packager."];
|
|
56
|
-
if (executedLocalPackager) {
|
|
57
|
-
parts.push('Run "npm install -g @intelligentgraphics/ig.gfx.packager@latest" to install the global version, if it is not yet installed.');
|
|
58
|
-
}
|
|
59
|
-
parts.push('Run "npm uninstall @intelligentgraphics/ig.gfx.packager" to remove the local version.');
|
|
60
|
-
console.error(parts.join("\n"));
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
if (executedLocalPackager) {
|
|
64
|
-
console.error(`Detected locally installed ig.gfx.packager.
|
|
65
|
-
Run "npm install -g @intelligentgraphics/ig.gfx.packager@latest" to install the global version, if it is not yet installed.
|
|
66
|
-
Run "npm install" to get rid of the local packager version.`);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
const notifier = updateNotifier({
|
|
70
|
-
pkg: pjson,
|
|
71
|
-
shouldNotifyInNpmScript: true,
|
|
72
|
-
updateCheckInterval: 1000 * 60
|
|
73
|
-
});
|
|
74
|
-
notifier.notify({
|
|
75
|
-
isGlobal: true,
|
|
76
|
-
defer: true
|
|
77
|
-
});
|
|
78
|
-
if (repositoryPackage === undefined) {
|
|
79
|
-
throw new Error("Could not load package.json file in current directory");
|
|
80
|
-
}
|
|
81
|
-
repositoryPackage.scripts ??= {};
|
|
82
|
-
repositoryPackage.scripts.postinstall = "packager postinstall";
|
|
83
|
-
writeWorkspaceNpmManifest(workspaceLocation, repositoryPackage);
|
|
84
|
-
};
|
|
85
|
-
const yargsInstance = yargs(process.argv.slice(2));
|
|
86
|
-
const resolvePackagesWithTypescriptFromMaybePatterns = (args = [], workspace) => {
|
|
87
|
-
const folders = new Map();
|
|
88
|
-
for (const arg of args) {
|
|
89
|
-
glob.sync(arg, {
|
|
90
|
-
cwd: workspace.path,
|
|
91
|
-
absolute: true
|
|
92
|
-
}).forEach(folder => {
|
|
93
|
-
try {
|
|
94
|
-
const location = detectPackage(workspace, folder);
|
|
95
|
-
if (getPackageTypescriptFiles(location).length === 0) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
folders.set(folder, location);
|
|
99
|
-
} catch (err) {}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return Array.from(folders.values());
|
|
103
|
-
};
|
|
104
|
-
yargsInstance.command("build [directories...]", "Builds the specified directories", argv => argv.options(buildOptions), async ({
|
|
105
|
-
directories = [],
|
|
106
|
-
...options
|
|
107
|
-
}) => {
|
|
108
|
-
const workspace = detectWorkspace(options.cwd);
|
|
109
|
-
const folders = resolvePackagesWithTypescriptFromMaybePatterns(directories, workspace);
|
|
110
|
-
await preCommandCheck(workspace);
|
|
111
|
-
if (folders.length === 0) {
|
|
112
|
-
return console.log("No build targets found. Please check wether a folder with the provided name exists and wether it has _Package.json.");
|
|
113
|
-
}
|
|
114
|
-
const {
|
|
115
|
-
buildFolders
|
|
116
|
-
} = await import('./commands/build/index.mjs');
|
|
117
|
-
await buildFolders({
|
|
118
|
-
...options,
|
|
119
|
-
packages: folders,
|
|
120
|
-
workspace
|
|
121
|
-
}).catch(captureError);
|
|
122
|
-
});
|
|
123
|
-
yargsInstance.command("publish [directory]", "Publishes the specified directory", argv => argv.options({
|
|
124
|
-
...buildOptions,
|
|
125
|
-
noUpload: {
|
|
126
|
-
type: "boolean",
|
|
127
|
-
default: false,
|
|
128
|
-
description: "Only zip built files and do not upload them"
|
|
129
|
-
},
|
|
130
|
-
domain: {
|
|
131
|
-
type: "string",
|
|
132
|
-
description: "Overwrite the publish domain. Defaults to the one in the _Package.json"
|
|
133
|
-
},
|
|
134
|
-
subdomain: {
|
|
135
|
-
type: "string",
|
|
136
|
-
description: "Overwrite the publish subdomain. Defaults to the one in the _Package.json"
|
|
137
|
-
},
|
|
138
|
-
newVersion: {
|
|
139
|
-
type: "string",
|
|
140
|
-
description: "The name of the new version",
|
|
141
|
-
default: process.env.VERSION,
|
|
142
|
-
required: true
|
|
143
|
-
},
|
|
144
|
-
address: {
|
|
145
|
-
type: "string",
|
|
146
|
-
description: "Address",
|
|
147
|
-
default: "localhost"
|
|
148
|
-
},
|
|
149
|
-
service: {
|
|
150
|
-
type: "string",
|
|
151
|
-
description: "IG.Asset.Server url",
|
|
152
|
-
default: process.env.IG_GFX_ASSET_SERVICE,
|
|
153
|
-
required: true
|
|
154
|
-
},
|
|
155
|
-
user: {
|
|
156
|
-
type: "string",
|
|
157
|
-
description: "User",
|
|
158
|
-
default: process.env.IG_GFX_USER
|
|
159
|
-
},
|
|
160
|
-
password: {
|
|
161
|
-
type: "string",
|
|
162
|
-
description: "Password",
|
|
163
|
-
default: process.env.IG_GFX_PWD
|
|
164
|
-
},
|
|
165
|
-
docs: {
|
|
166
|
-
type: "boolean",
|
|
167
|
-
default: false,
|
|
168
|
-
description: "Generate typedoc documentation"
|
|
169
|
-
},
|
|
170
|
-
pushOnly: {
|
|
171
|
-
type: "boolean",
|
|
172
|
-
default: false,
|
|
173
|
-
description: "Try to upload an existing zip file without building and validating the version number"
|
|
174
|
-
},
|
|
175
|
-
license: {
|
|
176
|
-
type: "string",
|
|
177
|
-
description: "Path to a license file",
|
|
178
|
-
default: process.env.IG_GFX_LICENSE
|
|
179
|
-
}
|
|
180
|
-
}), async ({
|
|
181
|
-
directory,
|
|
182
|
-
user,
|
|
183
|
-
password,
|
|
184
|
-
service,
|
|
185
|
-
license,
|
|
186
|
-
...options
|
|
187
|
-
}) => {
|
|
188
|
-
const workspace = detectWorkspace(options.cwd);
|
|
189
|
-
const folder = detectPackage(workspace, directory);
|
|
190
|
-
await preCommandCheck(workspace);
|
|
191
|
-
if (!options.noUpload) {
|
|
192
|
-
if (!service) {
|
|
193
|
-
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'));
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
if (!license && (!user || !password)) {
|
|
197
|
-
captureError(new Error(`Expected authentication to be provided through either of the following methods:
|
|
198
|
-
- as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable
|
|
199
|
-
- as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`));
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (license && !license.endsWith(".iglic")) {
|
|
203
|
-
captureError(new Error(`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.`));
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
let authentication;
|
|
208
|
-
if (license) {
|
|
209
|
-
const fullLicensePath = path.resolve(process.cwd(), license);
|
|
210
|
-
try {
|
|
211
|
-
const content = fs.readFileSync(fullLicensePath);
|
|
212
|
-
authentication = {
|
|
213
|
-
type: "license",
|
|
214
|
-
license: content.toString("base64")
|
|
215
|
-
};
|
|
216
|
-
} catch (err) {
|
|
217
|
-
if ((err === null || err === void 0 ? void 0 : err.code) === "ENOENT") {
|
|
218
|
-
captureError(new Error(`Expected to find a license file at path: ${fullLicensePath}`));
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
captureError(new Error(`Failed to read license file at path: ${fullLicensePath}`));
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
} else if (user && password) {
|
|
225
|
-
console.log(`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`);
|
|
226
|
-
authentication = {
|
|
227
|
-
type: "credentials",
|
|
228
|
-
username: user,
|
|
229
|
-
password
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
const {
|
|
233
|
-
releaseFolder
|
|
234
|
-
} = await import('./commands/publish/index.mjs');
|
|
235
|
-
const prompter = createDefaultPrompter();
|
|
236
|
-
const fullOptions = {
|
|
237
|
-
...options,
|
|
238
|
-
authentication,
|
|
239
|
-
service: service,
|
|
240
|
-
directory: folder,
|
|
241
|
-
banner: true,
|
|
242
|
-
prompter,
|
|
243
|
-
newVersion: options.newVersion,
|
|
244
|
-
workspace
|
|
245
|
-
};
|
|
246
|
-
await releaseFolder(fullOptions).catch(captureError);
|
|
247
|
-
});
|
|
248
|
-
yargsInstance.command({
|
|
249
|
-
command: "generateIndex [directory]",
|
|
250
|
-
builder: argv => {
|
|
251
|
-
return argv.option("ignore", {
|
|
252
|
-
type: "array",
|
|
253
|
-
default: [],
|
|
254
|
-
description: "Files to ignore while generating index"
|
|
255
|
-
});
|
|
256
|
-
},
|
|
257
|
-
handler: async ({
|
|
258
|
-
directory,
|
|
259
|
-
ignore
|
|
260
|
-
}) => {
|
|
261
|
-
const workspace = detectWorkspace(process.cwd());
|
|
262
|
-
await preCommandCheck(workspace);
|
|
263
|
-
const {
|
|
264
|
-
extract
|
|
265
|
-
} = await import('./commands/generate.mjs');
|
|
266
|
-
const location = detectPackage(workspace, directory);
|
|
267
|
-
extract(location, ignore);
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
yargsInstance.command({
|
|
271
|
-
command: "postinstall",
|
|
272
|
-
builder: argv => argv,
|
|
273
|
-
handler: async () => {
|
|
274
|
-
const {
|
|
275
|
-
executePostInstall
|
|
276
|
-
} = await import('./commands/postinstall.mjs');
|
|
277
|
-
executePostInstall(detectWorkspace(process.cwd()));
|
|
278
|
-
},
|
|
279
|
-
describe: "Runs postinstall tasks"
|
|
280
|
-
});
|
|
281
|
-
yargsInstance.command({
|
|
282
|
-
command: "publishNpm [directory]",
|
|
283
|
-
builder: argv => argv.options({
|
|
284
|
-
newVersion: {
|
|
285
|
-
type: "string",
|
|
286
|
-
description: "Name of the new version",
|
|
287
|
-
default: process.env.VERSION,
|
|
288
|
-
required: true
|
|
289
|
-
},
|
|
290
|
-
dryRun: {
|
|
291
|
-
type: "boolean"
|
|
292
|
-
}
|
|
293
|
-
}),
|
|
294
|
-
handler: async ({
|
|
295
|
-
directory,
|
|
296
|
-
newVersion,
|
|
297
|
-
dryRun
|
|
298
|
-
}) => {
|
|
299
|
-
const workspace = detectWorkspace(process.cwd());
|
|
300
|
-
const {
|
|
301
|
-
publishToNpm
|
|
302
|
-
} = await import('./commands/publishNpm.mjs');
|
|
303
|
-
await publishToNpm({
|
|
304
|
-
workspace,
|
|
305
|
-
location: detectPackage(workspace, directory),
|
|
306
|
-
version: newVersion,
|
|
307
|
-
dryRun
|
|
308
|
-
}).catch(captureError);
|
|
309
|
-
},
|
|
310
|
-
describe: "Publishes the package to npm"
|
|
311
|
-
});
|
|
312
|
-
yargsInstance.demandCommand().pkgConf("packager").showHelpOnFail(false).version(pjson.version).argv;
|
|
313
|
-
//# sourceMappingURL=cli.mjs.map
|
package/build/cli.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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\tconst repositoryPackage = readWorkspaceNpmManifest(workspaceLocation);\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(pjson.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,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,CACZ,oDAAoD,GAAGN,GAAG,CAACO,OAAO,CAClE,CAAA;AACF,GAAA;AACD,CAAC,CAAA;AAED,MAAMC,YAAY,GAAG;AACpBC,EAAAA,MAAM,EAAE;AACPC,IAAAA,WAAW,EAAE,kBAAkB;AAC/BC,I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CE,MAAAA,OAAO,EAAET,OAAO,CAACC,GAAG,CAAC2E,OAAO;AAC5BC,MAAAA,QAAQ,EAAE,IAAA;KACV;AACD+B,IAAAA,MAAM,EAAE;AACPpG,MAAAA,IAAI,EAAE,SAAA;AACP,KAAA;AACD,GAAC,CAAC;AACH+F,EAAAA,OAAO,EAAE,OAAO;IAAEf,SAAS;IAAEb,UAAU;AAAEiC,IAAAA,MAAAA;AAAO,GAAC,KAAK;IACrD,MAAM5D,SAAS,GAAGoB,eAAe,CAACpE,OAAO,CAACc,GAAG,EAAE,CAAC,CAAA;IAEhD,MAAM;AAAE+F,MAAAA,YAAAA;AAAa,KAAC,GAAG,MAAM,OAAO,2BAAuB,CAAC,CAAA;AAE9D,IAAA,MAAMA,YAAY,CAAC;MAClB7D,SAAS;AACTS,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,CAACxH,KAAK,CAACwH,OAAO,CAAC,CAAClE,IAAI"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import typedoc from 'typedoc';
|
|
2
|
-
import glob from 'glob';
|
|
3
|
-
import ts from 'typescript';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
|
|
6
|
-
const generateDocs = async (location, declarationFile, outFolder, name) => {
|
|
7
|
-
const app = new typedoc.Application();
|
|
8
|
-
const mediaDir = path.join(location.manifestDir, "Media");
|
|
9
|
-
app.bootstrap({
|
|
10
|
-
entryPoints: [declarationFile],
|
|
11
|
-
media: mediaDir,
|
|
12
|
-
out: outFolder,
|
|
13
|
-
tsconfig: path.join(location.scriptsDir, "tsconfig.json"),
|
|
14
|
-
skipErrorChecking: true
|
|
15
|
-
});
|
|
16
|
-
app.options.setCompilerOptions([declarationFile], {
|
|
17
|
-
target: ts.ScriptTarget.ES5
|
|
18
|
-
}, undefined);
|
|
19
|
-
app.options.setValue("name", name);
|
|
20
|
-
const [readmePath] = glob.sync("**/readme.md", {
|
|
21
|
-
absolute: true,
|
|
22
|
-
cwd: location.manifestDir
|
|
23
|
-
});
|
|
24
|
-
if (readmePath) {
|
|
25
|
-
app.options.setValue("readme", readmePath);
|
|
26
|
-
}
|
|
27
|
-
const project = app.convert();
|
|
28
|
-
if (project) {
|
|
29
|
-
await app.generateDocs(project, outFolder);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { generateDocs };
|
|
34
|
-
//# sourceMappingURL=docs.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.mjs","sources":["../../../src/commands/build/docs.ts"],"sourcesContent":["import typedoc from \"typedoc\";\nimport glob from \"glob\";\nimport ts from \"typescript\";\nimport * as path from \"path\";\nimport { PackageLocation } from \"../../lib/package\";\n\nexport const generateDocs = async (\n\tlocation: PackageLocation,\n\tdeclarationFile: string,\n\toutFolder: string,\n\tname: string,\n) => {\n\tconst app = new typedoc.Application();\n\n\tconst mediaDir = path.join(location.manifestDir, \"Media\");\n\n\tapp.bootstrap({\n\t\tentryPoints: [declarationFile],\n\t\tmedia: mediaDir,\n\t\tout: outFolder,\n\t\ttsconfig: path.join(location.scriptsDir, \"tsconfig.json\"),\n\t\tskipErrorChecking: true,\n\t});\n\n\tapp.options.setCompilerOptions(\n\t\t[declarationFile],\n\t\t{\n\t\t\ttarget: ts.ScriptTarget.ES5,\n\t\t},\n\t\tundefined,\n\t);\n\n\tapp.options.setValue(\"name\", name);\n\n\tconst [readmePath] = glob.sync(\"**/readme.md\", {\n\t\tabsolute: true,\n\t\tcwd: location.manifestDir,\n\t});\n\n\tif (readmePath) {\n\t\tapp.options.setValue(\"readme\", readmePath);\n\t}\n\n\tconst project = app.convert();\n\n\tif (project) {\n\t\tawait app.generateDocs(project, outFolder);\n\t}\n};\n"],"names":["generateDocs","location","declarationFile","outFolder","name","app","typedoc","Application","mediaDir","path","join","manifestDir","bootstrap","entryPoints","media","out","tsconfig","scriptsDir","skipErrorChecking","options","setCompilerOptions","target","ts","ScriptTarget","ES5","undefined","setValue","readmePath","glob","sync","absolute","cwd","project","convert"],"mappings":";;;;;AAMO,MAAMA,YAAY,GAAG,OAC3BC,QAAyB,EACzBC,eAAuB,EACvBC,SAAiB,EACjBC,IAAY,KACR;AACJ,EAAA,MAAMC,GAAG,GAAG,IAAIC,OAAO,CAACC,WAAW,EAAE,CAAA;EAErC,MAAMC,QAAQ,GAAGC,IAAI,CAACC,IAAI,CAACT,QAAQ,CAACU,WAAW,EAAE,OAAO,CAAC,CAAA;EAEzDN,GAAG,CAACO,SAAS,CAAC;IACbC,WAAW,EAAE,CAACX,eAAe,CAAC;AAC9BY,IAAAA,KAAK,EAAEN,QAAQ;AACfO,IAAAA,GAAG,EAAEZ,SAAS;IACda,QAAQ,EAAEP,IAAI,CAACC,IAAI,CAACT,QAAQ,CAACgB,UAAU,EAAE,eAAe,CAAC;AACzDC,IAAAA,iBAAiB,EAAE,IAAA;AACpB,GAAC,CAAC,CAAA;EAEFb,GAAG,CAACc,OAAO,CAACC,kBAAkB,CAC7B,CAAClB,eAAe,CAAC,EACjB;AACCmB,IAAAA,MAAM,EAAEC,EAAE,CAACC,YAAY,CAACC,GAAAA;GACxB,EACDC,SAAS,CACT,CAAA;EAEDpB,GAAG,CAACc,OAAO,CAACO,QAAQ,CAAC,MAAM,EAAEtB,IAAI,CAAC,CAAA;EAElC,MAAM,CAACuB,UAAU,CAAC,GAAGC,IAAI,CAACC,IAAI,CAAC,cAAc,EAAE;AAC9CC,IAAAA,QAAQ,EAAE,IAAI;IACdC,GAAG,EAAE9B,QAAQ,CAACU,WAAAA;AACf,GAAC,CAAC,CAAA;AAEF,EAAA,IAAIgB,UAAU,EAAE;IACftB,GAAG,CAACc,OAAO,CAACO,QAAQ,CAAC,QAAQ,EAAEC,UAAU,CAAC,CAAA;AAC3C,GAAA;AAEA,EAAA,MAAMK,OAAO,GAAG3B,GAAG,CAAC4B,OAAO,EAAE,CAAA;AAE7B,EAAA,IAAID,OAAO,EAAE;AACZ,IAAA,MAAM3B,GAAG,CAACL,YAAY,CAACgC,OAAO,EAAE7B,SAAS,CAAC,CAAA;AAC3C,GAAA;AACD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
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;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EA,EAAA,OAAOvF,SAAS,CAAA;AACjB,CAAC;;;;"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import * as fs from 'fs';
|
|
4
|
-
import { getPackageTypescriptFiles } from '../../lib/scripts.mjs';
|
|
5
|
-
|
|
6
|
-
const tryReadTsConfig = location => {
|
|
7
|
-
const {
|
|
8
|
-
config
|
|
9
|
-
} = ts.readConfigFile(path.join(location.scriptsDir, "tsconfig.json"), path => {
|
|
10
|
-
try {
|
|
11
|
-
return fs.readFileSync(path, "utf8");
|
|
12
|
-
} catch {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return config;
|
|
17
|
-
};
|
|
18
|
-
const build = async (location, outputDir) => {
|
|
19
|
-
const config = tryReadTsConfig(location);
|
|
20
|
-
config.compilerOptions.lib = ["es5", "dom"];
|
|
21
|
-
const result = ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir);
|
|
22
|
-
const compilerOptions = {
|
|
23
|
-
...result.options,
|
|
24
|
-
removeComments: false,
|
|
25
|
-
declaration: true,
|
|
26
|
-
sourceMap: false,
|
|
27
|
-
// We don't use tsc to actually emit the files, but we still need to set the correct
|
|
28
|
-
// output directory so the compiler can rewrite the `reference path` directives.
|
|
29
|
-
outFile: path.join(outputDir, "out.js"),
|
|
30
|
-
target: ts.ScriptTarget.ES5,
|
|
31
|
-
noEmitOnError: true
|
|
32
|
-
};
|
|
33
|
-
const host = ts.createCompilerHost(compilerOptions);
|
|
34
|
-
host.getCurrentDirectory = () => location.scriptsDir;
|
|
35
|
-
let js;
|
|
36
|
-
let definitions;
|
|
37
|
-
host.writeFile = (fileName, data, writeByteOrderMark) => {
|
|
38
|
-
if (fileName.endsWith(".js")) {
|
|
39
|
-
js = data;
|
|
40
|
-
} else if (fileName.endsWith(".d.ts")) {
|
|
41
|
-
definitions = data;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const files = getPackageTypescriptFiles(location);
|
|
45
|
-
if (files.length === 0) {
|
|
46
|
-
throw new Error(`Expected typescript files to exist when building a package. Packages only consisting of animation jsons do not need to be built.`);
|
|
47
|
-
}
|
|
48
|
-
const programOptions = {
|
|
49
|
-
rootNames: files,
|
|
50
|
-
options: compilerOptions,
|
|
51
|
-
host
|
|
52
|
-
};
|
|
53
|
-
const program = ts.createProgram(programOptions);
|
|
54
|
-
const emitResult = program.emit();
|
|
55
|
-
const allDiagnostics = ts.getPreEmitDiagnostics(program);
|
|
56
|
-
if (!emitResult.emitSkipped) {
|
|
57
|
-
if (allDiagnostics.length > 0) {
|
|
58
|
-
console.log(allDiagnostics.map(createErrorMessage).join("\n"));
|
|
59
|
-
}
|
|
60
|
-
if (js === undefined || definitions === undefined) {
|
|
61
|
-
throw new Error(`Unexpected: no js or definitions were created`);
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
js,
|
|
65
|
-
definitions
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
const error = allDiagnostics.map(createErrorMessage).join("\n");
|
|
69
|
-
throw new Error(error);
|
|
70
|
-
};
|
|
71
|
-
const createErrorMessage = diagnostic => {
|
|
72
|
-
if (!diagnostic.file) {
|
|
73
|
-
return `${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`;
|
|
74
|
-
}
|
|
75
|
-
const {
|
|
76
|
-
line,
|
|
77
|
-
character
|
|
78
|
-
} = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
79
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
80
|
-
return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export { build, tryReadTsConfig };
|
|
84
|
-
//# sourceMappingURL=tsc.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsc.mjs","sources":["../../../src/commands/build/tsc.ts"],"sourcesContent":["import ts from \"typescript\";\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport { PackageLocation } from \"../../lib/package\";\n\nimport { FolderBuilder } from \".\";\nimport { getPackageTypescriptFiles } from \"../../lib/scripts\";\n\nexport const tryReadTsConfig = (location: PackageLocation) => {\n\tconst { config } = ts.readConfigFile(\n\t\tpath.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t(path) => {\n\t\t\ttry {\n\t\t\t\treturn fs.readFileSync(path, \"utf8\");\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t);\n\n\treturn config as {\n\t\tcompilerOptions: ts.CompilerOptions;\n\t};\n};\n\nexport const build: FolderBuilder = async (\n\tlocation: PackageLocation,\n\toutputDir: string,\n) => {\n\tconst config = tryReadTsConfig(location);\n\n\tconfig.compilerOptions.lib = [\"es5\", \"dom\"];\n\n\tconst result = ts.convertCompilerOptionsFromJson(\n\t\tconfig.compilerOptions,\n\t\tlocation.scriptsDir,\n\t);\n\n\tconst compilerOptions: ts.CompilerOptions = {\n\t\t...result.options,\n\t\tremoveComments: false,\n\t\tdeclaration: true,\n\t\tsourceMap: false,\n\t\t// We don't use tsc to actually emit the files, but we still need to set the correct\n\t\t// output directory so the compiler can rewrite the `reference path` directives.\n\t\toutFile: path.join(outputDir, \"out.js\"),\n\t\ttarget: ts.ScriptTarget.ES5,\n\t\tnoEmitOnError: true,\n\t};\n\n\tconst host = ts.createCompilerHost(compilerOptions);\n\thost.getCurrentDirectory = () => location.scriptsDir;\n\n\tlet js: string | undefined;\n\tlet definitions: string | undefined;\n\n\thost.writeFile = (fileName, data, writeByteOrderMark) => {\n\t\tif (fileName.endsWith(\".js\")) {\n\t\t\tjs = data;\n\t\t} else if (fileName.endsWith(\".d.ts\")) {\n\t\t\tdefinitions = data;\n\t\t}\n\t};\n\n\tconst files = getPackageTypescriptFiles(location);\n\n\tif (files.length === 0) {\n\t\tthrow new Error(\n\t\t\t`Expected typescript files to exist when building a package. Packages only consisting of animation jsons do not need to be built.`,\n\t\t);\n\t}\n\n\tconst programOptions: ts.CreateProgramOptions = {\n\t\trootNames: files,\n\t\toptions: compilerOptions,\n\t\thost,\n\t};\n\n\tconst program = ts.createProgram(programOptions);\n\tconst emitResult = program.emit();\n\tconst allDiagnostics = ts.getPreEmitDiagnostics(program);\n\n\tif (!emitResult.emitSkipped) {\n\t\tif (allDiagnostics.length > 0) {\n\t\t\tconsole.log(allDiagnostics.map(createErrorMessage).join(\"\\n\"));\n\t\t}\n\n\t\tif (js === undefined || definitions === undefined) {\n\t\t\tthrow new Error(`Unexpected: no js or definitions were created`);\n\t\t}\n\n\t\treturn { js, definitions };\n\t}\n\n\tconst error = allDiagnostics.map(createErrorMessage).join(\"\\n\");\n\n\tthrow new Error(error);\n};\n\nconst createErrorMessage = (diagnostic: ts.Diagnostic) => {\n\tif (!diagnostic.file) {\n\t\treturn `${ts.flattenDiagnosticMessageText(\n\t\t\tdiagnostic.messageText,\n\t\t\t\"\\n\",\n\t\t)}`;\n\t}\n\n\tconst { line, character } = diagnostic.file.getLineAndCharacterOfPosition(\n\t\tdiagnostic.start!,\n\t);\n\n\tconst message = ts.flattenDiagnosticMessageText(\n\t\tdiagnostic.messageText,\n\t\t\"\\n\",\n\t);\n\n\treturn `${diagnostic.file.fileName} (${line + 1},${\n\t\tcharacter + 1\n\t}): ${message}`;\n};\n"],"names":["tryReadTsConfig","location","config","ts","readConfigFile","path","join","scriptsDir","fs","readFileSync","undefined","build","outputDir","compilerOptions","lib","result","convertCompilerOptionsFromJson","options","removeComments","declaration","sourceMap","outFile","target","ScriptTarget","ES5","noEmitOnError","host","createCompilerHost","getCurrentDirectory","js","definitions","writeFile","fileName","data","writeByteOrderMark","endsWith","files","getPackageTypescriptFiles","length","Error","programOptions","rootNames","program","createProgram","emitResult","emit","allDiagnostics","getPreEmitDiagnostics","emitSkipped","console","log","map","createErrorMessage","error","diagnostic","file","flattenDiagnosticMessageText","messageText","line","character","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AIuB,EAAE,KAAKnB,SAAS,IAAIoB,WAAW,KAAKpB,SAAS,EAAE;AAClD,MAAA,MAAM,IAAI6B,KAAK,CAAE,CAAA,6CAAA,CAA8C,CAAC,CAAA;AACjE,KAAA;IAEA,OAAO;MAAEV,EAAE;AAAEC,MAAAA,WAAAA;KAAa,CAAA;AAC3B,GAAA;AAEA,EAAA,MAAMuB,KAAK,GAAGP,cAAc,CAACK,GAAG,CAACC,kBAAkB,CAAC,CAAC9C,IAAI,CAAC,IAAI,CAAC,CAAA;AAE/D,EAAA,MAAM,IAAIiC,KAAK,CAACc,KAAK,CAAC,CAAA;AACvB,EAAC;AAED,MAAMD,kBAAkB,GAAIE,UAAyB,IAAK;AACzD,EAAA,IAAI,CAACA,UAAU,CAACC,IAAI,EAAE;IACrB,OAAQ,CAAA,EAAEpD,EAAE,CAACqD,4BAA4B,CACxCF,UAAU,CAACG,WAAW,EACtB,IAAI,CACH,CAAC,CAAA,CAAA;AACJ,GAAA;EAEA,MAAM;IAAEC,IAAI;AAAEC,IAAAA,SAAAA;GAAW,GAAGL,UAAU,CAACC,IAAI,CAACK,6BAA6B,CACxEN,UAAU,CAACO,KAAK,CAChB,CAAA;EAED,MAAMC,OAAO,GAAG3D,EAAE,CAACqD,4BAA4B,CAC9CF,UAAU,CAACG,WAAW,EACtB,IAAI,CACJ,CAAA;AAED,EAAA,OAAQ,GAAEH,UAAU,CAACC,IAAI,CAACvB,QAAS,CAAI0B,EAAAA,EAAAA,IAAI,GAAG,CAAE,IAC/CC,SAAS,GAAG,CACZ,CAAA,GAAA,EAAKG,OAAQ,CAAC,CAAA,CAAA;AAChB,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate.mjs","sources":["../../src/commands/generate.ts"],"sourcesContent":["import ts from \"typescript\";\n\nimport {\n\tPackageLocation,\n\twritePackageCreatorIndex,\n\treadPackageCreatorIndex,\n} from \"../lib/package\";\nimport { getPackageTypescriptFiles } from \"../lib/scripts\";\nimport {\n\tCreatorIndexEntry,\n\tCreatorIndexParameter,\n\tCreatorIndexParameterType,\n} from \"../lib/package\";\n\nfunction findTsNode<T extends ts.Node>(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => node is T,\n): T | undefined;\nfunction findTsNode(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => boolean,\n): ts.Node | undefined;\nfunction findTsNode(\n\tnode: ts.Node,\n\tcallback: (node: ts.Node) => boolean,\n): ts.Node | undefined {\n\tlet result: ts.Node | undefined;\n\n\tts.forEachChild(node, (child) => {\n\t\tif (callback(child)) {\n\t\t\tresult = child;\n\t\t\treturn true;\n\t\t}\n\t});\n\n\treturn result;\n}\n\nfunction capitalizeFirstLetter(string) {\n\treturn string?.charAt(0).toUpperCase() + string?.slice(1);\n}\n\nfunction parseDefault(value: string, type: string) {\n\tconst uType: CreatorIndexParameterType = capitalizeFirstLetter(type);\n\tif (value === \"null\") return null;\n\tswitch (uType) {\n\t\tcase \"LengthM\":\n\t\tcase \"ArcDEG\":\n\t\tcase \"Float\":\n\t\t\treturn parseFloat(value);\n\t\tcase \"Integer\":\n\t\tcase \"Int\":\n\t\t\treturn parseInt(value);\n\t\tcase \"Boolean\":\n\t\tcase \"Bool\":\n\t\t\treturn value === \"true\";\n\t\tcase \"Material\":\n\t\tcase \"String\":\n\t\tdefault:\n\t\t\treturn value.replace(/^\"/, \"\").replace(/\"$/, \"\");\n\t}\n}\n\nfunction findEvaluatorNode(node: ts.Node): ts.ClassDeclaration | undefined {\n\tif (\n\t\tts.isModuleDeclaration(node) &&\n\t\tnode.body &&\n\t\tts.isModuleDeclaration(node.body) &&\n\t\tnode.body.body\n\t) {\n\t\tconst classDeclaration = findTsNode(\n\t\t\tnode.body.body,\n\t\t\t(child): child is ts.ClassDeclaration => {\n\t\t\t\tif (!ts.isClassDeclaration(child)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst isEvaluator = child.heritageClauses?.some((clause) => {\n\t\t\t\t\tif (clause.token !== ts.SyntaxKind.ExtendsKeyword) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn clause.types.some((type) =>\n\t\t\t\t\t\ttype.getText().includes(\"Evaluator\"),\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\treturn isEvaluator ?? false;\n\t\t\t},\n\t\t);\n\n\t\treturn classDeclaration;\n\t}\n}\n\nfunction getParameter(evaluatorNode: ts.ClassDeclaration) {\n\tlet memb = evaluatorNode.members?.find(\n\t\t(member) => member?.name?.getText().toLowerCase() == \"create\",\n\t);\n\tif (ts.isMethodDeclaration(memb!)) {\n\t\treturn memb.parameters.find(\n\t\t\t(para) => para.name.getText().toLowerCase() == \"parameters\",\n\t\t);\n\t}\n}\n\nfunction findParametersInterface(\n\tnode: ts.Node,\n\tinterfaceName: string,\n): ts.InterfaceDeclaration | undefined {\n\tif (\n\t\tts.isModuleDeclaration(node) &&\n\t\tnode.body &&\n\t\tts.isModuleDeclaration(node.body) &&\n\t\tnode.body.body\n\t) {\n\t\tconst interfaceDeclaration = findTsNode(\n\t\t\tnode.body.body,\n\t\t\t(child): child is ts.InterfaceDeclaration =>\n\t\t\t\tts.isInterfaceDeclaration(child) &&\n\t\t\t\tchild.name.getText() == interfaceName,\n\t\t);\n\n\t\treturn interfaceDeclaration;\n\t}\n\n\treturn undefined;\n}\n\nfunction getModuleName(sourceFile: ts.Node): string {\n\tlet fullName = \"\";\n\tif (ts.isModuleDeclaration(sourceFile)) {\n\t\tfullName += sourceFile.name.getText();\n\n\t\tlet packageB = sourceFile.body!;\n\t\tif (ts.isModuleDeclaration(packageB)) {\n\t\t\tfullName += \".\" + packageB.name.getText();\n\t\t}\n\t}\n\treturn fullName;\n}\n\nfunction genParameters(\n\tinterfac: ts.InterfaceDeclaration,\n): CreatorIndexParameter[] {\n\treturn interfac.members.map((member, i) => {\n\t\tlet para = {} as CreatorIndexParameter;\n\n\t\tpara.Name = member.name!.getText();\n\t\tif (para.Name.length > 45)\n\t\t\tthrow new Error(`Parameter name length >45 '${para.Name}'`);\n\n\t\tlet rawDocTags = ts.getJSDocTags(member);\n\t\tif (rawDocTags.length) {\n\t\t\tlet dict = getTagDict(rawDocTags);\n\t\t\tif (dict.summary) para.Description = dict.summary;\n\t\t\tif (dict.creatorType)\n\t\t\t\tpara.Type = dict.creatorType as CreatorIndexParameterType;\n\t\t\tif (dict.default && dict.creatorType)\n\t\t\t\tpara.Default = parseDefault(dict.default, dict.creatorType);\n\t\t\tpara.DisplayIndex = i + 1;\n\t\t}\n\t\treturn para;\n\t});\n}\n\ninterface IDocTags {\n\tdefault?: string;\n\tcreatorType?: string;\n\tsummary?: string;\n}\n\nfunction getTagDict(tags: any): IDocTags {\n\tlet dict = {};\n\ttags.forEach((tag) => {\n\t\tdict[tag.tagName.text] = tag.comment;\n\t});\n\treturn dict;\n}\n\nfunction findParametersInterfaceInFiles(\n\tprogram: ts.Program,\n\tfileList: string[],\n\tname: string,\n): ts.InterfaceDeclaration | undefined {\n\tfor (const file of fileList) {\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\tif (sourceFile === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`Expected a source file to exist for file name \"${file}\"`,\n\t\t\t);\n\t\t}\n\n\t\tlet interfaceDeclaration: ts.InterfaceDeclaration | undefined;\n\n\t\tts.forEachChild(sourceFile, (node) => {\n\t\t\tinterfaceDeclaration = findParametersInterface(node, name);\n\n\t\t\treturn interfaceDeclaration !== undefined;\n\t\t});\n\n\t\tif (interfaceDeclaration !== undefined) {\n\t\t\treturn interfaceDeclaration;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Extracts and returns script array for _Index.json from a src folder\n *\n * @param folderPath path to a src folder\n */\nexport function extract(location: PackageLocation, ignore: string[] = []) {\n\tconst files = getPackageTypescriptFiles(location);\n\tconst filtered = files.filter((path) => {\n\t\treturn !ignore.some((suffix) => path.endsWith(suffix));\n\t});\n\tlet arr = new Array<CreatorIndexEntry>();\n\n\tlet program = ts.createProgram(filtered, { allowJs: true });\n\tprogram.getTypeChecker();\n\tfiltered.forEach((file) => {\n\t\t// Create a Program to represent the project, then pull out the\n\t\t// source file to parse its AST.\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\t// Loop through the root AST nodes of the file\n\t\tts.forEachChild(sourceFile!, (node) => {\n\t\t\tconst evalNode = findEvaluatorNode(node);\n\n\t\t\tif (evalNode === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet moduleName = getModuleName(node);\n\n\t\t\tif (evalNode.name === undefined) {\n\t\t\t\tthrow new Error(`Expected evaluator class to have a name`);\n\t\t\t}\n\n\t\t\tconst name = moduleName + \".\" + evalNode.name.getText();\n\n\t\t\tif (name.length > 45)\n\t\t\t\tthrow new Error(`Package name length >45 '${name}'`);\n\n\t\t\tlet para = getParameter(evalNode);\n\t\t\tlet paraName = (para?.type as any).typeName.getText();\n\t\t\tlet interfac = findParametersInterfaceInFiles(\n\t\t\t\tprogram,\n\t\t\t\tfiltered,\n\t\t\t\tparaName,\n\t\t\t);\n\n\t\t\tif (interfac === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to find parameters type declaration for evaluator ${evalNode.name.getText()}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst obj: CreatorIndexEntry = {\n\t\t\t\tName: name,\n\t\t\t\tParameters: [],\n\t\t\t\tType: \"Evaluator\",\n\t\t\t};\n\n\t\t\tlet rawDocTags = ts.getJSDocTags(evalNode);\n\t\t\tif (rawDocTags.length) {\n\t\t\t\tlet dict = getTagDict(rawDocTags);\n\t\t\t\tif (dict.summary) obj.Description = dict.summary;\n\t\t\t\tif (dict.creatorType)\n\t\t\t\t\tobj.Type = dict.creatorType as \"Interactor\" | \"Evaluator\";\n\t\t\t}\n\n\t\t\tobj.Parameters = genParameters(interfac);\n\n\t\t\tarr.push(obj);\n\t\t});\n\t});\n\n\twritePackageCreatorIndex(location, arr);\n}\n"],"names":["findTsNode","node","callback","result","ts","forEachChild","child","capitalizeFirstLetter","string","charAt","toUpperCase","slice","parseDefault","value","type","uType","parseFloat","parseInt","replace","findEvaluatorNode","isModuleDeclaration","body","classDeclaration","isClassDeclaration","isEvaluator","heritageClauses","some","clause","token","SyntaxKind","ExtendsKeyword","types","getText","includes","getParameter","evaluatorNode","memb","members","find","member","name","toLowerCase","isMethodDeclaration","parameters","para","findParametersInterface","interfaceName","interfaceDeclaration","isInterfaceDeclaration","undefined","getModuleName","sourceFile","fullName","packageB","genParameters","interfac","map","i","Name","length","Error","rawDocTags","getJSDocTags","dict","getTagDict","summary","Description","creatorType","Type","default","Default","DisplayIndex","tags","forEach","tag","tagName","text","comment","findParametersInterfaceInFiles","program","fileList","file","getSourceFile","extract","location","ignore","files","getPackageTypescriptFiles","filtered","filter","path","suffix","endsWith","arr","Array","createProgram","allowJs","getTypeChecker","evalNode","moduleName","paraName","typeName","obj","Parameters","push","writePackageCreatorIndex"],"mappings":";;;;AAsBA,SAASA,UAAU,CAClBC,IAAa,EACbC,QAAoC,EACd;AACtB,EAAA,IAAIC,MAA2B,CAAA;AAE/BC,EAAAA,EAAE,CAACC,YAAY,CAACJ,IAAI,EAAGK,KAAK,IAAK;AAChC,IAAA,IAAIJ,QAAQ,CAACI,KAAK,CAAC,EAAE;AACpBH,MAAAA,MAAM,GAAGG,KAAK,CAAA;AACd,MAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AACD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,MAAM,CAAA;AACd,CAAA;AAEA,SAASI,qBAAqB,CAACC,MAAM,EAAE;EACtC,OAAO,CAAAA,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,KAAGF,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,G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