@infomaximum/package-cli 2.6.0 → 2.7.0
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/widget/configs/webpack/common.js +6 -2
- package/dist/widget/configs/webpack/sections/plugins/minimizer.js +6 -0
- package/dist/widget/configs/webpack/sections/plugins/modifyManifestWidget.js +10 -3
- package/dist/widget/const.js +2 -0
- 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.0](https://github.com/Infomaximum/package-cli/compare/v2.6.1...v2.7.0) (2024-09-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* добавлена возможность генерации filename с использованием хеша содержимого файла ([15b11ea](https://github.com/Infomaximum/package-cli/commit/15b11eaf56bc3b4eeaf53be025ee122adc1b3053))
|
|
11
|
+
|
|
12
|
+
### [2.6.1](https://github.com/Infomaximum/package-cli/compare/v2.6.0...v2.6.1) (2024-09-17)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* убрано извлечение комментариев ([5564467](https://github.com/Infomaximum/package-cli/commit/556446794b1b4ba9a4c4df83a377e833f956e839))
|
|
18
|
+
|
|
5
19
|
## [2.6.0](https://github.com/Infomaximum/package-cli/compare/v2.5.0...v2.6.0) (2024-08-29)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -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
|
},
|
|
@@ -9,6 +9,12 @@ export const getMinimizer = () => {
|
|
|
9
9
|
new TerserWebpackPlugin({
|
|
10
10
|
minify: TerserWebpackPlugin.terserMinify,
|
|
11
11
|
parallel: true,
|
|
12
|
+
extractComments: false,
|
|
13
|
+
terserOptions: {
|
|
14
|
+
format: {
|
|
15
|
+
comments: false,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
12
18
|
}),
|
|
13
19
|
new CssMinimizerPlugin(),
|
|
14
20
|
],
|
|
@@ -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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infomaximum/package-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
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
|
}
|