@simplysm/sd-cli 6.0.19 → 6.0.27
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/.eslintrc.js +1 -2
- package/dist-node/bin/sd-cli.js +25 -8
- package/dist-node/bin/sd-cli.js.map +1 -1
- package/dist-node/build-tools/SdCliIndexFileGenerator.js +51 -0
- package/dist-node/build-tools/SdCliIndexFileGenerator.js.map +1 -0
- package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js +621 -0
- package/dist-node/build-tools/SdCliNgModuleFilesGenerator.js.map +1 -0
- package/dist-node/build-tools/metadata/SdAotMetadataReader.js +270 -0
- package/dist-node/build-tools/metadata/SdAotMetadataReader.js.map +1 -0
- package/dist-node/build-tools/metadata/SdIvyMetadataReader.js +101 -0
- package/dist-node/build-tools/metadata/SdIvyMetadataReader.js.map +1 -0
- package/dist-node/build-tools/metadata/SdMyMetadataReader.js +298 -0
- package/dist-node/build-tools/metadata/SdMyMetadataReader.js.map +1 -0
- package/dist-node/{build-tools → builders}/SdCliJavascriptLinter.js +1 -1
- package/dist-node/builders/SdCliJavascriptLinter.js.map +1 -0
- package/dist-node/{build-tools → builders}/SdCliNgClientBuilder.js +176 -102
- package/dist-node/builders/SdCliNgClientBuilder.js.map +1 -0
- package/dist-node/builders/SdCliNgLibraryBuilder.js +238 -0
- package/dist-node/builders/SdCliNgLibraryBuilder.js.map +1 -0
- package/dist-node/{build-tools → builders}/SdCliPublisher.js +0 -0
- package/dist-node/builders/SdCliPublisher.js.map +1 -0
- package/dist-node/{build-tools → builders}/SdCliServerBuilder.js +8 -6
- package/dist-node/builders/SdCliServerBuilder.js.map +1 -0
- package/dist-node/builders/SdCliTypescriptBuilder.js +304 -0
- package/dist-node/builders/SdCliTypescriptBuilder.js.map +1 -0
- package/dist-node/entry-points/SdCliLocalUpdater.js +9 -8
- package/dist-node/entry-points/SdCliLocalUpdater.js.map +1 -1
- package/dist-node/entry-points/SdCliProject.js +11 -9
- package/dist-node/entry-points/SdCliProject.js.map +1 -1
- package/dist-node/packages/SdCliClientPackage.js +12 -2
- package/dist-node/packages/SdCliClientPackage.js.map +1 -1
- package/dist-node/packages/SdCliLibraryPackage.js +17 -9
- package/dist-node/packages/SdCliLibraryPackage.js.map +1 -1
- package/dist-node/packages/SdCliServerPackage.js +2 -2
- package/dist-node/packages/SdCliServerPackage.js.map +1 -1
- package/dist-node/utils/SdCliFileCrypto.js +76 -0
- package/dist-node/utils/SdCliFileCrypto.js.map +1 -0
- package/dist-node/utils/SdProjectConfigUtil.js +1 -1
- package/dist-node/utils/SdProjectConfigUtil.js.map +1 -1
- package/dist-node/utils/SdWebpackUtil.js +12 -3
- package/dist-node/utils/SdWebpackUtil.js.map +1 -1
- package/dist-node/workers/lib-build-worker.js +7 -6
- package/dist-node/workers/lib-build-worker.js.map +1 -1
- package/dist-types/build-tools/SdCliIndexFileGenerator.d.ts +12 -0
- package/dist-types/build-tools/SdCliNgModuleFilesGenerator.d.ts +42 -0
- package/dist-types/build-tools/metadata/SdAotMetadataReader.d.ts +57 -0
- package/dist-types/build-tools/metadata/SdIvyMetadataReader.d.ts +41 -0
- package/dist-types/build-tools/metadata/SdMyMetadataReader.d.ts +57 -0
- package/dist-types/{build-tools → builders}/SdCliJavascriptLinter.d.ts +0 -0
- package/dist-types/{build-tools → builders}/SdCliNgClientBuilder.d.ts +1 -1
- package/dist-types/builders/SdCliNgLibraryBuilder.d.ts +27 -0
- package/dist-types/{build-tools → builders}/SdCliPublisher.d.ts +0 -0
- package/dist-types/{build-tools → builders}/SdCliServerBuilder.d.ts +0 -0
- package/dist-types/builders/SdCliTypescriptBuilder.d.ts +46 -0
- package/dist-types/commons.d.ts +11 -3
- package/dist-types/packages/SdCliClientPackage.d.ts +1 -1
- package/dist-types/utils/SdCliFileCrypto.d.ts +7 -0
- package/dist-types/utils/SdWebpackUtil.d.ts +1 -0
- package/package.json +10 -7
- package/schema/schema.json +247 -0
- package/src/bin/sd-cli.ts +37 -14
- package/src/build-tools/SdCliIndexFileGenerator.ts +61 -0
- package/src/build-tools/SdCliNgModuleFilesGenerator.ts +837 -0
- package/src/build-tools/metadata/SdAotMetadataReader.ts +368 -0
- package/src/build-tools/metadata/SdIvyMetadataReader.ts +152 -0
- package/src/build-tools/metadata/SdMyMetadataReader.ts +379 -0
- package/src/{build-tools → builders}/SdCliJavascriptLinter.ts +1 -1
- package/src/{build-tools → builders}/SdCliNgClientBuilder.ts +209 -111
- package/src/builders/SdCliNgLibraryBuilder.ts +336 -0
- package/src/{build-tools → builders}/SdCliPublisher.ts +0 -0
- package/src/{build-tools → builders}/SdCliServerBuilder.ts +14 -8
- package/src/builders/SdCliTypescriptBuilder.ts +488 -0
- package/src/commons.ts +11 -3
- package/src/entry-points/SdCliLocalUpdater.ts +9 -8
- package/src/entry-points/SdCliProject.ts +12 -9
- package/src/packages/SdCliClientPackage.ts +14 -3
- package/src/packages/SdCliLibraryPackage.ts +19 -11
- package/src/packages/SdCliServerPackage.ts +2 -2
- package/src/utils/SdCliFileCrypto.ts +87 -0
- package/src/utils/SdCliUtils.ts +56 -0
- package/src/utils/SdProjectConfigUtil.ts +1 -1
- package/src/utils/SdWebpackUtil.ts +13 -3
- package/src/workers/lib-build-worker.ts +8 -7
- package/dist-node/build-tools/SdCliJavascriptLinter.js.map +0 -1
- package/dist-node/build-tools/SdCliNgClientBuilder.js.map +0 -1
- package/dist-node/build-tools/SdCliNgLibraryBuilder.js +0 -164
- package/dist-node/build-tools/SdCliNgLibraryBuilder.js.map +0 -1
- package/dist-node/build-tools/SdCliPublisher.js.map +0 -1
- package/dist-node/build-tools/SdCliServerBuilder.js.map +0 -1
- package/dist-node/build-tools/SdCliTypescriptBuilder.js +0 -316
- package/dist-node/build-tools/SdCliTypescriptBuilder.js.map +0 -1
- package/dist-node/build-tools/SdCliTypescriptIndexFileGenerator.js +0 -75
- package/dist-node/build-tools/SdCliTypescriptIndexFileGenerator.js.map +0 -1
- package/dist-types/build-tools/SdCliNgLibraryBuilder.d.ts +0 -23
- package/dist-types/build-tools/SdCliTypescriptBuilder.d.ts +0 -37
- package/dist-types/build-tools/SdCliTypescriptIndexFileGenerator.d.ts +0 -12
- package/src/build-tools/SdCliNgLibraryBuilder.ts +0 -225
- package/src/build-tools/SdCliTypescriptBuilder.ts +0 -424
- package/src/build-tools/SdCliTypescriptIndexFileGenerator.ts +0 -93
|
@@ -10,7 +10,8 @@ import * as esbuild from "esbuild";
|
|
|
10
10
|
import {
|
|
11
11
|
AnyComponentStyleBudgetChecker,
|
|
12
12
|
CommonJsUsageWarnPlugin,
|
|
13
|
-
DedupeModuleResolvePlugin
|
|
13
|
+
DedupeModuleResolvePlugin,
|
|
14
|
+
SuppressExtractedTextChunksWebpackPlugin
|
|
14
15
|
} from "@angular-devkit/build-angular/src/webpack/plugins";
|
|
15
16
|
import { LicenseWebpackPlugin } from "license-webpack-plugin";
|
|
16
17
|
import { Type } from "@angular-devkit/build-angular";
|
|
@@ -23,11 +24,13 @@ import * as CopyWebpackPlugin from "copy-webpack-plugin";
|
|
|
23
24
|
import { NextHandleFunction } from "connect";
|
|
24
25
|
import { HmrLoader } from "@angular-devkit/build-angular/src/webpack/plugins/hmr/hmr-loader";
|
|
25
26
|
import * as WebpackDevMiddleware from "webpack-dev-middleware";
|
|
26
|
-
import {
|
|
27
|
-
import * as os from "os";
|
|
28
|
-
import { StringUtil } from "@simplysm/sd-core-common";
|
|
27
|
+
import { StringUtil, Wait } from "@simplysm/sd-core-common";
|
|
29
28
|
import { augmentAppWithServiceWorker } from "@angular-devkit/build-angular/src/utils/service-worker";
|
|
30
29
|
import * as browserslist from "browserslist";
|
|
30
|
+
import * as WebpackHotMiddleware from "webpack-hot-middleware";
|
|
31
|
+
import { SdCliNgLibraryBuilder } from "./SdCliNgLibraryBuilder";
|
|
32
|
+
import * as os from "os";
|
|
33
|
+
import { LintResult } from "eslint-webpack-plugin/declarations/options";
|
|
31
34
|
|
|
32
35
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
36
|
const ESLintWebpackPlugin = require("eslint-webpack-plugin");
|
|
@@ -47,13 +50,8 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
47
50
|
this.parsedTsconfig = {
|
|
48
51
|
...parsedTsconfig,
|
|
49
52
|
options: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
strictInjectionParameters: true,
|
|
53
|
-
strictInputAccessModifiers: true,
|
|
54
|
-
strictTemplates: true,
|
|
55
|
-
strictInputTypes: false,
|
|
56
|
-
...parsedTsconfig.options
|
|
53
|
+
...parsedTsconfig.options,
|
|
54
|
+
...tsconfig.angularCompilerOptions
|
|
57
55
|
}
|
|
58
56
|
};
|
|
59
57
|
|
|
@@ -71,9 +69,18 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
71
69
|
|
|
72
70
|
await FsUtil.removeAsync(this.parsedTsconfig.options.outDir!);
|
|
73
71
|
|
|
72
|
+
const buildResult: ISdPackageBuildResult[] = [];
|
|
73
|
+
|
|
74
|
+
// GENERATOR
|
|
75
|
+
const ngGenerator = new SdCliNgLibraryBuilder(this.rootPath, this.tsconfigFilePath, ["emit", "check", "lint"], undefined);
|
|
76
|
+
const genFilePaths = await ngGenerator.reloadProgramAsync(false);
|
|
77
|
+
const genResult = await ngGenerator.generateAdditionalFilesAsync(genFilePaths, false);
|
|
78
|
+
buildResult.push(...genResult.result);
|
|
79
|
+
|
|
80
|
+
// WEBPACK 빌드
|
|
74
81
|
const webpackConfig = this._getWebpackConfig(false);
|
|
75
82
|
const compiler = webpack(webpackConfig);
|
|
76
|
-
const
|
|
83
|
+
const webpackBuildResults = await new Promise<ISdPackageBuildResult[]>((resolve, reject) => {
|
|
77
84
|
compiler.run((err, stat) => {
|
|
78
85
|
if (err != null) {
|
|
79
86
|
reject(err);
|
|
@@ -84,17 +91,12 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
84
91
|
resolve(results);
|
|
85
92
|
});
|
|
86
93
|
});
|
|
94
|
+
buildResult.push(...webpackBuildResults);
|
|
87
95
|
|
|
88
96
|
// .config.json 파일 쓰기
|
|
89
97
|
|
|
90
98
|
const targetPath = path.resolve(this.parsedTsconfig.options.outDir!, ".config.json");
|
|
91
|
-
FsUtil.
|
|
92
|
-
|
|
93
|
-
// CopyWebpackPlugin 대신 직접 카피
|
|
94
|
-
|
|
95
|
-
for (const item of ["assets/"]) {
|
|
96
|
-
await FsUtil.copyAsync(path.resolve(this.rootPath, "src", item), path.resolve(this.parsedTsconfig.options.outDir!, item));
|
|
97
|
-
}
|
|
99
|
+
await FsUtil.writeFileAsync(targetPath, JSON.stringify(this.config.configs ?? {}, undefined, 2));
|
|
98
100
|
|
|
99
101
|
// service-worker 처리
|
|
100
102
|
|
|
@@ -107,29 +109,98 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
107
109
|
PathUtil.posix(path.relative(this.projectRootPath, path.resolve(this.rootPath, "ngsw-config.json")))
|
|
108
110
|
);
|
|
109
111
|
|
|
110
|
-
this.emit("complete",
|
|
112
|
+
this.emit("complete", buildResult.distinct());
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
public async watchAsync(serverPath?: string): Promise<NextHandleFunction> {
|
|
115
|
+
public async watchAsync(serverPath?: string): Promise<NextHandleFunction[]> {
|
|
114
116
|
await FsUtil.removeAsync(this.parsedTsconfig.options.outDir!);
|
|
115
117
|
|
|
118
|
+
let buildResult: ISdPackageBuildResult[] = [];
|
|
119
|
+
|
|
120
|
+
const ngGenerator = new SdCliNgLibraryBuilder(this.rootPath, this.tsconfigFilePath, ["emit", "check", "lint"], undefined);
|
|
121
|
+
|
|
122
|
+
// WEBPACK 빌드
|
|
116
123
|
const webpackConfig = this._getWebpackConfig(true);
|
|
117
124
|
const compiler = webpack(webpackConfig);
|
|
118
|
-
return await new Promise<NextHandleFunction>((resolve, reject) => {
|
|
119
|
-
compiler.hooks.watchRun.
|
|
125
|
+
return await new Promise<NextHandleFunction[]>((resolve, reject) => {
|
|
126
|
+
compiler.hooks.watchRun.tapAsync(this.constructor.name, async (compiler1, callback) => {
|
|
120
127
|
this.emit("change");
|
|
128
|
+
|
|
129
|
+
buildResult = [];
|
|
130
|
+
|
|
131
|
+
// -- FIRST
|
|
132
|
+
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition,@typescript-eslint/strict-boolean-expressions
|
|
134
|
+
if (!compiler.modifiedFiles || !compiler.removedFiles) {
|
|
135
|
+
const genDirtyFilePaths = await ngGenerator.reloadProgramAsync(true);
|
|
136
|
+
const genResult = await ngGenerator.generateAdditionalFilesAsync(genDirtyFilePaths, true);
|
|
137
|
+
buildResult.push(...genResult.result);
|
|
138
|
+
|
|
139
|
+
callback();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// -- NOT FIRST
|
|
143
|
+
|
|
144
|
+
else {
|
|
145
|
+
const changedFiles = [...compiler.modifiedFiles, ...compiler.removedFiles];
|
|
146
|
+
|
|
147
|
+
// 변경파일 중, 유효한 파일 추출
|
|
148
|
+
const watchPaths = ngGenerator.getWatchPaths();
|
|
149
|
+
const changedFilePaths = changedFiles
|
|
150
|
+
.map((item) => PathUtil.posix(item))
|
|
151
|
+
.filter((item) => path.basename(item).includes("."))
|
|
152
|
+
.filter((item) => watchPaths.includes(path.dirname(item)))
|
|
153
|
+
.distinct();
|
|
154
|
+
if (changedFilePaths.length === 0) {
|
|
155
|
+
callback();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// 변경파일에 대한 프로그램 리로드
|
|
160
|
+
const genDirtyFilePaths = await ngGenerator.reloadChangedProgramAsync(changedFilePaths, true);
|
|
161
|
+
if (genDirtyFilePaths.length === 0) {
|
|
162
|
+
callback();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// 변경파일에 대해 자동생성할 소스파일들 생성 및 리로드 (index.ts등)
|
|
167
|
+
const genResult = await ngGenerator.generateAdditionalFilesAsync(genDirtyFilePaths, true);
|
|
168
|
+
buildResult.push(...genResult.result);
|
|
169
|
+
if (genResult.dirtyFilePaths.length === 0) {
|
|
170
|
+
callback();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
genDirtyFilePaths.push(...genResult.dirtyFilePaths);
|
|
174
|
+
|
|
175
|
+
const modifiedFiles = [...compiler.modifiedFiles];
|
|
176
|
+
const removedFiles = [...compiler.removedFiles];
|
|
177
|
+
for (const genFilePath of genDirtyFilePaths.distinct()) {
|
|
178
|
+
if (FsUtil.exists(genFilePath)) {
|
|
179
|
+
modifiedFiles.push(genFilePath);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
removedFiles.push(genFilePath);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
compiler.modifiedFiles = new Set(modifiedFiles.distinct());
|
|
186
|
+
compiler.removedFiles = new Set(removedFiles.distinct());
|
|
187
|
+
|
|
188
|
+
callback();
|
|
189
|
+
}
|
|
121
190
|
});
|
|
122
191
|
|
|
123
192
|
// eslint-disable-next-line prefer-const
|
|
124
|
-
let
|
|
193
|
+
let devMiddleware: NextHandleFunction | undefined;
|
|
194
|
+
// eslint-disable-next-line prefer-const
|
|
195
|
+
let hotMiddleware: NextHandleFunction | undefined;
|
|
125
196
|
|
|
126
197
|
compiler.hooks.failed.tap(this.constructor.name, (err) => {
|
|
127
198
|
const results = SdWebpackUtil.getWebpackResults(err);
|
|
128
|
-
this.emit("complete", results);
|
|
199
|
+
this.emit("complete", [...buildResult, ...results].distinct());
|
|
129
200
|
reject(err);
|
|
130
201
|
});
|
|
131
202
|
|
|
132
|
-
compiler.hooks.done.tap("SdCliClientCompiler", (stats) => {
|
|
203
|
+
compiler.hooks.done.tap("SdCliClientCompiler", async (stats) => {
|
|
133
204
|
const results = SdWebpackUtil.getWebpackResults(stats);
|
|
134
205
|
|
|
135
206
|
// .config.json 파일 쓰기
|
|
@@ -137,18 +208,25 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
137
208
|
const configDistPath = !StringUtil.isNullOrEmpty(serverPath)
|
|
138
209
|
? path.resolve(serverPath, "dist/www", packageKey, ".config.json")
|
|
139
210
|
: path.resolve(this.parsedTsconfig.options.outDir!, ".config.json");
|
|
140
|
-
FsUtil.
|
|
211
|
+
await FsUtil.writeFileAsync(configDistPath, JSON.stringify(this.config.configs ?? {}, undefined, 2));
|
|
212
|
+
|
|
141
213
|
|
|
142
|
-
|
|
143
|
-
|
|
214
|
+
await Wait.true(() => devMiddleware !== undefined && hotMiddleware !== undefined);
|
|
215
|
+
this.emit("complete", [...buildResult, ...results].distinct());
|
|
216
|
+
resolve([devMiddleware!, hotMiddleware!]);
|
|
144
217
|
});
|
|
145
218
|
|
|
146
|
-
|
|
219
|
+
devMiddleware = WebpackDevMiddleware(compiler, {
|
|
147
220
|
publicPath: webpackConfig.output!.publicPath as string,
|
|
148
221
|
index: "index.html",
|
|
149
222
|
headers: { "Access-Control-Allow-Origin": "*" },
|
|
150
223
|
stats: false
|
|
151
224
|
});
|
|
225
|
+
|
|
226
|
+
hotMiddleware = WebpackHotMiddleware(compiler, {
|
|
227
|
+
path: `${webpackConfig.output!.publicPath as string}__webpack_hmr`,
|
|
228
|
+
log: false
|
|
229
|
+
});
|
|
152
230
|
});
|
|
153
231
|
}
|
|
154
232
|
|
|
@@ -168,9 +246,7 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
168
246
|
symlinks: true,
|
|
169
247
|
modules: [this.projectRootPath, "node_modules"],
|
|
170
248
|
mainFields: ["es2015", "browser", "module", "main"],
|
|
171
|
-
fallback:
|
|
172
|
-
os: require.resolve("os-browserify/browser")
|
|
173
|
-
}
|
|
249
|
+
fallback: this.config.resolveFallback
|
|
174
250
|
},
|
|
175
251
|
resolveLoader: {
|
|
176
252
|
symlinks: true,
|
|
@@ -182,6 +258,9 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
182
258
|
context: this.projectRootPath,
|
|
183
259
|
entry: {
|
|
184
260
|
main: [
|
|
261
|
+
...watch ? [
|
|
262
|
+
`webpack-hot-middleware/client?path=/${packageKey}/__webpack_hmr&timeout=20000&reload=true&overlay=true`
|
|
263
|
+
] : [],
|
|
185
264
|
path.resolve(this.rootPath, "src/main.ts")
|
|
186
265
|
],
|
|
187
266
|
polyfills: [
|
|
@@ -244,37 +323,54 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
244
323
|
] as any : [],
|
|
245
324
|
{
|
|
246
325
|
test: /\.scss$/i,
|
|
247
|
-
|
|
248
|
-
{
|
|
249
|
-
loader: MiniCssExtractPlugin.loader
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
loader: "css-loader",
|
|
253
|
-
options: {
|
|
254
|
-
url: false,
|
|
255
|
-
sourceMap: watch
|
|
256
|
-
}
|
|
257
|
-
},
|
|
326
|
+
rules: [
|
|
258
327
|
{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
328
|
+
oneOf: [
|
|
329
|
+
{
|
|
330
|
+
include: path.resolve(this.rootPath, "src/styles.scss"),
|
|
331
|
+
use: [
|
|
332
|
+
{
|
|
333
|
+
loader: MiniCssExtractPlugin.loader
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
loader: "css-loader",
|
|
337
|
+
options: {
|
|
338
|
+
url: false,
|
|
339
|
+
sourceMap: watch
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
exclude: path.resolve(this.rootPath, "src/styles.scss"),
|
|
346
|
+
type: "asset/source"
|
|
347
|
+
}
|
|
348
|
+
]
|
|
263
349
|
},
|
|
264
350
|
{
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
351
|
+
use: [
|
|
352
|
+
{
|
|
353
|
+
loader: "resolve-url-loader",
|
|
354
|
+
options: {
|
|
355
|
+
sourceMap: watch
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
loader: "sass-loader",
|
|
360
|
+
options: {
|
|
361
|
+
implementation: nodeSass,
|
|
362
|
+
sourceMap: true,
|
|
363
|
+
sassOptions: {
|
|
364
|
+
fiber: false,
|
|
365
|
+
precision: 8,
|
|
366
|
+
includePaths: [],
|
|
367
|
+
outputStyle: "expanded",
|
|
368
|
+
quietDeps: true,
|
|
369
|
+
verbose: false
|
|
370
|
+
}
|
|
371
|
+
}
|
|
276
372
|
}
|
|
277
|
-
|
|
373
|
+
]
|
|
278
374
|
}
|
|
279
375
|
]
|
|
280
376
|
},
|
|
@@ -371,27 +467,25 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
371
467
|
{}
|
|
372
468
|
),
|
|
373
469
|
new DedupeModuleResolvePlugin({ verbose: false }) as any,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
})
|
|
394
|
-
] : [],
|
|
470
|
+
new CopyWebpackPlugin({
|
|
471
|
+
patterns: ["favicon.ico", "assets/", "manifest.webmanifest"].map((item) => ({
|
|
472
|
+
context: this.rootPath,
|
|
473
|
+
to: item,
|
|
474
|
+
from: `src/${item}`,
|
|
475
|
+
noErrorOnMissing: true,
|
|
476
|
+
force: true,
|
|
477
|
+
globOptions: {
|
|
478
|
+
dot: true,
|
|
479
|
+
followSymbolicLinks: false,
|
|
480
|
+
ignore: [
|
|
481
|
+
".gitkeep",
|
|
482
|
+
"**/.DS_Store",
|
|
483
|
+
"**/Thumbs.db"
|
|
484
|
+
].map((i) => PathUtil.posix(this.rootPath, i))
|
|
485
|
+
},
|
|
486
|
+
priority: 0
|
|
487
|
+
}))
|
|
488
|
+
}),
|
|
395
489
|
...watch ? [] : [
|
|
396
490
|
new LicenseWebpackPlugin({
|
|
397
491
|
stats: { warnings: false, errors: false },
|
|
@@ -428,7 +522,9 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
428
522
|
// filename: watch ? "[name].css" : `[name].[contenthash:20].css`
|
|
429
523
|
filename: "[name].css"
|
|
430
524
|
}),
|
|
431
|
-
|
|
525
|
+
...watch ? [] : [
|
|
526
|
+
new SuppressExtractedTextChunksWebpackPlugin()
|
|
527
|
+
],
|
|
432
528
|
new AngularWebpackPlugin({
|
|
433
529
|
tsconfig: this.tsconfigFilePath,
|
|
434
530
|
compilerOptions: this.parsedTsconfig.options,
|
|
@@ -436,33 +532,32 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
436
532
|
emitNgModuleScope: watch,
|
|
437
533
|
inlineStyleFileExtension: "scss"
|
|
438
534
|
}),
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
] : [],
|
|
535
|
+
new IndexHtmlWebpackPlugin({
|
|
536
|
+
indexPath: path.resolve(this.rootPath, "src/index.html"),
|
|
537
|
+
outputPath: "index.html",
|
|
538
|
+
baseHref: `/${packageKey}/`,
|
|
539
|
+
entrypoints: [
|
|
540
|
+
"runtime",
|
|
541
|
+
"polyfills",
|
|
542
|
+
"sw-register",
|
|
543
|
+
"styles",
|
|
544
|
+
"vendor",
|
|
545
|
+
"main"
|
|
546
|
+
],
|
|
547
|
+
moduleEntrypoints: [],
|
|
548
|
+
noModuleEntrypoints: [],
|
|
549
|
+
deployUrl: undefined,
|
|
550
|
+
sri: false,
|
|
551
|
+
postTransform: undefined,
|
|
552
|
+
optimization: {
|
|
553
|
+
scripts: !watch,
|
|
554
|
+
styles: { minify: !watch, inlineCritical: !watch },
|
|
555
|
+
fonts: { inline: !watch }
|
|
556
|
+
},
|
|
557
|
+
WOFFSupportNeeded: false,
|
|
558
|
+
crossOrigin: "none",
|
|
559
|
+
lang: undefined
|
|
560
|
+
}),
|
|
466
561
|
new webpack.ProvidePlugin({
|
|
467
562
|
"Buffer": ["buffer", "Buffer"]
|
|
468
563
|
}),
|
|
@@ -477,7 +572,7 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
477
572
|
exclude: ["node_modules"],
|
|
478
573
|
fix: false,
|
|
479
574
|
threads: true,
|
|
480
|
-
formatter: (results: LintResult[]
|
|
575
|
+
formatter: (results: LintResult[]) => {
|
|
481
576
|
const resultMessages: string[] = [];
|
|
482
577
|
for (const result of results) {
|
|
483
578
|
for (const msg of result.messages) {
|
|
@@ -486,7 +581,10 @@ export class SdCliNgClientBuilder extends EventEmitter {
|
|
|
486
581
|
}
|
|
487
582
|
return resultMessages.join(os.EOL);
|
|
488
583
|
}
|
|
489
|
-
})
|
|
584
|
+
}),
|
|
585
|
+
...watch ? [
|
|
586
|
+
new webpack.HotModuleReplacementPlugin()
|
|
587
|
+
] : []
|
|
490
588
|
],
|
|
491
589
|
node: false,
|
|
492
590
|
stats: "errors-warnings"
|