@remit/web-client 0.0.37 → 0.0.39
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/harness/build.mjs +38 -13
- package/package.json +2 -2
package/harness/build.mjs
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
//
|
|
14
14
|
// The chosen provider can also be given via REMIT_AUTH_PROVIDER; the flag wins.
|
|
15
15
|
import { cpSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
16
|
+
import { rm } from "node:fs/promises";
|
|
16
17
|
import { dirname, join, resolve } from "node:path";
|
|
17
18
|
import { fileURLToPath } from "node:url";
|
|
18
19
|
import { build } from "vite";
|
|
@@ -24,23 +25,45 @@ const harnessDir = dirname(fileURLToPath(import.meta.url));
|
|
|
24
25
|
const packageDir = resolve(harnessDir, "..");
|
|
25
26
|
|
|
26
27
|
const parseArgs = (argv) => {
|
|
27
|
-
const args = {
|
|
28
|
+
const args = {
|
|
29
|
+
auth: process.env.REMIT_AUTH_PROVIDER ?? "combined",
|
|
30
|
+
out: "dist",
|
|
31
|
+
};
|
|
28
32
|
for (let i = 0; i < argv.length; i += 1) {
|
|
29
|
-
if (argv[i] === "--auth")
|
|
30
|
-
|
|
33
|
+
if (argv[i] === "--auth") {
|
|
34
|
+
args.auth = argv[i + 1];
|
|
35
|
+
i += 1;
|
|
36
|
+
} else if (argv[i] === "--out") {
|
|
37
|
+
args.out = argv[i + 1];
|
|
38
|
+
i += 1;
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
41
|
return args;
|
|
33
42
|
};
|
|
34
43
|
|
|
35
44
|
const PROVIDERS = {
|
|
36
|
-
combined: {
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
combined: {
|
|
46
|
+
specifier: "@remit/web-client/auth/combined",
|
|
47
|
+
name: "combinedAuthProvider",
|
|
48
|
+
cognitoCss: true,
|
|
49
|
+
},
|
|
50
|
+
cognito: {
|
|
51
|
+
specifier: "@remit/web-client/auth/cognito",
|
|
52
|
+
name: "cognitoAuthProvider",
|
|
53
|
+
cognitoCss: true,
|
|
54
|
+
},
|
|
55
|
+
"better-auth": {
|
|
56
|
+
specifier: "@remit/web-client/auth/better-auth",
|
|
57
|
+
name: "betterAuthProvider",
|
|
58
|
+
cognitoCss: false,
|
|
59
|
+
},
|
|
39
60
|
};
|
|
40
61
|
|
|
41
62
|
const entrySource = (provider) =>
|
|
42
63
|
[
|
|
43
|
-
provider.cognitoCss
|
|
64
|
+
provider.cognitoCss
|
|
65
|
+
? 'import "@remit/web-client/styles/cognito.css";'
|
|
66
|
+
: null,
|
|
44
67
|
'import { mountApp } from "@remit/web-client/shell";',
|
|
45
68
|
`import { ${provider.name} } from "${provider.specifier}";`,
|
|
46
69
|
"",
|
|
@@ -54,7 +77,9 @@ const run = async () => {
|
|
|
54
77
|
const { auth, out } = parseArgs(process.argv.slice(2));
|
|
55
78
|
const provider = PROVIDERS[auth];
|
|
56
79
|
if (!provider) {
|
|
57
|
-
console.error(
|
|
80
|
+
console.error(
|
|
81
|
+
`Unknown --auth "${auth}". Expected one of: ${Object.keys(PROVIDERS).join(", ")}.`,
|
|
82
|
+
);
|
|
58
83
|
process.exit(1);
|
|
59
84
|
}
|
|
60
85
|
|
|
@@ -83,14 +108,14 @@ const run = async () => {
|
|
|
83
108
|
// Never let cleanup replace the build's own failure. Removing the root is
|
|
84
109
|
// best-effort housekeeping on a throwaway directory; a build error is the
|
|
85
110
|
// thing the caller needs to see.
|
|
86
|
-
|
|
87
|
-
rmSync(root, { recursive: true, force: true });
|
|
88
|
-
} catch (error) {
|
|
111
|
+
await rm(root, { recursive: true, force: true }).catch((error) => {
|
|
89
112
|
console.warn(`Could not remove ${root}: ${error.message}`);
|
|
90
|
-
}
|
|
113
|
+
});
|
|
91
114
|
}
|
|
92
115
|
|
|
93
|
-
console.log(
|
|
116
|
+
console.log(
|
|
117
|
+
`Built web client (auth: ${auth}) to ${resolve(packageDir, out)}`,
|
|
118
|
+
);
|
|
94
119
|
};
|
|
95
120
|
|
|
96
121
|
run();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remit/web-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
|
|
6
6
|
"exports": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"build:dist": "npm run generate:routes && node --import tsx harness/build.mjs",
|
|
30
30
|
"preview": "vite preview",
|
|
31
31
|
"test:typecheck": "npm run generate:routes && tsgo --noEmit",
|
|
32
|
-
"test:run": "node --import tsx --import ./test-support/register.mjs --test 'src/**/*.test.ts'",
|
|
32
|
+
"test:run": "node --import tsx --import ./test-support/register.mjs --experimental-test-coverage --test-coverage-include='src/**' --test-coverage-exclude='src/**/*.test.ts' --test-coverage-exclude='src/**/*.test.tsx' --test-coverage-lines=50 --test 'src/**/*.test.ts'",
|
|
33
33
|
"test": "npm run test:typecheck && npm run test:run"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|