@player-tools/cli 0.5.1 → 0.5.2--canary.72.2116

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.
@@ -7,6 +7,7 @@ export default class Validate extends BaseCommand {
7
7
  config: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
8
  };
9
9
  private getOptions;
10
+ private getTSConfig;
10
11
  run(): Promise<void>;
11
12
  }
12
13
  //# sourceMappingURL=validate.d.ts.map
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const globby_1 = tslib_1.__importDefault(require("globby"));
5
5
  const log_symbols_1 = tslib_1.__importDefault(require("log-symbols"));
6
+ const fs_1 = require("fs");
6
7
  const ts = tslib_1.__importStar(require("typescript"));
7
8
  const core_1 = require("@oclif/core");
8
9
  const base_command_1 = require("../../utils/base-command");
9
- const fs_1 = require("../../utils/fs");
10
+ const fs_2 = require("../../utils/fs");
10
11
  const compiler_options_1 = require("../../utils/compiler-options");
11
12
  /** A command thay runs TS typechecker against source ts and tsx files */
12
13
  class Validate extends base_command_1.BaseCommand {
@@ -21,12 +22,34 @@ class Validate extends base_command_1.BaseCommand {
21
22
  inputFiles: Array.isArray(files) ? files : [files],
22
23
  };
23
24
  }
25
+ async getTSConfig() {
26
+ let TSEnvConfig, configFile;
27
+ const EnvTSConfig = globby_1.default.sync("./tsconfig.json")[0];
28
+ this.log(`Local Typesscript file found ${EnvTSConfig}`);
29
+ try {
30
+ configFile = await fs_1.promises.readFile(EnvTSConfig);
31
+ }
32
+ catch (e) {
33
+ this.log("Error reading the TypeScript configuration file.");
34
+ return;
35
+ }
36
+ const compilerConfigObject = configFile && JSON.parse(configFile.toString());
37
+ this.log(`Enviroment Typescript compiler configurations found: ${compilerConfigObject}`);
38
+ if (compilerConfigObject.CompilerOptions) {
39
+ TSEnvConfig = compilerConfigObject.CompilerOptions;
40
+ return TSEnvConfig;
41
+ }
42
+ else {
43
+ this.log("No compiler configuration found on tsconfig.json file");
44
+ }
45
+ }
24
46
  async run() {
25
47
  const { inputFiles } = await this.getOptions();
26
- const files = await (0, globby_1.default)((0, fs_1.convertToFileGlob)(inputFiles, "**/*.(tsx|jsx|js|ts)"), {
48
+ const files = await (0, globby_1.default)((0, fs_2.convertToFileGlob)(inputFiles, "**/*.(tsx|jsx|js|ts)"), {
27
49
  expandDirectories: true,
28
50
  });
29
- const program = ts.createProgram(files, compiler_options_1.DEFAULT_COMPILER_OPTIONS);
51
+ const TSConfig = (await this.getTSConfig()) || compiler_options_1.DEFAULT_COMPILER_OPTIONS;
52
+ const program = ts.createProgram(files, TSConfig);
30
53
  const allDiagnostics = ts.getPreEmitDiagnostics(program);
31
54
  let diagnosticsCount = 0;
32
55
  const groupedDiagnostics = allDiagnostics.reduce((acc, diagnostic) => {
@@ -55,7 +78,9 @@ class Validate extends base_command_1.BaseCommand {
55
78
  });
56
79
  });
57
80
  if (fileNameList.length) {
58
- this.log(`${diagnosticsCount} type or syntax errors found in ${fileNameList.length} file${fileNameList.length > 1 ? "s" : ""}, exiting program`);
81
+ this.log(`${diagnosticsCount} type or syntax errors found in
82
+ ${fileNameList.length}
83
+ file${fileNameList.length > 1 ? "s" : ""}, exiting program`);
59
84
  this.exit(1);
60
85
  }
61
86
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@player-tools/cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.2--canary.72.2116",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -21,12 +21,12 @@
21
21
  "@oclif/plugin-plugins"
22
22
  ],
23
23
  "dependencies": {
24
- "@player-tools/dsl": "0.5.1",
25
- "@player-tools/json-language-service": "0.5.1",
26
- "@player-tools/xlr": "0.5.1",
27
- "@player-tools/xlr-converters": "0.5.1",
28
- "@player-tools/xlr-sdk": "0.5.1",
29
- "@player-tools/xlr-utils": "0.5.1",
24
+ "@player-tools/dsl": "0.5.2--canary.72.2116",
25
+ "@player-tools/json-language-service": "0.5.2--canary.72.2116",
26
+ "@player-tools/xlr": "0.5.2--canary.72.2116",
27
+ "@player-tools/xlr-converters": "0.5.2--canary.72.2116",
28
+ "@player-tools/xlr-sdk": "0.5.2--canary.72.2116",
29
+ "@player-tools/xlr-utils": "0.5.2--canary.72.2116",
30
30
  "react": "^18.2.0",
31
31
  "tapable-ts": "^0.2.4",
32
32
  "@babel/register": "^7.23.3",