@baeta/plugin-prisma 2.0.0-next.13 → 2.0.0-next.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @baeta/plugin-prisma
2
2
 
3
+ ## 2.0.0-next.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - @baeta/plugin-exec@2.0.0-next.14
9
+
3
10
  ## 2.0.0-next.13
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ function createPrismaClientPlugin(options) {
23
23
  skip: async (ctx) => {
24
24
  const schema = resolve(ctx.generatorOptions.cwd, prismaSchema);
25
25
  if (ctx.watching && ctx.changedFile?.path !== schema) return true;
26
- if (!ctx.watching && generatedSchemaPath) return compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);
26
+ if (!ctx.watching && generatedSchemaPath) return await compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);
27
27
  return false;
28
28
  }
29
29
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../lib/client-generator.ts","../index.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport { resolve } from '@baeta/util-path';\nimport type { PrismaPluginOptions } from './options.ts';\n\nasync function compareSchemas(cwd: string, current: string, generated: string) {\n\tconst [currentSchema, generatedSchema] = await Promise.all([\n\t\treadFile(resolve(cwd, current), 'utf-8'),\n\t\treadFile(resolve(cwd, generated), 'utf-8').catch(() => null),\n\t]);\n\treturn currentSchema.replaceAll(' ', '') === generatedSchema?.replaceAll(' ', '');\n}\n\nexport function createPrismaClientPlugin(options: PrismaPluginOptions) {\n\tconst { prismaSchema, generateCommand, generatedSchemaPath } = options;\n\n\treturn createExecPlugin({\n\t\tname: 'prisma-client',\n\t\tactionName: 'Prisma client',\n\t\texec: generateCommand ?? 'prisma generate',\n\t\twatch: (generatorOptions, watcher, reload) => {\n\t\t\tconst prismaPath = resolve(generatorOptions.cwd, prismaSchema);\n\n\t\t\tconst handleChange = (file: WatcherFile) => {\n\t\t\t\tif (file.path === prismaPath) {\n\t\t\t\t\treload(file);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twatcher.on('update', handleChange);\n\t\t\twatcher.on('delete', handleChange);\n\t\t},\n\t\tskip: async (ctx: Ctx) => {\n\t\t\tconst schema = resolve(ctx.generatorOptions.cwd, prismaSchema);\n\n\t\t\tif (ctx.watching && ctx.changedFile?.path !== schema) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (!ctx.watching && generatedSchemaPath) {\n\t\t\t\treturn compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t});\n}\n","import { createPrismaClientPlugin } from './lib/client-generator.ts';\nimport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport default prismaPlugin;\n\n/**\n * A plugin that manages Prisma client generation in your Baeta project.\n * See https://baeta.io/docs/plugins/prisma\n *\n * @param options - Configuration options for the pagination plugin\n * @returns A Baeta generator plugin\n */\nexport function prismaPlugin(options: PrismaPluginOptions) {\n\tif (options.generateClient === false) {\n\t\treturn [];\n\t}\n\treturn [createPrismaClientPlugin(options)];\n}\n"],"mappings":";;;;AAMA,eAAe,eAAe,KAAa,SAAiB,WAAmB;CAC9E,MAAM,CAAC,eAAe,mBAAmB,MAAM,QAAQ,IAAI,CAC1D,SAAS,QAAQ,KAAK,QAAQ,EAAE,QAAQ,EACxC,SAAS,QAAQ,KAAK,UAAU,EAAE,QAAQ,CAAC,YAAY,KAAK,CAC5D,CAAC;AACF,QAAO,cAAc,WAAW,KAAK,GAAG,KAAK,iBAAiB,WAAW,KAAK,GAAG;;AAGlF,SAAgB,yBAAyB,SAA8B;CACtE,MAAM,EAAE,cAAc,iBAAiB,wBAAwB;AAE/D,QAAO,iBAAiB;EACvB,MAAM;EACN,YAAY;EACZ,MAAM,mBAAmB;EACzB,QAAQ,kBAAkB,SAAS,WAAW;GAC7C,MAAM,aAAa,QAAQ,iBAAiB,KAAK,aAAa;GAE9D,MAAM,gBAAgB,SAAsB;AAC3C,QAAI,KAAK,SAAS,WACjB,QAAO,KAAK;;AAId,WAAQ,GAAG,UAAU,aAAa;AAClC,WAAQ,GAAG,UAAU,aAAa;;EAEnC,MAAM,OAAO,QAAa;GACzB,MAAM,SAAS,QAAQ,IAAI,iBAAiB,KAAK,aAAa;AAE9D,OAAI,IAAI,YAAY,IAAI,aAAa,SAAS,OAC7C,QAAO;AAGR,OAAI,CAAC,IAAI,YAAY,oBACpB,QAAO,eAAe,IAAI,iBAAiB,KAAK,cAAc,oBAAoB;AAGnF,UAAO;;EAER,CAAC;;;;ACzCH,IAAA,wBAAe;;;;;;;;AASf,SAAgB,aAAa,SAA8B;AAC1D,KAAI,QAAQ,mBAAmB,MAC9B,QAAO,EAAE;AAEV,QAAO,CAAC,yBAAyB,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../lib/client-generator.ts","../index.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Ctx, WatcherFile } from '@baeta/generator-sdk';\nimport { createExecPlugin } from '@baeta/plugin-exec';\nimport { resolve } from '@baeta/util-path';\nimport type { PrismaPluginOptions } from './options.ts';\n\nasync function compareSchemas(cwd: string, current: string, generated: string) {\n\tconst [currentSchema, generatedSchema] = await Promise.all([\n\t\treadFile(resolve(cwd, current), 'utf-8'),\n\t\treadFile(resolve(cwd, generated), 'utf-8').catch(() => null),\n\t]);\n\treturn currentSchema.replaceAll(' ', '') === generatedSchema?.replaceAll(' ', '');\n}\n\nexport function createPrismaClientPlugin(options: PrismaPluginOptions) {\n\tconst { prismaSchema, generateCommand, generatedSchemaPath } = options;\n\n\treturn createExecPlugin({\n\t\tname: 'prisma-client',\n\t\tactionName: 'Prisma client',\n\t\texec: generateCommand ?? 'prisma generate',\n\t\twatch: (generatorOptions, watcher, reload) => {\n\t\t\tconst prismaPath = resolve(generatorOptions.cwd, prismaSchema);\n\n\t\t\tconst handleChange = (file: WatcherFile) => {\n\t\t\t\tif (file.path === prismaPath) {\n\t\t\t\t\treload(file);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twatcher.on('update', handleChange);\n\t\t\twatcher.on('delete', handleChange);\n\t\t},\n\t\tskip: async (ctx: Ctx) => {\n\t\t\tconst schema = resolve(ctx.generatorOptions.cwd, prismaSchema);\n\n\t\t\tif (ctx.watching && ctx.changedFile?.path !== schema) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (!ctx.watching && generatedSchemaPath) {\n\t\t\t\treturn await compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t});\n}\n","import { createPrismaClientPlugin } from './lib/client-generator.ts';\nimport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport type { PrismaPluginOptions } from './lib/options.ts';\n\nexport default prismaPlugin;\n\n/**\n * A plugin that manages Prisma client generation in your Baeta project.\n * See https://baeta.io/docs/plugins/prisma\n *\n * @param options - Configuration options for the pagination plugin\n * @returns A Baeta generator plugin\n */\nexport function prismaPlugin(options: PrismaPluginOptions) {\n\tif (options.generateClient === false) {\n\t\treturn [];\n\t}\n\treturn [createPrismaClientPlugin(options)];\n}\n"],"mappings":";;;;AAMA,eAAe,eAAe,KAAa,SAAiB,WAAmB;CAC9E,MAAM,CAAC,eAAe,mBAAmB,MAAM,QAAQ,IAAI,CAC1D,SAAS,QAAQ,KAAK,QAAQ,EAAE,QAAQ,EACxC,SAAS,QAAQ,KAAK,UAAU,EAAE,QAAQ,CAAC,YAAY,KAAK,CAC5D,CAAC;AACF,QAAO,cAAc,WAAW,KAAK,GAAG,KAAK,iBAAiB,WAAW,KAAK,GAAG;;AAGlF,SAAgB,yBAAyB,SAA8B;CACtE,MAAM,EAAE,cAAc,iBAAiB,wBAAwB;AAE/D,QAAO,iBAAiB;EACvB,MAAM;EACN,YAAY;EACZ,MAAM,mBAAmB;EACzB,QAAQ,kBAAkB,SAAS,WAAW;GAC7C,MAAM,aAAa,QAAQ,iBAAiB,KAAK,aAAa;GAE9D,MAAM,gBAAgB,SAAsB;AAC3C,QAAI,KAAK,SAAS,WACjB,QAAO,KAAK;;AAId,WAAQ,GAAG,UAAU,aAAa;AAClC,WAAQ,GAAG,UAAU,aAAa;;EAEnC,MAAM,OAAO,QAAa;GACzB,MAAM,SAAS,QAAQ,IAAI,iBAAiB,KAAK,aAAa;AAE9D,OAAI,IAAI,YAAY,IAAI,aAAa,SAAS,OAC7C,QAAO;AAGR,OAAI,CAAC,IAAI,YAAY,oBACpB,QAAO,MAAM,eAAe,IAAI,iBAAiB,KAAK,cAAc,oBAAoB;AAGzF,UAAO;;EAER,CAAC;;;;ACzCH,IAAA,wBAAe;;;;;;;;AASf,SAAgB,aAAa,SAA8B;AAC1D,KAAI,QAAQ,mBAAmB,MAC9B,QAAO,EAAE;AAEV,QAAO,CAAC,yBAAyB,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,57 +1,61 @@
1
1
  {
2
2
  "name": "@baeta/plugin-prisma",
3
- "version": "2.0.0-next.13",
3
+ "version": "2.0.0-next.14",
4
4
  "keywords": [
5
5
  "baeta",
6
+ "builder",
7
+ "framework",
6
8
  "graphql",
7
9
  "schema",
8
10
  "types",
9
- "typescript",
10
- "framework",
11
- "builder"
11
+ "typescript"
12
12
  ],
13
13
  "homepage": "https://github.com/andreisergiu98/baeta#readme",
14
14
  "bugs": {
15
15
  "url": "https://github.com/andreisergiu98/baeta/issues"
16
16
  },
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/andreisergiu98/baeta.git",
20
- "directory": "packages/plugin-prisma"
21
- },
22
17
  "license": "MIT",
23
18
  "author": {
24
19
  "name": "Andrei Pampu",
25
20
  "url": "https://github.com/andreisergiu98"
26
21
  },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/andreisergiu98/baeta.git",
25
+ "directory": "packages/plugin-prisma"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "package.json"
30
+ ],
27
31
  "type": "module",
32
+ "types": "dist/index.d.ts",
28
33
  "exports": {
29
34
  ".": {
30
35
  "types": "./dist/index.d.ts",
31
36
  "default": "./dist/index.js"
32
37
  }
33
38
  },
34
- "types": "dist/index.d.ts",
35
- "files": [
36
- "dist",
37
- "package.json"
38
- ],
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "exports": {
42
+ ".": {
43
+ "types": "./dist/index.d.ts",
44
+ "default": "./dist/index.js"
45
+ }
46
+ }
47
+ },
39
48
  "scripts": {
40
49
  "build": "builder build",
41
50
  "check:deps": "builder check-deps",
42
- "prepack": "builder prepare",
43
51
  "postpack": "builder prepare --restore",
52
+ "prepack": "builder prepare",
44
53
  "test": "builder test",
45
54
  "types": "tsc --noEmit"
46
55
  },
47
- "ava": {
48
- "extensions": [
49
- "ts"
50
- ]
51
- },
52
56
  "dependencies": {
53
57
  "@baeta/generator-sdk": "^2.0.0-next.5",
54
- "@baeta/plugin-exec": "^2.0.0-next.13",
58
+ "@baeta/plugin-exec": "^2.0.0-next.14",
55
59
  "@baeta/util-path": "^2.0.0-next.4"
56
60
  },
57
61
  "devDependencies": {
@@ -61,18 +65,14 @@
61
65
  "@types/node": "^22.19.17",
62
66
  "typescript": "^6.0.0"
63
67
  },
68
+ "ava": {
69
+ "extensions": [
70
+ "ts"
71
+ ]
72
+ },
64
73
  "engines": {
65
74
  "node": ">=22.20.0"
66
75
  },
67
- "publishConfig": {
68
- "access": "public",
69
- "exports": {
70
- ".": {
71
- "types": "./dist/index.d.ts",
72
- "default": "./dist/index.js"
73
- }
74
- }
75
- },
76
76
  "typedocOptions": {
77
77
  "entryPoints": [
78
78
  "./index.ts"