@preference-sl/prefconfigurator-wasm 0.1.4 → 0.1.6
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/README.md +4 -4
- package/package.json +1 -1
- package/scripts/postinstall.js +7 -17
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Upon install, postinstall copies into the consumer project:
|
|
4
4
|
|
|
5
|
-
- public
|
|
6
|
-
- public
|
|
7
|
-
- public
|
|
8
|
-
- public
|
|
5
|
+
- public/preference-sl/prefconfigurator-wasm/_framework
|
|
6
|
+
- public/preference-sl/prefconfigurator-wasm/main.js (if not present)
|
|
7
|
+
- public/preference-sl/prefconfigurator-wasm/index.demo.html (if not present; example to try it)
|
|
8
|
+
- public/preference-sl/prefconfigurator-wasm/ extra JS found under wwwroot (without overwriting existing files)
|
|
9
9
|
|
|
10
10
|
Env vars:
|
|
11
11
|
- PUBLIC_DIR — destination root (auto-detects public, wwwroot, or src/assets if not set)
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"postinstall": "node scripts/postinstall.js"
|
|
4
4
|
},
|
|
5
5
|
"description": ".NET WebAssembly runtime package that centralizes logic for building product configurators, exposing a simple API for integration into ecommerce platforms.",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.6",
|
|
7
7
|
"files": [
|
|
8
8
|
"_framework/**",
|
|
9
9
|
"scripts/**",
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-console */
|
|
2
3
|
const fs = require("fs");
|
|
3
4
|
const path = require("path");
|
|
4
5
|
|
|
@@ -25,19 +26,6 @@ function copyFileIfAbsent(src, dest) {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
function getAppFolder(frameworkDir) {
|
|
29
|
-
try {
|
|
30
|
-
const bootPath = path.join(frameworkDir, "blazor.boot.json");
|
|
31
|
-
if (fs.existsSync(bootPath)) {
|
|
32
|
-
const boot = JSON.parse(fs.readFileSync(bootPath, "utf8"));
|
|
33
|
-
if (boot && typeof boot.mainAssemblyName === "string" && boot.mainAssemblyName) {
|
|
34
|
-
return boot.mainAssemblyName;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
} catch {}
|
|
38
|
-
return "wasm-app";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
29
|
try {
|
|
42
30
|
const pkgRoot = __dirname ? path.resolve(__dirname, "..") : process.cwd();
|
|
43
31
|
const srcFramework = path.join(pkgRoot, "_framework");
|
|
@@ -54,9 +42,12 @@ try {
|
|
|
54
42
|
}
|
|
55
43
|
if (!targetPublic) targetPublic = path.resolve(consumerRoot, "public");
|
|
56
44
|
|
|
45
|
+
// Siempre bajo public/preference-sl/<nombrepaquete>, y <nombrepaquete> en minúsculas
|
|
46
|
+
const packageName = "prefconfigurator-wasm".toLowerCase();
|
|
47
|
+
const preferenceNamespace = "preference-sl";
|
|
48
|
+
const destRoot = path.join(targetPublic, preferenceNamespace, packageName);
|
|
49
|
+
|
|
57
50
|
const wasmSubdir = process.env.WASM_SUBDIR || "_framework";
|
|
58
|
-
const appFolderName = getAppFolder(srcFramework);
|
|
59
|
-
const destRoot = path.join(targetPublic, appFolderName);
|
|
60
51
|
const destFramework = path.join(destRoot, wasmSubdir);
|
|
61
52
|
|
|
62
53
|
// 1) Copiar runtime
|
|
@@ -89,7 +80,6 @@ try {
|
|
|
89
80
|
}
|
|
90
81
|
|
|
91
82
|
// 4) Copiar TODOS los .js fuera de _framework y sin sobreescribir, preservando estructura.
|
|
92
|
-
// Excluye: main.js (raÃz del paquete), index.html, scripts/postinstall.js
|
|
93
83
|
console.log(`[${path.basename(pkgRoot)}] Copying extra JS -> ${destRoot}`);
|
|
94
84
|
const excludeAbs = new Set([
|
|
95
85
|
path.join(pkgRoot, "main.js"),
|