@dashild/prisma 0.1.0-alpha.4 → 0.1.0-alpha.7

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/README.md +40 -23
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @dashild/prisma
2
2
 
3
- Generador oficial de Prisma. Se declara en `schema.prisma`:
3
+ The official Prisma generator. Declare it in `schema.prisma`:
4
4
 
5
5
  ```prisma
6
6
  generator client {
@@ -14,36 +14,47 @@ generator dashild {
14
14
  }
15
15
  ```
16
16
 
17
- Escribe **un solo archivo**: `dashild-metadata.json`. No genera recursos, ni páginas, ni clientes.
17
+ It writes **one file**: `dashild-metadata.json`. It does not generate resources,
18
+ pages, or clients.
18
19
 
19
- ## Qué contiene el artefacto
20
+ ## What the artifact contains
20
21
 
21
- | Campo | Para qué |
22
+ | Field | Purpose |
22
23
  | --- | --- |
23
- | `formatVersion` | Dashild rechaza metadatos de un formato que no entiende |
24
- | `schemaPath` | Ruta absoluta del schema de origen |
25
- | `clientOutput` | Ruta absoluta del cliente Prisma, si hay un generador `prisma-client` |
26
- | `engineVersion` | Hash del engine con el que Prisma generó (diagnóstico) |
27
- | `models` | Campos, tipos, enums, relaciones, `nativeType`, marcas de solo lectura |
28
- | `enums` | Nombre y valores |
24
+ | `formatVersion` | Dashild rejects metadata in a format it does not understand |
25
+ | `schemaPath` | Absolute path to the source schema |
26
+ | `clientOutput` | Absolute path to the Prisma client, when a `prisma-client` generator exists |
27
+ | `engineVersion` | Hash of the engine Prisma used (diagnostic) |
28
+ | `models` | Fields, types, enums, relations, `nativeType`, read-only flags |
29
+ | `enums` | Name and values |
29
30
 
30
- `engineVersion` no es la versión de Prisma: `options.version` de Prisma 7 es el commit del engine. La versión del paquete no se expone al generador.
31
+ `engineVersion` is not the Prisma version: Prisma 7's `options.version` is the
32
+ engine commit. The package version is not exposed to the generator.
31
33
 
32
- ## Resolución del provider (verificado con Prisma 7.10.1)
34
+ ## Provider resolution (verified with Prisma 7.10.1)
33
35
 
34
- **Prisma no resuelve `provider` como módulo de Node.** Ejecuta la cadena tal cual con `/bin/sh`. Por eso `provider = "dashild-prisma-generator"` funciona únicamente porque el paquete publica un `bin` con ese nombre y npm/pnpm ponen `node_modules/.bin` en el `PATH` al correr scripts.
36
+ **Prisma does not resolve `provider` as a Node module.** It runs the string
37
+ through `/bin/sh`. `provider = "dashild-prisma-generator"` works only because the
38
+ package publishes a `bin` with that name and npm/pnpm put `node_modules/.bin` on
39
+ `PATH` when running scripts.
35
40
 
36
- Consecuencia: `pnpm prisma generate` (o `npm run ...`) funciona; invocar el binario de Prisma desde un entorno sin ese `PATH` falla con `dashild-prisma-generator: orden no encontrada`. El error es explícito, no silencioso.
41
+ Consequently, `pnpm prisma generate` (or `npm run ...`) works; invoking the
42
+ Prisma binary from an environment without that `PATH` fails with
43
+ `dashild-prisma-generator: command not found`. The error is explicit, not silent.
37
44
 
38
45
  ## Prisma 7
39
46
 
40
- - La `url` del datasource ya no se declara en el schema: va en `prisma.config.ts` o en el constructor del cliente. El fixture no la declara porque `generate` no se conecta.
41
- - `@prisma/generator-helper` es CommonJS: el entrypoint lo carga con `createRequire`, no con un import nombrado de ESM.
47
+ - The datasource `url` is no longer declared in the schema: it lives in
48
+ `prisma.config.ts` or in the client constructor. The fixture does not declare
49
+ it because `generate` does not connect.
50
+ - `@prisma/generator-helper` is CommonJS: the entrypoint loads it with
51
+ `createRequire`, not a named ESM import.
42
52
 
43
- ## Código
53
+ ## Code
44
54
 
45
- - `src/generator.ts` — entrypoint. Solo registra el handler y escribe el archivo.
46
- - `src/extract.ts` — DMMF → `DashildMetadata`. Funciones puras, probadas aparte.
55
+ - `src/generator.ts` — entrypoint. It only registers the handler and writes the
56
+ file.
57
+ - `src/extract.ts` — DMMF → `DashildMetadata`. Pure functions, tested separately.
47
58
 
48
59
  ## Tests
49
60
 
@@ -51,9 +62,15 @@ Consecuencia: `pnpm prisma generate` (o `npm run ...`) funciona; invocar el bina
51
62
  pnpm --filter @dashild/prisma test
52
63
  ```
53
64
 
54
- Dos niveles:
65
+ Two levels:
55
66
 
56
- - **Integración**: ejecuta `prisma generate` de verdad sobre `test/fixtures/hostile/schema.prisma` (enum, opcionales, `Decimal`, `BigInt`, `Json`, `Bytes`, `@db.Text`, `@db.Uuid`, m2o, o2m y auto-relación) y verifica el JSON.
57
- - **Unidad**: `resolveClientOutput` con generadores sintéticos, incluido el caso de `provider` por variable de entorno.
67
+ - **Integration**: runs a real `prisma generate` over
68
+ `test/fixtures/hostile/schema.prisma` (enum, optionals, `Decimal`, `BigInt`,
69
+ `Json`, `Bytes`, `@db.Text`, `@db.Uuid`, m2o, o2m, and self-relation) and
70
+ verifies the JSON.
71
+ - **Unit**: `resolveClientOutput` with synthetic generators, including the
72
+ `provider` from an environment variable.
58
73
 
59
- El test necesita el `bin` del generador en el `PATH`; lo resuelve desde el `.bin` de la raíz del monorepo, que es donde pnpm enlaza `@dashild/prisma` (declarado como devDependency de la raíz precisamente para esto).
74
+ The test needs the generator `bin` on `PATH`; it resolves it from the monorepo
75
+ root `.bin`, where pnpm links `@dashild/prisma` (declared as a root
76
+ devDependency for exactly this reason).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashild/prisma",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.7",
4
4
  "type": "module",
5
5
  "description": "Official Prisma generator that extracts the metadata Dashild consumes",
6
6
  "license": "MIT",
@@ -17,7 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@dashild/core": "0.1.0-alpha.4",
20
+ "@dashild/core": "0.1.0-alpha.7",
21
21
  "@prisma/generator-helper": "7.10.1"
22
22
  },
23
23
  "main": "./dist/generator.js",