@simple-auth-kit/cli 1.5.0 → 1.5.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/lib/copy.ts +1 -1
- package/package.json +1 -1
- package/registry/combos/express-prisma/variants/base/src/create-auth-app.ts +1 -1
- package/registry/combos/express-prisma/variants/base/src/rbac.defaults.ts +1 -1
- package/registry/combos/express-prisma/variants/base/src/seed.ts +1 -1
- package/registry/combos/express-prisma/variants/workspaces/src/create-auth-app.ts +1 -1
- package/registry/combos/express-prisma/variants/workspaces/src/rbac.defaults.ts +1 -1
- package/registry/combos/express-prisma/variants/workspaces/src/seed.ts +1 -1
- package/registry/combos/nestjs-prisma/variants/base/src/auth.module.ts +1 -1
- package/registry/combos/nestjs-prisma/variants/base/src/rbac.defaults.ts +1 -1
- package/registry/combos/nestjs-prisma/variants/base/src/seed.ts +1 -1
- package/registry/combos/nestjs-prisma/variants/workspaces/src/auth.module.ts +1 -1
- package/registry/combos/nestjs-prisma/variants/workspaces/src/rbac.defaults.ts +1 -1
- package/registry/combos/nestjs-prisma/variants/workspaces/src/seed.ts +1 -1
- package/simple-auth-kit.ts +13 -9
package/lib/copy.ts
CHANGED
|
@@ -52,7 +52,7 @@ export interface CopyOptions {
|
|
|
52
52
|
* `cli/simple-auth-kit.ts`) — the registry source itself keeps the path that's correct for its
|
|
53
53
|
* own dev/typecheck loop, where nothing has moved.
|
|
54
54
|
*/
|
|
55
|
-
extraRewrites?: { from: string; to: string }[];
|
|
55
|
+
extraRewrites?: { from: string | RegExp; to: string }[];
|
|
56
56
|
/**
|
|
57
57
|
* The previous install's sha256-by-path manifest. A destination file whose current content
|
|
58
58
|
* no longer matches what was recorded is a file the user edited, and is left alone.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-auth-kit/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "simple-auth-kit add <combo> — copies registry source (backend combos, admin consoles, mobile apps) into a consumer repo, shadcn-CLI-style. Nothing is ever installed as a runtime dependency of the consumer.",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,7 @@ import { createAuthMiddleware } from "./middleware/auth.middleware.js";
|
|
|
10
10
|
import { createAuthRouter } from "./routers/auth.router.js";
|
|
11
11
|
import { AuthService } from "./services/auth.service.js";
|
|
12
12
|
import { createAuthzMiddleware } from "./middleware/authz.middleware.js";
|
|
13
|
-
import { PrismaClient } from "
|
|
13
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
14
14
|
import { KeyProviderService } from "./key-provider.js";
|
|
15
15
|
import { OAuthRepository } from "./repositories/oauth.repository.js";
|
|
16
16
|
import { openApiSpec } from "./openapi-spec.js";
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
//
|
|
22
22
|
// Callers: `src/seed.ts` (`npm run seed`, the only bootstrap in this variant) and
|
|
23
23
|
// `variants/base/test/variant-hooks.ts`.
|
|
24
|
-
import type { PrismaClient } from "
|
|
24
|
+
import type { PrismaClient } from "../generated/prisma/client.js";
|
|
25
25
|
|
|
26
26
|
/** The display metadata a seeded permission carries. `group`/`order` exist so an admin console can render a stable matrix. */
|
|
27
27
|
export interface PermissionSeed {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// what gets seeded and what the routes demand cannot drift apart.
|
|
23
23
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
24
24
|
import { hashPassword } from "@/lib/auth/core/crypto.js";
|
|
25
|
-
import { PrismaClient } from "
|
|
25
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
26
26
|
import {
|
|
27
27
|
DEFAULT_ROLES,
|
|
28
28
|
PERMISSION_SLUGS,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createAuthzMiddleware,
|
|
14
14
|
createWorkspaceMiddleware,
|
|
15
15
|
} from "./middleware/authz.middleware.js";
|
|
16
|
-
import { PrismaClient } from "
|
|
16
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
17
17
|
import { KeyProviderService } from "./key-provider.js";
|
|
18
18
|
import { OAuthRepository } from "./repositories/oauth.repository.js";
|
|
19
19
|
import { openApiSpec } from "./openapi-spec.js";
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
// `src/workspace.repository.ts` (which provisions every workspace created afterwards, inside the
|
|
29
29
|
// same transaction that creates it, so its creator is never locked out of a workspace they just
|
|
30
30
|
// made).
|
|
31
|
-
import type { PrismaClient } from "
|
|
31
|
+
import type { PrismaClient } from "../generated/prisma/client.js";
|
|
32
32
|
|
|
33
33
|
/** The display metadata a seeded permission carries. `group`/`order` exist so an admin console can render a stable matrix. */
|
|
34
34
|
export interface PermissionSeed {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
// gets, whichever path created it, and the permissions the routes demand cannot drift apart.
|
|
30
30
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
31
31
|
import { hashPassword } from "@/lib/auth/core/crypto.js";
|
|
32
|
-
import { PrismaClient } from "
|
|
32
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
33
33
|
import {
|
|
34
34
|
DEFAULT_ROLES,
|
|
35
35
|
PERMISSION_SLUGS,
|
|
@@ -12,7 +12,7 @@ import { AuthController } from "./controllers/auth.controller.js";
|
|
|
12
12
|
import { AuthGuard } from "./guards/auth.guard.js";
|
|
13
13
|
import { AuthService } from "./services/auth.service.js";
|
|
14
14
|
import { AuthzGuard } from "./guards/authz.guard.js";
|
|
15
|
-
import { PrismaClient } from "
|
|
15
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
16
16
|
import { CountryRepository } from "./repositories/country.repository.js";
|
|
17
17
|
import { CustomerRepository } from "./repositories/customer.repository.js";
|
|
18
18
|
import { KeyProviderService } from "./key-provider.js";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// `provisionDefaultRoles` writes these rows once at seed time; from then on the database is
|
|
5
5
|
// authoritative and nothing in the request path reads this file. Callers: `src/seed.ts` and
|
|
6
6
|
// `variants/base/test/variant-hooks.ts`.
|
|
7
|
-
import type { PrismaClient } from "
|
|
7
|
+
import type { PrismaClient } from "../generated/prisma/client.js";
|
|
8
8
|
|
|
9
9
|
export interface PermissionSeed {
|
|
10
10
|
displayName: string;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// existing admin keeps the password they already have.
|
|
6
6
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
7
7
|
import { hashPassword } from "@/lib/auth/core/crypto.js";
|
|
8
|
-
import { PrismaClient } from "
|
|
8
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_ROLES,
|
|
11
11
|
PERMISSION_SLUGS,
|
|
@@ -10,7 +10,7 @@ import { AuthController } from "./controllers/auth.controller.js";
|
|
|
10
10
|
import { AuthGuard } from "./guards/auth.guard.js";
|
|
11
11
|
import { AuthService } from "./services/auth.service.js";
|
|
12
12
|
import { AuthzGuard, WorkspaceGuard } from "./guards/authz.guard.js";
|
|
13
|
-
import { PrismaClient } from "
|
|
13
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
14
14
|
import { CountryRepository } from "./repositories/country.repository.js";
|
|
15
15
|
import { CustomerRepository } from "./repositories/customer.repository.js";
|
|
16
16
|
import { KeyProviderService } from "./key-provider.js";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// thing that creates a workspace — callers are `src/seed.ts` (the first workspace) and
|
|
10
10
|
// `src/workspace.repository.ts` (every workspace created afterward, in the same transaction
|
|
11
11
|
// that creates it).
|
|
12
|
-
import type { PrismaClient } from "
|
|
12
|
+
import type { PrismaClient } from "../generated/prisma/client.js";
|
|
13
13
|
|
|
14
14
|
export interface PermissionSeed {
|
|
15
15
|
displayName: string;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// routes demand.
|
|
12
12
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
13
13
|
import { hashPassword } from "@/lib/auth/core/crypto.js";
|
|
14
|
-
import { PrismaClient } from "
|
|
14
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_ROLES,
|
|
17
17
|
PERMISSION_SLUGS,
|
package/simple-auth-kit.ts
CHANGED
|
@@ -445,24 +445,28 @@ function printPostInstallNotes(combo: ComboEntry, variant: string) {
|
|
|
445
445
|
*
|
|
446
446
|
* `generatedClientImport`: only Prisma has this — its schema's `generator { output }` is relative
|
|
447
447
|
* to schema.prisma's own location, so moving prisma.config.ts/prisma/ to the project root also
|
|
448
|
-
* moves the generated client. The registry source's `src
|
|
449
|
-
* `"../generated/prisma/client.js"`
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
448
|
+
* moves the generated client. The registry source's `src/**\/*.ts` files import it with whatever
|
|
449
|
+
* relative depth is correct from their own location — `"../generated/prisma/client.js"` for a
|
|
450
|
+
* top-level file, `"../../generated/prisma/client.js"` for one nested a level deeper in
|
|
451
|
+
* controllers/services/repositories/etc — all correct for the registry's own dev/typecheck loop
|
|
452
|
+
* (where nothing has moved). installMerge rewrites *any* such relative import (matched by regex,
|
|
453
|
+
* not a fixed-depth literal string — a real bug here once: a plain string match only ever
|
|
454
|
+
* matched the top-level depth, leaving a stray leading "../" on every nested file's rewritten
|
|
455
|
+
* import) to the fixed alias `@/prisma/client.js`: the generated client always lands at the
|
|
456
|
+
* project root regardless of how deep the importing file sits (unlike `@/lib/auth/core`, whose
|
|
457
|
+
* depth actually varies with `--path`), so a fixed alias is both simpler and stable across
|
|
454
458
|
* installs. The consumer adds `"@/prisma/*": ["./generated/prisma/*"]` to their tsconfig `paths`
|
|
455
459
|
* once (see postInstall) — the CLI never writes tsconfig itself, same as `@/lib/auth`. Drizzle has
|
|
456
460
|
* no equivalent generated artifact to redirect. */
|
|
457
461
|
const ORM_LAYOUTS: {
|
|
458
462
|
configFile: string;
|
|
459
463
|
dataDir: string;
|
|
460
|
-
generatedClientImport?:
|
|
464
|
+
generatedClientImport?: RegExp;
|
|
461
465
|
}[] = [
|
|
462
466
|
{
|
|
463
467
|
configFile: "prisma.config.ts",
|
|
464
468
|
dataDir: "prisma",
|
|
465
|
-
generatedClientImport:
|
|
469
|
+
generatedClientImport: /(?:\.\/)?(?:\.\.\/)+generated\/prisma\/client\.js/g,
|
|
466
470
|
},
|
|
467
471
|
{ configFile: "drizzle.config.ts", dataDir: "drizzle" },
|
|
468
472
|
];
|
|
@@ -476,7 +480,7 @@ interface MergePlan {
|
|
|
476
480
|
orm: (typeof ORM_LAYOUTS)[number] | null;
|
|
477
481
|
skipFromShared: Set<string>;
|
|
478
482
|
skipFromVariant: Set<string>;
|
|
479
|
-
extraRewrites: { from: string; to: string }[] | undefined;
|
|
483
|
+
extraRewrites: { from: string | RegExp; to: string }[] | undefined;
|
|
480
484
|
config: SimpleAuthKitConfig;
|
|
481
485
|
previous: Record<string, string>;
|
|
482
486
|
}
|