@baeta/plugin-prisma 0.0.13 → 0.0.15

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 ADDED
@@ -0,0 +1,23 @@
1
+ # @baeta/plugin-prisma
2
+
3
+ ## 0.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [#40](https://github.com/andreisergiu98/baeta/pull/40) [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - normalize config
8
+
9
+ - Updated dependencies [[`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056), [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056)]:
10
+ - @baeta/generator-sdk@0.0.5
11
+ - @baeta/plugin-exec@0.0.3
12
+
13
+ ## 0.0.14
14
+
15
+ ### Patch Changes
16
+
17
+ - [`d1190c1`](https://github.com/andreisergiu98/baeta/commit/d1190c10e3c259c73ddeeb73a4bd312b22bf2ea4) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - create cli sdk
18
+ release prisma plugin
19
+ update dependencies
20
+ refactor generator plugins
21
+ - Updated dependencies [[`d1190c1`](https://github.com/andreisergiu98/baeta/commit/d1190c10e3c259c73ddeeb73a4bd312b22bf2ea4)]:
22
+ - @baeta/generator-sdk@0.0.4
23
+ - @baeta/plugin-exec@0.0.2
package/dist/index.cjs CHANGED
@@ -2,22 +2,22 @@
2
2
  var _pluginexec = require('@baeta/plugin-exec');
3
3
  var _promises = require('fs/promises');
4
4
  var _path = require('path');
5
- async function compareSchemas(current, generated) {
5
+ async function compareSchemas(cwd, current, generated) {
6
6
  const [currentSchema, generatedSchema] = await Promise.all([
7
- _promises.readFile.call(void 0, _path.resolve.call(void 0, process.cwd(), current), "utf-8"),
8
- _promises.readFile.call(void 0, _path.resolve.call(void 0, process.cwd(), generated), "utf-8").catch(() => null)
7
+ _promises.readFile.call(void 0, _path.resolve.call(void 0, cwd, current), "utf-8"),
8
+ _promises.readFile.call(void 0, _path.resolve.call(void 0, cwd, generated), "utf-8").catch(() => null)
9
9
  ]);
10
10
  return currentSchema === generatedSchema;
11
11
  }
12
12
  function createPrismaClientPlugin(options) {
13
13
  const { prismaSchema, generateCommand, generatedSchemaPath } = options;
14
- const schema = _path.resolve.call(void 0, process.cwd(), prismaSchema);
15
14
  const skip = async (ctx) => {
15
+ const schema = _path.resolve.call(void 0, ctx.generatorOptions.cwd, prismaSchema);
16
16
  if (ctx.watching && ctx.changedFile !== schema) {
17
17
  return true;
18
18
  }
19
19
  if (!ctx.watching && generatedSchemaPath) {
20
- return compareSchemas(prismaSchema, generatedSchemaPath);
20
+ return compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);
21
21
  }
22
22
  return false;
23
23
  };
@@ -25,9 +25,9 @@ function createPrismaClientPlugin(options) {
25
25
  name: "prisma-client",
26
26
  actionName: "Prisma client",
27
27
  exec: _nullishCoalesce(generateCommand, () => ( "prisma generate")),
28
- watch: () => {
28
+ watch: (generatorOptions) => {
29
29
  return {
30
- include: [_path.resolve.call(void 0, process.cwd(), prismaSchema)],
30
+ include: [_path.resolve.call(void 0, generatorOptions.cwd, prismaSchema)],
31
31
  ignore: []
32
32
  };
33
33
  },
package/dist/index.js CHANGED
@@ -2,22 +2,22 @@
2
2
  import { createExecPlugin } from "@baeta/plugin-exec";
3
3
  import { readFile } from "fs/promises";
4
4
  import { resolve } from "path";
5
- async function compareSchemas(current, generated) {
5
+ async function compareSchemas(cwd, current, generated) {
6
6
  const [currentSchema, generatedSchema] = await Promise.all([
7
- readFile(resolve(process.cwd(), current), "utf-8"),
8
- readFile(resolve(process.cwd(), generated), "utf-8").catch(() => null)
7
+ readFile(resolve(cwd, current), "utf-8"),
8
+ readFile(resolve(cwd, generated), "utf-8").catch(() => null)
9
9
  ]);
10
10
  return currentSchema === generatedSchema;
11
11
  }
12
12
  function createPrismaClientPlugin(options) {
13
13
  const { prismaSchema, generateCommand, generatedSchemaPath } = options;
14
- const schema = resolve(process.cwd(), prismaSchema);
15
14
  const skip = async (ctx) => {
15
+ const schema = resolve(ctx.generatorOptions.cwd, prismaSchema);
16
16
  if (ctx.watching && ctx.changedFile !== schema) {
17
17
  return true;
18
18
  }
19
19
  if (!ctx.watching && generatedSchemaPath) {
20
- return compareSchemas(prismaSchema, generatedSchemaPath);
20
+ return compareSchemas(ctx.generatorOptions.cwd, prismaSchema, generatedSchemaPath);
21
21
  }
22
22
  return false;
23
23
  };
@@ -25,9 +25,9 @@ function createPrismaClientPlugin(options) {
25
25
  name: "prisma-client",
26
26
  actionName: "Prisma client",
27
27
  exec: generateCommand ?? "prisma generate",
28
- watch: () => {
28
+ watch: (generatorOptions) => {
29
29
  return {
30
- include: [resolve(process.cwd(), prismaSchema)],
30
+ include: [resolve(generatorOptions.cwd, prismaSchema)],
31
31
  ignore: []
32
32
  };
33
33
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baeta/plugin-prisma",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "homepage": "https://github.com/andreisergiu98/baeta#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/andreisergiu98/baeta/issues"
@@ -24,8 +24,8 @@
24
24
  "types": "tsc --noEmit"
25
25
  },
26
26
  "dependencies": {
27
- "@baeta/generator-sdk": "^0.0.3",
28
- "@baeta/plugin-exec": "^0.0.1",
27
+ "@baeta/generator-sdk": "^0.0.5",
28
+ "@baeta/plugin-exec": "^0.0.3",
29
29
  "execa": "^6.1.0"
30
30
  },
31
31
  "devDependencies": {