@alumbwe/anvil 1.0.55 → 1.0.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alumbwe/anvil",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -44,7 +44,7 @@
44
44
  "scripts": {
45
45
  "dev": "bun --env-file=../.env.local run src/entry.ts --cwd ..",
46
46
  "build:binary": "bun ./scripts/build-binary.ts anvil $npm_package_version",
47
- "publish": "bun run ./scripts/publish.ts",
47
+ "publish:online": "bun run ./scripts/publish.ts",
48
48
  "typecheck": "tsc --noEmit -p .",
49
49
  "prepublishOnly": "bun run ./scripts/vendor-deps.ts"
50
50
  },
@@ -48,15 +48,21 @@ export async function runSupabaseLogin(): Promise<void> {
48
48
  try {
49
49
  const user = await loginViaBrowser()
50
50
 
51
- if (user.id) {
52
- identifyUser(user.id, { email: user.email, anvil: IS_ANVIL })
53
- trackEvent(AnalyticsEvent.LOGIN, {
54
- userId: user.id,
55
- via: 'plain_command',
56
- hasEmail: Boolean(user.email),
57
- hasName: Boolean(user.name),
58
- })
59
- await flushAnalytics()
51
+ // Login must succeed even when it runs before the full app/analytics
52
+ // initialization (for example from `~`). Analytics is best-effort here.
53
+ try {
54
+ if (user.id) {
55
+ identifyUser(user.id, { email: user.email, anvil: IS_ANVIL })
56
+ trackEvent(AnalyticsEvent.LOGIN, {
57
+ userId: user.id,
58
+ via: 'plain_command',
59
+ hasEmail: Boolean(user.email),
60
+ hasName: Boolean(user.name),
61
+ })
62
+ await flushAnalytics()
63
+ }
64
+ } catch {
65
+ // Never turn a successful authentication into a login failure.
60
66
  }
61
67
 
62
68
  console.log()