@infomaximum/package-cli 1.4.0-rc → 1.4.0-rc3
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,6 +3,7 @@ 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 { require } from "../../utils.js";
|
|
6
7
|
const packageFilename = "main";
|
|
7
8
|
export const getPackageConfig = (mode, PATHS) => {
|
|
8
9
|
const widgetVersion = require(PATHS.appPackageJson).version;
|
|
@@ -6,6 +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 { require } from "../../utils.js";
|
|
9
10
|
const { ProgressPlugin } = webpack;
|
|
10
11
|
const isProduction = (mode) => mode === "production";
|
|
11
12
|
const isDevelopment = (mode) => mode === "development";
|
|
@@ -59,28 +60,25 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
59
60
|
{
|
|
60
61
|
test: /\.(ts|tsx)$/i,
|
|
61
62
|
exclude: ["/node_modules/"],
|
|
62
|
-
loader:
|
|
63
|
+
loader: "babel-loader",
|
|
63
64
|
options: {
|
|
64
65
|
plugins: [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
!isProduction(mode) &&
|
|
66
|
+
"babel-plugin-inline-json-import",
|
|
67
|
+
"@babel/plugin-transform-runtime",
|
|
68
|
+
!isProduction(mode) && "react-refresh/babel",
|
|
68
69
|
].filter(Boolean),
|
|
69
70
|
},
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
test: /\.css$/i,
|
|
73
74
|
use: [
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
"style-loader",
|
|
76
|
+
"css-loader",
|
|
76
77
|
{
|
|
77
|
-
loader:
|
|
78
|
+
loader: "postcss-loader",
|
|
78
79
|
options: {
|
|
79
80
|
postcssOptions: {
|
|
80
|
-
plugins: [
|
|
81
|
-
require.resolve("postcss-preset-env"),
|
|
82
|
-
require.resolve("autoprefixer"),
|
|
83
|
-
],
|
|
81
|
+
plugins: ["postcss-preset-env", "autoprefixer"],
|
|
84
82
|
},
|
|
85
83
|
},
|
|
86
84
|
},
|
|
@@ -89,23 +87,20 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
89
87
|
{
|
|
90
88
|
test: /\.s[ac]ss$/i,
|
|
91
89
|
use: [
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
"style-loader",
|
|
91
|
+
"css-loader",
|
|
94
92
|
{
|
|
95
|
-
loader:
|
|
93
|
+
loader: "postcss-loader",
|
|
96
94
|
options: {
|
|
97
95
|
postcssOptions: {
|
|
98
|
-
plugins: [
|
|
99
|
-
require.resolve("postcss-preset-env"),
|
|
100
|
-
require.resolve("autoprefixer"),
|
|
101
|
-
],
|
|
96
|
+
plugins: ["postcss-preset-env", "autoprefixer"],
|
|
102
97
|
},
|
|
103
98
|
},
|
|
104
99
|
},
|
|
105
100
|
{
|
|
106
|
-
loader:
|
|
101
|
+
loader: "sass-loader",
|
|
107
102
|
options: {
|
|
108
|
-
implementation:
|
|
103
|
+
implementation: "sass",
|
|
109
104
|
sassOptions: {
|
|
110
105
|
fiber: false,
|
|
111
106
|
},
|
|
@@ -116,21 +111,18 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
116
111
|
{
|
|
117
112
|
test: /\.less$/i,
|
|
118
113
|
use: [
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
"style-loader",
|
|
115
|
+
"css-loader",
|
|
121
116
|
{
|
|
122
|
-
loader:
|
|
117
|
+
loader: "postcss-loader",
|
|
123
118
|
options: {
|
|
124
119
|
postcssOptions: {
|
|
125
|
-
plugins: [
|
|
126
|
-
require.resolve("postcss-preset-env"),
|
|
127
|
-
require.resolve("autoprefixer"),
|
|
128
|
-
],
|
|
120
|
+
plugins: ["postcss-preset-env", "autoprefixer"],
|
|
129
121
|
},
|
|
130
122
|
},
|
|
131
123
|
},
|
|
132
124
|
{
|
|
133
|
-
loader:
|
|
125
|
+
loader: "less-loader",
|
|
134
126
|
options: {
|
|
135
127
|
sourceMap: isDevelopment(mode),
|
|
136
128
|
lessOptions: {
|
|
@@ -168,7 +160,7 @@ export const getCommonWidgetConfig = (mode, PATHS) => {
|
|
|
168
160
|
},
|
|
169
161
|
{
|
|
170
162
|
issuer: /\.[jt]sx?$/,
|
|
171
|
-
loader:
|
|
163
|
+
loader: "@svgr/webpack",
|
|
172
164
|
options: {
|
|
173
165
|
svgoConfig: {
|
|
174
166
|
plugins: [
|
package/dist/paths.js
CHANGED
package/dist/utils.js
CHANGED
|
@@ -3,6 +3,8 @@ import fs from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import https from "node:https";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
|
+
import Module from "node:module";
|
|
7
|
+
export const require = Module.createRequire(import.meta.url);
|
|
6
8
|
export function capitalizeFirstLetter(str = "") {
|
|
7
9
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
8
10
|
}
|