@remit/web-client 0.0.38 → 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.
Files changed (2) hide show
  1. package/harness/build.mjs +38 -13
  2. package/package.json +1 -1
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 = { auth: process.env.REMIT_AUTH_PROVIDER ?? "combined", out: "dist" };
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") args.auth = argv[(i += 1)];
30
- else if (argv[i] === "--out") args.out = argv[(i += 1)];
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: { specifier: "@remit/web-client/auth/combined", name: "combinedAuthProvider", cognitoCss: true },
37
- cognito: { specifier: "@remit/web-client/auth/cognito", name: "cognitoAuthProvider", cognitoCss: true },
38
- "better-auth": { specifier: "@remit/web-client/auth/better-auth", name: "betterAuthProvider", cognitoCss: false },
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 ? 'import "@remit/web-client/styles/cognito.css";' : null,
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(`Unknown --auth "${auth}". Expected one of: ${Object.keys(PROVIDERS).join(", ")}.`);
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
- try {
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(`Built web client (auth: ${auth}) to ${resolve(packageDir, out)}`);
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.38",
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": {