prisma-effect-schema-generator 0.1.0 → 0.1.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.
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # prisma-effect-schema-generator
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/prisma-effect-schema-generator.svg)](https://www.npmjs.com/package/prisma-effect-schema-generator)
4
+
3
5
  A standalone [Prisma](https://www.prisma.io) generator that emits
4
6
  [Effect Schema](https://effect.website/docs/schema) values for every
5
7
  model in your `schema.prisma`. Drop-in runtime validation for your
6
- database rows perfect for sync engines, RPC layers, or anywhere you
8
+ database rows, perfect for sync engines, RPC layers, or anywhere you
7
9
  need to assert that what you read from the DB actually matches what
8
10
  your code expects.
9
11
 
@@ -59,6 +61,8 @@ npm install --save-dev prisma-effect-schema-generator
59
61
  npm install effect # the generator emits `Schema.X` from `effect`
60
62
  ```
61
63
 
64
+ Published on npm as [`prisma-effect-schema-generator`](https://www.npmjs.com/package/prisma-effect-schema-generator).
65
+
62
66
  ## Configure
63
67
 
64
68
  Add the generator to your `schema.prisma`:
@@ -176,4 +180,4 @@ npm run typecheck # tsc --noEmit
176
180
 
177
181
  ## License
178
182
 
179
- MIT
183
+ MIT
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  /**
2
3
  * prisma-effect-schema-generator
3
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,YAAY,EACZ,cAAc,EACd,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,eAAe,GAChB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,YAAY,EACZ,cAAc,EACd,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,eAAe,GAChB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  /**
3
4
  * prisma-effect-schema-generator
@@ -36,17 +37,19 @@ Object.defineProperty(exports, "DEFAULTS", { enumerable: true, get: function ()
36
37
  var render_js_2 = require("./render.js");
37
38
  Object.defineProperty(exports, "shouldQuoteName", { enumerable: true, get: function () { return render_js_2.shouldQuoteName; } });
38
39
  Object.defineProperty(exports, "renderKey", { enumerable: true, get: function () { return render_js_2.renderKey; } });
39
- // Auto-register when imported as the generator entry point.
40
- // We guard with a feature-detection on `process` so importing the
41
- // module from tests / Node doesn't crash on environments that lack it.
42
- if (typeof process !== "undefined" && process.env.PRISMA_GENERATOR_AUTO_REGISTER !== "0") {
43
- try {
44
- (0, generator_js_1.register)();
45
- }
46
- catch {
47
- // No-op: registering requires `@prisma/generator-helper`'s
48
- // `generatorHandler`, which only works under Prisma's spawn. When
49
- // imported from a test / a build script we skip registration.
50
- }
40
+ // Auto-register only when this file is the entry point (i.e. Prisma
41
+ // spawned it as the generator binary). When the package is imported as
42
+ // a library we must not start the generator RPC, because that would try
43
+ // to read stdin and write stdout and interfere with the host process.
44
+ //
45
+ // `require.main === module` is the standard CommonJS signal for "run
46
+ // directly". Our compiled output is CommonJS, so this works for the
47
+ // `bin` entry point; it also safely does nothing under ESM/Bundler loads
48
+ // because `require` is not defined there.
49
+ if (typeof process !== "undefined" &&
50
+ process.env.PRISMA_GENERATOR_AUTO_REGISTER !== "0" &&
51
+ typeof require !== "undefined" &&
52
+ require.main === module) {
53
+ (0, generator_js_1.register)();
51
54
  }
52
55
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAA0C;AAE1C,+CAKwB;AAJtB,wGAAA,QAAQ,OAAA;AACR,4GAAA,YAAY,OAAA;AACZ,0GAAA,UAAU,OAAA;AACV,iHAAA,iBAAiB,OAAA;AAEnB,yCAA2C;AAAlC,yGAAA,YAAY,OAAA;AACrB,yCAMqB;AALnB,oHAAA,uBAAuB,OAAA;A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AAW;IAC9B,OAAO,CAAC,GAAG,CAAC,8BAA8B,KAAK,GAAG;IAClD,OAAO,OAAO,KAAK,WAAW;IAC9B,OAAO,CAAC,IAAI,KAAK,MAAM,EACvB,CAAC;IACD,IAAA,uBAAQ,GAAE,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-effect-schema-generator",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Prisma generator that emits Effect Schema values for every model — drop-in validation for your database rows.",
5
5
  "keywords": [
6
6
  "prisma",
@@ -34,6 +34,9 @@
34
34
  },
35
35
  "./package.json": "./package.json"
36
36
  },
37
+ "bin": {
38
+ "prisma-effect-schema-generator": "dist/index.js"
39
+ },
37
40
  "files": [
38
41
  "dist",
39
42
  "README.md",
@@ -41,6 +44,7 @@
41
44
  ],
42
45
  "scripts": {
43
46
  "build": "tsc -p tsconfig.build.json",
47
+ "postbuild": "chmod +x dist/index.js",
44
48
  "clean": "rm -rf dist",
45
49
  "prepublishOnly": "npm run clean && npm run build && npm test",
46
50
  "test": "vitest run",