@intelligentgraphics/ig.gfx.packager 2.3.2 → 2.3.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/index.js +138 -18
- package/build/index.js.map +1 -1
- package/package.json +3 -2
- package/readme.md +8 -0
package/build/index.js
CHANGED
|
@@ -3864,6 +3864,8 @@ var _igTools = __webpack_require__(/*! @intelligentgraphics/ig.tools.core */ "..
|
|
|
3864
3864
|
|
|
3865
3865
|
var path = _interopRequireWildcard(__webpack_require__(/*! path */ "path"));
|
|
3866
3866
|
|
|
3867
|
+
var _simpleGit = __webpack_require__(/*! simple-git */ "simple-git");
|
|
3868
|
+
|
|
3867
3869
|
var fs = _interopRequireWildcard(__webpack_require__(/*! fs-extra */ "fs-extra"));
|
|
3868
3870
|
|
|
3869
3871
|
var _util = __webpack_require__(/*! ../util */ "./src/util.ts");
|
|
@@ -3915,6 +3917,9 @@ const releaseFolder = async (folderPath, options) => {
|
|
|
3915
3917
|
} = (0, _util.parsePackageDomains)(fullPackageName);
|
|
3916
3918
|
const publishDomain = (_options$domain = options.domain) !== null && _options$domain !== void 0 ? _options$domain : domain;
|
|
3917
3919
|
const publishSubdomain = (_options$subdomain = options.subdomain) !== null && _options$subdomain !== void 0 ? _options$subdomain : subdomain;
|
|
3920
|
+
const sharedPackageJson = await fs.readFile(path.join(process.cwd(), "package.json"), {
|
|
3921
|
+
encoding: "utf8"
|
|
3922
|
+
}).then(JSON.parse).catch(() => undefined);
|
|
3918
3923
|
let newVersion;
|
|
3919
3924
|
|
|
3920
3925
|
try {
|
|
@@ -3935,11 +3940,44 @@ const releaseFolder = async (folderPath, options) => {
|
|
|
3935
3940
|
};
|
|
3936
3941
|
}
|
|
3937
3942
|
|
|
3943
|
+
const gitVersionInformation = await getVersionInformationFromGit(folderPath, options.cwd);
|
|
3944
|
+
|
|
3938
3945
|
if (!options.pushOnly) {
|
|
3946
|
+
var _sharedPackageJson$pa;
|
|
3947
|
+
|
|
3939
3948
|
writeVersionFile(fullPackageName, newVersion);
|
|
3949
|
+
let bannerText = sharedPackageJson === null || sharedPackageJson === void 0 ? void 0 : (_sharedPackageJson$pa = sharedPackageJson.packager) === null || _sharedPackageJson$pa === void 0 ? void 0 : _sharedPackageJson$pa.banner;
|
|
3950
|
+
|
|
3951
|
+
if (bannerText) {
|
|
3952
|
+
const match = bannerText.match(/Copyright \(C\) (\d+)( ?- ?(\d+))?/);
|
|
3953
|
+
|
|
3954
|
+
if (match !== null) {
|
|
3955
|
+
const startYear = parseInt(match[1]);
|
|
3956
|
+
const endYear = new Date().getFullYear();
|
|
3957
|
+
|
|
3958
|
+
if (startYear !== endYear) {
|
|
3959
|
+
bannerText = bannerText.replace(match[0], `Copyright (C) ${startYear} - ${endYear}`);
|
|
3960
|
+
} else {
|
|
3961
|
+
bannerText = bannerText.replace(match[0], `Copyright (C) ${startYear}`);
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
|
|
3940
3966
|
await (0, _build.buildFolders)(_objectSpread(_objectSpread({}, options), {}, {
|
|
3941
3967
|
directories: [folderPath],
|
|
3942
|
-
skipPackagesWithoutTsFiles: true
|
|
3968
|
+
skipPackagesWithoutTsFiles: true,
|
|
3969
|
+
banner: options.banner ? {
|
|
3970
|
+
text: bannerText,
|
|
3971
|
+
commit: gitVersionInformation.commit,
|
|
3972
|
+
commitDirty: gitVersionInformation.dirty,
|
|
3973
|
+
version: newVersion.toVersionString({
|
|
3974
|
+
buildNumber: true
|
|
3975
|
+
}),
|
|
3976
|
+
date: new Date(Date.now()) // gitVersionInformation.commitDate
|
|
3977
|
+
// ? new Date(gitVersionInformation.commitDate)
|
|
3978
|
+
// : new Date(Date.now()),
|
|
3979
|
+
|
|
3980
|
+
} : undefined
|
|
3943
3981
|
}));
|
|
3944
3982
|
}
|
|
3945
3983
|
|
|
@@ -4109,6 +4147,39 @@ const parseVersion = input => {
|
|
|
4109
4147
|
return new _igTools.PackageVersion(parseInt(major), parseInt(minor), parseInt(patch), preRelease, buildNumber);
|
|
4110
4148
|
};
|
|
4111
4149
|
|
|
4150
|
+
const getVersionInformationFromGit = async (packageDir, gitDir) => {
|
|
4151
|
+
try {
|
|
4152
|
+
var _log$latest, _log$latest2;
|
|
4153
|
+
|
|
4154
|
+
const git = (0, _simpleGit.simpleGit)({
|
|
4155
|
+
baseDir: gitDir
|
|
4156
|
+
}); // check wether the files for a folder are changed
|
|
4157
|
+
// if so, mark as dirty
|
|
4158
|
+
|
|
4159
|
+
const diff = await git.diffSummary();
|
|
4160
|
+
const dirty = diff.files.some(file => {
|
|
4161
|
+
if (file.file.toLowerCase().includes("releases") || file.file.toLowerCase().endsWith("version.ts")) {
|
|
4162
|
+
return false;
|
|
4163
|
+
}
|
|
4164
|
+
|
|
4165
|
+
const fullPath = path.resolve(gitDir, file.file);
|
|
4166
|
+
const relativePath = path.relative(packageDir, fullPath);
|
|
4167
|
+
return !relativePath.startsWith("..");
|
|
4168
|
+
});
|
|
4169
|
+
const log = await git.log({
|
|
4170
|
+
maxCount: 1
|
|
4171
|
+
});
|
|
4172
|
+
const commit = !((_log$latest = log.latest) !== null && _log$latest !== void 0 && _log$latest.hash) ? undefined : log.latest.hash.substring(0, 7);
|
|
4173
|
+
return {
|
|
4174
|
+
commit,
|
|
4175
|
+
dirty,
|
|
4176
|
+
commitDate: (_log$latest2 = log.latest) === null || _log$latest2 === void 0 ? void 0 : _log$latest2.date
|
|
4177
|
+
};
|
|
4178
|
+
} catch (err) {
|
|
4179
|
+
return {};
|
|
4180
|
+
}
|
|
4181
|
+
};
|
|
4182
|
+
|
|
4112
4183
|
/***/ }),
|
|
4113
4184
|
|
|
4114
4185
|
/***/ "./src/docs.ts":
|
|
@@ -4415,16 +4486,9 @@ Packaging without a javascript file is only allowed when animation json files ar
|
|
|
4415
4486
|
}
|
|
4416
4487
|
|
|
4417
4488
|
if (animations.size > 0) {
|
|
4418
|
-
const
|
|
4419
|
-
const scope =
|
|
4420
|
-
library +=
|
|
4421
|
-
var ${scriptDomain};
|
|
4422
|
-
(function (${scriptDomain}) {
|
|
4423
|
-
var ${scriptSubdomain};
|
|
4424
|
-
(function (${scriptSubdomain}) {
|
|
4425
|
-
})(${scriptSubdomain} = ${scriptDomain}.${scriptSubdomain} || (${scriptDomain}.${scriptSubdomain} = {}));
|
|
4426
|
-
})(${scriptDomain} || (${scriptDomain} = {}));
|
|
4427
|
-
`;
|
|
4489
|
+
const scopeParts = data.Scope.split(".");
|
|
4490
|
+
const scope = data.Scope;
|
|
4491
|
+
library += createNamespace(scopeParts);
|
|
4428
4492
|
|
|
4429
4493
|
for (const [name, data] of animations) {
|
|
4430
4494
|
library += `${scope}.${name} = ` + data + ";";
|
|
@@ -4472,6 +4536,17 @@ Packaging without a javascript file is only allowed when animation json files ar
|
|
|
4472
4536
|
await pipeline(archive.generateNodeStream(), zipOutputStream);
|
|
4473
4537
|
};
|
|
4474
4538
|
|
|
4539
|
+
const createNamespace = parts => {
|
|
4540
|
+
let code = `var ${parts[0]};`;
|
|
4541
|
+
|
|
4542
|
+
for (let index = 0; index < parts.length; index++) {
|
|
4543
|
+
const path = parts.slice(0, index + 1).join(".");
|
|
4544
|
+
code += `\n(${path} = ${path} || {});`;
|
|
4545
|
+
}
|
|
4546
|
+
|
|
4547
|
+
return code;
|
|
4548
|
+
};
|
|
4549
|
+
|
|
4475
4550
|
const uploadArchive = async ({
|
|
4476
4551
|
domain,
|
|
4477
4552
|
subdomain,
|
|
@@ -4648,8 +4723,45 @@ const build = async (folderPath, options) => {
|
|
|
4648
4723
|
|
|
4649
4724
|
host.writeFile = (fileName, data, writeByteOrderMark) => {
|
|
4650
4725
|
if (options.banner) {
|
|
4651
|
-
|
|
4726
|
+
const details = [];
|
|
4727
|
+
|
|
4728
|
+
if (options.banner.version) {
|
|
4729
|
+
details.push(`Version: ${options.banner.version}`);
|
|
4730
|
+
}
|
|
4731
|
+
|
|
4732
|
+
if (options.banner.commit) {
|
|
4733
|
+
if (options.banner.commitDirty) {
|
|
4734
|
+
details.push(`Commit: ${options.banner.commit} (dirty)`);
|
|
4735
|
+
} else {
|
|
4736
|
+
details.push(`Commit: ${options.banner.commit}`);
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
|
|
4740
|
+
if (options.banner.date) {
|
|
4741
|
+
details.push(`Date: ${options.banner.date.toISOString()}`);
|
|
4742
|
+
}
|
|
4743
|
+
|
|
4744
|
+
const detailsText = details.map(line => ` * ${line}`).join("\n");
|
|
4745
|
+
const bannerParts = [];
|
|
4746
|
+
|
|
4747
|
+
if (options.banner.text) {
|
|
4748
|
+
bannerParts.push(" * " + options.banner.text);
|
|
4749
|
+
}
|
|
4750
|
+
|
|
4751
|
+
if (detailsText) {
|
|
4752
|
+
bannerParts.push(detailsText);
|
|
4753
|
+
}
|
|
4754
|
+
|
|
4755
|
+
const bannerText = bannerParts.join("\n\n");
|
|
4756
|
+
|
|
4757
|
+
if (bannerText) {
|
|
4758
|
+
data = `/*
|
|
4759
|
+
${bannerText}
|
|
4760
|
+
*
|
|
4761
|
+
* @preserve
|
|
4762
|
+
*/
|
|
4652
4763
|
${data}`;
|
|
4764
|
+
}
|
|
4653
4765
|
}
|
|
4654
4766
|
|
|
4655
4767
|
const {
|
|
@@ -8170,6 +8282,17 @@ module.exports = require("rimraf");
|
|
|
8170
8282
|
|
|
8171
8283
|
/***/ }),
|
|
8172
8284
|
|
|
8285
|
+
/***/ "simple-git":
|
|
8286
|
+
/*!*****************************!*\
|
|
8287
|
+
!*** external "simple-git" ***!
|
|
8288
|
+
\*****************************/
|
|
8289
|
+
/***/ ((module) => {
|
|
8290
|
+
|
|
8291
|
+
"use strict";
|
|
8292
|
+
module.exports = require("simple-git");
|
|
8293
|
+
|
|
8294
|
+
/***/ }),
|
|
8295
|
+
|
|
8173
8296
|
/***/ "source-map-support":
|
|
8174
8297
|
/*!*************************************!*\
|
|
8175
8298
|
!*** external "source-map-support" ***!
|
|
@@ -8342,7 +8465,7 @@ module.exports = require("util");
|
|
|
8342
8465
|
/***/ ((module) => {
|
|
8343
8466
|
|
|
8344
8467
|
"use strict";
|
|
8345
|
-
module.exports = JSON.parse('{"name":"@intelligentgraphics/ig.gfx.packager","version":"2.3.
|
|
8468
|
+
module.exports = JSON.parse('{"name":"@intelligentgraphics/ig.gfx.packager","version":"2.3.4","description":"IG.GFX.Packager 2.3.4 (2.3.4.100)","author":"Michael Beier <mb@intelligentgraphics.biz>","main":"build/index.js","private":false,"publishConfig":{"access":"public"},"engines":{"node":">=14.0.0"},"bin":{"packager":"./build/index.js"},"files":["build","locales","scripts"],"scripts":{"dist":"webpack","clean":"rimraf build *.tsbuildinfo","prepublishOnly":"yarn clean && yarn dist","test":"jest","_postinstall":"node scripts/postinstall.js","format":"prettier --write \\"**/*.{ts,tsx,json}\\""},"dependencies":{"ajv":"^8.6.2","axios":"^0.21.1","core-js":"^3.16.0","execa":"^5.1.1","fs-extra":"^10.0.0","glob":"^7.1.4","jszip":"^3.10.0","rimraf":"^3.0.2","simple-git":"^3.15.1","source-map-support":"^0.5.19","terser":"^4.8.0","typedoc":"~0.23.2","typescript":"~4.7.4","update-notifier":"^5.1.0","v8-compile-cache":"^2.1.1","y18n":"^5.0.8","yargs":"^17.0.1"},"devDependencies":{"@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-proposal-object-rest-spread":"^7.18.9","@babel/preset-env":"^7.18.9","@intelligentgraphics/ig.tools.core":"^1.5.2","@intelligentgraphics/ig.utilities":"^1.6.6","@types/fs-extra":"^9.0.12","@types/glob":"^7.1.4","@types/node":"^16.4.11","@types/rimraf":"^3.0.1","@types/update-notifier":"^5.1.0","@types/yargs":"^17.0.2","babel-loader":"^8.1.0","ts-loader":"^9.2.5","ts-node":"^10.1.0","webpack":"^5.64.4","webpack-cli":"^4.7.2"}}');
|
|
8346
8469
|
|
|
8347
8470
|
/***/ })
|
|
8348
8471
|
|
|
@@ -8432,10 +8555,6 @@ const captureError = err => {
|
|
|
8432
8555
|
};
|
|
8433
8556
|
|
|
8434
8557
|
const applyBuildOptions = argv => argv.options({
|
|
8435
|
-
banner: {
|
|
8436
|
-
description: (0, _localization.translate)("options.banner.description"),
|
|
8437
|
-
type: "string"
|
|
8438
|
-
},
|
|
8439
8558
|
outDir: {
|
|
8440
8559
|
description: (0, _localization.translate)("options.outDir.description"),
|
|
8441
8560
|
type: "string",
|
|
@@ -8604,7 +8723,8 @@ yargs.command({
|
|
|
8604
8723
|
const fullOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
8605
8724
|
authentication,
|
|
8606
8725
|
service: service,
|
|
8607
|
-
directories: [directory]
|
|
8726
|
+
directories: [directory],
|
|
8727
|
+
banner: true
|
|
8608
8728
|
});
|
|
8609
8729
|
|
|
8610
8730
|
releaseFolders(fullOptions).catch(captureError);
|