From 870b5e6945e5133af2acd59f8406a529ad47f112 Mon Sep 17 00:00:00 2001 From: Romain Lenzotti Date: Wed, 24 Jul 2024 18:49:17 +0200 Subject: [PATCH] fix(cli): fix require error issue related to update-notifier import Closes: #392 --- lerna.json | 1 + packages/cli/src/commands/add/AddCmd.ts | 5 +++-- packages/cli/src/commands/init/InitCmd.ts | 5 +++-- packages/cli/src/commands/update/UpdateCmd.ts | 5 +++-- packages/cli/tsconfig.json | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lerna.json b/lerna.json index ca5f3573d..efebebf85 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,6 @@ { "npmClient": "yarn", + "useWorkspaces": true, "packages": [ "packages/*" ], diff --git a/packages/cli/src/commands/add/AddCmd.ts b/packages/cli/src/commands/add/AddCmd.ts index 3345075d0..1ab3b95ce 100644 --- a/packages/cli/src/commands/add/AddCmd.ts +++ b/packages/cli/src/commands/add/AddCmd.ts @@ -7,7 +7,8 @@ import { createSubTasks, PackageManagersModule, ProjectPackageJson, - QuestionOptions + QuestionOptions, + Task } from "@tsed/cli-core"; export interface AddCmdOptions extends CliDefaultOptions { @@ -49,7 +50,7 @@ export class AddCmd implements CommandProvider { ]; } - $exec(ctx: AddCmdOptions) { + $exec(ctx: AddCmdOptions): Task[] { this.packageJson.addDevDependency(ctx.name, "latest"); return [ diff --git a/packages/cli/src/commands/init/InitCmd.ts b/packages/cli/src/commands/init/InitCmd.ts index cf7c9e5ac..4a604842b 100644 --- a/packages/cli/src/commands/init/InitCmd.ts +++ b/packages/cli/src/commands/init/InitCmd.ts @@ -15,7 +15,8 @@ import { PackageManagersModule, ProjectPackageJson, QuestionOptions, - RootRendererService + RootRendererService, + Task } from "@tsed/cli-core"; import {paramCase, pascalCase} from "change-case"; import {basename, join} from "path"; @@ -289,7 +290,7 @@ export class InitCmd implements CommandProvider { ); } - async $exec(ctx: InitCmdContext) { + async $exec(ctx: InitCmdContext): Promise { this.checkPrecondition(ctx); const subTasks = [ diff --git a/packages/cli/src/commands/update/UpdateCmd.ts b/packages/cli/src/commands/update/UpdateCmd.ts index d06ef62fb..128e9e571 100644 --- a/packages/cli/src/commands/update/UpdateCmd.ts +++ b/packages/cli/src/commands/update/UpdateCmd.ts @@ -8,7 +8,8 @@ import { NpmRegistryClient, PackageManagersModule, ProjectPackageJson, - QuestionOptions + QuestionOptions, + Task } from "@tsed/cli-core"; import {getValue} from "@tsed/core"; import semver from "semver"; @@ -70,7 +71,7 @@ export class UpdateCmd implements CommandProvider { ]; } - async $exec(ctx: UpdateCmdContext) { + async $exec(ctx: UpdateCmdContext): Promise { Object.keys(this.projectPackage.dependencies).forEach((pkg: string) => { if (shouldUpdate(pkg)) { this.projectPackage.addDependency(pkg, ctx.version); diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 3fea65865..acaac5714 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "baseUrl": ".", "module": "commonjs", + "moduleResolution": "Node16", "rootDir": "src", "outDir": "./lib/cjs", "declaration": true,