diff --git a/packages/nx-prisma/.eslintrc.json b/packages/nx-prisma/.eslintrc.json index 23d6c3cb..78540f67 100644 --- a/packages/nx-prisma/.eslintrc.json +++ b/packages/nx-prisma/.eslintrc.json @@ -14,13 +14,6 @@ "files": ["*.js", "*.jsx"], "rules": {} }, - { - "files": ["./package.json", "./generators.json", "./executors.json"], - "parser": "jsonc-eslint-parser", - "rules": { - "@nx/nx-plugin-checks": "error" - } - }, { "files": ["*.json"], "parser": "jsonc-eslint-parser", @@ -32,6 +25,13 @@ } ] } + }, + { + "files": ["./package.json", "./executors.json", "./generators.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/nx-plugin-checks": "error" + } } ] } diff --git a/packages/nx-prisma/executors.json b/packages/nx-prisma/executors.json index a9bc87f0..36d376c4 100644 --- a/packages/nx-prisma/executors.json +++ b/packages/nx-prisma/executors.json @@ -1,60 +1,59 @@ { - "$schema": "http://json-schema.org/schema", "executors": { "deploy": { "implementation": "./src/executors/deploy/executor", "schema": "./src/executors/deploy/schema.json", - "description": "Applies all pending migrations, and creates the database if it does not exist" - }, - "validate": { - "implementation": "./src/executors/validate/executor", - "schema": "./src/executors/validate/schema.json", - "description": "Validates your prisma schema" + "description": "The migrate deploy command applies all pending migrations, and creates the database if it does not exist. Primarily used in non-development environments." }, "generate": { "implementation": "./src/executors/generate/executor", "schema": "./src/executors/generate/schema.json", - "description": "Generates assets like Prisma Client based on the generator and data model blocks defined in your schema.prisma file" + "description": "The generate command generates assets like Prisma Client based on the generator and data model blocks defined in your schema.prisma file." }, "migrate": { "implementation": "./src/executors/migrate/executor", "schema": "./src/executors/migrate/schema.json", - "description": "Syncs Prisma Migrations" + "description": "The migrate dev command updates your database using migrations during development and creates the database if it does not exist." }, "pull": { "implementation": "./src/executors/pull/executor", "schema": "./src/executors/pull/schema.json", - "description": "Connects to your database and adds Prisma models to your Prisma schema that reflect the current database schema" + "description": "The db pull command connects to your database and adds Prisma models to your Prisma schema that reflect the current database schema." }, "push": { "implementation": "./src/executors/push/executor", "schema": "./src/executors/push/schema.json", - "description": "Pushes the state of your Prisma schema file to the database without using migrations. It creates the database if the database does not exist." + "description": "The db push command pushes the state of your Prisma schema file to the database without using migrations. It creates the database if the database does not exist." }, "reset": { "implementation": "./src/executors/reset/executor", "schema": "./src/executors/reset/schema.json", - "description": "Deletes and recreates the database, or performs a 'soft reset' by removing all data, tables, indexes, and other artifacts" + "description": "This command deletes and recreates the database, or performs a 'soft reset' by removing all data, tables, indexes, and other artifacts." }, "resolve": { "implementation": "./src/executors/resolve/executor", "schema": "./src/executors/resolve/schema.json", - "description": "Allows you to solve migration history issues in production by marking a failed migration as already applied (supports baselining) or rolled back" + "description": "The migrate resolve command allows you to solve migration history issues in production by marking a failed migration as already applied (supports baselining) or rolled back." }, "seed": { "implementation": "./src/executors/seed/executor", "schema": "./src/executors/seed/schema.json", - "description": "Seed your database using Prisma Client" + "description": "Seed your database." }, "status": { "implementation": "./src/executors/status/executor", "schema": "./src/executors/status/schema.json", - "description": "Looks up the migrations and shows the DB status" + "description": "The prisma migrate status command looks up the migrations in migrations folder and the entries in the _prisma_migrations table and compiles information about the state of the migrations in your database." }, "studio": { "implementation": "./src/executors/studio/executor", "schema": "./src/executors/studio/schema.json", - "description": "The studio command allows you to interact with and manage your data interactively" + "description": "The studio command allows you to interact with and manage your data interactively. It does this by starting a local web server with a web app configured with your project's data schema and records." + }, + "validate": { + "implementation": "./src/executors/validate/executor", + "schema": "./src/executors/validate/schema.json", + "description": "Validates the Prisma Schema Language of the Prisma schema file." } } } diff --git a/packages/nx-prisma/jest.config.ts b/packages/nx-prisma/jest.config.ts index e8e2bbcf..35de2f43 100644 --- a/packages/nx-prisma/jest.config.ts +++ b/packages/nx-prisma/jest.config.ts @@ -2,14 +2,8 @@ export default { displayName: 'nx-prisma', preset: '../../jest.preset.js', - globals: {}, transform: { - '^.+\\.[tj]s$': [ - 'ts-jest', - { - tsconfig: '/tsconfig.spec.json', - }, - ], + '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], }, moduleFileExtensions: ['ts', 'js', 'html'], coverageDirectory: '../../coverage/packages/nx-prisma', diff --git a/packages/nx-prisma/package.json b/packages/nx-prisma/package.json index 2cd682f3..9a81719a 100644 --- a/packages/nx-prisma/package.json +++ b/packages/nx-prisma/package.json @@ -1,6 +1,7 @@ { "name": "@nx-tools/nx-prisma", - "version": "5.0.3", + "version": "6.0.0-alpha.1", + "type": "commonjs", "author": "gperdomor ", "contributors": [ "wSedlacek" @@ -8,18 +9,17 @@ "repository": "https://github.com/gperdomor/nx-tools", "bugs": "https://github.com/gperdomor/nx-tools/issues", "license": "MIT", - "main": "src/index.js", - "generators": "./generators.json", + "main": "./src/index.js", + "typings": "./src/index.d.ts", "executors": "./executors.json", + "generators": "./generators.json", "dependencies": { - "@nx-tools/core": "5.0.3", - "semver": "7.5.4" + "@nx-tools/core": "6.0.0-alpha.1" }, "peerDependencies": { "@nx/devkit": "^16.0.0", - "@nx/workspace": "^16.0.0", - "prisma": "^4.5.0 || ^5.0.0", - "ts-node": "*", + "prisma": "^5.0.0", + "ts-node": "^10.0.0", "tslib": "^2.5.3" } } diff --git a/packages/nx-prisma/project.json b/packages/nx-prisma/project.json index ada2c27e..1355155d 100644 --- a/packages/nx-prisma/project.json +++ b/packages/nx-prisma/project.json @@ -36,15 +36,19 @@ ] } }, + "publish": { + "command": "node tools/scripts/publish.mjs nx-prisma {args.ver} {args.tag}", + "dependsOn": ["build"] + }, "lint": { "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": [ "packages/nx-prisma/**/*.ts", - "packages/nx-prisma/generators.json", + "packages/nx-prisma/package.json", "packages/nx-prisma/executors.json", - "packages/nx-prisma/package.json" + "packages/nx-prisma/generators.json" ] } }, diff --git a/packages/nx-prisma/src/executors/deploy/schema.d.ts b/packages/nx-prisma/src/executors/deploy/schema.d.ts index afefdf28..ec6e4b93 100644 --- a/packages/nx-prisma/src/executors/deploy/schema.d.ts +++ b/packages/nx-prisma/src/executors/deploy/schema.d.ts @@ -1,4 +1,12 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface DeployExecutorSchema extends PrismaBase {} +/** + * Applies all pending migrations, and creates the database if it does not exist. + */ +export type DeployExecutorSchema = PrismaBase; diff --git a/packages/nx-prisma/src/executors/deploy/schema.json b/packages/nx-prisma/src/executors/deploy/schema.json index b83b0058..6e64b517 100644 --- a/packages/nx-prisma/src/executors/deploy/schema.json +++ b/packages/nx-prisma/src/executors/deploy/schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Deploy executor", - "description": "Apply pending migrations to update the database schema in production/staging.", + "title": "Prisma migrate deploy executor", + "description": "The migrate deploy command applies all pending migrations, and creates the database if it does not exist. Primarily used in non-development environments.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." } }, "required": [] diff --git a/packages/nx-prisma/src/executors/generate/executor.spec.ts b/packages/nx-prisma/src/executors/generate/executor.spec.ts index fd2d5dca..8f8bf39e 100644 --- a/packages/nx-prisma/src/executors/generate/executor.spec.ts +++ b/packages/nx-prisma/src/executors/generate/executor.spec.ts @@ -1,5 +1,5 @@ -import { ExecutorContext } from '@nx/devkit'; import { getExecOutput } from '@nx-tools/core'; +import { ExecutorContext } from '@nx/devkit'; import executor from './executor'; import { GenerateExecutorSchema } from './schema'; @@ -23,6 +23,10 @@ export const expectCommandToHaveBeenCalled = (cmd: string, args: string[]) => { }; describe('Generate Executor', () => { + beforeEach(() => { + jest.spyOn(console, 'info').mockImplementation(() => true); + }); + it('empty options', async () => { const options: GenerateExecutorSchema = {}; const output = await executor(options, mockContext as ExecutorContext); diff --git a/packages/nx-prisma/src/executors/generate/schema.d.ts b/packages/nx-prisma/src/executors/generate/schema.d.ts index 4d3b7861..22fb803d 100644 --- a/packages/nx-prisma/src/executors/generate/schema.d.ts +++ b/packages/nx-prisma/src/executors/generate/schema.d.ts @@ -1,5 +1,14 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; +/** + * Generate artifacts (e.g. Prisma Client). + */ export interface GenerateExecutorSchema extends PrismaBase { /** * The generate command will generate Prisma Client for use with the Data Proxy. diff --git a/packages/nx-prisma/src/executors/generate/schema.json b/packages/nx-prisma/src/executors/generate/schema.json index e1456067..7f6c289e 100644 --- a/packages/nx-prisma/src/executors/generate/schema.json +++ b/packages/nx-prisma/src/executors/generate/schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Generate executor", - "description": "Generate artifacts (e.g. Prisma Client).", + "title": "Prisma generate executor", + "description": "The generate command generates assets like Prisma Client based on the generator and data model blocks defined in your schema.prisma file.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." }, "data-proxy": { "type": "boolean", diff --git a/packages/nx-prisma/src/executors/migrate/executor.spec.ts b/packages/nx-prisma/src/executors/migrate/executor.spec.ts index c72e19b9..bb5e6031 100644 --- a/packages/nx-prisma/src/executors/migrate/executor.spec.ts +++ b/packages/nx-prisma/src/executors/migrate/executor.spec.ts @@ -19,6 +19,10 @@ const mockContext: Partial = { }; describe('Migrate Executor', () => { + beforeEach(() => { + jest.spyOn(console, 'info').mockImplementation(() => true); + }); + it('empty options', async () => { const options: MigrateExecutorSchema = { name: 'mig-name' }; const output = await executor(options, mockContext as ExecutorContext); diff --git a/packages/nx-prisma/src/executors/migrate/schema.d.ts b/packages/nx-prisma/src/executors/migrate/schema.d.ts index ece3b08c..5442032d 100644 --- a/packages/nx-prisma/src/executors/migrate/schema.d.ts +++ b/packages/nx-prisma/src/executors/migrate/schema.d.ts @@ -1,8 +1,17 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; +/** + * Updates your database using migrations during development and creates the database if it does not exist. + */ export interface MigrateExecutorSchema extends PrismaBase { /** - * The name of the migration. If no name is provided, the CLI will prompt you. + * The name of the migration. */ name: string; /** diff --git a/packages/nx-prisma/src/executors/migrate/schema.json b/packages/nx-prisma/src/executors/migrate/schema.json index c9307227..0815cb16 100644 --- a/packages/nx-prisma/src/executors/migrate/schema.json +++ b/packages/nx-prisma/src/executors/migrate/schema.json @@ -1,17 +1,17 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Migrate executor", - "description": "Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client).", + "title": "Prisma migrate dev executor", + "description": "The migrate dev command updates your database using migrations during development and creates the database if it does not exist.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." }, "name": { "type": "string", - "description": "The name of the migration. If no name is provided, the CLI will prompt you." + "description": "The name of the migration." }, "create-only": { "type": "boolean", diff --git a/packages/nx-prisma/src/executors/pull/schema.d.ts b/packages/nx-prisma/src/executors/pull/schema.d.ts index e69310b3..9decdfd7 100644 --- a/packages/nx-prisma/src/executors/pull/schema.d.ts +++ b/packages/nx-prisma/src/executors/pull/schema.d.ts @@ -1,8 +1,17 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; +/** + * The db pull command connects to your database and adds Prisma models to your Prisma schema that reflect the current database schema. + */ export interface PullExecutorSchema extends PrismaBase { /** - * Force overwrite of manual changes made to schema. + * Force overwrite of manual changes made to schema. The generated schema will be based on the introspected schema only. */ force?: boolean; /** diff --git a/packages/nx-prisma/src/executors/pull/schema.json b/packages/nx-prisma/src/executors/pull/schema.json index b2274f0b..d1c74763 100644 --- a/packages/nx-prisma/src/executors/pull/schema.json +++ b/packages/nx-prisma/src/executors/pull/schema.json @@ -1,17 +1,17 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Pull executor", - "description": "Pull the schema from an existing database, updating the Prisma schema.", + "title": "Prisma db pull executor", + "description": "The db pull command connects to your database and adds Prisma models to your Prisma schema that reflect the current database schema.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." }, "force": { "type": "boolean", - "description": "Force overwrite of manual changes made to schema." + "description": "Force overwrite of manual changes made to schema. The generated schema will be based on the introspected schema only." }, "print": { "type": "boolean", diff --git a/packages/nx-prisma/src/executors/push/schema.d.ts b/packages/nx-prisma/src/executors/push/schema.d.ts index 011477bb..13c57c86 100644 --- a/packages/nx-prisma/src/executors/push/schema.d.ts +++ b/packages/nx-prisma/src/executors/push/schema.d.ts @@ -1,5 +1,14 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; +/** + * The db push command pushes the state of your Prisma schema file to the database without using migrations. It creates the database if the database does not exist + */ export interface PushExecutorSchema extends PrismaBase { /** * Skip generation of artifacts such as Prisma Client. diff --git a/packages/nx-prisma/src/executors/push/schema.json b/packages/nx-prisma/src/executors/push/schema.json index 28bb23bb..a8046d62 100644 --- a/packages/nx-prisma/src/executors/push/schema.json +++ b/packages/nx-prisma/src/executors/push/schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Push executor", - "description": "Push the Prisma schema state to the database.", + "title": "Prisma db push executor", + "description": "The db push command pushes the state of your Prisma schema file to the database without using migrations. It creates the database if the database does not exist.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." }, "skip-generate": { "type": "boolean", diff --git a/packages/nx-prisma/src/executors/reset/executor.spec.ts b/packages/nx-prisma/src/executors/reset/executor.spec.ts index 6a484538..81569867 100644 --- a/packages/nx-prisma/src/executors/reset/executor.spec.ts +++ b/packages/nx-prisma/src/executors/reset/executor.spec.ts @@ -19,6 +19,10 @@ const mockContext: Partial = { }; describe('Reset Executor', () => { + beforeEach(() => { + jest.spyOn(console, 'info').mockImplementation(() => true); + }); + it('empty options', async () => { const options: ResetExecutorSchema = { force: true }; const output = await executor(options, mockContext as ExecutorContext); diff --git a/packages/nx-prisma/src/executors/reset/schema.d.ts b/packages/nx-prisma/src/executors/reset/schema.d.ts index f4473b40..f201376a 100644 --- a/packages/nx-prisma/src/executors/reset/schema.d.ts +++ b/packages/nx-prisma/src/executors/reset/schema.d.ts @@ -1,5 +1,14 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; +/** + * This command deletes and recreates the database, or performs a 'soft reset' by removing all data, tables, indexes, and other artifacts. + */ export interface ResetExecutorSchema extends PrismaBase { /** * Skip the confirmation prompt. diff --git a/packages/nx-prisma/src/executors/reset/schema.json b/packages/nx-prisma/src/executors/reset/schema.json index bfdc0e54..630ea789 100644 --- a/packages/nx-prisma/src/executors/reset/schema.json +++ b/packages/nx-prisma/src/executors/reset/schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Reset executor", - "description": "Reset your database and apply all migrations, all data will be lost.", + "title": "Prisma migrate reset executor", + "description": "This command deletes and recreates the database, or performs a 'soft reset' by removing all data, tables, indexes, and other artifacts.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." }, "force": { "type": "boolean", diff --git a/packages/nx-prisma/src/executors/resolve/schema.d.ts b/packages/nx-prisma/src/executors/resolve/schema.d.ts index d707c33e..a40d85a4 100644 --- a/packages/nx-prisma/src/executors/resolve/schema.d.ts +++ b/packages/nx-prisma/src/executors/resolve/schema.d.ts @@ -1,12 +1,21 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; +/** + * The migrate resolve command allows you to solve migration history issues in production by marking a failed migration as already applied (supports baselining) or rolled back. + */ export interface ResolveExecutorSchema extends PrismaBase { /** - * Record a specific migration as applied. + * Record a specific migration as applied - for example --applied '20201231000000_add_users_table' */ applied?: string; /** - * Record a specific migration as rolled back. + * Record a specific migration as rolled back - for example --rolled-back '20201231000000_add_users_table'. */ 'rolled-back'?: string; } diff --git a/packages/nx-prisma/src/executors/resolve/schema.json b/packages/nx-prisma/src/executors/resolve/schema.json index b00dec56..627c104a 100644 --- a/packages/nx-prisma/src/executors/resolve/schema.json +++ b/packages/nx-prisma/src/executors/resolve/schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Resolve executor", - "description": "Resolve issues with database migrations in deployment databases.", + "title": "Prisma migrate resolve executor", + "description": "The migrate resolve command allows you to solve migration history issues in production by marking a failed migration as already applied (supports baselining) or rolled back.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." }, "applied": { "type": "string", diff --git a/packages/nx-prisma/src/executors/seed/executor.ts b/packages/nx-prisma/src/executors/seed/executor.ts index 819e43c0..9b79779f 100644 --- a/packages/nx-prisma/src/executors/seed/executor.ts +++ b/packages/nx-prisma/src/executors/seed/executor.ts @@ -1,6 +1,5 @@ import { getExecOutput, getProjectRoot, logger } from '@nx-tools/core'; -import { ExecutorContext, getPackageManagerCommand } from '@nx/devkit'; -import { join } from 'node:path'; +import { ExecutorContext, getPackageManagerCommand, joinPathFragments } from '@nx/devkit'; import { SeedExecutorSchema } from './schema'; export default async function run(options: SeedExecutorSchema, ctx: ExecutorContext): Promise<{ success: true }> { @@ -24,7 +23,7 @@ export default async function run(options: SeedExecutorSchema, ctx: ExecutorCont const getArgs = (options: SeedExecutorSchema, ctx: ExecutorContext): string[] => { const args = []; - const tsConfig = options?.tsConfig ?? join(getProjectRoot(ctx), 'tsconfig.json'); + const tsConfig = options?.tsConfig ?? joinPathFragments(getProjectRoot(ctx), 'tsconfig.json'); args.push(`--project=${tsConfig}`); diff --git a/packages/nx-prisma/src/executors/seed/schema.d.ts b/packages/nx-prisma/src/executors/seed/schema.d.ts index fa29417c..0191654a 100644 --- a/packages/nx-prisma/src/executors/seed/schema.d.ts +++ b/packages/nx-prisma/src/executors/seed/schema.d.ts @@ -1,3 +1,12 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +/** + * Seed your database + */ export interface SeedExecutorSchema { /** * The path to the seeding script diff --git a/packages/nx-prisma/src/executors/seed/schema.json b/packages/nx-prisma/src/executors/seed/schema.json index c2792c9b..2ae5855c 100644 --- a/packages/nx-prisma/src/executors/seed/schema.json +++ b/packages/nx-prisma/src/executors/seed/schema.json @@ -1,8 +1,8 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Seed executor", - "description": "Seed your database", + "title": "Prisma db seed executor", + "description": "Seed your database.", "type": "object", "properties": { "script": { diff --git a/packages/nx-prisma/src/executors/status/schema.d.ts b/packages/nx-prisma/src/executors/status/schema.d.ts index 55e4d9b0..96b0973a 100644 --- a/packages/nx-prisma/src/executors/status/schema.d.ts +++ b/packages/nx-prisma/src/executors/status/schema.d.ts @@ -1,4 +1,12 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface StatusExecutorSchema extends PrismaBase {} +/** + * The prisma migrate status command looks up the migrations in migrations folder and the entries in the _prisma_migrations table and compiles information about the state of the migrations in your database. + */ +export type StatusExecutorSchema = PrismaBase; diff --git a/packages/nx-prisma/src/executors/status/schema.json b/packages/nx-prisma/src/executors/status/schema.json index dd67425d..e42d3234 100644 --- a/packages/nx-prisma/src/executors/status/schema.json +++ b/packages/nx-prisma/src/executors/status/schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Status executor", - "description": "Check the status of your database migrations.", + "title": "Prisma migrate status executor", + "description": "The prisma migrate status command looks up the migrations in migrations folder and the entries in the _prisma_migrations table and compiles information about the state of the migrations in your database.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." } }, "required": [] diff --git a/packages/nx-prisma/src/executors/studio/schema.d.ts b/packages/nx-prisma/src/executors/studio/schema.d.ts index eb6fa176..26f35e9d 100644 --- a/packages/nx-prisma/src/executors/studio/schema.d.ts +++ b/packages/nx-prisma/src/executors/studio/schema.d.ts @@ -1,5 +1,14 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; +/** + * The studio command allows you to interact with and manage your data interactively. It does this by starting a local web server with a web app configured with your project's data schema and records. + */ export interface StudioExecutorSchema extends PrismaBase { /** * The browser to auto-open Studio in. diff --git a/packages/nx-prisma/src/executors/studio/schema.json b/packages/nx-prisma/src/executors/studio/schema.json index e5bef96d..0baef8c6 100644 --- a/packages/nx-prisma/src/executors/studio/schema.json +++ b/packages/nx-prisma/src/executors/studio/schema.json @@ -1,21 +1,22 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Studio executor", - "description": "Browse your data with Prisma Studio.", + "title": "Prisma studio executor", + "description": "The studio command allows you to interact with and manage your data interactively. It does this by starting a local web server with a web app configured with your project's data schema and records.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." }, "browser": { "type": "string", - "description": "The browser to auto-open Studio in" + "description": "The browser to auto-open Studio in." }, "port": { "type": "number", - "description": "The port number to start Studio on" + "description": "The port number to start Studio on.", + "default": 5555 } }, "required": [] diff --git a/packages/nx-prisma/src/executors/validate/schema.d.ts b/packages/nx-prisma/src/executors/validate/schema.d.ts index 0d98faab..8985e2e6 100644 --- a/packages/nx-prisma/src/executors/validate/schema.d.ts +++ b/packages/nx-prisma/src/executors/validate/schema.d.ts @@ -1,4 +1,12 @@ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + import { PrismaBase } from '../../interfaces'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ValidateExecutorSchema extends PrismaBase {} +/** + * Validates the Prisma Schema Language of the Prisma schema file. + */ +export type ValidateExecutorSchema = PrismaBase; diff --git a/packages/nx-prisma/src/executors/validate/schema.json b/packages/nx-prisma/src/executors/validate/schema.json index 152161d6..f301ae87 100644 --- a/packages/nx-prisma/src/executors/validate/schema.json +++ b/packages/nx-prisma/src/executors/validate/schema.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/schema", "version": 2, - "title": "Prisma Validate executor", - "description": "Validate prisma schema", + "title": "Prisma validate executor", + "description": "Validates the Prisma Schema Language of the Prisma schema file.", "type": "object", "properties": { "schema": { "type": "string", - "description": "The path to the prisma schema eg. 'prisma/schema.prisma'" + "description": "Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported." } }, "required": [] diff --git a/packages/nx-prisma/src/index.ts b/packages/nx-prisma/src/index.ts index e69de29b..e34a23a3 100644 --- a/packages/nx-prisma/src/index.ts +++ b/packages/nx-prisma/src/index.ts @@ -0,0 +1 @@ +export { runCommand } from './run-commands'; diff --git a/packages/nx-prisma/src/interfaces.ts b/packages/nx-prisma/src/interfaces.ts index b04c4c26..49b4008a 100644 --- a/packages/nx-prisma/src/interfaces.ts +++ b/packages/nx-prisma/src/interfaces.ts @@ -1,6 +1,6 @@ export interface PrismaBase { /** - * The path to the prisma schema eg. 'prisma/schema.prisma' + * Specifies the path to the desired schema.prisma file to be processed instead of the default path. Both absolute and relative paths are supported. */ schema?: string; } diff --git a/packages/nx-prisma/src/utils.ts b/packages/nx-prisma/src/utils.ts index 99079b19..a933b0aa 100644 --- a/packages/nx-prisma/src/utils.ts +++ b/packages/nx-prisma/src/utils.ts @@ -1,5 +1,6 @@ -import { ExecutorContext } from '@nx/devkit'; import { getProjectRoot } from '@nx-tools/core'; -import { join } from 'node:path'; +import { ExecutorContext, joinPathFragments } from '@nx/devkit'; +import { PRISMA_DEFAULT_DIR } from './generators/configuration/constants'; -export const getDefaultScheme = (ctx: ExecutorContext) => join(getProjectRoot(ctx), 'prisma/schema.prisma'); +export const getDefaultScheme = (ctx: ExecutorContext) => + joinPathFragments(getProjectRoot(ctx), `${PRISMA_DEFAULT_DIR}/schema.prisma`);