@intelligentgraphics/ig.gfx.packager 2.3.3 → 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 +124 -8
- package/build/index.js.map +1 -1
- package/package.json +3 -2
- package/readme.md +4 -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":
|
|
@@ -4652,8 +4723,45 @@ const build = async (folderPath, options) => {
|
|
|
4652
4723
|
|
|
4653
4724
|
host.writeFile = (fileName, data, writeByteOrderMark) => {
|
|
4654
4725
|
if (options.banner) {
|
|
4655
|
-
|
|
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
|
+
*/
|
|
4656
4763
|
${data}`;
|
|
4764
|
+
}
|
|
4657
4765
|
}
|
|
4658
4766
|
|
|
4659
4767
|
const {
|
|
@@ -8174,6 +8282,17 @@ module.exports = require("rimraf");
|
|
|
8174
8282
|
|
|
8175
8283
|
/***/ }),
|
|
8176
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
|
+
|
|
8177
8296
|
/***/ "source-map-support":
|
|
8178
8297
|
/*!*************************************!*\
|
|
8179
8298
|
!*** external "source-map-support" ***!
|
|
@@ -8346,7 +8465,7 @@ module.exports = require("util");
|
|
|
8346
8465
|
/***/ ((module) => {
|
|
8347
8466
|
|
|
8348
8467
|
"use strict";
|
|
8349
|
-
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"}}');
|
|
8350
8469
|
|
|
8351
8470
|
/***/ })
|
|
8352
8471
|
|
|
@@ -8436,10 +8555,6 @@ const captureError = err => {
|
|
|
8436
8555
|
};
|
|
8437
8556
|
|
|
8438
8557
|
const applyBuildOptions = argv => argv.options({
|
|
8439
|
-
banner: {
|
|
8440
|
-
description: (0, _localization.translate)("options.banner.description"),
|
|
8441
|
-
type: "string"
|
|
8442
|
-
},
|
|
8443
8558
|
outDir: {
|
|
8444
8559
|
description: (0, _localization.translate)("options.outDir.description"),
|
|
8445
8560
|
type: "string",
|
|
@@ -8608,7 +8723,8 @@ yargs.command({
|
|
|
8608
8723
|
const fullOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
8609
8724
|
authentication,
|
|
8610
8725
|
service: service,
|
|
8611
|
-
directories: [directory]
|
|
8726
|
+
directories: [directory],
|
|
8727
|
+
banner: true
|
|
8612
8728
|
});
|
|
8613
8729
|
|
|
8614
8730
|
releaseFolders(fullOptions).catch(captureError);
|