@infomaximum/package-cli 2.6.1 → 2.7.1
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/CHANGELOG.md +14 -0
- package/dist/package/configs/webpack/buildPackage.js +1 -1
- package/dist/widget/configs/webpack/common.js +6 -2
- package/dist/widget/configs/webpack/sections/plugins/modifyManifestWidget.js +10 -3
- package/dist/widget/const.js +2 -0
- package/dist/widget/templates/widgetManifest.js +0 -1
- package/dist/widget/utils.js +1 -1
- package/package.json +2 -2
- package/schemas/widgetManifestSchema.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.7.1](https://github.com/Infomaximum/package-cli/compare/v2.7.0...v2.7.1) (2024-09-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* удалено поле entry из манифеста виджета ([02d00a7](https://github.com/Infomaximum/package-cli/commit/02d00a753485de953020dc565dadfdf28138ff2d))
|
|
11
|
+
|
|
12
|
+
## [2.7.0](https://github.com/Infomaximum/package-cli/compare/v2.6.1...v2.7.0) (2024-09-17)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* добавлена возможность генерации filename с использованием хеша содержимого файла ([15b11ea](https://github.com/Infomaximum/package-cli/commit/15b11eaf56bc3b4eeaf53be025ee122adc1b3053))
|
|
18
|
+
|
|
5
19
|
### [2.6.1](https://github.com/Infomaximum/package-cli/compare/v2.6.0...v2.6.1) (2024-09-17)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -7,7 +7,7 @@ import { isExist, removeServiceFieldsForDevelopment, systemRequire, } from "../.
|
|
|
7
7
|
import { BUILD_ARCHIVE_EXT, DEV_POSTFIX, MANIFEST_REG_EXP, } from "../../../const.js";
|
|
8
8
|
import { assertSimple } from "@infomaximum/assert";
|
|
9
9
|
const packageFilename = "main.js";
|
|
10
|
-
export const getPackageBuildConfig = (
|
|
10
|
+
export const getPackageBuildConfig = (_a) => __awaiter(void 0, [_a], void 0, function* ({ mode, PATHS, isBuildDevMode, entityArchivePath, }) {
|
|
11
11
|
const entityVersion = systemRequire(PATHS.appPackageJson).version;
|
|
12
12
|
const manifestPackageName = systemRequire(PATHS.packageManifestPath).name;
|
|
13
13
|
let entityPackageName = `${manifestPackageName}_${entityVersion}`;
|
|
@@ -5,17 +5,21 @@ import webpack, {} from "webpack";
|
|
|
5
5
|
import { cssLoaders } from "./sections/loaders/cssLoaders.js";
|
|
6
6
|
import { compact, systemRequire } from "../../../utils.js";
|
|
7
7
|
import { MANIFEST_REG_EXP } from "../../../const.js";
|
|
8
|
-
import
|
|
8
|
+
import { WIDGET_OUTPUT_FILE_NAME, WIDGET_OUTPUT_FULL_FILE_NAME, } from "../../const.js";
|
|
9
9
|
const { ProgressPlugin } = webpack;
|
|
10
10
|
const isProduction = (mode) => mode === "production";
|
|
11
11
|
const isDevelopment = (mode) => mode === "development";
|
|
12
12
|
export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
13
|
+
const manifestEntry = systemRequire(PATHS.widgetManifestJsonPath).entry;
|
|
14
|
+
const filename = isProduction(mode)
|
|
15
|
+
? `${WIDGET_OUTPUT_FILE_NAME}.[contenthash].js`
|
|
16
|
+
: WIDGET_OUTPUT_FULL_FILE_NAME;
|
|
13
17
|
return {
|
|
14
18
|
mode,
|
|
15
19
|
entry: [PATHS.moduleIndex, PATHS.widgetManifestJsonPath],
|
|
16
20
|
output: {
|
|
17
21
|
path: PATHS.appBuildPath,
|
|
18
|
-
filename:
|
|
22
|
+
filename: manifestEntry !== null && manifestEntry !== void 0 ? manifestEntry : filename,
|
|
19
23
|
asyncChunks: false,
|
|
20
24
|
clean: true,
|
|
21
25
|
},
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
|
|
2
2
|
import { DEV_POSTFIX } from "../../../../../const.js";
|
|
3
3
|
import { removeServiceFieldsForDevelopment } from "../../../../../utils.js";
|
|
4
|
-
import { WIDGET_SDK_VERSION_FIELD_NAME } from "../../../../const.js";
|
|
4
|
+
import { WIDGET_OUTPUT_FILE_NAME, WIDGET_OUTPUT_FULL_FILE_NAME, WIDGET_SDK_VERSION_FIELD_NAME, } from "../../../../const.js";
|
|
5
5
|
import { getSdkVersionFromPackageJson } from "../../../../utils.js";
|
|
6
6
|
export const getModifyManifestWidgetPlugin = ({ host, port, isBuildDevMode, WIDGET_PATHS, }) => {
|
|
7
7
|
return new JsonModifyWebpackPlugin({
|
|
8
8
|
matchers: [
|
|
9
9
|
{
|
|
10
10
|
matcher: /^manifest.json$/,
|
|
11
|
-
action: (currentJsonContent) => {
|
|
11
|
+
action: (currentJsonContent, assetNames) => {
|
|
12
|
+
const manifestEntry = currentJsonContent.entry;
|
|
12
13
|
if (isBuildDevMode && host && port) {
|
|
13
|
-
currentJsonContent.entry = `http://${host}:${port}/${
|
|
14
|
+
currentJsonContent.entry = `http://${host}:${port}/${manifestEntry !== null && manifestEntry !== void 0 ? manifestEntry : WIDGET_OUTPUT_FULL_FILE_NAME}`;
|
|
14
15
|
if ((currentJsonContent === null || currentJsonContent === void 0 ? void 0 : currentJsonContent.name) &&
|
|
15
16
|
typeof currentJsonContent.name === "object") {
|
|
16
17
|
Object.keys(currentJsonContent.name).forEach((lang) => {
|
|
@@ -20,6 +21,12 @@ export const getModifyManifestWidgetPlugin = ({ host, port, isBuildDevMode, WIDG
|
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
}
|
|
24
|
+
else if (!manifestEntry) {
|
|
25
|
+
const entryName = assetNames.find((asset) => asset.startsWith(`${WIDGET_OUTPUT_FILE_NAME}.`));
|
|
26
|
+
if (entryName) {
|
|
27
|
+
currentJsonContent.entry = entryName;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
23
30
|
const sdkVersion = getSdkVersionFromPackageJson(WIDGET_PATHS.appPackageJson);
|
|
24
31
|
currentJsonContent[WIDGET_SDK_VERSION_FIELD_NAME] = sdkVersion;
|
|
25
32
|
currentJsonContent["api_version"] = sdkVersion;
|
package/dist/widget/const.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BUILD_ARCHIVE_EXT } from "../const.js";
|
|
2
2
|
export const WIDGET_SDK_LIB_NAME = "@infomaximum/widget-sdk";
|
|
3
|
+
export const WIDGET_OUTPUT_FILE_NAME = "widget";
|
|
4
|
+
export const WIDGET_OUTPUT_FULL_FILE_NAME = `${WIDGET_OUTPUT_FILE_NAME}.js`;
|
|
3
5
|
export const WIDGET_CONFIG_FIELD_NAME = "widget";
|
|
4
6
|
export const WIDGET_CONFIG_FILE_NAME = `${WIDGET_CONFIG_FIELD_NAME}rc`;
|
|
5
7
|
export const WIDGET_ARCHIVE_NAME = "widget";
|
|
@@ -5,7 +5,6 @@ export const WIDGET_MANIFEST_TEMPLATE = `\
|
|
|
5
5
|
{
|
|
6
6
|
"$schema": "node_modules/${CUSTOM_PACKAGE_CLI_LIB_NAME}/schemas/widgetManifestSchema.json",
|
|
7
7
|
"uuid": "${randomUUID()}",
|
|
8
|
-
"entry": "index.js",
|
|
9
8
|
"api_version": 1,
|
|
10
9
|
"name": {
|
|
11
10
|
"en": "{{${capitalizeHelperName} packageName}}",
|
package/dist/widget/utils.js
CHANGED
|
@@ -5,8 +5,8 @@ import { getLatestVersionOfLibrary, getLibraryVersionInProject, systemRequire, }
|
|
|
5
5
|
import { WIDGET_SDK_LIB_NAME } from "./const.js";
|
|
6
6
|
import { CUSTOM_PACKAGE_CLI_LIB_NAME } from "../const.js";
|
|
7
7
|
export function checkLatestVersion(libName) {
|
|
8
|
-
var _a, _b, _c;
|
|
9
8
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
var _a, _b, _c;
|
|
10
10
|
const libVersionInProject = yield getLibraryVersionInProject(libName);
|
|
11
11
|
if (!libVersionInProject)
|
|
12
12
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infomaximum/package-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"exports": "./dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@babel/core": "^7.23.6",
|
|
26
26
|
"@babel/plugin-transform-runtime": "^7.23.6",
|
|
27
27
|
"@infomaximum/assert": "^1.1.3",
|
|
28
|
-
"@infomaximum/json-modify-webpack-plugin": "^1.0
|
|
28
|
+
"@infomaximum/json-modify-webpack-plugin": "^1.1.0",
|
|
29
29
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
30
30
|
"@svgr/webpack": "^8.1.0",
|
|
31
31
|
"autoprefixer": "^10.4.16",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"entry": {
|
|
12
12
|
"type": "string",
|
|
13
13
|
"title": "Имя файла в который будет собран виджет",
|
|
14
|
+
"description": "Если не задан, то будет сгенерирован widget.[contenthash].js",
|
|
14
15
|
"pattern": "\\w+\\.js$",
|
|
15
16
|
"examples": ["index.js", "main.js"]
|
|
16
17
|
},
|
|
@@ -55,5 +56,5 @@
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
},
|
|
58
|
-
"required": ["uuid", "
|
|
59
|
+
"required": ["uuid", "name"]
|
|
59
60
|
}
|