shakapacker 9.3.0.beta.6 → 9.3.0.beta.7
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/ESLINT_TECHNICAL_DEBT.md +8 -2
- data/Gemfile.lock +1 -1
- data/lib/shakapacker/doctor.rb +125 -68
- data/lib/shakapacker/runner.rb +12 -8
- data/lib/shakapacker/swc_migrator.rb +7 -7
- data/lib/shakapacker/version.rb +1 -1
- data/package/configExporter/cli.ts +71 -62
- data/package/configExporter/fileWriter.ts +3 -3
- data/package/configExporter/yamlSerializer.ts +36 -0
- data/package/plugins/webpack.ts +2 -1
- data/package.json +1 -1
- data/test/configExporter/integration.test.js +8 -8
- data/test/package/configExporter.test.js +7 -7
- metadata +2 -3
- data/package-lock.json +0 -13047
|
@@ -351,7 +351,7 @@ QUICK START (for troubleshooting):
|
|
|
351
351
|
|
|
352
352
|
# Advanced output options
|
|
353
353
|
bin/shakapacker-config --build=dev --stdout # View in terminal
|
|
354
|
-
bin/shakapacker-config --build=dev --output=config.
|
|
354
|
+
bin/shakapacker-config --build=dev --output=config.yml # Save to specific file`
|
|
355
355
|
)
|
|
356
356
|
.strict()
|
|
357
357
|
.parseSync()
|
|
@@ -566,7 +566,7 @@ async function runValidateCommand(options: ExportOptions): Promise<number> {
|
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
console.log(
|
|
569
|
+
console.log(`\n${"=".repeat(80)}`)
|
|
570
570
|
console.log("🔍 Validating Builds")
|
|
571
571
|
console.log("=".repeat(80))
|
|
572
572
|
console.log(`\nValidating ${buildsToValidate.length} build(s)...\n`)
|
|
@@ -577,7 +577,7 @@ async function runValidateCommand(options: ExportOptions): Promise<number> {
|
|
|
577
577
|
" This includes all webpack/rspack compilation logs, warnings, and progress messages"
|
|
578
578
|
)
|
|
579
579
|
console.log(" Use without --verbose to see only errors and summaries\n")
|
|
580
|
-
console.log("=".repeat(80)
|
|
580
|
+
console.log(`${"=".repeat(80)}\n`)
|
|
581
581
|
}
|
|
582
582
|
|
|
583
583
|
const results = []
|
|
@@ -585,7 +585,7 @@ async function runValidateCommand(options: ExportOptions): Promise<number> {
|
|
|
585
585
|
// Validate each build
|
|
586
586
|
for (const buildName of buildsToValidate) {
|
|
587
587
|
if (options.verbose) {
|
|
588
|
-
console.log(
|
|
588
|
+
console.log(`\n${"=".repeat(80)}`)
|
|
589
589
|
console.log(`📦 VALIDATING BUILD: ${buildName}`)
|
|
590
590
|
console.log("=".repeat(80))
|
|
591
591
|
} else {
|
|
@@ -611,7 +611,11 @@ async function runValidateCommand(options: ExportOptions): Promise<number> {
|
|
|
611
611
|
"development"
|
|
612
612
|
|
|
613
613
|
// Auto-detect bundler using the build's environment
|
|
614
|
-
const defaultBundler = await autoDetectBundler(
|
|
614
|
+
const defaultBundler = await autoDetectBundler(
|
|
615
|
+
buildEnv,
|
|
616
|
+
appRoot,
|
|
617
|
+
options.verbose
|
|
618
|
+
)
|
|
615
619
|
|
|
616
620
|
// Resolve build config with the correct default bundler
|
|
617
621
|
const resolvedBuild = loader.resolveBuild(
|
|
@@ -719,7 +723,7 @@ async function runAllBuildsCommand(options: ExportOptions): Promise<number> {
|
|
|
719
723
|
}
|
|
720
724
|
|
|
721
725
|
// Print summary
|
|
722
|
-
console.log(
|
|
726
|
+
console.log(`\n${"=".repeat(80)}`)
|
|
723
727
|
console.log("✅ All Builds Exported!")
|
|
724
728
|
console.log("=".repeat(80))
|
|
725
729
|
console.log(`\nCreated ${createdFiles.length} configuration file(s) in:`)
|
|
@@ -728,7 +732,7 @@ async function runAllBuildsCommand(options: ExportOptions): Promise<number> {
|
|
|
728
732
|
createdFiles.forEach((file) => {
|
|
729
733
|
console.log(` ✓ ${basename(file)}`)
|
|
730
734
|
})
|
|
731
|
-
console.log(
|
|
735
|
+
console.log(`\n${"=".repeat(80)}\n`)
|
|
732
736
|
|
|
733
737
|
return 0
|
|
734
738
|
} catch (error: unknown) {
|
|
@@ -749,7 +753,7 @@ async function runDoctorMode(
|
|
|
749
753
|
const savedEnv = saveBuildEnvironmentVariables()
|
|
750
754
|
|
|
751
755
|
try {
|
|
752
|
-
console.log(
|
|
756
|
+
console.log(`\n${"=".repeat(80)}`)
|
|
753
757
|
console.log("🔍 Config Exporter - Doctor Mode")
|
|
754
758
|
console.log("=".repeat(80))
|
|
755
759
|
|
|
@@ -899,7 +903,7 @@ async function runDoctorMode(
|
|
|
899
903
|
|
|
900
904
|
function printDoctorSummary(createdFiles: string[], targetDir: string): void {
|
|
901
905
|
// Print summary
|
|
902
|
-
console.log(
|
|
906
|
+
console.log(`\n${"=".repeat(80)}`)
|
|
903
907
|
console.log("✅ Export Complete!")
|
|
904
908
|
console.log("=".repeat(80))
|
|
905
909
|
console.log(`\nCreated ${createdFiles.length} configuration file(s) in:`)
|
|
@@ -922,14 +926,14 @@ function printDoctorSummary(createdFiles: string[], targetDir: string): void {
|
|
|
922
926
|
}
|
|
923
927
|
|
|
924
928
|
if (shouldSuggestGitignore) {
|
|
925
|
-
console.log(
|
|
929
|
+
console.log(`\n${"─".repeat(80)}`)
|
|
926
930
|
console.log(
|
|
927
931
|
"💡 Tip: Add the export directory to .gitignore to avoid committing config files:"
|
|
928
932
|
)
|
|
929
933
|
console.log(`\n echo "${dirName}/" >> .gitignore\n`)
|
|
930
934
|
}
|
|
931
935
|
|
|
932
|
-
console.log(
|
|
936
|
+
console.log(`\n${"=".repeat(80)}\n`)
|
|
933
937
|
}
|
|
934
938
|
|
|
935
939
|
async function runSaveMode(
|
|
@@ -946,7 +950,7 @@ async function runSaveMode(
|
|
|
946
950
|
if (options.output) {
|
|
947
951
|
// Single file output
|
|
948
952
|
const combined = configs.map((c) => c.config)
|
|
949
|
-
const metadata = configs[0]
|
|
953
|
+
const { metadata } = configs[0]
|
|
950
954
|
metadata.configCount = combined.length
|
|
951
955
|
|
|
952
956
|
const output = formatConfig(
|
|
@@ -986,15 +990,15 @@ async function runStdoutMode(
|
|
|
986
990
|
options: ExportOptions,
|
|
987
991
|
appRoot: string
|
|
988
992
|
): Promise<void> {
|
|
989
|
-
const configs = await loadConfigsForEnv(options.env
|
|
993
|
+
const configs = await loadConfigsForEnv(options.env, options, appRoot)
|
|
990
994
|
const combined = configs.map((c) => c.config)
|
|
991
|
-
const metadata = configs[0]
|
|
995
|
+
const { metadata } = configs[0]
|
|
992
996
|
metadata.configCount = combined.length
|
|
993
997
|
|
|
994
998
|
const config = combined.length === 1 ? combined[0] : combined
|
|
995
999
|
const output = formatConfig(config, metadata, options, appRoot)
|
|
996
1000
|
|
|
997
|
-
console.log(
|
|
1001
|
+
console.log(`\n${"=".repeat(80)}\n`)
|
|
998
1002
|
console.log(output)
|
|
999
1003
|
}
|
|
1000
1004
|
|
|
@@ -1002,9 +1006,9 @@ async function runSingleFileMode(
|
|
|
1002
1006
|
options: ExportOptions,
|
|
1003
1007
|
appRoot: string
|
|
1004
1008
|
): Promise<void> {
|
|
1005
|
-
const configs = await loadConfigsForEnv(options.env
|
|
1009
|
+
const configs = await loadConfigsForEnv(options.env, options, appRoot)
|
|
1006
1010
|
const combined = configs.map((c) => c.config)
|
|
1007
|
-
const metadata = configs[0]
|
|
1011
|
+
const { metadata } = configs[0]
|
|
1008
1012
|
metadata.configCount = combined.length
|
|
1009
1013
|
|
|
1010
1014
|
const config = combined.length === 1 ? combined[0] : combined
|
|
@@ -1031,7 +1035,11 @@ async function loadConfigsForEnv(
|
|
|
1031
1035
|
// Use a temporary env for auto-detection, will be overridden by build config
|
|
1032
1036
|
const tempEnv = env || "development"
|
|
1033
1037
|
const loader = new ConfigFileLoader(options.configFile)
|
|
1034
|
-
const defaultBundler = await autoDetectBundler(
|
|
1038
|
+
const defaultBundler = await autoDetectBundler(
|
|
1039
|
+
tempEnv,
|
|
1040
|
+
appRoot,
|
|
1041
|
+
options.verbose
|
|
1042
|
+
)
|
|
1035
1043
|
const resolvedBuild = loader.resolveBuild(
|
|
1036
1044
|
options.build,
|
|
1037
1045
|
options,
|
|
@@ -1055,7 +1063,7 @@ async function loadConfigsForEnv(
|
|
|
1055
1063
|
"DYLD_INSERT_LIBRARIES"
|
|
1056
1064
|
]
|
|
1057
1065
|
|
|
1058
|
-
if (
|
|
1066
|
+
if (options.verbose) {
|
|
1059
1067
|
console.log(
|
|
1060
1068
|
`[Config Exporter] Setting environment variables from build config...`
|
|
1061
1069
|
)
|
|
@@ -1075,7 +1083,7 @@ async function loadConfigsForEnv(
|
|
|
1075
1083
|
)
|
|
1076
1084
|
continue
|
|
1077
1085
|
}
|
|
1078
|
-
if (
|
|
1086
|
+
if (options.verbose) {
|
|
1079
1087
|
console.log(`[Config Exporter] ${key}=${value}`)
|
|
1080
1088
|
}
|
|
1081
1089
|
process.env[key] = value
|
|
@@ -1125,7 +1133,9 @@ async function loadConfigsForEnv(
|
|
|
1125
1133
|
finalEnv = env || "development"
|
|
1126
1134
|
|
|
1127
1135
|
// Auto-detect bundler if not specified
|
|
1128
|
-
bundler =
|
|
1136
|
+
bundler =
|
|
1137
|
+
options.bundler ||
|
|
1138
|
+
(await autoDetectBundler(finalEnv, appRoot, options.verbose))
|
|
1129
1139
|
|
|
1130
1140
|
// Set environment variables
|
|
1131
1141
|
process.env.NODE_ENV = finalEnv
|
|
@@ -1141,9 +1151,10 @@ async function loadConfigsForEnv(
|
|
|
1141
1151
|
|
|
1142
1152
|
// Find and load config file
|
|
1143
1153
|
const configFile =
|
|
1144
|
-
customConfigFile ||
|
|
1154
|
+
customConfigFile ||
|
|
1155
|
+
findConfigFile(bundler, appRoot, finalEnv, options.verbose)
|
|
1145
1156
|
// Quiet mode for cleaner output - only show if verbose or errors
|
|
1146
|
-
if (
|
|
1157
|
+
if (options.verbose) {
|
|
1147
1158
|
console.log(`[Config Exporter] Loading config: ${configFile}`)
|
|
1148
1159
|
console.log(`[Config Exporter] Environment: ${finalEnv}`)
|
|
1149
1160
|
console.log(`[Config Exporter] Bundler: ${bundler}`)
|
|
@@ -1156,7 +1167,6 @@ async function loadConfigsForEnv(
|
|
|
1156
1167
|
// Register ts-node for TypeScript config files
|
|
1157
1168
|
if (configFile.endsWith(".ts")) {
|
|
1158
1169
|
try {
|
|
1159
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1160
1170
|
require("ts-node/register/transpile-only")
|
|
1161
1171
|
} catch (error) {
|
|
1162
1172
|
throw new Error(
|
|
@@ -1205,7 +1215,6 @@ async function loadConfigsForEnv(
|
|
|
1205
1215
|
}
|
|
1206
1216
|
})
|
|
1207
1217
|
|
|
1208
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1209
1218
|
let loadedConfig: any
|
|
1210
1219
|
try {
|
|
1211
1220
|
loadedConfig = require(configFile)
|
|
@@ -1283,9 +1292,9 @@ async function loadConfigsForEnv(
|
|
|
1283
1292
|
}
|
|
1284
1293
|
|
|
1285
1294
|
throw new Error(
|
|
1286
|
-
`Failed to execute config function: ${errorMessage}\n
|
|
1287
|
-
|
|
1288
|
-
|
|
1295
|
+
`Failed to execute config function: ${errorMessage}\n${envDetails.join(
|
|
1296
|
+
"\n"
|
|
1297
|
+
)}\nTip: ${suggestion}`
|
|
1289
1298
|
)
|
|
1290
1299
|
}
|
|
1291
1300
|
}
|
|
@@ -1338,7 +1347,7 @@ async function loadConfigsForEnv(
|
|
|
1338
1347
|
}
|
|
1339
1348
|
|
|
1340
1349
|
// Debug logging
|
|
1341
|
-
if (
|
|
1350
|
+
if (options.verbose || buildOutputs.length > 0) {
|
|
1342
1351
|
console.log(
|
|
1343
1352
|
`[Config Exporter] Webpack returned ${configs.length} config(s), buildOutputs: [${buildOutputs.join(", ")}]`
|
|
1344
1353
|
)
|
|
@@ -1442,39 +1451,37 @@ function formatConfig(
|
|
|
1442
1451
|
return value
|
|
1443
1452
|
}
|
|
1444
1453
|
return JSON.stringify({ metadata, config }, jsonReplacer, 2)
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
let output =
|
|
1457
|
-
"=== METADATA ===\n\n" + inspect(metadata, inspectOptions) + "\n\n"
|
|
1458
|
-
output += "=== CONFIG ===\n\n"
|
|
1454
|
+
}
|
|
1455
|
+
// inspect format
|
|
1456
|
+
const inspectOptions = {
|
|
1457
|
+
depth: options.depth,
|
|
1458
|
+
colors: false,
|
|
1459
|
+
maxArrayLength: null,
|
|
1460
|
+
maxStringLength: null,
|
|
1461
|
+
breakLength: 120,
|
|
1462
|
+
compact: false
|
|
1463
|
+
}
|
|
1459
1464
|
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
config.forEach((cfg, index) => {
|
|
1463
|
-
output += `--- Config [${index}] ---\n\n`
|
|
1464
|
-
output += inspect(cfg, inspectOptions) + "\n\n"
|
|
1465
|
-
})
|
|
1466
|
-
} else {
|
|
1467
|
-
output += inspect(config, inspectOptions) + "\n"
|
|
1468
|
-
}
|
|
1465
|
+
let output = `=== METADATA ===\n\n${inspect(metadata, inspectOptions)}\n\n`
|
|
1466
|
+
output += "=== CONFIG ===\n\n"
|
|
1469
1467
|
|
|
1470
|
-
|
|
1468
|
+
if (Array.isArray(config)) {
|
|
1469
|
+
output += `Total configs: ${config.length}\n\n`
|
|
1470
|
+
config.forEach((cfg, index) => {
|
|
1471
|
+
output += `--- Config [${index}] ---\n\n`
|
|
1472
|
+
output += `${inspect(cfg, inspectOptions)}\n\n`
|
|
1473
|
+
})
|
|
1474
|
+
} else {
|
|
1475
|
+
output += `${inspect(config, inspectOptions)}\n`
|
|
1471
1476
|
}
|
|
1477
|
+
|
|
1478
|
+
return output
|
|
1472
1479
|
}
|
|
1473
1480
|
|
|
1474
1481
|
function cleanConfig(obj: any, rootPath: string): any {
|
|
1475
1482
|
const makePathRelative = (str: string): string => {
|
|
1476
1483
|
if (typeof str === "string" && str.startsWith(rootPath)) {
|
|
1477
|
-
return
|
|
1484
|
+
return `./${str.substring(rootPath.length + 1)}`
|
|
1478
1485
|
}
|
|
1479
1486
|
return str
|
|
1480
1487
|
}
|
|
@@ -1542,11 +1549,12 @@ let shakapackerConfigCache: {
|
|
|
1542
1549
|
|
|
1543
1550
|
function loadShakapackerConfig(
|
|
1544
1551
|
env: string,
|
|
1545
|
-
appRoot: string
|
|
1552
|
+
appRoot: string,
|
|
1553
|
+
verbose = false
|
|
1546
1554
|
): { bundler: "webpack" | "rspack"; configPath: string } {
|
|
1547
1555
|
// Return cached result if same environment
|
|
1548
1556
|
if (shakapackerConfigCache && shakapackerConfigCache.env === env) {
|
|
1549
|
-
if (
|
|
1557
|
+
if (verbose) {
|
|
1550
1558
|
console.log(
|
|
1551
1559
|
`[Config Exporter] Using cached bundler config for env: ${env}`
|
|
1552
1560
|
)
|
|
@@ -1554,7 +1562,7 @@ function loadShakapackerConfig(
|
|
|
1554
1562
|
return shakapackerConfigCache.result
|
|
1555
1563
|
}
|
|
1556
1564
|
|
|
1557
|
-
if (
|
|
1565
|
+
if (verbose) {
|
|
1558
1566
|
console.log(`[Config Exporter] Loading shakapacker config for env: ${env}`)
|
|
1559
1567
|
}
|
|
1560
1568
|
|
|
@@ -1623,18 +1631,20 @@ function loadShakapackerConfig(
|
|
|
1623
1631
|
*/
|
|
1624
1632
|
async function autoDetectBundler(
|
|
1625
1633
|
env: string,
|
|
1626
|
-
appRoot: string
|
|
1634
|
+
appRoot: string,
|
|
1635
|
+
verbose = false
|
|
1627
1636
|
): Promise<"webpack" | "rspack"> {
|
|
1628
|
-
const { bundler } = loadShakapackerConfig(env, appRoot)
|
|
1637
|
+
const { bundler } = loadShakapackerConfig(env, appRoot, verbose)
|
|
1629
1638
|
return bundler
|
|
1630
1639
|
}
|
|
1631
1640
|
|
|
1632
1641
|
function findConfigFile(
|
|
1633
1642
|
bundler: "webpack" | "rspack",
|
|
1634
1643
|
appRoot: string,
|
|
1635
|
-
env: string
|
|
1644
|
+
env: string,
|
|
1645
|
+
verbose = false
|
|
1636
1646
|
): string {
|
|
1637
|
-
const { configPath } = loadShakapackerConfig(env, appRoot)
|
|
1647
|
+
const { configPath } = loadShakapackerConfig(env, appRoot, verbose)
|
|
1638
1648
|
const extensions = ["ts", "js"]
|
|
1639
1649
|
|
|
1640
1650
|
if (bundler === "rspack") {
|
|
@@ -1692,7 +1702,6 @@ function setupNodePath(appRoot: string): void {
|
|
|
1692
1702
|
? `${nodePaths.join(delimiter)}${delimiter}${existingNodePath}`
|
|
1693
1703
|
: nodePaths.join(delimiter)
|
|
1694
1704
|
|
|
1695
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1696
1705
|
require("module").Module._initPaths()
|
|
1697
1706
|
}
|
|
1698
1707
|
}
|
|
@@ -56,12 +56,12 @@ export class FileWriter {
|
|
|
56
56
|
* @example
|
|
57
57
|
* // Built-in types
|
|
58
58
|
* generateFilename("webpack", "development", "client", "yaml")
|
|
59
|
-
* // => "webpack-development-client.
|
|
59
|
+
* // => "webpack-development-client.yml"
|
|
60
60
|
*
|
|
61
61
|
* @example
|
|
62
62
|
* // Custom output names
|
|
63
63
|
* generateFilename("webpack", "development", "client-modern", "yaml", "dev-hmr")
|
|
64
|
-
* // => "webpack-dev-hmr-client-modern.
|
|
64
|
+
* // => "webpack-dev-hmr-client-modern.yml"
|
|
65
65
|
*/
|
|
66
66
|
static generateFilename(
|
|
67
67
|
bundler: string,
|
|
@@ -72,7 +72,7 @@ export class FileWriter {
|
|
|
72
72
|
): string {
|
|
73
73
|
let ext: string
|
|
74
74
|
if (format === "yaml") {
|
|
75
|
-
ext = "
|
|
75
|
+
ext = "yml"
|
|
76
76
|
} else if (format === "json") {
|
|
77
77
|
ext = "json"
|
|
78
78
|
} else {
|
|
@@ -147,6 +147,22 @@ export class YamlSerializer {
|
|
|
147
147
|
|
|
148
148
|
arr.forEach((item, index) => {
|
|
149
149
|
const itemPath = `${keyPath}[${index}]`
|
|
150
|
+
|
|
151
|
+
// Check if this is a plugin object and add its name as a comment
|
|
152
|
+
const pluginName = this.getConstructorName(item)
|
|
153
|
+
const isPlugin = pluginName && /(^|\.)plugins\[\d+\]/.test(itemPath)
|
|
154
|
+
const isEmpty =
|
|
155
|
+
typeof item === "object" &&
|
|
156
|
+
item !== null &&
|
|
157
|
+
!Array.isArray(item) &&
|
|
158
|
+
Object.keys(item).length === 0
|
|
159
|
+
|
|
160
|
+
// For non-empty plugins, add comment before the plugin
|
|
161
|
+
// For empty plugins, the name will be shown inline
|
|
162
|
+
if (isPlugin && !isEmpty) {
|
|
163
|
+
lines.push(`${itemIndent}# ${pluginName}`)
|
|
164
|
+
}
|
|
165
|
+
|
|
150
166
|
const serialized = this.serializeValue(item, indent + 4, itemPath)
|
|
151
167
|
|
|
152
168
|
// Add documentation for array items if available
|
|
@@ -200,7 +216,13 @@ export class YamlSerializer {
|
|
|
200
216
|
|
|
201
217
|
private serializeObject(obj: any, indent: number, keyPath: string): string {
|
|
202
218
|
const keys = Object.keys(obj)
|
|
219
|
+
const constructorName = this.getConstructorName(obj)
|
|
220
|
+
|
|
221
|
+
// For empty objects, show constructor name if available
|
|
203
222
|
if (keys.length === 0) {
|
|
223
|
+
if (constructorName) {
|
|
224
|
+
return `{} # ${constructorName}`
|
|
225
|
+
}
|
|
204
226
|
return "{}"
|
|
205
227
|
}
|
|
206
228
|
|
|
@@ -277,4 +299,18 @@ export class YamlSerializer {
|
|
|
277
299
|
|
|
278
300
|
return "./" + rel
|
|
279
301
|
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Extracts the constructor name from an object
|
|
305
|
+
* Returns null for plain objects (Object constructor)
|
|
306
|
+
*/
|
|
307
|
+
private getConstructorName(obj: any): string | null {
|
|
308
|
+
if (!obj || typeof obj !== "object") return null
|
|
309
|
+
if (Array.isArray(obj)) return null
|
|
310
|
+
|
|
311
|
+
const constructorName = obj.constructor?.name
|
|
312
|
+
if (!constructorName || constructorName === "Object") return null
|
|
313
|
+
|
|
314
|
+
return constructorName
|
|
315
|
+
}
|
|
280
316
|
}
|
data/package/plugins/webpack.ts
CHANGED
|
@@ -3,7 +3,7 @@ const { requireOrError } = require("../utils/requireOrError")
|
|
|
3
3
|
const WebpackAssetsManifest = requireOrError("webpack-assets-manifest")
|
|
4
4
|
const webpack = requireOrError("webpack")
|
|
5
5
|
const config = require("../config")
|
|
6
|
-
const { isProduction } = require("../env")
|
|
6
|
+
const { isProduction, isDevelopment } = require("../env")
|
|
7
7
|
const { moduleExists } = require("../utils/helpers")
|
|
8
8
|
|
|
9
9
|
const getPlugins = (): unknown[] => {
|
|
@@ -15,6 +15,7 @@ const getPlugins = (): unknown[] => {
|
|
|
15
15
|
const plugins = [
|
|
16
16
|
new webpack.EnvironmentPlugin(process.env),
|
|
17
17
|
new WebpackAssetsManifestConstructor({
|
|
18
|
+
merge: isDevelopment,
|
|
18
19
|
entrypoints: true,
|
|
19
20
|
writeToDisk: true,
|
|
20
21
|
output: config.manifestPath,
|
data/package.json
CHANGED
|
@@ -127,21 +127,21 @@ builds:
|
|
|
127
127
|
|
|
128
128
|
// Should have 3 files (one per build)
|
|
129
129
|
expect(files).toHaveLength(3)
|
|
130
|
-
expect(files).toContain("webpack-dev-hmr-client.
|
|
131
|
-
expect(files).toContain("webpack-dev-client.
|
|
132
|
-
expect(files).toContain("webpack-prod-client.
|
|
130
|
+
expect(files).toContain("webpack-dev-hmr-client.yml")
|
|
131
|
+
expect(files).toContain("webpack-dev-client.yml")
|
|
132
|
+
expect(files).toContain("webpack-prod-client.yml")
|
|
133
133
|
|
|
134
134
|
// Verify files have different content (proving environment isolation)
|
|
135
135
|
const devHmrContent = require("fs").readFileSync(
|
|
136
|
-
join(outputDir, "webpack-dev-hmr-client.
|
|
136
|
+
join(outputDir, "webpack-dev-hmr-client.yml"),
|
|
137
137
|
"utf8"
|
|
138
138
|
)
|
|
139
139
|
const devContent = require("fs").readFileSync(
|
|
140
|
-
join(outputDir, "webpack-dev-client.
|
|
140
|
+
join(outputDir, "webpack-dev-client.yml"),
|
|
141
141
|
"utf8"
|
|
142
142
|
)
|
|
143
143
|
const prodContent = require("fs").readFileSync(
|
|
144
|
-
join(outputDir, "webpack-prod-client.
|
|
144
|
+
join(outputDir, "webpack-prod-client.yml"),
|
|
145
145
|
"utf8"
|
|
146
146
|
)
|
|
147
147
|
|
|
@@ -195,8 +195,8 @@ builds:
|
|
|
195
195
|
// Verify files
|
|
196
196
|
expect(existsSync(outputDir)).toBe(true)
|
|
197
197
|
const files = readdirSync(outputDir)
|
|
198
|
-
expect(files).toContain("webpack-custom-dev-client.
|
|
199
|
-
expect(files).toContain("webpack-custom-prod-client.
|
|
198
|
+
expect(files).toContain("webpack-custom-dev-client.yml")
|
|
199
|
+
expect(files).toContain("webpack-custom-prod-client.yml")
|
|
200
200
|
})
|
|
201
201
|
|
|
202
202
|
it("should use fallback builds when no config file exists", () => {
|
|
@@ -23,7 +23,7 @@ describe("configExporter", () => {
|
|
|
23
23
|
"client",
|
|
24
24
|
"yaml"
|
|
25
25
|
)
|
|
26
|
-
expect(filename).toBe("webpack-development-client.
|
|
26
|
+
expect(filename).toBe("webpack-development-client.yml")
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
test("generates correct filename for server config", () => {
|
|
@@ -34,7 +34,7 @@ describe("configExporter", () => {
|
|
|
34
34
|
"server",
|
|
35
35
|
"yaml"
|
|
36
36
|
)
|
|
37
|
-
expect(filename).toBe("webpack-production-server.
|
|
37
|
+
expect(filename).toBe("webpack-production-server.yml")
|
|
38
38
|
})
|
|
39
39
|
|
|
40
40
|
test("generates correct filename for client-hmr config", () => {
|
|
@@ -45,7 +45,7 @@ describe("configExporter", () => {
|
|
|
45
45
|
"client-hmr",
|
|
46
46
|
"yaml"
|
|
47
47
|
)
|
|
48
|
-
expect(filename).toBe("webpack-development-client-hmr.
|
|
48
|
+
expect(filename).toBe("webpack-development-client-hmr.yml")
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
test("generates correct filename for json format", () => {
|
|
@@ -67,7 +67,7 @@ describe("configExporter", () => {
|
|
|
67
67
|
"client-modern",
|
|
68
68
|
"yaml"
|
|
69
69
|
)
|
|
70
|
-
expect(filename).toBe("webpack-development-client-modern.
|
|
70
|
+
expect(filename).toBe("webpack-development-client-modern.yml")
|
|
71
71
|
})
|
|
72
72
|
|
|
73
73
|
test("generates correct filename for custom output name client-legacy", () => {
|
|
@@ -78,7 +78,7 @@ describe("configExporter", () => {
|
|
|
78
78
|
"client-legacy",
|
|
79
79
|
"yaml"
|
|
80
80
|
)
|
|
81
|
-
expect(filename).toBe("webpack-production-client-legacy.
|
|
81
|
+
expect(filename).toBe("webpack-production-client-legacy.yml")
|
|
82
82
|
})
|
|
83
83
|
|
|
84
84
|
test("generates correct filename for custom output name server-bundle", () => {
|
|
@@ -89,7 +89,7 @@ describe("configExporter", () => {
|
|
|
89
89
|
"server-bundle",
|
|
90
90
|
"yaml"
|
|
91
91
|
)
|
|
92
|
-
expect(filename).toBe("rspack-development-server-bundle.
|
|
92
|
+
expect(filename).toBe("rspack-development-server-bundle.yml")
|
|
93
93
|
})
|
|
94
94
|
|
|
95
95
|
test("generates correct filename with buildName override", () => {
|
|
@@ -101,7 +101,7 @@ describe("configExporter", () => {
|
|
|
101
101
|
"yaml",
|
|
102
102
|
"dev-hmr"
|
|
103
103
|
)
|
|
104
|
-
expect(filename).toBe("webpack-dev-hmr-client-modern.
|
|
104
|
+
expect(filename).toBe("webpack-dev-hmr-client-modern.yml")
|
|
105
105
|
})
|
|
106
106
|
})
|
|
107
107
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shakapacker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.3.0.beta.
|
|
4
|
+
version: 9.3.0.beta.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -273,7 +273,6 @@ files:
|
|
|
273
273
|
- lib/tasks/shakapacker/switch_bundler.rake
|
|
274
274
|
- lib/tasks/shakapacker/verify_config.rake
|
|
275
275
|
- lib/tasks/shakapacker/verify_install.rake
|
|
276
|
-
- package-lock.json
|
|
277
276
|
- package.json
|
|
278
277
|
- package/.npmignore
|
|
279
278
|
- package/babel/preset.ts
|
|
@@ -385,7 +384,7 @@ homepage: https://github.com/shakacode/shakapacker
|
|
|
385
384
|
licenses:
|
|
386
385
|
- MIT
|
|
387
386
|
metadata:
|
|
388
|
-
source_code_uri: https://github.com/shakacode/shakapacker/tree/v9.3.0.beta.
|
|
387
|
+
source_code_uri: https://github.com/shakacode/shakapacker/tree/v9.3.0.beta.7
|
|
389
388
|
rdoc_options: []
|
|
390
389
|
require_paths:
|
|
391
390
|
- lib
|