@tsed/cli-core 6.0.4 → 6.1.2

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,7 +1,8 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { Inject, Injectable } from "@tsed/di";
1
+ import { __decorate } from "tslib";
2
+ import { inject, Injectable } from "@tsed/di";
3
3
  import { join } from "path";
4
4
  import { Observable } from "rxjs";
5
+ import { CliFs } from "../../services/CliFs.js";
5
6
  import { CliYaml } from "../../services/CliYaml.js";
6
7
  import { BaseManager } from "./BaseManager.js";
7
8
  let YarnBerryManager = class YarnBerryManager extends BaseManager {
@@ -9,10 +10,20 @@ let YarnBerryManager = class YarnBerryManager extends BaseManager {
9
10
  super(...arguments);
10
11
  this.name = "yarn_berry";
11
12
  this.cmd = "yarn";
13
+ this.verboseOpt = "";
14
+ this.cliYaml = inject(CliYaml);
15
+ this.fs = inject(CliFs);
12
16
  }
13
17
  async init(options) {
18
+ const lockFile = join(String(options.cwd), "yarn.lock");
19
+ if (!this.fs.exists(lockFile)) {
20
+ this.fs.writeFileSync(lockFile, "");
21
+ }
14
22
  // init yarn v1
15
- this.install(options);
23
+ try {
24
+ await this.install(options).toPromise();
25
+ }
26
+ catch (er) { }
16
27
  // then switch write file
17
28
  await this.cliYaml.write(join(String(options.cwd), ".yarnrc.yml"), {
18
29
  nodeLinker: "node-modules"
@@ -27,13 +38,9 @@ let YarnBerryManager = class YarnBerryManager extends BaseManager {
27
38
  return this.run("add", ["-D", ...deps], options);
28
39
  }
29
40
  install(options) {
30
- return this.run("install", [options.verbose && "--verbose"], options);
41
+ return this.run("install", [], options);
31
42
  }
32
43
  };
33
- __decorate([
34
- Inject(),
35
- __metadata("design:type", CliYaml)
36
- ], YarnBerryManager.prototype, "cliYaml", void 0);
37
44
  YarnBerryManager = __decorate([
38
45
  Injectable({
39
46
  type: "package:manager"
@@ -116,7 +116,9 @@ let ProjectPackageJson = class ProjectPackageJson {
116
116
  addDevDependencies(modules, scope = {}) {
117
117
  const replacer = (match, key) => getValue(key, scope);
118
118
  Object.entries(modules).forEach(([pkg, version]) => {
119
- this.addDevDependency(pkg, (version || "").replace(/{{([\w.]+)}}/gi, replacer));
119
+ if (!this.dependencies[pkg]) {
120
+ this.addDevDependency(pkg, (version || "").replace(/{{([\w.]+)}}/gi, replacer));
121
+ }
120
122
  });
121
123
  return this;
122
124
  }
@@ -1,10 +1,13 @@
1
1
  import { Observable } from "rxjs";
2
+ import { CliFs } from "../../services/CliFs.js";
2
3
  import { CliYaml } from "../../services/CliYaml.js";
3
4
  import { BaseManager, type ManagerCmdOpts } from "./BaseManager.js";
4
5
  export declare class YarnBerryManager extends BaseManager {
5
6
  readonly name = "yarn_berry";
6
7
  readonly cmd = "yarn";
8
+ protected verboseOpt: string;
7
9
  protected cliYaml: CliYaml;
10
+ protected fs: CliFs;
8
11
  init(options: ManagerCmdOpts): Promise<void>;
9
12
  add(deps: string[], options: ManagerCmdOpts): Observable<any>;
10
13
  addDev(deps: string[], options: ManagerCmdOpts): Observable<any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsed/cli-core",
3
3
  "description": "Build your CLI with TypeScript and Decorators",
4
- "version": "6.0.4",
4
+ "version": "6.1.2",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "source": "./src/index.ts",
@@ -66,7 +66,7 @@
66
66
  "uuid": "^10.0.0"
67
67
  },
68
68
  "devDependencies": {
69
- "@tsed/typescript": "6.0.4",
69
+ "@tsed/typescript": "6.1.2",
70
70
  "@types/commander": "2.12.2",
71
71
  "@types/consolidate": "0.14.4",
72
72
  "@types/figures": "3.0.1",