@cmmn/tools 1.9.7 → 1.9.9

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.
@@ -0,0 +1,19 @@
1
+ import ts from "typescript";
2
+
3
+ export function getTSConfig(directory = process.cwd()) {
4
+ const configPath = ts.findConfigFile(directory, ts.sys.fileExists, 'tsconfig.json');
5
+ const readConfigFileResult = ts.readConfigFile(configPath, ts.sys.readFile);
6
+ if (readConfigFileResult.error) {
7
+ throw readConfigFileResult.error;
8
+ }
9
+ return readConfigFileResult.config;
10
+ }
11
+
12
+ export function getTSCompilerOptions(directory = process.cwd()) {
13
+ const jsonConfig = getTSConfig(directory);
14
+ const convertResult = ts.convertCompilerOptionsFromJson(jsonConfig.compilerOptions, './');
15
+ if (convertResult.errors && convertResult.errors.length > 0) {
16
+ throw convertResult.errors;
17
+ }
18
+ return convertResult.options;
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmmn/tools",
3
- "version": "1.9.7",
3
+ "version": "1.9.9",
4
4
  "description": "Compilation, bundling, code generator, testing.",
5
5
  "main": "dist/rollup.config.js",
6
6
  "type": "module",
@@ -10,7 +10,6 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "scripts": {},
14
13
  "bin": {
15
14
  "cmmn": "bin.js"
16
15
  },
@@ -38,7 +37,8 @@
38
37
  "serve/*",
39
38
  "plugins/*",
40
39
  "spawn/*",
41
- "test/*"
40
+ "test/*",
41
+ "helpers/*"
42
42
  ],
43
43
  "dependencies": {
44
44
  "@jest/globals": "27.x.x",
@@ -63,5 +63,6 @@
63
63
  },
64
64
  "author": "",
65
65
  "license": "ISC",
66
- "gitHead": "2755b333808bf97f1d9454601c2a2c9a88e4a021"
67
- }
66
+ "gitHead": "2755b333808bf97f1d9454601c2a2c9a88e4a021",
67
+ "scripts": {}
68
+ }