@tsed/cli-plugin-prisma 3.17.2 → 3.19.1

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.
@@ -5,19 +5,10 @@ export declare class PrismaInitHook {
5
5
  protected cliPrisma: CliPrisma;
6
6
  protected cliService: CliService;
7
7
  protected packageJson: ProjectPackageJson;
8
- onExec(ctx: InitCmdContext): Promise<({
8
+ onExec(ctx: InitCmdContext): Promise<{
9
9
  title: string;
10
10
  task: () => any;
11
- enabled?: undefined;
12
- } | {
13
- title: string;
14
- enabled: () => boolean;
15
- task: () => Promise<void>;
16
- } | {
17
- title: string;
18
- enabled: () => boolean;
19
- task: (ctx: any, task: import("listr2").ListrTaskWrapper<any, any>) => Promise<import("listr2").Listr<any, any, any>>;
20
- })[]>;
11
+ }[]>;
21
12
  addScripts(): void;
22
13
  addDependencies(ctx: InitCmdContext): void;
23
14
  addDevDependencies(ctx: InitCmdContext): void;
@@ -17,17 +17,7 @@ let PrismaInitHook = class PrismaInitHook {
17
17
  },
18
18
  {
19
19
  title: "Add Ts.ED configuration to Prisma schema",
20
- enabled: () => !!ctx.GH_TOKEN,
21
20
  task: () => this.cliPrisma.patchPrismaSchema()
22
- },
23
- {
24
- title: "Generate Prisma Service",
25
- enabled: () => !ctx.GH_TOKEN,
26
- task: cli_core_1.createSubTasks(async () => await this.cliService.getTasks("generate", {
27
- ...ctx,
28
- type: "prisma.service",
29
- name: "Prisma"
30
- }), { ...ctx, concurrent: false })
31
21
  }
32
22
  ];
33
23
  }
@@ -38,12 +28,8 @@ let PrismaInitHook = class PrismaInitHook {
38
28
  });
39
29
  }
40
30
  addDependencies(ctx) {
41
- if (ctx.GH_TOKEN) {
42
- this.packageJson.addDependencies({
43
- "@tsedio/prisma": "1.1.1"
44
- }, ctx);
45
- }
46
31
  this.packageJson.addDependencies({
32
+ "@tsed/prisma": "latest",
47
33
  "@prisma/client": "latest"
48
34
  }, ctx);
49
35
  }
@@ -1 +1 @@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E;YAChB,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B;gBACE,gBAAgB,EAAE,OAAO;aAC1B,EACD,GAAG,CACJ,CAAC;SACH;QACD,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B;YACE,gBAAgB,EAAE,QAAQ;SAC3B,EACD,GAAG,CACJ,CAAC;IACJ,CAAC;IAED,kBAAkB,CAAC,GAAmB;QACpC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC;CACF,CAAA;AAnEC;IADC,iBAAM,EAAE;sCACY,qBAAS;iDAAC;AAG/B;IADC,iBAAM,EAAE;sCACa,qBAAU;kDAAC;AAGjC;IADC,iBAAM,EAAE;sCACc,6BAAkB;mDAAC;AAG1C;IADC,iBAAM,CAAC,MAAM,CAAC;;;;4CA8Bd;AAxCU,cAAc;IAD1B,eAAU,EAAE;GACA,cAAc,CAqE1B;AArEY,wCAAc","sourcesContent":["import {InitCmdContext} from \"@tsed/cli\";\nimport {CliService, createSubTasks, Inject, OnExec, ProjectPackageJson} from \"@tsed/cli-core\";\nimport {Injectable} from \"@tsed/di\";\nimport {CliPrisma} from \"../services/CliPrisma\";\n\n@Injectable()\nexport class PrismaInitHook {\n @Inject()\n protected cliPrisma: CliPrisma;\n\n @Inject()\n protected cliService: CliService;\n\n @Inject()\n protected packageJson: ProjectPackageJson;\n\n @OnExec(\"init\")\n async onExec(ctx: InitCmdContext) {\n this.addScripts();\n this.addDependencies(ctx);\n this.addDevDependencies(ctx);\n\n return [\n {\n title: \"Generate Prisma schema\",\n task: () => this.cliPrisma.init()\n },\n {\n title: \"Add Ts.ED configuration to Prisma schema\",\n enabled: () => !!ctx.GH_TOKEN,\n task: () => this.cliPrisma.patchPrismaSchema()\n },\n {\n title: \"Generate Prisma Service\",\n enabled: () => !ctx.GH_TOKEN,\n task: createSubTasks(\n async () =>\n await this.cliService.getTasks(\"generate\", {\n ...ctx,\n type: \"prisma.service\",\n name: \"Prisma\"\n }),\n {...ctx, concurrent: false}\n )\n }\n ];\n }\n\n addScripts() {\n this.packageJson.addScripts({\n \"prisma:migrate\": \"npx prisma migrate dev --name init\",\n \"prisma:generate\": \"npx prisma generate\"\n });\n }\n\n addDependencies(ctx: InitCmdContext) {\n if (ctx.GH_TOKEN) {\n this.packageJson.addDependencies(\n {\n \"@tsedio/prisma\": \"1.1.1\"\n },\n ctx\n );\n }\n this.packageJson.addDependencies(\n {\n \"@prisma/client\": \"latest\"\n },\n ctx\n );\n }\n\n addDevDependencies(ctx: InitCmdContext) {\n this.packageJson.addDevDependencies({}, ctx);\n }\n}\n"]}
1
+ {"version":3,"file":"PrismaInitHook.js","sourceRoot":"","sources":["../../src/hooks/PrismaInitHook.ts"],"names":[],"mappings":";;;;AACA,6CAA8E;AAC9E,iCAAoC;AACpC,qDAAgD;AAGhD,IAAa,cAAc,GAA3B,MAAa,cAAc;IAWzB,KAAK,CAAC,MAAM,CAAC,GAAmB;QAC9B,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAE7B,OAAO;YACL;gBACE,KAAK,EAAE,wBAAwB;gBAC/B,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;aAClC;YACD;gBACE,KAAK,EAAE,0CAA0C;gBACjD,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE;aAC/C;SACF,CAAC;IACJ,CAAC;IAED,UAAU;QACR,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;YAC1B,gBAAgB,EAAE,oCAAoC;YACtD,iBAAiB,EAAE,qBAAqB;SACzC,CAAC,CAAC;IACL,CAAC;IAED,eAAe,CAAC,GAAmB;QACjC,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B;YACE,cAAc,EAAE,QAAQ;YACxB,gBAAgB,EAAE,QAAQ;SAC3B,EACD,GAAG,CACJ,CAAC;IACJ,CAAC;IAED,kBAAkB,CAAC,GAAmB;QACpC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC;CACF,CAAA;AA9CC;IADC,iBAAM,EAAE;sCACY,qBAAS;iDAAC;AAG/B;IADC,iBAAM,EAAE;sCACa,qBAAU;kDAAC;AAGjC;IADC,iBAAM,EAAE;sCACc,6BAAkB;mDAAC;AAG1C;IADC,iBAAM,CAAC,MAAM,CAAC;;;;4CAgBd;AA1BU,cAAc;IAD1B,eAAU,EAAE;GACA,cAAc,CAgD1B;AAhDY,wCAAc","sourcesContent":["import {InitCmdContext} from \"@tsed/cli\";\nimport {CliService, Inject, OnExec, ProjectPackageJson} from \"@tsed/cli-core\";\nimport {Injectable} from \"@tsed/di\";\nimport {CliPrisma} from \"../services/CliPrisma\";\n\n@Injectable()\nexport class PrismaInitHook {\n @Inject()\n protected cliPrisma: CliPrisma;\n\n @Inject()\n protected cliService: CliService;\n\n @Inject()\n protected packageJson: ProjectPackageJson;\n\n @OnExec(\"init\")\n async onExec(ctx: InitCmdContext) {\n this.addScripts();\n this.addDependencies(ctx);\n this.addDevDependencies(ctx);\n\n return [\n {\n title: \"Generate Prisma schema\",\n task: () => this.cliPrisma.init()\n },\n {\n title: \"Add Ts.ED configuration to Prisma schema\",\n task: () => this.cliPrisma.patchPrismaSchema()\n }\n ];\n }\n\n addScripts() {\n this.packageJson.addScripts({\n \"prisma:migrate\": \"npx prisma migrate dev --name init\",\n \"prisma:generate\": \"npx prisma generate\"\n });\n }\n\n addDependencies(ctx: InitCmdContext) {\n this.packageJson.addDependencies(\n {\n \"@tsed/prisma\": \"latest\",\n \"@prisma/client\": \"latest\"\n },\n ctx\n );\n }\n\n addDevDependencies(ctx: InitCmdContext) {\n this.packageJson.addDevDependencies({}, ctx);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/cli-plugin-prisma",
3
- "version": "3.17.2",
3
+ "version": "3.19.1",
4
4
  "main": "./lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "description": "Ts.ED CLI plugin. Add Prisma project initialisation support.",
@@ -9,8 +9,8 @@
9
9
  "tslib": "2.3.1"
10
10
  },
11
11
  "devDependencies": {
12
- "@tsed/cli": "3.17.2",
13
- "@tsed/cli-core": "3.17.2"
12
+ "@tsed/cli": "3.19.1",
13
+ "@tsed/cli-core": "3.19.1"
14
14
  },
15
15
  "scripts": {
16
16
  "build": "tsc --build tsconfig.compile.json",