@player-tools/cli 0.5.2--canary.72.2116 → 0.5.2-next.0

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.
@@ -22,33 +22,46 @@ class Validate extends base_command_1.BaseCommand {
22
22
  inputFiles: Array.isArray(files) ? files : [files],
23
23
  };
24
24
  }
25
- async getTSConfig() {
25
+ async getTSConfig(filePath, compilerOptions = {}) {
26
26
  let TSEnvConfig, configFile;
27
- const EnvTSConfig = globby_1.default.sync("./tsconfig.json")[0];
28
- this.log(`Local Typesscript file found ${EnvTSConfig}`);
27
+ const EnvTSConfigPath = filePath
28
+ ? filePath
29
+ : globby_1.default.sync("./tsconfig.json")[0];
30
+ this.log(`Loading TypeScript config from path ${EnvTSConfigPath}`);
29
31
  try {
30
- configFile = await fs_1.promises.readFile(EnvTSConfig);
32
+ configFile = await fs_1.promises.readFile(EnvTSConfigPath);
31
33
  }
32
34
  catch (e) {
33
- this.log("Error reading the TypeScript configuration file.");
35
+ this.warn("Error reading TypeScript configuration file, falling back to internal defaults");
34
36
  return;
35
37
  }
36
38
  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;
39
+ const configCompilerOpts = compilerConfigObject?.compilerOptions || {};
40
+ if (compilerConfigObject.extends) {
41
+ TSEnvConfig = await this.getTSConfig(compilerConfigObject.extends, {
42
+ ...compilerOptions,
43
+ ...configCompilerOpts,
44
+ });
41
45
  }
42
46
  else {
43
- this.log("No compiler configuration found on tsconfig.json file");
47
+ TSEnvConfig = {
48
+ ...compilerOptions,
49
+ ...configCompilerOpts,
50
+ };
51
+ }
52
+ if (TSEnvConfig && Object.keys(TSEnvConfig).length > 0) {
53
+ if (!compilerConfigObject.extends)
54
+ this.debug(`Final effective config: ${JSON.stringify(TSEnvConfig, null, 4)}`);
55
+ return TSEnvConfig;
44
56
  }
57
+ this.log(`No local TypeScript compiler configuration could be found, falling back to internal defaults`);
45
58
  }
46
59
  async run() {
47
60
  const { inputFiles } = await this.getOptions();
48
61
  const files = await (0, globby_1.default)((0, fs_2.convertToFileGlob)(inputFiles, "**/*.(tsx|jsx|js|ts)"), {
49
62
  expandDirectories: true,
50
63
  });
51
- const TSConfig = (await this.getTSConfig()) || compiler_options_1.DEFAULT_COMPILER_OPTIONS;
64
+ const TSConfig = (await this.getTSConfig()) ?? compiler_options_1.DEFAULT_COMPILER_OPTIONS;
52
65
  const program = ts.createProgram(files, TSConfig);
53
66
  const allDiagnostics = ts.getPreEmitDiagnostics(program);
54
67
  let diagnosticsCount = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@player-tools/cli",
3
- "version": "0.5.2--canary.72.2116",
3
+ "version": "0.5.2-next.0",
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.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",
24
+ "@player-tools/dsl": "0.5.2-next.0",
25
+ "@player-tools/json-language-service": "0.5.2-next.0",
26
+ "@player-tools/xlr": "0.5.2-next.0",
27
+ "@player-tools/xlr-converters": "0.5.2-next.0",
28
+ "@player-tools/xlr-sdk": "0.5.2-next.0",
29
+ "@player-tools/xlr-utils": "0.5.2-next.0",
30
30
  "react": "^18.2.0",
31
31
  "tapable-ts": "^0.2.4",
32
32
  "@babel/register": "^7.23.3",