@player-tools/cli 0.5.2-next.1 → 0.5.2-next.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.
- package/dist/commands/dsl/compile.js +1 -2
- package/dist/commands/dsl/validate.js +23 -30
- package/package.json +13 -12
|
@@ -105,8 +105,7 @@ class DSLCompile extends base_command_1.BaseCommand {
|
|
|
105
105
|
catch (e) {
|
|
106
106
|
results.exitCode = 100;
|
|
107
107
|
this.log("");
|
|
108
|
-
this.log(chalk_1.default.red(`${log_symbols_1.default.error} Error compiling ${file}: ${e.
|
|
109
|
-
this.debug(e);
|
|
108
|
+
this.log(chalk_1.default.red(`${log_symbols_1.default.error} Error compiling ${file}: ${e.stack}`));
|
|
110
109
|
compilerResults.push({
|
|
111
110
|
state: "completed",
|
|
112
111
|
error: e,
|
|
@@ -4,6 +4,7 @@ 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
6
|
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
8
|
const ts = tslib_1.__importStar(require("typescript"));
|
|
8
9
|
const core_1 = require("@oclif/core");
|
|
9
10
|
const base_command_1 = require("../../utils/base-command");
|
|
@@ -22,46 +23,38 @@ class Validate extends base_command_1.BaseCommand {
|
|
|
22
23
|
inputFiles: Array.isArray(files) ? files : [files],
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
configFile = await fs_1.promises.readFile(EnvTSConfigPath);
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
this.warn("Error reading TypeScript configuration file, falling back to internal defaults");
|
|
26
|
+
getTSConfig(filePath) {
|
|
27
|
+
const configFileLocation = ts.findConfigFile(filePath ?? ".", (fName) => {
|
|
28
|
+
return (0, fs_1.existsSync)(fName);
|
|
29
|
+
});
|
|
30
|
+
if (!configFileLocation) {
|
|
31
|
+
this.debug(`No TSConfig found`);
|
|
36
32
|
return;
|
|
37
33
|
}
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
TSEnvConfig = {
|
|
48
|
-
...compilerOptions,
|
|
49
|
-
...configCompilerOpts,
|
|
50
|
-
};
|
|
34
|
+
const configContent = ts.readConfigFile(configFileLocation, (p) => {
|
|
35
|
+
return (0, fs_1.readFileSync)(p, "utf-8");
|
|
36
|
+
});
|
|
37
|
+
if (configContent.error) {
|
|
38
|
+
this.warn(ts.flattenDiagnosticMessageText(configContent.error.messageText, "\n"));
|
|
39
|
+
return;
|
|
51
40
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
const basePath = path_1.default.dirname(configFileLocation);
|
|
42
|
+
const parsedConfigContent = ts.parseJsonConfigFileContent(configContent.config, ts.sys, basePath);
|
|
43
|
+
if (parsedConfigContent.errors.length > 0) {
|
|
44
|
+
throw new Error(`Error while parsing tsconfig: ${parsedConfigContent.errors
|
|
45
|
+
.map((d) => {
|
|
46
|
+
return ts.flattenDiagnosticMessageText(d.messageText, "\n");
|
|
47
|
+
})
|
|
48
|
+
.join("\n\n")}`);
|
|
56
49
|
}
|
|
57
|
-
|
|
50
|
+
return parsedConfigContent.options;
|
|
58
51
|
}
|
|
59
52
|
async run() {
|
|
60
53
|
const { inputFiles } = await this.getOptions();
|
|
61
54
|
const files = await (0, globby_1.default)((0, fs_2.convertToFileGlob)(inputFiles, "**/*.(tsx|jsx|js|ts)"), {
|
|
62
55
|
expandDirectories: true,
|
|
63
56
|
});
|
|
64
|
-
const TSConfig =
|
|
57
|
+
const TSConfig = this.getTSConfig() ?? compiler_options_1.DEFAULT_COMPILER_OPTIONS;
|
|
65
58
|
const program = ts.createProgram(files, TSConfig);
|
|
66
59
|
const allDiagnostics = ts.getPreEmitDiagnostics(program);
|
|
67
60
|
let diagnosticsCount = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-tools/cli",
|
|
3
|
-
"version": "0.5.2-next.
|
|
3
|
+
"version": "0.5.2-next.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
"bin": "player",
|
|
13
13
|
"dirname": "player",
|
|
14
14
|
"topicSeparator": " ",
|
|
15
|
-
"commands": "dist/commands"
|
|
15
|
+
"commands": "dist/commands",
|
|
16
|
+
"plugins": [
|
|
17
|
+
"@oclif/plugin-plugins"
|
|
18
|
+
]
|
|
16
19
|
},
|
|
17
20
|
"bin": {
|
|
18
21
|
"player": "bin/run"
|
|
19
22
|
},
|
|
20
|
-
"plugins": [
|
|
21
|
-
"@oclif/plugin-plugins"
|
|
22
|
-
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@player-tools/dsl": "0.5.2-next.
|
|
25
|
-
"@player-tools/json-language-service": "0.5.2-next.
|
|
26
|
-
"@player-tools/xlr": "0.5.2-next.
|
|
27
|
-
"@player-tools/xlr-converters": "0.5.2-next.
|
|
28
|
-
"@player-tools/xlr-sdk": "0.5.2-next.
|
|
29
|
-
"@player-tools/xlr-utils": "0.5.2-next.
|
|
24
|
+
"@player-tools/dsl": "0.5.2-next.2",
|
|
25
|
+
"@player-tools/json-language-service": "0.5.2-next.2",
|
|
26
|
+
"@player-tools/xlr": "0.5.2-next.2",
|
|
27
|
+
"@player-tools/xlr-converters": "0.5.2-next.2",
|
|
28
|
+
"@player-tools/xlr-sdk": "0.5.2-next.2",
|
|
29
|
+
"@player-tools/xlr-utils": "0.5.2-next.2",
|
|
30
30
|
"react": "^18.2.0",
|
|
31
31
|
"tapable-ts": "^0.2.4",
|
|
32
32
|
"@babel/register": "^7.23.3",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@babel/plugin-transform-react-jsx-source": "^7.23.3",
|
|
37
37
|
"@oclif/core": "1.9.0",
|
|
38
38
|
"@oclif/plugin-legacy": "^1.2.7",
|
|
39
|
+
"@oclif/plugin-plugins": "^1.9.0",
|
|
39
40
|
"chalk": "^4.0.1",
|
|
40
41
|
"cosmiconfig": "^7.0.1",
|
|
41
42
|
"cross-fetch": "^3.0.5",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"mkdirp": "^1.0.4",
|
|
51
52
|
"vscode-languageserver-textdocument": "^1.0.1",
|
|
52
53
|
"vscode-languageserver-types": "^3.15.1",
|
|
53
|
-
"typescript": "4.
|
|
54
|
+
"typescript": "^5.4.4",
|
|
54
55
|
"tslib": "^2.6.2"
|
|
55
56
|
},
|
|
56
57
|
"sideEffects": false,
|