@tsed/cli 6.1.8 → 6.1.10-rc.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.
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { register } from "node:module";
3
+ import { join } from "node:path";
3
4
  import { fileURLToPath, pathToFileURL } from "node:url";
4
5
  const EXT = process.env.CLI_MODE === "ts" ? "ts" : "js";
5
- register(pathToFileURL(`${import.meta.dirname}/../loaders/alias.hook.${EXT}`), {
6
+ register(pathToFileURL(join(import.meta.dirname, `../loaders/alias.hook.${EXT}`)), {
6
7
  parentURL: import.meta.dirname,
7
8
  data: {
8
9
  "@tsed/core": fileURLToPath(import.meta.resolve("@tsed/core")),
@@ -1,10 +1,10 @@
1
1
  var GenerateCmd_1;
2
2
  import { __decorate, __metadata } from "tslib";
3
- import { Command, Inject, inject, ProjectPackageJson, SrcRendererService } from "@tsed/cli-core";
3
+ import { basename, dirname, join } from "node:path";
4
+ import { Command, Inject, ProjectPackageJson, SrcRendererService } from "@tsed/cli-core";
4
5
  import { normalizePath } from "@tsed/normalize-path";
5
6
  import { kebabCase, pascalCase } from "change-case";
6
7
  import { globbySync } from "globby";
7
- import { basename, dirname, join } from "path";
8
8
  import { ProjectConvention } from "../../interfaces/ProjectConvention.js";
9
9
  import { ClassNamePipe } from "../../pipes/ClassNamePipe.js";
10
10
  import { OutputFilePathPipe } from "../../pipes/OutputFilePathPipe.js";
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
+ import { basename, join } from "node:path";
2
3
  import { CliExeca, CliFs, CliLoadFile, cliPackageJson, CliPlugins, CliService, Command, Configuration, createSubTasks, createTasksRunner, inject, PackageManager, PackageManagersModule, ProjectPackageJson, RootRendererService } from "@tsed/cli-core";
3
4
  import { kebabCase, pascalCase } from "change-case";
4
- import { basename, join } from "path";
5
5
  import { DEFAULT_TSED_TAGS } from "../../constants/index.js";
6
6
  import { ArchitectureConvention } from "../../interfaces/ArchitectureConvention.js";
7
7
  import { PlatformType } from "../../interfaces/index.js";
@@ -213,6 +213,13 @@ let InitCmd = class InitCmd {
213
213
  }
214
214
  addScripts(ctx) {
215
215
  this.packageJson.addScripts(this.runtimes.scripts(ctx));
216
+ if (ctx.eslint || ctx.testing) {
217
+ const runtime = this.runtimes.get();
218
+ const scripts = {
219
+ test: [ctx.eslint && runtime.run("test:lint"), ctx.testing && runtime.run("test:coverage")].filter(Boolean).join("&&")
220
+ };
221
+ this.packageJson.addScripts(scripts);
222
+ }
216
223
  }
217
224
  addDependencies(ctx) {
218
225
  this.packageJson.addDependencies({
@@ -1,4 +1,4 @@
1
- import { dirname, join } from "path";
1
+ import { dirname, join } from "node:path";
2
2
  import { readPackageUpSync } from "read-pkg-up";
3
3
  const { path, packageJson } = readPackageUpSync({
4
4
  cwd: join(import.meta.dirname, "..", "..")
@@ -2,6 +2,7 @@ import generateAliasesResolver from "esm-module-alias";
2
2
  let resolver = null;
3
3
  export async function initialize(aliases) {
4
4
  // Receives data from `register`.
5
+ console.debug("Initializing alias hook with aliases", aliases);
5
6
  resolver = generateAliasesResolver(aliases);
6
7
  }
7
8
  export function resolve(specifier, context, nextResolve) {
@@ -1,8 +1,8 @@
1
1
  import { __decorate } from "tslib";
2
+ import { basename } from "node:path";
2
3
  import { ProjectPackageJson } from "@tsed/cli-core";
3
4
  import { inject, Injectable } from "@tsed/di";
4
5
  import { kebabCase, pascalCase } from "change-case";
5
- import { basename } from "path";
6
6
  import { ProjectConvention } from "../interfaces/ProjectConvention.js";
7
7
  import { ProvidersInfoService } from "../services/ProvidersInfoService.js";
8
8
  let ClassNamePipe = class ClassNamePipe {
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
+ import { dirname, join } from "node:path";
2
3
  import { inject, Injectable, ProjectPackageJson } from "@tsed/cli-core";
3
4
  import { Inject } from "@tsed/di";
4
- import { dirname, join } from "path";
5
5
  import { ArchitectureConvention, ProjectConvention } from "../interfaces/index.js";
6
6
  import { ProvidersInfoService } from "../services/ProvidersInfoService.js";
7
7
  import { ClassNamePipe } from "./ClassNamePipe.js";
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
+ import { dirname } from "node:path";
2
3
  import { Injectable } from "@tsed/di";
3
- import { dirname } from "path";
4
4
  import { NodeRuntime } from "./NodeRuntime.js";
5
5
  let BabelRuntime = class BabelRuntime extends NodeRuntime {
6
6
  constructor() {
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
+ import { dirname } from "node:path";
2
3
  import { Injectable } from "@tsed/di";
3
- import { dirname } from "path";
4
4
  import { BabelRuntime } from "./BabelRuntime.js";
5
5
  let WebpackRuntime = class WebpackRuntime extends BabelRuntime {
6
6
  constructor() {