@infomaximum/package-cli 1.4.0-rc2 → 1.4.0-rc4
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.
|
@@ -3,11 +3,11 @@ import CopyWebpackPlugin from "copy-webpack-plugin";
|
|
|
3
3
|
import { archiveExt, buildWidgetConfigName, widgetArchiveName, } from "./common.js";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
|
|
6
|
-
import {
|
|
6
|
+
import { systemRequire } from "../../utils.js";
|
|
7
7
|
const packageFilename = "main";
|
|
8
8
|
export const getPackageConfig = (mode, PATHS) => {
|
|
9
|
-
const widgetVersion =
|
|
10
|
-
const manifestPackageName =
|
|
9
|
+
const widgetVersion = systemRequire(PATHS.appPackageJson).version;
|
|
10
|
+
const manifestPackageName = systemRequire(PATHS.packageManifest).name;
|
|
11
11
|
return {
|
|
12
12
|
mode,
|
|
13
13
|
name: "package",
|
|
@@ -6,7 +6,7 @@ import TerserWebpackPlugin from "terser-webpack-plugin";
|
|
|
6
6
|
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
7
7
|
import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
|
|
8
8
|
import webpack, {} from "webpack";
|
|
9
|
-
import {
|
|
9
|
+
import { systemRequire } from "../../utils.js";
|
|
10
10
|
const { ProgressPlugin } = webpack;
|
|
11
11
|
const isProduction = (mode) => mode === "production";
|
|
12
12
|
const isDevelopment = (mode) => mode === "development";
|
|
@@ -22,7 +22,7 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
22
22
|
entry: [PATHS.moduleIndex, PATHS.manifestJson],
|
|
23
23
|
output: {
|
|
24
24
|
path: PATHS.appBuild,
|
|
25
|
-
filename:
|
|
25
|
+
filename: systemRequire(PATHS.manifestJson).entry,
|
|
26
26
|
asyncChunks: false,
|
|
27
27
|
clean: true,
|
|
28
28
|
},
|
|
@@ -60,27 +60,28 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
60
60
|
{
|
|
61
61
|
test: /\.(ts|tsx)$/i,
|
|
62
62
|
exclude: ["/node_modules/"],
|
|
63
|
-
loader:
|
|
63
|
+
loader: systemRequire.resolve("babel-loader"),
|
|
64
64
|
options: {
|
|
65
65
|
plugins: [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
!isProduction(mode) &&
|
|
66
|
+
systemRequire.resolve("babel-plugin-inline-json-import"),
|
|
67
|
+
systemRequire.resolve("@babel/plugin-transform-runtime"),
|
|
68
|
+
!isProduction(mode) &&
|
|
69
|
+
systemRequire.resolve("react-refresh/babel"),
|
|
69
70
|
].filter(Boolean),
|
|
70
71
|
},
|
|
71
72
|
},
|
|
72
73
|
{
|
|
73
74
|
test: /\.css$/i,
|
|
74
75
|
use: [
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
systemRequire.resolve("style-loader"),
|
|
77
|
+
systemRequire.resolve("css-loader"),
|
|
77
78
|
{
|
|
78
|
-
loader:
|
|
79
|
+
loader: systemRequire.resolve("postcss-loader"),
|
|
79
80
|
options: {
|
|
80
81
|
postcssOptions: {
|
|
81
82
|
plugins: [
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
systemRequire.resolve("postcss-preset-env"),
|
|
84
|
+
systemRequire.resolve("autoprefixer"),
|
|
84
85
|
],
|
|
85
86
|
},
|
|
86
87
|
},
|
|
@@ -90,23 +91,23 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
90
91
|
{
|
|
91
92
|
test: /\.s[ac]ss$/i,
|
|
92
93
|
use: [
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
systemRequire.resolve("style-loader"),
|
|
95
|
+
systemRequire.resolve("css-loader"),
|
|
95
96
|
{
|
|
96
|
-
loader:
|
|
97
|
+
loader: systemRequire.resolve("postcss-loader"),
|
|
97
98
|
options: {
|
|
98
99
|
postcssOptions: {
|
|
99
100
|
plugins: [
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
systemRequire.resolve("postcss-preset-env"),
|
|
102
|
+
systemRequire.resolve("autoprefixer"),
|
|
102
103
|
],
|
|
103
104
|
},
|
|
104
105
|
},
|
|
105
106
|
},
|
|
106
107
|
{
|
|
107
|
-
loader:
|
|
108
|
+
loader: systemRequire.resolve("sass-loader"),
|
|
108
109
|
options: {
|
|
109
|
-
implementation:
|
|
110
|
+
implementation: systemRequire("sass"),
|
|
110
111
|
sassOptions: {
|
|
111
112
|
fiber: false,
|
|
112
113
|
},
|
|
@@ -117,21 +118,21 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
117
118
|
{
|
|
118
119
|
test: /\.less$/i,
|
|
119
120
|
use: [
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
systemRequire.resolve("style-loader"),
|
|
122
|
+
systemRequire.resolve("css-loader"),
|
|
122
123
|
{
|
|
123
|
-
loader:
|
|
124
|
+
loader: systemRequire.resolve("postcss-loader"),
|
|
124
125
|
options: {
|
|
125
126
|
postcssOptions: {
|
|
126
127
|
plugins: [
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
systemRequire.resolve("postcss-preset-env"),
|
|
129
|
+
systemRequire.resolve("autoprefixer"),
|
|
129
130
|
],
|
|
130
131
|
},
|
|
131
132
|
},
|
|
132
133
|
},
|
|
133
134
|
{
|
|
134
|
-
loader:
|
|
135
|
+
loader: systemRequire.resolve("less-loader"),
|
|
135
136
|
options: {
|
|
136
137
|
sourceMap: isDevelopment(mode),
|
|
137
138
|
lessOptions: {
|
|
@@ -169,7 +170,7 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
169
170
|
},
|
|
170
171
|
{
|
|
171
172
|
issuer: /\.[jt]sx?$/,
|
|
172
|
-
loader:
|
|
173
|
+
loader: systemRequire.resolve("@svgr/webpack"),
|
|
173
174
|
options: {
|
|
174
175
|
svgoConfig: {
|
|
175
176
|
plugins: [
|
|
@@ -199,7 +200,7 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
199
200
|
}
|
|
200
201
|
: undefined,
|
|
201
202
|
resolve: {
|
|
202
|
-
extensions: [".tsx", ".ts", ""],
|
|
203
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
203
204
|
plugins: [new TsconfigPathsPlugin()],
|
|
204
205
|
},
|
|
205
206
|
devtool: isProduction(mode) ? false : "cheap-module-source-map",
|
package/dist/paths.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { systemRequire } from "./utils.js";
|
|
4
4
|
const appDirectory = fs.realpathSync(process.cwd());
|
|
5
5
|
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);
|
|
6
6
|
const moduleFileExtensions = [
|
|
@@ -51,7 +51,7 @@ export const generateIndexPath = (entryPath) => {
|
|
|
51
51
|
return entryPath;
|
|
52
52
|
}
|
|
53
53
|
try {
|
|
54
|
-
const mainIndexPath = path.resolve(process.cwd(), (_a =
|
|
54
|
+
const mainIndexPath = path.resolve(process.cwd(), (_a = systemRequire(resolveApp("package.json"))) === null || _a === void 0 ? void 0 : _a.main);
|
|
55
55
|
if (mainIndexPath && fs.existsSync(mainIndexPath)) {
|
|
56
56
|
return mainIndexPath;
|
|
57
57
|
}
|
package/dist/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
import https from "node:https";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import Module from "node:module";
|
|
7
|
-
export const
|
|
7
|
+
export const systemRequire = Module.createRequire(import.meta.url);
|
|
8
8
|
export function capitalizeFirstLetter(str = "") {
|
|
9
9
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
10
10
|
}
|