@hg-ts-config/typescript 0.0.1

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/build-dev.mjs ADDED
@@ -0,0 +1 @@
1
+ import 'tsc-watch';
package/build.mjs ADDED
@@ -0,0 +1,61 @@
1
+ import { fork } from 'node:child_process';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { readFile, rm } from 'node:fs/promises';
5
+
6
+ import glob from 'glob';
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const configPaths = glob.sync('tsconfig*(\\.?*)\\.json');
10
+
11
+ await Promise.all(configPaths.map(runTypescript));
12
+
13
+ /**
14
+ *
15
+ * @param {string} configPath
16
+ * @returns {Promise<{
17
+ * compilerOptions: {
18
+ * outDir: string;
19
+ * }
20
+ * }>}
21
+ */
22
+ async function getConfig(configPath) {
23
+ const configData = await readFile(configPath, 'utf8');
24
+
25
+ return JSON.parse(configData);
26
+ }
27
+
28
+ async function runTypescript(configPath) {
29
+ const config = await getConfig(configPath);
30
+
31
+ if (config.compilerOptions?.outDir) {
32
+ const distPath = resolve(config.compilerOptions?.outDir);
33
+
34
+ await rm(distPath, {
35
+ force: true,
36
+ recursive: true
37
+ });
38
+ }
39
+
40
+ const childProcess = fork(
41
+ resolve(__dirname, 'tsc.mjs'),
42
+ [
43
+ ...process.argv.slice(2),
44
+ '--project',
45
+ configPath,
46
+ ],
47
+ {
48
+ stdio: 'inherit'
49
+ },
50
+ );
51
+
52
+ return new Promise((resolve, reject) => {
53
+ childProcess.once('close', (code) => {
54
+ if (code === 0) {
55
+ resolve();
56
+ } else {
57
+ reject();
58
+ }
59
+ });
60
+ });
61
+ }
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@hg-ts-config/typescript",
3
+ "version": "0.0.1",
4
+ "main": "tsconfig.commonjs.json",
5
+ "module": "tsconfig.esm.json",
6
+ "repository": "git@gitlab.com:hyper-graph/framework.git",
7
+ "peerDependencies": {
8
+ "reflect-metadata": "*",
9
+ "tsc-watch": "*",
10
+ "tslib": "*",
11
+ "typescript": "*"
12
+ }
13
+ }
package/tsc.mjs ADDED
@@ -0,0 +1 @@
1
+ import 'typescript/lib/tsc.js';
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS"
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "ESNext"
5
+ }
6
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": false,
4
+ "allowSyntheticDefaultImports": true,
5
+ "allowUnreachableCode": false,
6
+ "allowUnusedLabels": false,
7
+ "alwaysStrict": true,
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+ "diagnostics": true,
11
+ "downlevelIteration": true,
12
+ "emitBOM": false,
13
+ "emitDecoratorMetadata": true,
14
+ "esModuleInterop": true,
15
+ "exactOptionalPropertyTypes": true,
16
+ "experimentalDecorators": true,
17
+ "extendedDiagnostics": true,
18
+ "forceConsistentCasingInFileNames": true,
19
+ "importHelpers": true,
20
+ "importsNotUsedAsValues": "error",
21
+ "moduleResolution": "node",
22
+ "newLine": "lf",
23
+ "noEmitHelpers": true,
24
+ "noEmitOnError": true,
25
+ "noErrorTruncation": true,
26
+ "noFallthroughCasesInSwitch": true,
27
+ "noImplicitAny": true,
28
+ "noImplicitOverride": true,
29
+ "noImplicitReturns": true,
30
+ "noImplicitThis": true,
31
+ "noPropertyAccessFromIndexSignature": true,
32
+ "noUncheckedIndexedAccess": true,
33
+ "noUnusedLocals": true,
34
+ "noUnusedParameters": true,
35
+ "preserveSymlinks": true,
36
+ "preserveValueImports": true,
37
+ "pretty": true
38
+ "removeComments": true,
39
+ "resolveJsonModule": true,
40
+ "sourceMap": true,
41
+ "strict": true,
42
+ "strictBindCallApply": true,
43
+ "strictFunctionTypes": true,
44
+ "strictNullChecks": true,
45
+ "strictPropertyInitialization": false,
46
+ "suppressImplicitAnyIndexErrors": true,
47
+ "target": "ESNext",
48
+ "useUnknownInCatchVariables": true,
49
+ }
50
+ }