prisma-nestjs-graphql
Advanced tools
Comparing version 1.0.0 to 1.1.0
33
index.js
@@ -211,3 +211,3 @@ "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __assign = Object.assign; | ||
function toGraphqlImportType(args) { | ||
const {isId, type} = args; | ||
const {isId, type, kind} = args; | ||
let name = type; | ||
@@ -220,2 +220,5 @@ if (isId) { | ||
} | ||
if (kind === "scalar" && type === "Json") { | ||
return {name: "GraphQLJSON", moduleSpecifier: "graphql-type-json"}; | ||
} | ||
if (name === "DateTime") { | ||
@@ -234,2 +237,3 @@ name = "String"; | ||
[{type: (type) => type === "Boolean", kind: "scalar"}, () => "boolean"], | ||
[{type: (type) => type === "Json", kind: "scalar"}, () => "object"], | ||
[{type: () => true, kind: "object"}, (field) => field.type], | ||
@@ -444,7 +448,8 @@ [{type: () => true, kind: "enum"}, (field) => field.type], | ||
// src/update.ts | ||
// src/remove.ts | ||
var _path = require('path'); | ||
async function update2(project, options) { | ||
var _typescriptequals = require('typescript-equals'); | ||
async function remove(project, options) { | ||
_assert2.default.call(void 0, options.generator.output); | ||
@@ -454,2 +459,21 @@ for (const sourceFile of project.getSourceFiles()) { | ||
const outfile = _path.resolve.call(void 0, options.generator.output, `.${filePath}`); | ||
if (_fs.existsSync.call(void 0, outfile)) { | ||
const outfileText = await _fs.promises.readFile(outfile, {encoding: "utf8"}); | ||
const sourceFileText = sourceFile.getText(); | ||
if (_typescriptequals.equals.call(void 0, outfileText, sourceFileText)) { | ||
sourceFile.deleteImmediatelySync(); | ||
} | ||
} | ||
} | ||
} | ||
// src/update.ts | ||
async function update(project, options) { | ||
_assert2.default.call(void 0, options.generator.output); | ||
for (const sourceFile of project.getSourceFiles()) { | ||
const filePath = sourceFile.getFilePath(); | ||
const outfile = _path.resolve.call(void 0, options.generator.output, `.${filePath}`); | ||
const directory = _path.dirname.call(void 0, outfile); | ||
@@ -469,3 +493,4 @@ if (!_fs.existsSync.call(void 0, directory)) { | ||
const project = await generate(options); | ||
await update2(project, options); | ||
await remove(project, options); | ||
await update(project, options); | ||
}, | ||
@@ -472,0 +497,0 @@ onManifest() { |
{ | ||
"name": "prisma-nestjs-graphql", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
"description": "Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module", | ||
"main": "index.js", | ||
"bin": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/unlight/nestjs-graphql-prisma.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/unlight/nestjs-graphql-prisma/issues" | ||
}, | ||
"homepage": "https://github.com/unlight/nestjs-graphql-prisma#readme", | ||
"keywords": [ | ||
@@ -28,4 +37,3 @@ "nestjs", | ||
"lint:fix": "npm run eslint -- --fix", | ||
"build": "sh Taskfile build", | ||
"bundle": "sh Taskfile bundle", | ||
"build": "sh Taskfile bundle", | ||
"prisma:g": "node node_modules/@prisma/cli/build/index.js generate", | ||
@@ -47,3 +55,4 @@ "unused": "no-unused-export \"src/**/*.ts\"", | ||
"to-kebab": "^1.0.7", | ||
"ts-morph": "^7.1.3" | ||
"ts-morph": "^7.3.0", | ||
"typescript-equals": "^1.0.0" | ||
}, | ||
@@ -61,10 +70,10 @@ "peerDependencies": { | ||
"@semantic-release/git": "^9.0.0", | ||
"@types/mocha": "^8.0.1", | ||
"@types/mocha": "^8.0.2", | ||
"@types/node": "^14.0.27", | ||
"@typescript-eslint/eslint-plugin": "^3.8.0", | ||
"@typescript-eslint/parser": "^3.8.0", | ||
"@typescript-eslint/eslint-plugin": "^3.9.0", | ||
"@typescript-eslint/parser": "^3.9.0", | ||
"c8": "^7.3.0", | ||
"eslint": "^7.6.0", | ||
"eslint": "^7.7.0", | ||
"eslint-import-resolver-node": "^0.3.4", | ||
"eslint-plugin-etc": "0.0.1-beta.36", | ||
"eslint-plugin-etc": "0.0.1-beta.40", | ||
"eslint-plugin-import": "^2.22.0", | ||
@@ -77,7 +86,8 @@ "eslint-plugin-only-warn": "^1.0.2", | ||
"eslint-plugin-sonarjs": "^0.5.0", | ||
"eslint-plugin-sort-class-members": "^1.7.0", | ||
"eslint-plugin-total-functions": "^1.40.0", | ||
"eslint-plugin-sort-class-members": "^1.8.0", | ||
"eslint-plugin-total-functions": "^1.42.1", | ||
"eslint-plugin-unicorn": "^21.0.0", | ||
"eslint-plugin-wix-editor": "^3.2.0", | ||
"git-branch-is": "^4.0.0", | ||
"graphql-type-json": "^0.3.2", | ||
"husky": "^4.2.5", | ||
@@ -84,0 +94,0 @@ "mocha": "^8.1.1", |
@@ -17,3 +17,3 @@ # prisma-nestjs-graphql | ||
generator nestgraphql { | ||
provider = "prisma-nestjs-graphql" | ||
provider = "node node_modules/prisma-nestjs-graphql" | ||
output = "../src" | ||
@@ -43,2 +43,4 @@ } | ||
- https://github.com/unlight/nestjs-graphql-prisma-realworld-example-app | ||
- https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/data-model | ||
- JSON type for the code first approach - https://github.com/nestjs/graphql/issues/111#issuecomment-631452899 | ||
@@ -45,0 +47,0 @@ ## Todo |
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
38786
949
1
0
48
7
39
+ Addedtypescript-equals@^1.0.0
+ Addedlodash.trim@4.5.1(transitive)
+ Addedtypescript-equals@1.0.0(transitive)
Updatedts-morph@^7.3.0