everything-dev 1.11.5 → 1.12.1

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/src/cli/init.ts CHANGED
@@ -310,18 +310,6 @@ export async function personalizeConfig(
310
310
  if (isInit && config.app && typeof config.app === "object") {
311
311
  const app = config.app as Record<string, unknown>;
312
312
 
313
- const authClientPath = join(destination, "ui", "src", "lib", "auth-client.ts");
314
- if (existsSync(authClientPath)) {
315
- const authClientContent = readFileSync(authClientPath, "utf-8")
316
- .split("\n")
317
- .filter(
318
- (line) =>
319
- !line.includes("inferAdditionalFields") && !line.includes("createAuthInstance"),
320
- )
321
- .join("\n");
322
- writeFileSync(authClientPath, authClientContent);
323
- }
324
-
325
313
  for (const entryKey of Object.keys(app)) {
326
314
  const entry = app[entryKey];
327
315
  if (entry && typeof entry === "object") {
@@ -449,13 +437,13 @@ export async function personalizeConfig(
449
437
 
450
438
  await resolveWorkspaceRefs(destination, opts.workspaceOpts);
451
439
 
452
- const genContractPath = join(destination, "ui", "src", "api-contract.gen.ts");
440
+ const genContractPath = join(destination, "ui", "src", "lib", "api-types.gen.ts");
453
441
  if (!existsSync(genContractPath)) {
454
442
  mkdirSync(dirname(genContractPath), { recursive: true });
455
443
  writeFileSync(genContractPath, `export type ApiContract = Record<string, never>;\n`);
456
444
  }
457
445
 
458
- const pluginsClientGenPath = join(destination, "api", "src", "plugins-client.gen.ts");
446
+ const pluginsClientGenPath = join(destination, "api", "src", "lib", "plugins-types.gen.ts");
459
447
  if (!existsSync(pluginsClientGenPath)) {
460
448
  mkdirSync(dirname(pluginsClientGenPath), { recursive: true });
461
449
  writeFileSync(
@@ -464,12 +452,30 @@ export async function personalizeConfig(
464
452
  );
465
453
  }
466
454
 
467
- const authTypesGenPath = join(destination, "ui", "src", "auth-types.gen.ts");
455
+ const authTypesGenPath = join(destination, "ui", "src", "lib", "auth-types.gen.ts");
468
456
  if (!existsSync(authTypesGenPath)) {
469
457
  mkdirSync(dirname(authTypesGenPath), { recursive: true });
470
458
  writeFileSync(
471
459
  authTypesGenPath,
472
- `export type { Auth, createAuthInstance } from "better-auth";\n`,
460
+ `import type { Auth } from "better-auth";\nexport type { Auth } from "better-auth";\nexport type AuthSessionUser = NonNullable<Auth["$Infer"]["Session"]["user"]> & {\n role?: string | null;\n isAnonymous?: boolean | null;\n walletAddress?: string | null;\n banned?: boolean | null;\n};\nexport type AuthSessionData = NonNullable<Auth["$Infer"]["Session"]["session"]> & {\n activeOrganizationId?: string | null;\n};\nexport type AuthSession = {\n user: AuthSessionUser | null;\n session: AuthSessionData | null;\n};\nexport interface AuthOrganizationContext {\n activeOrganizationId: string | null;\n organization: { id: string; name: string; slug: string; logo?: string | null; metadata?: Record<string, unknown> } | null;\n member: { id: string; role: string } | null;\n isPersonal: boolean;\n hasOrganization: boolean;\n}\nexport interface AuthRequestContext {\n user: AuthSessionUser | null;\n userId: string | null;\n isAuthenticated: boolean;\n authMethod: "session" | "apiKey" | "anonymous" | "none";\n near: {\n primaryAccountId: string | null;\n linkedAccounts: Array<{ accountId: string; network: string; publicKey: string; isPrimary: boolean }>;\n hasNearAccount: boolean;\n };\n organization: AuthOrganizationContext;\n organizations?: Array<{ id: string; role: string; name?: string; slug?: string }>;\n}\nexport type AuthActiveMember = { id: string | null; role: string | null; organizationId: string | null };\nexport type AuthOrganization = NonNullable<AuthOrganizationContext["organization"]>;\nexport type AuthOrganizationMember = NonNullable<AuthOrganizationContext["member"]>;\nexport type AuthOrganizationSummary = NonNullable<AuthRequestContext["organizations"]>[number];\nexport type AuthBaseSession = Auth["$Infer"]["Session"];\nexport type createAuthInstance = never;\nexport interface AuthServices {\n auth: Auth;\n db: unknown;\n driver: { close(): Promise<void> };\n handler: (req: Request) => Promise<Response>;\n}\n`,
461
+ );
462
+ }
463
+
464
+ const apiAuthTypesGenPath = join(destination, "api", "src", "lib", "auth-types.gen.ts");
465
+ if (!existsSync(apiAuthTypesGenPath)) {
466
+ mkdirSync(dirname(apiAuthTypesGenPath), { recursive: true });
467
+ writeFileSync(
468
+ apiAuthTypesGenPath,
469
+ `import type { Auth } from "better-auth";\nexport type { Auth } from "better-auth";\nexport type AuthSessionUser = NonNullable<Auth["$Infer"]["Session"]["user"]> & {\n role?: string | null;\n isAnonymous?: boolean | null;\n walletAddress?: string | null;\n banned?: boolean | null;\n};\nexport type AuthSessionData = NonNullable<Auth["$Infer"]["Session"]["session"]> & {\n activeOrganizationId?: string | null;\n};\nexport type AuthSession = {\n user: AuthSessionUser | null;\n session: AuthSessionData | null;\n};\nexport interface AuthOrganizationContext {\n activeOrganizationId: string | null;\n organization: { id: string; name: string; slug: string; logo?: string | null; metadata?: Record<string, unknown> } | null;\n member: { id: string; role: string } | null;\n isPersonal: boolean;\n hasOrganization: boolean;\n}\nexport interface AuthRequestContext {\n user: AuthSessionUser | null;\n userId: string | null;\n isAuthenticated: boolean;\n authMethod: "session" | "apiKey" | "anonymous" | "none";\n near: {\n primaryAccountId: string | null;\n linkedAccounts: Array<{ accountId: string; network: string; publicKey: string; isPrimary: boolean }>;\n hasNearAccount: boolean;\n };\n organization: AuthOrganizationContext;\n organizations?: Array<{ id: string; role: string; name?: string; slug?: string }>;\n}\nexport type AuthActiveMember = { id: string | null; role: string | null; organizationId: string | null };\nexport type AuthOrganization = NonNullable<AuthOrganizationContext["organization"]>;\nexport type AuthOrganizationMember = NonNullable<AuthOrganizationContext["member"]>;\nexport type AuthOrganizationSummary = NonNullable<AuthRequestContext["organizations"]>[number];\nexport type AuthBaseSession = Auth["$Infer"]["Session"];\nexport type createAuthInstance = never;\nexport interface AuthServices {\n auth: Auth;\n db: unknown;\n driver: { close(): Promise<void> };\n handler: (req: Request) => Promise<Response>;\n}\n`,
470
+ );
471
+ }
472
+
473
+ const hostAuthTypesGenPath = join(destination, "host", "src", "lib", "auth-types.gen.ts");
474
+ if (existsSync(join(destination, "host", "src")) && !existsSync(hostAuthTypesGenPath)) {
475
+ mkdirSync(dirname(hostAuthTypesGenPath), { recursive: true });
476
+ writeFileSync(
477
+ hostAuthTypesGenPath,
478
+ `import type { Auth } from "better-auth";\nexport type { Auth } from "better-auth";\nexport type AuthSessionUser = NonNullable<Auth["$Infer"]["Session"]["user"]> & {\n role?: string | null;\n isAnonymous?: boolean | null;\n walletAddress?: string | null;\n banned?: boolean | null;\n};\nexport type AuthSessionData = NonNullable<Auth["$Infer"]["Session"]["session"]> & {\n activeOrganizationId?: string | null;\n};\nexport type AuthSession = {\n user: AuthSessionUser | null;\n session: AuthSessionData | null;\n};\nexport interface AuthOrganizationContext {\n activeOrganizationId: string | null;\n organization: { id: string; name: string; slug: string; logo?: string | null; metadata?: Record<string, unknown> } | null;\n member: { id: string; role: string } | null;\n isPersonal: boolean;\n hasOrganization: boolean;\n}\nexport interface AuthRequestContext {\n user: AuthSessionUser | null;\n userId: string | null;\n isAuthenticated: boolean;\n authMethod: "session" | "apiKey" | "anonymous" | "none";\n near: {\n primaryAccountId: string | null;\n linkedAccounts: Array<{ accountId: string; network: string; publicKey: string; isPrimary: boolean }>;\n hasNearAccount: boolean;\n };\n organization: AuthOrganizationContext;\n organizations?: Array<{ id: string; role: string; name?: string; slug?: string }>;\n}\nexport type AuthActiveMember = { id: string | null; role: string | null; organizationId: string | null };\nexport type AuthOrganization = NonNullable<AuthOrganizationContext["organization"]>;\nexport type AuthOrganizationMember = NonNullable<AuthOrganizationContext["member"]>;\nexport type AuthOrganizationSummary = NonNullable<AuthRequestContext["organizations"]>[number];\nexport type AuthBaseSession = Auth["$Infer"]["Session"];\nexport type createAuthInstance = never;\nexport interface AuthServices {\n auth: Auth;\n db: unknown;\n driver: { close(): Promise<void> };\n handler: (req: Request) => Promise<Response>;\n}\n`,
473
479
  );
474
480
  }
475
481
  }
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
1
+ import { existsSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { glob } from "glob";
4
4
  import type { UpgradeOptions, UpgradeResult } from "../contract";
@@ -244,6 +244,16 @@ export async function upgradeTemplate(
244
244
  });
245
245
  }
246
246
 
247
+ const migratedFiles: string[] = [];
248
+ const obsoleteFiles = ["ui/src/lib/auth-client.ts", "ui/src/lib/session.ts"];
249
+ for (const file of obsoleteFiles) {
250
+ const filePath = join(projectDir, file);
251
+ if (existsSync(filePath)) {
252
+ rmSync(filePath);
253
+ migratedFiles.push(file);
254
+ }
255
+ }
256
+
247
257
  let changelogUrl: string | undefined;
248
258
  const mainPkg = packages.find((p) => p.name === "everything-dev");
249
259
  if (mainPkg?.from && mainPkg.from !== mainPkg.to) {
@@ -261,6 +271,7 @@ export async function upgradeTemplate(
261
271
  status: "upgraded",
262
272
  packages,
263
273
  sync: syncResult,
274
+ migrated: migratedFiles.length > 0 ? migratedFiles : undefined,
264
275
  changelogUrl,
265
276
  };
266
277
  }
package/src/cli.ts CHANGED
@@ -285,6 +285,10 @@ async function main() {
285
285
  console.log(colors.dim(" • Use --force only if you want framework updates"));
286
286
  }
287
287
  }
288
+ if (result.migrated && result.migrated.length > 0) {
289
+ console.log(` ${colors.yellow("Removed:")} ${result.migrated.length} obsolete file(s)`);
290
+ for (const f of result.migrated) console.log(` ${colors.dim(f)}`);
291
+ }
288
292
  console.log();
289
293
  return;
290
294
  }
package/src/contract.ts CHANGED
@@ -200,6 +200,7 @@ export const UpgradeResultSchema = z.object({
200
200
  }),
201
201
  ),
202
202
  sync: SyncResultSchema.optional(),
203
+ migrated: z.array(z.string()).optional(),
203
204
  changelogUrl: z.string().optional(),
204
205
  error: z.string().optional(),
205
206
  });
package/src/plugin.ts CHANGED
@@ -1553,13 +1553,19 @@ export default createPlugin({
1553
1553
  }
1554
1554
  }
1555
1555
 
1556
+ const generated = [
1557
+ "ui/src/lib/api-types.gen.ts",
1558
+ "ui/src/lib/auth-types.gen.ts",
1559
+ "api/src/lib/plugins-types.gen.ts",
1560
+ "api/src/lib/auth-types.gen.ts",
1561
+ ];
1562
+ if (existsSync(join(projectDir, "host", "src"))) {
1563
+ generated.push("host/src/lib/auth-types.gen.ts");
1564
+ }
1565
+
1556
1566
  return {
1557
1567
  status: "success" as const,
1558
- generated: [
1559
- "ui/src/api-contract.gen.ts",
1560
- "ui/src/auth-types.gen.ts",
1561
- "api/src/plugins-client.gen.ts",
1562
- ],
1568
+ generated,
1563
1569
  fetched,
1564
1570
  skipped,
1565
1571
  failed: [],
@@ -1573,12 +1579,19 @@ export default createPlugin({
1573
1579
  apiBaseUrl: refreshed.runtime.api.url,
1574
1580
  });
1575
1581
 
1576
- const generated = ["ui/src/api-contract.gen.ts", "api/src/plugins-client.gen.ts"];
1582
+ const generated = [
1583
+ "ui/src/lib/api-types.gen.ts",
1584
+ "api/src/lib/plugins-types.gen.ts",
1585
+ "api/src/lib/auth-types.gen.ts",
1586
+ ];
1577
1587
  if (
1578
1588
  refreshed.runtime.auth &&
1579
1589
  (refreshed.runtime.auth.source !== "local" || refreshed.runtime.auth.localPath)
1580
1590
  ) {
1581
- generated.push("ui/src/auth-types.gen.ts");
1591
+ generated.push("ui/src/lib/auth-types.gen.ts");
1592
+ }
1593
+ if (existsSync(join(projectDir, "host", "src"))) {
1594
+ generated.push("host/src/lib/auth-types.gen.ts");
1582
1595
  }
1583
1596
 
1584
1597
  return {