@intelligentgraphics/ig.gfx.packager 3.0.9 → 3.0.11
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/bin.mjs +6 -0
- package/build/bin.mjs.map +1 -0
- package/build/cli-381989cc.mjs +1389 -0
- package/build/cli-381989cc.mjs.map +1 -0
- package/build/dependencies-1f665204.mjs +129 -0
- package/build/dependencies-1f665204.mjs.map +1 -0
- package/build/generateIndex-074f4aa1.mjs +257 -0
- package/build/generateIndex-074f4aa1.mjs.map +1 -0
- package/build/generateParameterType-4c9e95a5.mjs +75 -0
- package/build/generateParameterType-4c9e95a5.mjs.map +1 -0
- package/build/index-06ac2c4c.mjs +495 -0
- package/build/index-06ac2c4c.mjs.map +1 -0
- package/build/index-cc42a478.mjs +312 -0
- package/build/index-cc42a478.mjs.map +1 -0
- package/build/postinstall-c38d9b55.mjs +67 -0
- package/build/postinstall-c38d9b55.mjs.map +1 -0
- package/build/publishNpm-8ec1b871.mjs +134 -0
- package/build/publishNpm-8ec1b871.mjs.map +1 -0
- package/build/versionFile-aa8b6b7a.mjs +384 -0
- package/build/versionFile-aa8b6b7a.mjs.map +1 -0
- package/lib/lib.mjs +1476 -0
- package/package.json +13 -9
- package/readme.md +86 -2
- package/build/cli-17d957b0.js +0 -2531
- package/build/cli-17d957b0.js.map +0 -1
- package/build/dependencies-51916db0.js +0 -149
- package/build/dependencies-51916db0.js.map +0 -1
- package/build/generateIndex-59993f0f.js +0 -266
- package/build/generateIndex-59993f0f.js.map +0 -1
- package/build/generateParameterType-d3ab08fd.js +0 -74
- package/build/generateParameterType-d3ab08fd.js.map +0 -1
- package/build/index-a48c5d0a.js +0 -480
- package/build/index-a48c5d0a.js.map +0 -1
- package/build/index-ac2cd050.js +0 -308
- package/build/index-ac2cd050.js.map +0 -1
- package/build/index.mjs +0 -6
- package/build/index.mjs.map +0 -1
- package/build/postinstall-9990fb31.js +0 -64
- package/build/postinstall-9990fb31.js.map +0 -1
- package/build/publishNpm-74a96626.js +0 -133
- package/build/publishNpm-74a96626.js.map +0 -1
- package/build/versionFile-68e35b54.js +0 -370
- package/build/versionFile-68e35b54.js.map +0 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as terser from 'terser';
|
|
4
|
+
import 'resolve';
|
|
5
|
+
import 'write-pkg';
|
|
6
|
+
import { h as getPackageTypescriptFiles, r as readPackageCreatorManifest, o as readPackageNpmManifest } from './cli-381989cc.mjs';
|
|
7
|
+
import 'node:path';
|
|
8
|
+
import 'node:fs';
|
|
9
|
+
import 'axios';
|
|
10
|
+
import ts from 'typescript';
|
|
11
|
+
import typedoc from 'typedoc';
|
|
12
|
+
import glob from 'glob';
|
|
13
|
+
|
|
14
|
+
const logPackageMessage = (name, step, index, total)=>{
|
|
15
|
+
const numLength = total === undefined ? undefined : total.toString().length;
|
|
16
|
+
const indexString = total === undefined || total < 2 ? "" : `${index.toString().padStart(numLength, "0")}/${total} `;
|
|
17
|
+
const identifierString = `${indexString}${name.padEnd(15)}`;
|
|
18
|
+
console.log(`${identifierString} >> ${step}`);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const tryReadTsConfig = (location)=>{
|
|
22
|
+
const { config } = ts.readConfigFile(path.join(location.scriptsDir, "tsconfig.json"), (path)=>{
|
|
23
|
+
try {
|
|
24
|
+
return fs.readFileSync(path, "utf8");
|
|
25
|
+
} catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return config;
|
|
30
|
+
};
|
|
31
|
+
const build = async (location, outputDir)=>{
|
|
32
|
+
const config = tryReadTsConfig(location);
|
|
33
|
+
config.compilerOptions.lib = [
|
|
34
|
+
"es5",
|
|
35
|
+
"dom"
|
|
36
|
+
];
|
|
37
|
+
const result = ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir);
|
|
38
|
+
const compilerOptions = {
|
|
39
|
+
...result.options,
|
|
40
|
+
removeComments: false,
|
|
41
|
+
declaration: true,
|
|
42
|
+
sourceMap: false,
|
|
43
|
+
// We don't use tsc to actually emit the files, but we still need to set the correct
|
|
44
|
+
// output directory so the compiler can rewrite the `reference path` directives.
|
|
45
|
+
outFile: path.join(outputDir, "out.js"),
|
|
46
|
+
target: ts.ScriptTarget.ES5,
|
|
47
|
+
noEmitOnError: true
|
|
48
|
+
};
|
|
49
|
+
const host = ts.createCompilerHost(compilerOptions);
|
|
50
|
+
host.getCurrentDirectory = ()=>location.scriptsDir;
|
|
51
|
+
let js;
|
|
52
|
+
let definitions;
|
|
53
|
+
host.writeFile = (fileName, data, writeByteOrderMark)=>{
|
|
54
|
+
if (fileName.endsWith(".js")) {
|
|
55
|
+
js = data;
|
|
56
|
+
} else if (fileName.endsWith(".d.ts")) {
|
|
57
|
+
definitions = data;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const files = getPackageTypescriptFiles(location);
|
|
61
|
+
if (files.length === 0) {
|
|
62
|
+
throw new Error(`Expected typescript files to exist when building a package. Packages only consisting of animation jsons do not need to be built.`);
|
|
63
|
+
}
|
|
64
|
+
const programOptions = {
|
|
65
|
+
rootNames: files,
|
|
66
|
+
options: compilerOptions,
|
|
67
|
+
host
|
|
68
|
+
};
|
|
69
|
+
const program = ts.createProgram(programOptions);
|
|
70
|
+
const emitResult = program.emit();
|
|
71
|
+
const allDiagnostics = ts.getPreEmitDiagnostics(program);
|
|
72
|
+
if (!emitResult.emitSkipped) {
|
|
73
|
+
if (allDiagnostics.length > 0) {
|
|
74
|
+
console.log(allDiagnostics.map(createErrorMessage).join("\n"));
|
|
75
|
+
}
|
|
76
|
+
if (js === undefined || definitions === undefined) {
|
|
77
|
+
throw new Error(`Unexpected: no js or definitions were created`);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
js,
|
|
81
|
+
definitions
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const error = allDiagnostics.map(createErrorMessage).join("\n");
|
|
85
|
+
throw new Error(error);
|
|
86
|
+
};
|
|
87
|
+
const createErrorMessage = (diagnostic)=>{
|
|
88
|
+
if (!diagnostic.file) {
|
|
89
|
+
return `${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`;
|
|
90
|
+
}
|
|
91
|
+
const { line , character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
92
|
+
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
93
|
+
return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const generateDocs = async (location, declarationFile, outFolder, name)=>{
|
|
97
|
+
const app = new typedoc.Application();
|
|
98
|
+
const mediaDir = path.join(location.manifestDir, "Media");
|
|
99
|
+
app.bootstrap({
|
|
100
|
+
entryPoints: [
|
|
101
|
+
declarationFile
|
|
102
|
+
],
|
|
103
|
+
media: mediaDir,
|
|
104
|
+
out: outFolder,
|
|
105
|
+
tsconfig: path.join(location.scriptsDir, "tsconfig.json"),
|
|
106
|
+
skipErrorChecking: true
|
|
107
|
+
});
|
|
108
|
+
app.options.setCompilerOptions([
|
|
109
|
+
declarationFile
|
|
110
|
+
], {
|
|
111
|
+
target: ts.ScriptTarget.ES5
|
|
112
|
+
}, undefined);
|
|
113
|
+
app.options.setValue("name", name);
|
|
114
|
+
const [readmePath] = glob.sync("**/readme.md", {
|
|
115
|
+
absolute: true,
|
|
116
|
+
cwd: location.manifestDir
|
|
117
|
+
});
|
|
118
|
+
if (readmePath) {
|
|
119
|
+
app.options.setValue("readme", readmePath);
|
|
120
|
+
}
|
|
121
|
+
const project = app.convert();
|
|
122
|
+
if (project) {
|
|
123
|
+
await app.generateDocs(project, outFolder);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Stolen from ig.tools.core
|
|
128
|
+
const toposort = (packages)=>{
|
|
129
|
+
const queue = Object.getOwnPropertyNames(packages);
|
|
130
|
+
const result = [];
|
|
131
|
+
let index = 0;
|
|
132
|
+
while(queue.length > 0){
|
|
133
|
+
if (index >= queue.length) {
|
|
134
|
+
throw new Error("Packages can not have cyclic dependencies");
|
|
135
|
+
}
|
|
136
|
+
const queueEntry = queue[index];
|
|
137
|
+
const dependencies = packages[queueEntry];
|
|
138
|
+
const dependencyQueued = dependencies.some((dependency)=>queue.includes(dependency));
|
|
139
|
+
if (dependencyQueued) {
|
|
140
|
+
index++;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
queue.splice(index, 1);
|
|
144
|
+
index = 0;
|
|
145
|
+
result.push(queueEntry);
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const buildFolders = async (options)=>{
|
|
151
|
+
if (options.outDir !== undefined && options.clean) {
|
|
152
|
+
fs.rmSync(options.outDir, {
|
|
153
|
+
recursive: true
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const workspace = options.workspace;
|
|
157
|
+
const folders = options.packages;
|
|
158
|
+
let sortedPackages = sortPackagesByBuildOrder(folders);
|
|
159
|
+
if (options.skipPackagesWithoutTsFiles) {
|
|
160
|
+
sortedPackages = sortedPackages.filter((location)=>getPackageTypescriptFiles(location).length > 0);
|
|
161
|
+
}
|
|
162
|
+
let index = 1;
|
|
163
|
+
for (const location of sortedPackages){
|
|
164
|
+
ensureTsConfig(location);
|
|
165
|
+
const data = readPackageCreatorManifest(location);
|
|
166
|
+
const logStep = (step)=>logPackageMessage(data.Package, step, index, folders.length);
|
|
167
|
+
logStep("Compiling typescript to javascript");
|
|
168
|
+
const outputDirectory = options.outDir || location.scriptsDir;
|
|
169
|
+
fs.mkdirSync(outputDirectory, {
|
|
170
|
+
recursive: true
|
|
171
|
+
});
|
|
172
|
+
const buildResult = await build(location, outputDirectory);
|
|
173
|
+
const banner = options.banner ? createBannerComment(options.banner) : undefined;
|
|
174
|
+
if (banner) {
|
|
175
|
+
buildResult.js = banner + "\n" + buildResult.js;
|
|
176
|
+
buildResult.definitions = banner + "\n" + buildResult.definitions;
|
|
177
|
+
}
|
|
178
|
+
fs.writeFileSync(path.join(outputDirectory, `${data.Package}.js`), buildResult.js, {
|
|
179
|
+
encoding: "utf8"
|
|
180
|
+
});
|
|
181
|
+
fs.writeFileSync(path.join(outputDirectory, `${data.Package}.d.ts`), buildResult.definitions, {
|
|
182
|
+
encoding: "utf8"
|
|
183
|
+
});
|
|
184
|
+
if (options.minimize) {
|
|
185
|
+
const minifyResult = await terser.minify(buildResult.js, {
|
|
186
|
+
ecma: 5
|
|
187
|
+
});
|
|
188
|
+
const minifiedPath = path.join(outputDirectory, `${data.Package}.min.js`);
|
|
189
|
+
fs.writeFileSync(minifiedPath, minifyResult.code, {
|
|
190
|
+
encoding: "utf8"
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (location.path.includes("Basics")) {
|
|
194
|
+
fs.mkdirSync(path.join(workspace.path, "lib"), {
|
|
195
|
+
recursive: true
|
|
196
|
+
});
|
|
197
|
+
logStep("Copying basics definition file to the lib folder");
|
|
198
|
+
fs.writeFileSync(path.join(workspace.path, "lib", `${data.Package}.d.ts`), buildResult.definitions, {
|
|
199
|
+
encoding: "utf8"
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (options.docs) {
|
|
203
|
+
logStep("Generating typedoc documentation");
|
|
204
|
+
await generateDocs(location, path.join(outputDirectory, `${data.Package}.d.ts`), path.join(workspace.path, "docs", data.Package), data.Package);
|
|
205
|
+
}
|
|
206
|
+
index++;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const ensureTsConfig = (location)=>{
|
|
210
|
+
const tsconfigPath = path.join(location.scriptsDir, "tsconfig.json");
|
|
211
|
+
if (!fs.existsSync(tsconfigPath)) {
|
|
212
|
+
const content = {};
|
|
213
|
+
applyTsConfigOption(content);
|
|
214
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(content, undefined, "\t"), "utf8");
|
|
215
|
+
} else {
|
|
216
|
+
const content = JSON.parse(fs.readFileSync(tsconfigPath, "utf8"));
|
|
217
|
+
applyTsConfigOption(content);
|
|
218
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(content, undefined, "\t"), "utf8");
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const applyTsConfigOption = (data)=>{
|
|
222
|
+
data.compilerOptions = data.compilerOptions ?? {};
|
|
223
|
+
data.compilerOptions.target = "es5";
|
|
224
|
+
data.compilerOptions.lib = [
|
|
225
|
+
"es5",
|
|
226
|
+
"dom"
|
|
227
|
+
];
|
|
228
|
+
};
|
|
229
|
+
const sortPackagesByBuildOrder = (folders)=>{
|
|
230
|
+
const packages = Array.from(folders).reduce((acc, location)=>{
|
|
231
|
+
const data = readPackageNpmManifest(location);
|
|
232
|
+
if (data !== undefined) {
|
|
233
|
+
acc[data.name] = {
|
|
234
|
+
data,
|
|
235
|
+
location
|
|
236
|
+
};
|
|
237
|
+
} else {
|
|
238
|
+
acc[location.path] = {
|
|
239
|
+
data: undefined,
|
|
240
|
+
location
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
return acc;
|
|
244
|
+
}, {});
|
|
245
|
+
const packageDependencies = Object.getOwnPropertyNames(packages).reduce((acc, packageName)=>{
|
|
246
|
+
const packageData = packages[packageName];
|
|
247
|
+
if (packageData.data === undefined) {
|
|
248
|
+
acc[packageName] = [];
|
|
249
|
+
} else {
|
|
250
|
+
acc[packageName] = Object.getOwnPropertyNames({
|
|
251
|
+
...packageData.data.devDependencies,
|
|
252
|
+
...packageData.data.dependencies,
|
|
253
|
+
...packageData.data.peerDependencies
|
|
254
|
+
}).filter((packageName)=>packages[packageName] !== undefined);
|
|
255
|
+
}
|
|
256
|
+
return acc;
|
|
257
|
+
}, {});
|
|
258
|
+
const sortedPackages = toposort(packageDependencies);
|
|
259
|
+
const result = [];
|
|
260
|
+
for (const packageName of sortedPackages){
|
|
261
|
+
const location = packages[packageName].location;
|
|
262
|
+
if (readPackageCreatorManifest(location).Package.endsWith(".Basics")) {
|
|
263
|
+
result.unshift(location);
|
|
264
|
+
} else {
|
|
265
|
+
result.push(location);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return result;
|
|
269
|
+
};
|
|
270
|
+
const createBannerComment = (banner)=>{
|
|
271
|
+
const bannerParts = [];
|
|
272
|
+
if (banner.text) {
|
|
273
|
+
bannerParts.push(" * " + banner.text);
|
|
274
|
+
}
|
|
275
|
+
{
|
|
276
|
+
const details = [];
|
|
277
|
+
if (banner.version) {
|
|
278
|
+
details.push(`Version: ${banner.version}`);
|
|
279
|
+
}
|
|
280
|
+
if (banner.commit) {
|
|
281
|
+
if (banner.commitDirty) {
|
|
282
|
+
details.push(`Commit: ${banner.commit} (dirty)`);
|
|
283
|
+
} else {
|
|
284
|
+
details.push(`Commit: ${banner.commit}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (banner.date) {
|
|
288
|
+
details.push(`Date: ${banner.date.toISOString()}`);
|
|
289
|
+
}
|
|
290
|
+
const detailsText = details.map((line)=>` * ${line}`).join("\n");
|
|
291
|
+
if (detailsText) {
|
|
292
|
+
bannerParts.push(detailsText);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const bannerText = bannerParts.join("\n\n");
|
|
296
|
+
if (bannerText) {
|
|
297
|
+
return `/*
|
|
298
|
+
${bannerText}
|
|
299
|
+
*
|
|
300
|
+
* @preserve
|
|
301
|
+
*/`;
|
|
302
|
+
}
|
|
303
|
+
return undefined;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
307
|
+
__proto__: null,
|
|
308
|
+
buildFolders: buildFolders
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
export { buildFolders as b, index as i, logPackageMessage as l };
|
|
312
|
+
//# sourceMappingURL=index-cc42a478.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-cc42a478.mjs","sources":["../../tools.core/build/log.mjs","../src/commands/build/tsc.ts","../src/commands/build/docs.ts","../src/lib/toposort.ts","../src/commands/build/index.ts"],"sourcesContent":["const logPackageMessage = (name, step, index, total)=>{\n const numLength = total === undefined ? undefined : total.toString().length;\n const indexString = total === undefined || total < 2 ? \"\" : `${index.toString().padStart(numLength, \"0\")}/${total} `;\n const identifierString = `${indexString}${name.padEnd(15)}`;\n console.log(`${identifierString} >> ${step}`);\n};\n\nexport { logPackageMessage };\n//# sourceMappingURL=log.mjs.map\n","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","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","// Stolen from ig.tools.core\n\nexport const toposort = (packages: Record<string, string[]>) => {\n\tconst queue = Object.getOwnPropertyNames(packages);\n\tconst result: string[] = [];\n\n\tlet index = 0;\n\n\twhile (queue.length > 0) {\n\t\tif (index >= queue.length) {\n\t\t\tthrow new Error(\"Packages can not have cyclic dependencies\");\n\t\t}\n\n\t\tconst queueEntry = queue[index];\n\n\t\tconst dependencies = packages[queueEntry];\n\t\tconst dependencyQueued = dependencies.some((dependency) =>\n\t\t\tqueue.includes(dependency),\n\t\t);\n\n\t\tif (dependencyQueued) {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tqueue.splice(index, 1);\n\t\tindex = 0;\n\t\tresult.push(queueEntry);\n\t}\n\n\treturn result;\n};\n","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\tlet sortedPackages = sortPackagesByBuildOrder(folders);\n\n\tif (options.skipPackagesWithoutTsFiles) {\n\t\tsortedPackages = sortedPackages.filter(\n\t\t\t(location) => getPackageTypescriptFiles(location).length > 0,\n\t\t);\n\t}\n\n\tlet index = 1;\n\n\tfor (const location of sortedPackages) {\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":["logPackageMessage","name","step","index","total","numLength","undefined","toString","length","indexString","padStart","identifierString","padEnd","console","log","tryReadTsConfig","location","config","ts","readConfigFile","path","join","scriptsDir","fs","readFileSync","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","Error","programOptions","rootNames","program","createProgram","emitResult","emit","allDiagnostics","getPreEmitDiagnostics","emitSkipped","map","createErrorMessage","error","diagnostic","file","flattenDiagnosticMessageText","messageText","line","character","getLineAndCharacterOfPosition","start","message","generateDocs","declarationFile","outFolder","app","typedoc","Application","mediaDir","manifestDir","bootstrap","entryPoints","media","out","tsconfig","skipErrorChecking","setCompilerOptions","setValue","readmePath","glob","sync","absolute","cwd","project","convert","toposort","packages","queue","Object","getOwnPropertyNames","queueEntry","dependencies","dependencyQueued","some","dependency","includes","splice","push","buildFolders","outDir","clean","rmSync","recursive","workspace","folders","sortedPackages","sortPackagesByBuildOrder","skipPackagesWithoutTsFiles","filter","ensureTsConfig","readPackageCreatorManifest","logStep","Package","outputDirectory","mkdirSync","buildResult","tscBuild","banner","createBannerComment","writeFileSync","encoding","minimize","minifyResult","terser","minify","ecma","minifiedPath","code","docs","tsconfigPath","existsSync","content","applyTsConfigOption","JSON","stringify","parse","Array","from","reduce","acc","readPackageNpmManifest","packageDependencies","packageName","packageData","devDependencies","peerDependencies","unshift","bannerParts","text","details","version","commit","commitDirty","date","toISOString","detailsText","bannerText"],"mappings":";;;;;;;;;;;;;AAAA,MAAMA,iBAAoB,GAAA,CAACC,IAAMC,EAAAA,IAAAA,EAAMC,OAAOC,KAAQ,GAAA;AAClD,IAAA,MAAMC,YAAYD,KAAUE,KAAAA,SAAAA,GAAYA,YAAYF,KAAMG,CAAAA,QAAQ,GAAGC,MAAM,CAAA;AAC3E,IAAA,MAAMC,cAAcL,KAAUE,KAAAA,SAAAA,IAAaF,QAAQ,CAAI,GAAA,EAAA,GAAK,CAAC,EAAED,KAAAA,CA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,QAAA,IAAIkJ,WAAa,EAAA;AAChBR,YAAAA,WAAAA,CAAYlD,IAAI,CAAC0D,WAAAA,CAAAA,CAAAA;SACjB;AACF,KAAA;IAEA,MAAMC,UAAAA,GAAaT,WAAY1I,CAAAA,IAAI,CAAC,MAAA,CAAA,CAAA;AAEpC,IAAA,IAAImJ,UAAY,EAAA;AACf,QAAA,OAAO,CAAC;AACV,EAAEA,UAAW,CAAA;;;EAGX,CAAC,CAAA;KACD;IAED,OAAOlK,SAAAA,CAAAA;AACR,CAAA;;;;;;;;;"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import glob from 'glob';
|
|
4
|
+
import * as os from 'os';
|
|
5
|
+
import { d as determineWorkspaceIGLibraries, a as readPublishedPackageNpmManifest } from './dependencies-1f665204.mjs';
|
|
6
|
+
import 'write-pkg';
|
|
7
|
+
import { c as readWorkspaceNpmManifest, l as getWorkspaceLibPath } from './cli-381989cc.mjs';
|
|
8
|
+
import 'node:path';
|
|
9
|
+
import 'node:fs';
|
|
10
|
+
import 'axios';
|
|
11
|
+
import 'resolve';
|
|
12
|
+
import 'update-notifier';
|
|
13
|
+
import 'yargs/yargs';
|
|
14
|
+
import 'url';
|
|
15
|
+
import 'assert';
|
|
16
|
+
import 'events';
|
|
17
|
+
import 'core-js/modules/es.typed-array.set.js';
|
|
18
|
+
import 'util';
|
|
19
|
+
import 'inquirer';
|
|
20
|
+
|
|
21
|
+
const DEFINITION_FILE_HINT = "// This file is automatically managed by the ig.gfx.packager.";
|
|
22
|
+
const executePostInstall = (workspace)=>{
|
|
23
|
+
readWorkspaceNpmManifest(workspace);
|
|
24
|
+
const libPath = getWorkspaceLibPath(workspace);
|
|
25
|
+
fs.mkdirSync(libPath, {
|
|
26
|
+
recursive: true
|
|
27
|
+
});
|
|
28
|
+
const existingDefinitions = glob.sync("**/*.d.ts", {
|
|
29
|
+
cwd: libPath,
|
|
30
|
+
absolute: true
|
|
31
|
+
});
|
|
32
|
+
// delete all existing definition files that are managed by the packager.
|
|
33
|
+
// we'll recreate all needed definitions in the next step.
|
|
34
|
+
for (const existingDefinitionPath of existingDefinitions){
|
|
35
|
+
const content = fs.readFileSync(existingDefinitionPath, {
|
|
36
|
+
encoding: "utf-8"
|
|
37
|
+
});
|
|
38
|
+
if (content.startsWith(DEFINITION_FILE_HINT)) {
|
|
39
|
+
fs.rmSync(existingDefinitionPath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const libraryLocations = determineWorkspaceIGLibraries(workspace);
|
|
43
|
+
for (const location of libraryLocations){
|
|
44
|
+
const manifest = readPublishedPackageNpmManifest(location);
|
|
45
|
+
for (const existingDefinitionPath of existingDefinitions){
|
|
46
|
+
const basename = path.basename(existingDefinitionPath);
|
|
47
|
+
if (basename === manifest.types) {
|
|
48
|
+
fs.rmSync(existingDefinitionPath, {
|
|
49
|
+
force: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// add a hint to the top of the file so we know it's managed by the packager.
|
|
54
|
+
const content = [
|
|
55
|
+
DEFINITION_FILE_HINT,
|
|
56
|
+
`// This is a reference to version ${manifest.version}.`,
|
|
57
|
+
`// Run "npm install" to install the types if they are missing or not up to date.`,
|
|
58
|
+
`/// <reference types="${manifest.name}" />`
|
|
59
|
+
].join(os.EOL);
|
|
60
|
+
fs.writeFileSync(path.join(getWorkspaceLibPath(workspace), manifest.types), content, {
|
|
61
|
+
encoding: "utf8"
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export { executePostInstall };
|
|
67
|
+
//# sourceMappingURL=postinstall-c38d9b55.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postinstall-c38d9b55.mjs","sources":["../src/commands/postinstall.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport glob from \"glob\";\nimport * as os from \"os\";\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\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\n\t\tconst content = [\n\t\t\tDEFINITION_FILE_HINT,\n\t\t\t`// This is a reference to version ${manifest.version}.`,\n\t\t\t`// Run \"npm install\" to install the types if they are missing or not up to date.`,\n\t\t\t`/// <reference types=\"${manifest.name}\" />`,\n\t\t].join(os.EOL);\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","readWorkspaceNpmManifest","libPath","getWorkspaceLibPath","fs","mkdirSync","recursive","existingDefinitions","glob","sync","cwd","absolute","existingDefinitionPath","content","readFileSync","encoding","startsWith","rmSync","libraryLocations","determineWorkspaceIGLibraries","location","manifest","readPublishedPackageNpmManifest","basename","path","types","force","version","name","join","os","EOL","writeFileSync"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,oBACL,GAAA,+DAAA,CAAA;AAEM,MAAMC,kBAAqB,GAAA,CAACC,SAAiC,GAAA;AACnE,IAAiBC,wBAAyBD,CAAAA,SAAAA,EAAAA;AAE1C,IAAA,MAAME,UAAUC,mBAAoBH,CAAAA,SAAAA,CAAAA,CAAAA;IAEpCI,EAAGC,CAAAA,SAAS,CAACH,OAAS,EAAA;AAAEI,QAAAA,SAAAA,EAAW,IAAI;AAAC,KAAA,CAAA,CAAA;AAExC,IAAA,MAAMC,mBAAsBC,GAAAA,IAAAA,CAAKC,IAAI,CAAC,WAAa,EAAA;QAClDC,GAAKR,EAAAA,OAAAA;AACLS,QAAAA,QAAAA,EAAU,IAAI;AACf,KAAA,CAAA,CAAA;;;IAIA,KAAK,MAAMC,0BAA0BL,mBAAqB,CAAA;AACzD,QAAA,MAAMM,OAAUT,GAAAA,EAAAA,CAAGU,YAAY,CAACF,sBAAwB,EAAA;YACvDG,QAAU,EAAA,OAAA;AACX,SAAA,CAAA,CAAA;QAEA,IAAIF,OAAAA,CAAQG,UAAU,CAAClB,oBAAuB,CAAA,EAAA;AAC7CM,YAAAA,EAAAA,CAAGa,MAAM,CAACL,sBAAAA,CAAAA,CAAAA;SACV;AACF,KAAA;AAEA,IAAA,MAAMM,mBAAmBC,6BAA8BnB,CAAAA,SAAAA,CAAAA,CAAAA;IAEvD,KAAK,MAAMoB,YAAYF,gBAAkB,CAAA;AACxC,QAAA,MAAMG,WAAWC,+BAAgCF,CAAAA,QAAAA,CAAAA,CAAAA;QAEjD,KAAK,MAAMR,0BAA0BL,mBAAqB,CAAA;YACzD,MAAMgB,QAAAA,GAAWC,IAAKD,CAAAA,QAAQ,CAACX,sBAAAA,CAAAA,CAAAA;YAE/B,IAAIW,QAAAA,KAAaF,QAASI,CAAAA,KAAK,EAAE;gBAChCrB,EAAGa,CAAAA,MAAM,CAACL,sBAAwB,EAAA;AAAEc,oBAAAA,KAAAA,EAAO,IAAI;AAAC,iBAAA,CAAA,CAAA;aAChD;AACF,SAAA;;AAIA,QAAA,MAAMb,OAAU,GAAA;AACff,YAAAA,oBAAAA;AACA,YAAA,CAAC,kCAAkC,EAAEuB,QAAAA,CAASM,OAAO,CAAC,CAAC,CAAC;AACxD,YAAA,CAAC,gFAAgF,CAAC;AAClF,YAAA,CAAC,sBAAsB,EAAEN,QAAAA,CAASO,IAAI,CAAC,IAAI,CAAC;SAC5C,CAACC,IAAI,CAACC,EAAAA,CAAGC,GAAG,CAAA,CAAA;QAEb3B,EAAG4B,CAAAA,aAAa,CACfR,IAAAA,CAAKK,IAAI,CAAC1B,oBAAoBH,SAAYqB,CAAAA,EAAAA,QAAAA,CAASI,KAAK,CAAA,EACxDZ,OACA,EAAA;YACCE,QAAU,EAAA,MAAA;AACX,SAAA,CAAA,CAAA;AAEF,KAAA;AACD;;;;"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import { spawnSync } from 'child_process';
|
|
4
|
+
import 'resolve';
|
|
5
|
+
import 'write-pkg';
|
|
6
|
+
import { c as readWorkspaceNpmManifest, g as getWorkspaceOutputPath, r as readPackageCreatorManifest, o as readPackageNpmManifest, q as writePackageNpmManifest, P as PACKAGE_FILE, b as readPackageCreatorIndex, I as INDEX_FILE, t as iterateWorkspacePackages } from './cli-381989cc.mjs';
|
|
7
|
+
import { b as buildFolders, l as logPackageMessage } from './index-cc42a478.mjs';
|
|
8
|
+
import 'glob';
|
|
9
|
+
import 'node:path';
|
|
10
|
+
import 'node:fs';
|
|
11
|
+
import 'axios';
|
|
12
|
+
import { p as parseVersionFromString, g as getVersionFileHandler, a as getVersionInformationFromGit, b as getWorkspaceBannerText } from './versionFile-aa8b6b7a.mjs';
|
|
13
|
+
import 'update-notifier';
|
|
14
|
+
import 'yargs/yargs';
|
|
15
|
+
import 'url';
|
|
16
|
+
import 'assert';
|
|
17
|
+
import 'events';
|
|
18
|
+
import 'core-js/modules/es.typed-array.set.js';
|
|
19
|
+
import 'util';
|
|
20
|
+
import 'inquirer';
|
|
21
|
+
import 'terser';
|
|
22
|
+
import 'typescript';
|
|
23
|
+
import 'typedoc';
|
|
24
|
+
import 'simple-git';
|
|
25
|
+
|
|
26
|
+
const publishToNpm = async ({ workspace , location , version: providedVersion , dryRun })=>{
|
|
27
|
+
let newVersion;
|
|
28
|
+
try {
|
|
29
|
+
newVersion = parseVersionFromString(providedVersion);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
throw new Error(`Please enter a version in this format 1.0.0.100`);
|
|
32
|
+
}
|
|
33
|
+
if (newVersion.buildNumber < 100) {
|
|
34
|
+
newVersion.preRelease = {
|
|
35
|
+
type: "beta",
|
|
36
|
+
version: newVersion.buildNumber
|
|
37
|
+
};
|
|
38
|
+
} else if (newVersion.buildNumber === 100) {
|
|
39
|
+
newVersion.preRelease = undefined;
|
|
40
|
+
} else {
|
|
41
|
+
throw new Error(`Refusing to publish a package with a build version larger than 100.`);
|
|
42
|
+
}
|
|
43
|
+
const workspaceManifest = readWorkspaceNpmManifest(workspace);
|
|
44
|
+
const workspaceOutputPath = getWorkspaceOutputPath(workspace);
|
|
45
|
+
const creatorPackage = readPackageCreatorManifest(location);
|
|
46
|
+
let packageJson = readPackageNpmManifest(location);
|
|
47
|
+
if (packageJson === undefined) {
|
|
48
|
+
packageJson = {
|
|
49
|
+
name: "@intelligentgraphics/3d" + creatorPackage.Package.toLowerCase(),
|
|
50
|
+
version: "1.0.0",
|
|
51
|
+
description: creatorPackage.Package
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
packageJson.version = newVersion.toVersionString({
|
|
55
|
+
buildNumber: false
|
|
56
|
+
});
|
|
57
|
+
packageJson.description = newVersion.toDescriptionString(creatorPackage.Package);
|
|
58
|
+
packageJson.main = `${creatorPackage.Package}.js`;
|
|
59
|
+
packageJson.types = `${creatorPackage.Package}.d.ts`;
|
|
60
|
+
packageJson.publishConfig ??= {};
|
|
61
|
+
packageJson.publishConfig.acccess = "public";
|
|
62
|
+
packageJson.ig = {
|
|
63
|
+
scriptingLibrary: true
|
|
64
|
+
};
|
|
65
|
+
packageJson.files = undefined;
|
|
66
|
+
const publishDir = path.join(workspaceOutputPath, "publish", creatorPackage.Package);
|
|
67
|
+
fs.rmSync(publishDir, {
|
|
68
|
+
recursive: true,
|
|
69
|
+
force: true
|
|
70
|
+
});
|
|
71
|
+
fs.mkdirSync(publishDir, {
|
|
72
|
+
recursive: true
|
|
73
|
+
});
|
|
74
|
+
writePackageNpmManifest(location, packageJson);
|
|
75
|
+
getVersionFileHandler(location).write(creatorPackage.Package, newVersion);
|
|
76
|
+
const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
|
|
77
|
+
const bannerText = getWorkspaceBannerText(workspaceManifest);
|
|
78
|
+
await buildFolders({
|
|
79
|
+
workspace,
|
|
80
|
+
packages: [
|
|
81
|
+
location
|
|
82
|
+
],
|
|
83
|
+
minimize: true,
|
|
84
|
+
outDir: getWorkspaceOutputPath(workspace),
|
|
85
|
+
banner: {
|
|
86
|
+
text: bannerText,
|
|
87
|
+
commit: gitVersionInformation.commit,
|
|
88
|
+
commitDirty: gitVersionInformation.dirty,
|
|
89
|
+
version: newVersion.toVersionString({
|
|
90
|
+
buildNumber: true
|
|
91
|
+
}),
|
|
92
|
+
date: new Date(Date.now())
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
fs.copyFileSync(path.join(getWorkspaceOutputPath(workspace), `${creatorPackage.Package}.d.ts`), path.join(publishDir, `${creatorPackage.Package}.d.ts`));
|
|
96
|
+
fs.copyFileSync(path.join(getWorkspaceOutputPath(workspace), `${creatorPackage.Package}.min.js`), path.join(publishDir, `${creatorPackage.Package}.js`));
|
|
97
|
+
fs.copyFileSync(path.join(location.manifestDir, "package.json"), path.join(publishDir, "package.json"));
|
|
98
|
+
fs.writeFileSync(path.join(publishDir, PACKAGE_FILE), JSON.stringify(creatorPackage, null, 2));
|
|
99
|
+
const index = readPackageCreatorIndex(location);
|
|
100
|
+
if (index !== undefined) {
|
|
101
|
+
fs.writeFileSync(path.join(publishDir, INDEX_FILE), JSON.stringify(index));
|
|
102
|
+
}
|
|
103
|
+
const readmeName = fs.readdirSync(location.path).find((name)=>name.toLowerCase() === "readme.md");
|
|
104
|
+
if (readmeName !== undefined) {
|
|
105
|
+
fs.copyFileSync(path.join(location.path, readmeName), path.join(publishDir, readmeName));
|
|
106
|
+
}
|
|
107
|
+
const npmPublishArgs = [];
|
|
108
|
+
if (dryRun) {
|
|
109
|
+
npmPublishArgs.push("--dry-run");
|
|
110
|
+
}
|
|
111
|
+
if (newVersion.preRelease) {
|
|
112
|
+
npmPublishArgs.push("--tag", "next");
|
|
113
|
+
}
|
|
114
|
+
logPackageMessage(creatorPackage.Package, `Publishing to npm with version ${packageJson.version} using tag ${newVersion.preRelease ? "next" : "latest"}`);
|
|
115
|
+
spawnSync("npm", [
|
|
116
|
+
"publish",
|
|
117
|
+
...npmPublishArgs
|
|
118
|
+
], {
|
|
119
|
+
stdio: "inherit",
|
|
120
|
+
encoding: "utf8",
|
|
121
|
+
cwd: publishDir
|
|
122
|
+
});
|
|
123
|
+
for (const packageLocation of iterateWorkspacePackages(workspace)){
|
|
124
|
+
var _manifest_dependencies;
|
|
125
|
+
const manifest = readPackageNpmManifest(packageLocation);
|
|
126
|
+
if ((manifest == null ? void 0 : (_manifest_dependencies = manifest.dependencies) == null ? void 0 : _manifest_dependencies[packageJson.name]) !== undefined) {
|
|
127
|
+
manifest.dependencies[packageJson.name] = "^" + packageJson.version;
|
|
128
|
+
writePackageNpmManifest(packageLocation, manifest);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export { publishToNpm };
|
|
134
|
+
//# sourceMappingURL=publishNpm-8ec1b871.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishNpm-8ec1b871.mjs","sources":["../src/commands/publishNpm.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport { spawnSync } from \"child_process\";\n\nimport { PackageVersion } from \"../lib/packageVersion\";\nimport {\n\tINDEX_FILE,\n\tPackageLocation,\n\tPACKAGE_FILE,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n\twritePackageNpmManifest,\n} from \"../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\titerateWorkspacePackages,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../lib/git\";\nimport { getWorkspaceBannerText } from \"../lib/banner\";\nimport { parseVersionFromString } from \"../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../lib/versionFile\";\nimport { logPackageMessage } from \"../lib/log\";\n\nimport { buildFolders } from \"./build\";\n\nexport interface PublishToNpmSettings {\n\tworkspace: WorkspaceLocation;\n\tlocation: PackageLocation;\n\tversion: string;\n\tdryRun?: boolean;\n}\n\nexport const publishToNpm = async ({\n\tworkspace,\n\tlocation,\n\tversion: providedVersion,\n\tdryRun,\n}: PublishToNpmSettings) => {\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(providedVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber === 100) {\n\t\tnewVersion.preRelease = undefined;\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Refusing to publish a package with a build version larger than 100.`,\n\t\t);\n\t}\n\n\tconst workspaceManifest = readWorkspaceNpmManifest(workspace);\n\tconst workspaceOutputPath = getWorkspaceOutputPath(workspace);\n\tconst creatorPackage = readPackageCreatorManifest(location);\n\tlet packageJson = readPackageNpmManifest(location);\n\n\tif (packageJson === undefined) {\n\t\tpackageJson = {\n\t\t\tname:\n\t\t\t\t\"@intelligentgraphics/3d\" +\n\t\t\t\tcreatorPackage.Package.toLowerCase(),\n\t\t\tversion: \"1.0.0\",\n\t\t\tdescription: creatorPackage.Package,\n\t\t};\n\t}\n\n\tpackageJson.version = newVersion.toVersionString({\n\t\tbuildNumber: false,\n\t});\n\tpackageJson.description = newVersion.toDescriptionString(\n\t\tcreatorPackage.Package,\n\t);\n\tpackageJson.main = `${creatorPackage.Package}.js`;\n\tpackageJson.types = `${creatorPackage.Package}.d.ts`;\n\tpackageJson.publishConfig ??= {};\n\tpackageJson.publishConfig.acccess = \"public\";\n\tpackageJson.ig = {\n\t\tscriptingLibrary: true,\n\t};\n\tpackageJson.files = undefined;\n\n\tconst publishDir = path.join(\n\t\tworkspaceOutputPath,\n\t\t\"publish\",\n\t\tcreatorPackage.Package,\n\t);\n\tfs.rmSync(publishDir, { recursive: true, force: true });\n\tfs.mkdirSync(publishDir, { recursive: true });\n\n\twritePackageNpmManifest(location, packageJson);\n\n\tgetVersionFileHandler(location).write(creatorPackage.Package, newVersion);\n\n\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\tworkspace,\n\t\tlocation,\n\t);\n\n\tconst bannerText = getWorkspaceBannerText(workspaceManifest);\n\n\tawait buildFolders({\n\t\tworkspace,\n\t\tpackages: [location],\n\t\tminimize: true,\n\t\toutDir: getWorkspaceOutputPath(workspace),\n\t\tbanner: {\n\t\t\ttext: bannerText,\n\t\t\tcommit: gitVersionInformation.commit,\n\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\tversion: newVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t}),\n\t\t\tdate: new Date(Date.now()),\n\t\t},\n\t});\n\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.d.ts`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.d.ts`),\n\t);\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.min.js`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.js`),\n\t);\n\n\tfs.copyFileSync(\n\t\tpath.join(location.manifestDir, \"package.json\"),\n\t\tpath.join(publishDir, \"package.json\"),\n\t);\n\n\tfs.writeFileSync(\n\t\tpath.join(publishDir, PACKAGE_FILE),\n\t\tJSON.stringify(creatorPackage, null, 2),\n\t);\n\n\tconst index = readPackageCreatorIndex(location);\n\n\tif (index !== undefined) {\n\t\tfs.writeFileSync(\n\t\t\tpath.join(publishDir, INDEX_FILE),\n\t\t\tJSON.stringify(index),\n\t\t);\n\t}\n\n\tconst readmeName = fs\n\t\t.readdirSync(location.path)\n\t\t.find((name) => name.toLowerCase() === \"readme.md\");\n\n\tif (readmeName !== undefined) {\n\t\tfs.copyFileSync(\n\t\t\tpath.join(location.path, readmeName),\n\t\t\tpath.join(publishDir, readmeName),\n\t\t);\n\t}\n\n\tconst npmPublishArgs: string[] = [];\n\n\tif (dryRun) {\n\t\tnpmPublishArgs.push(\"--dry-run\");\n\t}\n\n\tif (newVersion.preRelease) {\n\t\tnpmPublishArgs.push(\"--tag\", \"next\");\n\t}\n\n\tlogPackageMessage(\n\t\tcreatorPackage.Package,\n\t\t`Publishing to npm with version ${packageJson.version} using tag ${\n\t\t\tnewVersion.preRelease ? \"next\" : \"latest\"\n\t\t}`,\n\t);\n\n\tspawnSync(\"npm\", [\"publish\", ...npmPublishArgs], {\n\t\tstdio: \"inherit\",\n\t\tencoding: \"utf8\",\n\t\tcwd: publishDir,\n\t});\n\n\tfor (const packageLocation of iterateWorkspacePackages(workspace)) {\n\t\tconst manifest = readPackageNpmManifest(packageLocation);\n\n\t\tif (manifest?.dependencies?.[packageJson.name] !== undefined) {\n\t\t\tmanifest.dependencies[packageJson.name] = \"^\" + packageJson.version;\n\t\t\twritePackageNpmManifest(packageLocation, manifest);\n\t\t}\n\t}\n};\n"],"names":["publishToNpm","workspace","location","version","providedVersion","dryRun","newVersion","parseVersionFromString","err","Error","buildNumber","preRelease","type","undefined","workspaceManifest","readWorkspaceNpmManifest","workspaceOutputPath","getWorkspaceOutputPath","creatorPackage","readPackageCreatorManifest","packageJson","readPackageNpmManifest","name","Package","toLowerCase","description","toVersionString","toDescriptionString","main","types","publishConfig","acccess","ig","scriptingLibrary","files","publishDir","path","join","fs","rmSync","recursive","force","mkdirSync","writePackageNpmManifest","getVersionFileHandler","write","gitVersionInformation","getVersionInformationFromGit","bannerText","getWorkspaceBannerText","buildFolders","packages","minimize","outDir","banner","text","commit","commitDirty","dirty","date","Date","now","copyFileSync","manifestDir","writeFileSync","PACKAGE_FILE","JSON","stringify","index","readPackageCreatorIndex","INDEX_FILE","readmeName","readdirSync","find","npmPublishArgs","push","logPackageMessage","spawnSync","stdio","encoding","cwd","packageLocation","iterateWorkspacePackages","manifest","dependencies"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmCaA,MAAAA,YAAAA,GAAe,OAAO,EAClCC,SAAS,GACTC,QAAQ,GACRC,OAASC,EAAAA,eAAAA,GACTC,MAAAA,GACsB,GAAK;IAC3B,IAAIC,UAAAA,CAAAA;IACJ,IAAI;AACHA,QAAAA,UAAAA,GAAaC,sBAAuBH,CAAAA,eAAAA,CAAAA,CAAAA;AACrC,KAAA,CAAE,OAAOI,GAAK,EAAA;AACb,QAAA,MAAM,IA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