@baeta/plugin-prisma 0.1.5 → 1.0.9

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,29 @@
1
1
  # @baeta/plugin-prisma
2
2
 
3
+ ## 1.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`583014f`](https://github.com/andreisergiu98/baeta/commit/583014f0bac810b25d9a8226bda2df4c9039f5e3) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Update dependencies
8
+
9
+ - Updated dependencies [[`583014f`](https://github.com/andreisergiu98/baeta/commit/583014f0bac810b25d9a8226bda2df4c9039f5e3)]:
10
+ - @baeta/generator-sdk@1.0.1
11
+ - @baeta/plugin-exec@1.0.9
12
+ - @baeta/util-path@1.0.1
13
+
14
+ ## 1.0.8
15
+
16
+ ### Patch Changes
17
+
18
+ - [#189](https://github.com/andreisergiu98/baeta/pull/189) [`d500378`](https://github.com/andreisergiu98/baeta/commit/d500378198e0a9c48298c4242913bca8ad348228) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add jsdocs
19
+
20
+ - [#165](https://github.com/andreisergiu98/baeta/pull/165) [`1334c2a`](https://github.com/andreisergiu98/baeta/commit/1334c2a866676c88f0f3d380b22133d81c4e98bc) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - mark as stable
21
+
22
+ - Updated dependencies [[`d500378`](https://github.com/andreisergiu98/baeta/commit/d500378198e0a9c48298c4242913bca8ad348228), [`1334c2a`](https://github.com/andreisergiu98/baeta/commit/1334c2a866676c88f0f3d380b22133d81c4e98bc)]:
23
+ - @baeta/generator-sdk@1.0.0
24
+ - @baeta/plugin-exec@1.0.8
25
+ - @baeta/util-path@1.0.0
26
+
3
27
  ## 0.1.5
4
28
 
5
29
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,12 +1,39 @@
1
1
  import * as _baeta_generator_sdk from '@baeta/generator-sdk';
2
2
 
3
+ /**
4
+ * Configuration options for the Prisma plugin
5
+ */
3
6
  interface PrismaPluginOptions {
7
+ /**
8
+ * Whether to generate the Prisma client
9
+ * @defaultValue true
10
+ */
4
11
  generateClient?: boolean;
12
+ /**
13
+ * Custom command to generate Prisma client
14
+ * @defaultValue 'prisma generate'
15
+ */
5
16
  generateCommand?: string;
17
+ /**
18
+ * Path to the Prisma schema file
19
+ * @example 'prisma/schema.prisma'
20
+ */
6
21
  prismaSchema: string;
22
+ /**
23
+ * Path to the generated schema file for comparison
24
+ * Used to avoid unnecessary regeneration
25
+ * @example 'node_modules/@prisma/client/schema.prisma'
26
+ */
7
27
  generatedSchemaPath: string;
8
28
  }
9
29
 
30
+ /**
31
+ * A plugin that manages Prisma client generation in your Baeta project.
32
+ * See https://baeta.io/docs/plugins/prisma
33
+ *
34
+ * @param options - Configuration options for the pagination plugin
35
+ * @returns A Baeta generator plugin
36
+ */
10
37
  declare function prismaPlugin(options: PrismaPluginOptions): _baeta_generator_sdk.GeneratorPluginV1<unknown>[];
11
38
 
12
39
  export { type PrismaPluginOptions, prismaPlugin as default, prismaPlugin };
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ function createPrismaClientPlugin(options) {
39
39
  }
40
40
 
41
41
  // index.ts
42
- var plugin_prisma_default = prismaPlugin;
42
+ var index_default = prismaPlugin;
43
43
  function prismaPlugin(options) {
44
44
  if (options.generateClient === false) {
45
45
  return [];
@@ -47,7 +47,7 @@ function prismaPlugin(options) {
47
47
  return [createPrismaClientPlugin(options)];
48
48
  }
49
49
  export {
50
- plugin_prisma_default as default,
50
+ index_default as default,
51
51
  prismaPlugin
52
52
  };
53
53
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"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 };\nexport default prismaPlugin;\n\nexport function prismaPlugin(options: PrismaPluginOptions) {\n\tif (options.generateClient === false) {\n\t\treturn [];\n\t}\n\treturn [createPrismaClientPlugin(options)];\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAEzB,SAAS,wBAAwB;AACjC,SAAS,eAAe;AAGxB,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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 };\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":";AAAA,SAAS,gBAAgB;AAEzB,SAAS,wBAAwB;AACjC,SAAS,eAAe;AAGxB,eAAe,eAAe,KAAa,SAAiB,WAAmB;AAC9E,QAAM,CAAC,eAAe,eAAe,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC1D,SAAS,QAAQ,KAAK,OAAO,GAAG,OAAO;AAAA,IACvC,SAAS,QAAQ,KAAK,SAAS,GAAG,OAAO,EAAE,MAAM,MAAM,IAAI;AAAA,EAC5D,CAAC;AACD,SAAO,cAAc,WAAW,KAAK,EAAE,MAAM,iBAAiB,WAAW,KAAK,EAAE;AACjF;AAEO,SAAS,yBAAyB,SAA8B;AACtE,QAAM,EAAE,cAAc,iBAAiB,oBAAoB,IAAI;AAE/D,SAAO,iBAAiB;AAAA,IACvB,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,MAAM,mBAAmB;AAAA,IACzB,OAAO,CAAC,kBAAkB,SAAS,WAAW;AAC7C,YAAM,aAAa,QAAQ,iBAAiB,KAAK,YAAY;AAE7D,YAAM,eAAe,CAAC,SAAsB;AAC3C,YAAI,KAAK,SAAS,YAAY;AAC7B,iBAAO,IAAI;AAAA,QACZ;AAAA,MACD;AAEA,cAAQ,GAAG,UAAU,YAAY;AACjC,cAAQ,GAAG,UAAU,YAAY;AAAA,IAClC;AAAA,IACA,MAAM,OAAO,QAAa;AACzB,YAAM,SAAS,QAAQ,IAAI,iBAAiB,KAAK,YAAY;AAE7D,UAAI,IAAI,YAAY,IAAI,aAAa,SAAS,QAAQ;AACrD,eAAO;AAAA,MACR;AAEA,UAAI,CAAC,IAAI,YAAY,qBAAqB;AACzC,eAAO,eAAe,IAAI,iBAAiB,KAAK,cAAc,mBAAmB;AAAA,MAClF;AAEA,aAAO;AAAA,IACR;AAAA,EACD,CAAC;AACF;;;AC3CA,IAAO,gBAAQ;AASR,SAAS,aAAa,SAA8B;AAC1D,MAAI,QAAQ,mBAAmB,OAAO;AACrC,WAAO,CAAC;AAAA,EACT;AACA,SAAO,CAAC,yBAAyB,OAAO,CAAC;AAC1C;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baeta/plugin-prisma",
3
- "version": "0.1.5",
3
+ "version": "1.0.9",
4
4
  "keywords": [
5
5
  "baeta",
6
6
  "graphql",
@@ -43,16 +43,16 @@
43
43
  "types": "tsc --noEmit"
44
44
  },
45
45
  "dependencies": {
46
- "@baeta/generator-sdk": "^0.1.5",
47
- "@baeta/plugin-exec": "^0.1.5",
48
- "@baeta/util-path": "^0.1.4",
49
- "execa": "^9.5.1"
46
+ "@baeta/generator-sdk": "^1.0.1",
47
+ "@baeta/plugin-exec": "^1.0.9",
48
+ "@baeta/util-path": "^1.0.1",
49
+ "execa": "^9.5.2"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@baeta/builder": "^0.0.0",
53
53
  "@baeta/tsconfig": "^0.0.0",
54
- "@types/node": "^22.10.1",
55
- "typescript": "^5.7.2"
54
+ "@types/node": "^22.13.10",
55
+ "typescript": "^5.8.2"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=22.12.0"
@@ -80,6 +80,12 @@
80
80
  "./index.ts"
81
81
  ],
82
82
  "readme": "none",
83
- "tsconfig": "./tsconfig.json"
83
+ "tsconfig": "./tsconfig.json",
84
+ "sort": [
85
+ "kind",
86
+ "instance-first",
87
+ "required-first",
88
+ "alphabetical-ignoring-documents"
89
+ ]
84
90
  }
85
91
  }