@baeta/plugin-prisma 0.0.14 → 0.0.16
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 +22 -0
- package/dist/index.cjs +9 -9
- package/dist/index.js +9 -9
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @baeta/plugin-prisma
|
|
2
2
|
|
|
3
|
+
## 0.0.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#47](https://github.com/andreisergiu98/baeta/pull/47) [`eb7096d`](https://github.com/andreisergiu98/baeta/commit/eb7096d42a53b17bae0a8365eccb795e7ded02e9) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
|
|
8
|
+
|
|
9
|
+
- [#43](https://github.com/andreisergiu98/baeta/pull/43) [`670501b`](https://github.com/andreisergiu98/baeta/commit/670501b2b1cfb1126be3421293b8ccd597c6ffc2) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - bump dependencies
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`eb7096d`](https://github.com/andreisergiu98/baeta/commit/eb7096d42a53b17bae0a8365eccb795e7ded02e9), [`670501b`](https://github.com/andreisergiu98/baeta/commit/670501b2b1cfb1126be3421293b8ccd597c6ffc2)]:
|
|
12
|
+
- @baeta/generator-sdk@0.0.6
|
|
13
|
+
- @baeta/plugin-exec@0.0.4
|
|
14
|
+
|
|
15
|
+
## 0.0.15
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#40](https://github.com/andreisergiu98/baeta/pull/40) [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - normalize config
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056), [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056)]:
|
|
22
|
+
- @baeta/generator-sdk@0.0.5
|
|
23
|
+
- @baeta/plugin-exec@0.0.3
|
|
24
|
+
|
|
3
25
|
## 0.0.14
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
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,
|
|
8
|
-
_promises.readFile.call(void 0, _path.resolve.call(void 0,
|
|
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,
|
|
30
|
+
include: [_path.resolve.call(void 0, generatorOptions.cwd, prismaSchema)],
|
|
31
31
|
ignore: []
|
|
32
32
|
};
|
|
33
33
|
},
|
|
@@ -36,7 +36,7 @@ function createPrismaClientPlugin(options) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// index.ts
|
|
39
|
-
var
|
|
39
|
+
var plugin_prisma_default = prismaPlugin;
|
|
40
40
|
function prismaPlugin(options) {
|
|
41
41
|
if (options.generateClient === false) {
|
|
42
42
|
return [];
|
|
@@ -46,4 +46,4 @@ function prismaPlugin(options) {
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
exports.default =
|
|
49
|
+
exports.default = plugin_prisma_default; exports.prismaPlugin = prismaPlugin;
|
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(
|
|
8
|
-
readFile(resolve(
|
|
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(
|
|
30
|
+
include: [resolve(generatorOptions.cwd, prismaSchema)],
|
|
31
31
|
ignore: []
|
|
32
32
|
};
|
|
33
33
|
},
|
|
@@ -36,7 +36,7 @@ function createPrismaClientPlugin(options) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// index.ts
|
|
39
|
-
var
|
|
39
|
+
var plugin_prisma_default = prismaPlugin;
|
|
40
40
|
function prismaPlugin(options) {
|
|
41
41
|
if (options.generateClient === false) {
|
|
42
42
|
return [];
|
|
@@ -44,6 +44,6 @@ function prismaPlugin(options) {
|
|
|
44
44
|
return [createPrismaClientPlugin(options)];
|
|
45
45
|
}
|
|
46
46
|
export {
|
|
47
|
-
|
|
47
|
+
plugin_prisma_default as default,
|
|
48
48
|
prismaPlugin
|
|
49
49
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/plugin-prisma",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"homepage": "https://github.com/andreisergiu98/baeta#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/andreisergiu98/baeta/issues"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/andreisergiu98/baeta.git",
|
|
11
|
-
"directory": "
|
|
11
|
+
"directory": "packages/plugin-prisma"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "Andrei Pampu <pampu.andrei@pm.me>",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"types": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@baeta/generator-sdk": "^0.0.
|
|
28
|
-
"@baeta/plugin-exec": "^0.0.
|
|
27
|
+
"@baeta/generator-sdk": "^0.0.6",
|
|
28
|
+
"@baeta/plugin-exec": "^0.0.4",
|
|
29
29
|
"execa": "^6.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@baeta/
|
|
32
|
+
"@baeta/builder": "^0.0.0",
|
|
33
33
|
"@baeta/tsconfig": "^0.0.0",
|
|
34
|
-
"@types/node": "^18.11
|
|
35
|
-
"typescript": "^4.9.
|
|
34
|
+
"@types/node": "^18.15.11",
|
|
35
|
+
"typescript": "^4.9.5"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=18.0.0"
|