@xylabs/ts-scripts-yarn3 3.0.83 → 3.0.85
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/actions/lint.js +19 -2
- package/dist/actions/lint.js.map +1 -1
- package/dist/actions/lint.mjs +19 -2
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/package/compile/tscNoEmit.js +52 -13
- package/dist/actions/package/compile/tscNoEmit.js.map +1 -1
- package/dist/actions/package/compile/tscNoEmit.mjs +49 -14
- package/dist/actions/package/compile/tscNoEmit.mjs.map +1 -1
- package/dist/actions/package/compile/tscTypes.js +5 -2
- package/dist/actions/package/compile/tscTypes.js.map +1 -1
- package/dist/actions/package/compile/tscTypes.mjs +5 -2
- package/dist/actions/package/compile/tscTypes.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/lint.ts +21 -2
- package/src/actions/package/compile/tscNoEmit.ts +60 -14
- package/src/actions/package/compile/tscTypes.ts +5 -2
package/dist/actions/lint.js
CHANGED
|
@@ -36,6 +36,23 @@ module.exports = __toCommonJS(lint_exports);
|
|
|
36
36
|
var import_chalk = __toESM(require("chalk"));
|
|
37
37
|
var import_eslint = require("eslint");
|
|
38
38
|
var import_lib = require("../lib");
|
|
39
|
+
const dumpMessages = (lintResults) => {
|
|
40
|
+
const colors = ["white", "yellow", "red"];
|
|
41
|
+
const severity = ["none", "warning", "error"];
|
|
42
|
+
lintResults.forEach((lintResult) => {
|
|
43
|
+
if (lintResult.messages.length > 0) {
|
|
44
|
+
console.log(import_chalk.default.gray(`${lintResult.filePath}`));
|
|
45
|
+
lintResult.messages.forEach((message) => {
|
|
46
|
+
console.log(
|
|
47
|
+
import_chalk.default.gray(` ${message.line}:${message.column}`),
|
|
48
|
+
import_chalk.default[colors[message.severity]](` ${severity[message.severity]}`),
|
|
49
|
+
import_chalk.default.white(` ${message.message}`),
|
|
50
|
+
import_chalk.default.gray(` ${message.ruleId}`)
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
39
56
|
const lintPackage = async ({ pkg }) => {
|
|
40
57
|
const workspace = (0, import_lib.yarnWorkspaces)().find((workspace2) => workspace2.name === pkg);
|
|
41
58
|
if (!workspace) {
|
|
@@ -44,14 +61,14 @@ const lintPackage = async ({ pkg }) => {
|
|
|
44
61
|
}
|
|
45
62
|
const engine = new import_eslint.ESLint({ cache: true });
|
|
46
63
|
const lintResults = await engine.lintFiles(workspace.location);
|
|
47
|
-
|
|
64
|
+
dumpMessages(lintResults);
|
|
48
65
|
const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
49
66
|
return errorCount;
|
|
50
67
|
};
|
|
51
68
|
const lintAll = async () => {
|
|
52
69
|
const engine = new import_eslint.ESLint({ cache: true });
|
|
53
70
|
const lintResults = await engine.lintFiles("./**/*.*");
|
|
54
|
-
|
|
71
|
+
dumpMessages(lintResults);
|
|
55
72
|
const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
56
73
|
return errorCount;
|
|
57
74
|
};
|
package/dist/actions/lint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/lint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find((workspace) => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/actions/lint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n lintResults.forEach((lintResult) => {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n lintResult.messages.forEach((message) => {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n })\n }\n })\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find((workspace) => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n\n return errorCount\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n\n return errorCount\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,oBAAuB;AAEvB,iBAAyC;AAYzC,MAAM,eAAe,CAAC,gBAAqC;AACzD,QAAM,SAAyC,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B,QAAM,aAAa,YAAY,OAAO,CAAC,MAAM,eAAe,OAAO,WAAW,YAAY,CAAC;AAE3F,SAAO;AACT;AAEO,MAAM,OAAO,OAAO,EAAE,IAAI,IAAgB,CAAC,MAAM;AACtD,SAAO,MAAM,MAAM,YAAY,EAAE,IAAI,CAAC,QAAI,qBAAS,sBAAsB,CAAC,CAAC,QAAQ,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC;AACjH;","names":["chalk","workspace"]}
|
package/dist/actions/lint.mjs
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { ESLint } from "eslint";
|
|
3
3
|
import { runSteps, yarnWorkspaces } from "../lib";
|
|
4
|
+
const dumpMessages = (lintResults) => {
|
|
5
|
+
const colors = ["white", "yellow", "red"];
|
|
6
|
+
const severity = ["none", "warning", "error"];
|
|
7
|
+
lintResults.forEach((lintResult) => {
|
|
8
|
+
if (lintResult.messages.length > 0) {
|
|
9
|
+
console.log(chalk.gray(`${lintResult.filePath}`));
|
|
10
|
+
lintResult.messages.forEach((message) => {
|
|
11
|
+
console.log(
|
|
12
|
+
chalk.gray(` ${message.line}:${message.column}`),
|
|
13
|
+
chalk[colors[message.severity]](` ${severity[message.severity]}`),
|
|
14
|
+
chalk.white(` ${message.message}`),
|
|
15
|
+
chalk.gray(` ${message.ruleId}`)
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
4
21
|
const lintPackage = async ({ pkg }) => {
|
|
5
22
|
const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
|
|
6
23
|
if (!workspace) {
|
|
@@ -9,14 +26,14 @@ const lintPackage = async ({ pkg }) => {
|
|
|
9
26
|
}
|
|
10
27
|
const engine = new ESLint({ cache: true });
|
|
11
28
|
const lintResults = await engine.lintFiles(workspace.location);
|
|
12
|
-
|
|
29
|
+
dumpMessages(lintResults);
|
|
13
30
|
const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
14
31
|
return errorCount;
|
|
15
32
|
};
|
|
16
33
|
const lintAll = async () => {
|
|
17
34
|
const engine = new ESLint({ cache: true });
|
|
18
35
|
const lintResults = await engine.lintFiles("./**/*.*");
|
|
19
|
-
|
|
36
|
+
dumpMessages(lintResults);
|
|
20
37
|
const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
21
38
|
return errorCount;
|
|
22
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/lint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find((workspace) => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/actions/lint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n lintResults.forEach((lintResult) => {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n lintResult.messages.forEach((message) => {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n })\n }\n })\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find((workspace) => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n\n return errorCount\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n\n return errorCount\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,cAAc;AAEvB,SAAS,UAAU,sBAAsB;AAYzC,MAAM,eAAe,CAAC,gBAAqC;AACzD,QAAM,SAAyC,CAAC,SAAS,UAAU,KAAK;AACxE,QAAM,WAAqB,CAAC,QAAQ,WAAW,OAAO;AAEtD,cAAY,QAAQ,CAAC,eAAe;AAClC,QAAI,WAAW,SAAS,SAAS,GAAG;AAClC,cAAQ,IAAI,MAAM,KAAK,GAAG,WAAW,QAAQ,EAAE,CAAC;AAChD,iBAAW,SAAS,QAAQ,CAAC,YAAY;AACvC,gBAAQ;AAAA,UACN,MAAM,KAAK,IAAK,QAAQ,IAAI,IAAI,QAAQ,MAAM,EAAE;AAAA,UAChD,MAAM,OAAO,QAAQ,QAAQ,CAAC,EAAE,IAAK,SAAS,QAAQ,QAAQ,CAAC,EAAE;AAAA,UACjE,MAAM,MAAM,IAAK,QAAQ,OAAO,EAAE;AAAA,UAClC,MAAM,KAAK,IAAK,QAAQ,MAAM,EAAE;AAAA,QAClC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;AAEO,MAAM,cAAc,OAAO,EAAE,IAAI,MAAkB;AACxD,QAAM,YAAY,eAAe,EAAE,KAAK,CAACA,eAAcA,WAAU,SAAS,GAAG;AAC7E,MAAI,CAAC,WAAW;AACd,YAAQ,MAAM,MAAM,IAAI,6BAA6B,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC;AAC3E,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,SAAS,IAAI,OAAO,EAAE,OAAO,KAAK,CAAC;AAEzC,QAAM,cAAc,MAAM,OAAO,UAAU,UAAU,QAAQ;AAE7D,eAAa,WAAW;AAExB,QAAM,aAAa,YAAY,OAAO,CAAC,MAAM,eAAe,OAAO,WAAW,YAAY,CAAC;AAE3F,SAAO;AACT;AAEO,MAAM,UAAU,YAAY;AACjC,QAAM,SAAS,IAAI,OAAO,EAAE,OAAO,KAAK,CAAC;AAEzC,QAAM,cAAc,MAAM,OAAO,UAAU,UAAU;AAErD,eAAa,WAAW;AAExB,QAAM,aAAa,YAAY,OAAO,CAAC,MAAM,eAAe,OAAO,WAAW,YAAY,CAAC;AAE3F,SAAO;AACT;AAEO,MAAM,OAAO,OAAO,EAAE,IAAI,IAAgB,CAAC,MAAM;AACtD,SAAO,MAAM,MAAM,YAAY,EAAE,IAAI,CAAC,IAAI,SAAS,sBAAsB,CAAC,CAAC,QAAQ,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC;AACjH;","names":["workspace"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,35 +17,72 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var tscNoEmit_exports = {};
|
|
20
30
|
__export(tscNoEmit_exports, {
|
|
21
31
|
packageCompileTscNoEmit: () => packageCompileTscNoEmit
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(tscNoEmit_exports);
|
|
34
|
+
var import_chalk = __toESM(require("chalk"));
|
|
24
35
|
var import_process = require("process");
|
|
25
|
-
var import_tsc_prog = require("tsc-prog");
|
|
26
36
|
var import_typescript = require("typescript");
|
|
27
37
|
var import_getCompilerOptions = require("./getCompilerOptions");
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
var import_inputs = require("./inputs");
|
|
39
|
+
const packageCompileTscNoEmit = (params, compilerOptionsParam) => {
|
|
40
|
+
const pkg = process.env.INIT_CWD ?? (0, import_process.cwd)();
|
|
41
|
+
const formatHost = {
|
|
42
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
43
|
+
getCurrentDirectory: () => pkg,
|
|
44
|
+
getNewLine: () => "\n"
|
|
45
|
+
};
|
|
30
46
|
if (params == null ? void 0 : params.verbose) {
|
|
31
47
|
console.log(`Compiling with NoEmit TSC [${pkg}]`);
|
|
32
48
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
49
|
+
const options = {
|
|
50
|
+
...(0, import_getCompilerOptions.getCompilerOptions)({
|
|
51
|
+
alwaysStrict: true,
|
|
52
|
+
baseUrl: pkg,
|
|
36
53
|
declaration: false,
|
|
37
54
|
declarationMap: false,
|
|
38
|
-
|
|
55
|
+
emitDeclarationOnly: false,
|
|
39
56
|
noEmit: true,
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
outDir: "dist",
|
|
58
|
+
rootDir: "src",
|
|
59
|
+
skipDefaultLibCheck: true,
|
|
60
|
+
skipLibCheck: true,
|
|
61
|
+
sourceMap: false,
|
|
62
|
+
strict: true,
|
|
63
|
+
strictBindCallApply: true,
|
|
64
|
+
strictFunctionTypes: true,
|
|
65
|
+
strictNullChecks: true,
|
|
66
|
+
strictPropertyInitialization: true
|
|
42
67
|
}),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
68
|
+
...compilerOptionsParam ?? {}
|
|
69
|
+
};
|
|
70
|
+
delete options["moduleResolution"];
|
|
71
|
+
const rootNames = (0, import_inputs.getAllInputs2)(options.rootDir ?? "src");
|
|
72
|
+
const programOptions = {
|
|
73
|
+
options,
|
|
74
|
+
rootNames
|
|
75
|
+
};
|
|
76
|
+
const program = (0, import_typescript.createProgram)(programOptions);
|
|
77
|
+
console.log(`noEmit-Program: [${pkg ?? (0, import_process.cwd)()}] ${JSON.stringify(program.getSourceFiles().length, null, 2)}`);
|
|
78
|
+
const results = (0, import_typescript.getPreEmitDiagnostics)(program);
|
|
79
|
+
results.forEach((diag) => {
|
|
80
|
+
var _a;
|
|
81
|
+
const lineAndChar = diag.file ? (0, import_typescript.getLineAndCharacterOfPosition)(diag.file, diag.start ?? 0) : { character: 0, line: 0 };
|
|
82
|
+
console.log(import_chalk.default.cyan(`${pkg}/${(_a = diag.file) == null ? void 0 : _a.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`));
|
|
83
|
+
console.log((0, import_typescript.formatDiagnosticsWithColorAndContext)([diag], formatHost));
|
|
84
|
+
});
|
|
85
|
+
return results.reduce((prev, diag) => prev + diag.category === import_typescript.DiagnosticCategory.Error ? 1 : 0, 0);
|
|
47
86
|
};
|
|
48
87
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
88
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tscNoEmit.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscNoEmit.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cwd } from 'process'\nimport {\n CompilerOptions,\n createProgram,\n CreateProgramOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { getCompilerOptions } from './getCompilerOptions'\nimport { getAllInputs2 } from './inputs'\n\nexport const packageCompileTscNoEmit = (params?: CompileParams, compilerOptionsParam?: CompilerOptions): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (params?.verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const options: CompilerOptions = {\n ...getCompilerOptions({\n alwaysStrict: true,\n baseUrl: pkg,\n declaration: false,\n declarationMap: false,\n emitDeclarationOnly: false,\n noEmit: true,\n outDir: 'dist',\n rootDir: 'src',\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n strict: true,\n strictBindCallApply: true,\n strictFunctionTypes: true,\n strictNullChecks: true,\n strictPropertyInitialization: true,\n }),\n ...(compilerOptionsParam ?? {}),\n }\n\n delete options['moduleResolution']\n\n const rootNames = getAllInputs2(options.rootDir ?? 'src')\n\n const programOptions: CreateProgramOptions = {\n options,\n rootNames,\n }\n\n const program = createProgram(programOptions)\n\n console.log(`noEmit-Program: [${pkg ?? cwd()}] ${JSON.stringify(program.getSourceFiles().length, null, 2)}`)\n\n const results = getPreEmitDiagnostics(program)\n\n results.forEach((diag) => {\n const lineAndChar: LineAndCharacter = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 }\n console.log(chalk.cyan(`${pkg}/${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n })\n\n return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,qBAAoB;AACpB,wBAUO;AAGP,gCAAmC;AACnC,oBAA8B;AAEvB,MAAM,0BAA0B,CAAC,QAAwB,yBAAmD;AACjH,QAAM,MAAM,QAAQ,IAAI,gBAAY,oBAAI;AAExC,QAAM,aAAoC;AAAA,IACxC,sBAAsB,CAAC,aAAa;AAAA,IACpC,qBAAqB,MAAM;AAAA,IAC3B,YAAY,MAAM;AAAA,EACpB;AAEA,MAAI,iCAAQ,SAAS;AACnB,YAAQ,IAAI,8BAA8B,GAAG,GAAG;AAAA,EAClD;AAEA,QAAM,UAA2B;AAAA,IAC/B,OAAG,8CAAmB;AAAA,MACpB,cAAc;AAAA,MACd,SAAS;AAAA,MACT,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,qBAAqB;AAAA,MACrB,cAAc;AAAA,MACd,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,qBAAqB;AAAA,MACrB,qBAAqB;AAAA,MACrB,kBAAkB;AAAA,MAClB,8BAA8B;AAAA,IAChC,CAAC;AAAA,IACD,GAAI,wBAAwB,CAAC;AAAA,EAC/B;AAEA,SAAO,QAAQ,kBAAkB;AAEjC,QAAM,gBAAY,6BAAc,QAAQ,WAAW,KAAK;AAExD,QAAM,iBAAuC;AAAA,IAC3C;AAAA,IACA;AAAA,EACF;AAEA,QAAM,cAAU,iCAAc,cAAc;AAE5C,UAAQ,IAAI,oBAAoB,WAAO,oBAAI,CAAC,KAAK,KAAK,UAAU,QAAQ,eAAe,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE;AAE3G,QAAM,cAAU,yCAAsB,OAAO;AAE7C,UAAQ,QAAQ,CAAC,SAAS;AApE5B;AAqEI,UAAM,cAAgC,KAAK,WAAO,iDAA8B,KAAK,MAAM,KAAK,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,EAAE;AACtI,YAAQ,IAAI,aAAAA,QAAM,KAAK,GAAG,GAAG,KAAI,UAAK,SAAL,mBAAW,QAAQ,IAAI,YAAY,OAAO,CAAC,IAAI,YAAY,YAAY,CAAC,EAAE,CAAC;AAC5G,YAAQ,QAAI,wDAAqC,CAAC,IAAI,GAAG,UAAU,CAAC;AAAA,EACtE,CAAC;AAED,SAAO,QAAQ,OAAO,CAAC,MAAM,SAAU,OAAO,KAAK,aAAa,qCAAmB,QAAQ,IAAI,GAAI,CAAC;AACtG;","names":["chalk"]}
|
|
@@ -1,26 +1,61 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
1
2
|
import { cwd } from "process";
|
|
2
|
-
import {
|
|
3
|
-
|
|
3
|
+
import {
|
|
4
|
+
createProgram,
|
|
5
|
+
DiagnosticCategory,
|
|
6
|
+
formatDiagnosticsWithColorAndContext,
|
|
7
|
+
getLineAndCharacterOfPosition,
|
|
8
|
+
getPreEmitDiagnostics
|
|
9
|
+
} from "typescript";
|
|
4
10
|
import { getCompilerOptions } from "./getCompilerOptions";
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
import { getAllInputs2 } from "./inputs";
|
|
12
|
+
const packageCompileTscNoEmit = (params, compilerOptionsParam) => {
|
|
13
|
+
const pkg = process.env.INIT_CWD ?? cwd();
|
|
14
|
+
const formatHost = {
|
|
15
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
16
|
+
getCurrentDirectory: () => pkg,
|
|
17
|
+
getNewLine: () => "\n"
|
|
18
|
+
};
|
|
7
19
|
if (params == null ? void 0 : params.verbose) {
|
|
8
20
|
console.log(`Compiling with NoEmit TSC [${pkg}]`);
|
|
9
21
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
const options = {
|
|
23
|
+
...getCompilerOptions({
|
|
24
|
+
alwaysStrict: true,
|
|
25
|
+
baseUrl: pkg,
|
|
13
26
|
declaration: false,
|
|
14
27
|
declarationMap: false,
|
|
15
|
-
|
|
28
|
+
emitDeclarationOnly: false,
|
|
16
29
|
noEmit: true,
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
outDir: "dist",
|
|
31
|
+
rootDir: "src",
|
|
32
|
+
skipDefaultLibCheck: true,
|
|
33
|
+
skipLibCheck: true,
|
|
34
|
+
sourceMap: false,
|
|
35
|
+
strict: true,
|
|
36
|
+
strictBindCallApply: true,
|
|
37
|
+
strictFunctionTypes: true,
|
|
38
|
+
strictNullChecks: true,
|
|
39
|
+
strictPropertyInitialization: true
|
|
19
40
|
}),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
41
|
+
...compilerOptionsParam ?? {}
|
|
42
|
+
};
|
|
43
|
+
delete options["moduleResolution"];
|
|
44
|
+
const rootNames = getAllInputs2(options.rootDir ?? "src");
|
|
45
|
+
const programOptions = {
|
|
46
|
+
options,
|
|
47
|
+
rootNames
|
|
48
|
+
};
|
|
49
|
+
const program = createProgram(programOptions);
|
|
50
|
+
console.log(`noEmit-Program: [${pkg ?? cwd()}] ${JSON.stringify(program.getSourceFiles().length, null, 2)}`);
|
|
51
|
+
const results = getPreEmitDiagnostics(program);
|
|
52
|
+
results.forEach((diag) => {
|
|
53
|
+
var _a;
|
|
54
|
+
const lineAndChar = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 };
|
|
55
|
+
console.log(chalk.cyan(`${pkg}/${(_a = diag.file) == null ? void 0 : _a.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`));
|
|
56
|
+
console.log(formatDiagnosticsWithColorAndContext([diag], formatHost));
|
|
57
|
+
});
|
|
58
|
+
return results.reduce((prev, diag) => prev + diag.category === DiagnosticCategory.Error ? 1 : 0, 0);
|
|
24
59
|
};
|
|
25
60
|
export {
|
|
26
61
|
packageCompileTscNoEmit
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tscNoEmit.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscNoEmit.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cwd } from 'process'\nimport {\n CompilerOptions,\n createProgram,\n CreateProgramOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { getCompilerOptions } from './getCompilerOptions'\nimport { getAllInputs2 } from './inputs'\n\nexport const packageCompileTscNoEmit = (params?: CompileParams, compilerOptionsParam?: CompilerOptions): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (params?.verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const options: CompilerOptions = {\n ...getCompilerOptions({\n alwaysStrict: true,\n baseUrl: pkg,\n declaration: false,\n declarationMap: false,\n emitDeclarationOnly: false,\n noEmit: true,\n outDir: 'dist',\n rootDir: 'src',\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n strict: true,\n strictBindCallApply: true,\n strictFunctionTypes: true,\n strictNullChecks: true,\n strictPropertyInitialization: true,\n }),\n ...(compilerOptionsParam ?? {}),\n }\n\n delete options['moduleResolution']\n\n const rootNames = getAllInputs2(options.rootDir ?? 'src')\n\n const programOptions: CreateProgramOptions = {\n options,\n rootNames,\n }\n\n const program = createProgram(programOptions)\n\n console.log(`noEmit-Program: [${pkg ?? cwd()}] ${JSON.stringify(program.getSourceFiles().length, null, 2)}`)\n\n const results = getPreEmitDiagnostics(program)\n\n results.forEach((diag) => {\n const lineAndChar: LineAndCharacter = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 }\n console.log(chalk.cyan(`${pkg}/${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n })\n\n return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,WAAW;AACpB;AAAA,EAEE;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAGP,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAEvB,MAAM,0BAA0B,CAAC,QAAwB,yBAAmD;AACjH,QAAM,MAAM,QAAQ,IAAI,YAAY,IAAI;AAExC,QAAM,aAAoC;AAAA,IACxC,sBAAsB,CAAC,aAAa;AAAA,IACpC,qBAAqB,MAAM;AAAA,IAC3B,YAAY,MAAM;AAAA,EACpB;AAEA,MAAI,iCAAQ,SAAS;AACnB,YAAQ,IAAI,8BAA8B,GAAG,GAAG;AAAA,EAClD;AAEA,QAAM,UAA2B;AAAA,IAC/B,GAAG,mBAAmB;AAAA,MACpB,c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ptions = require("./getCompilerOptions");
|
|
40
40
|
const packageCompileTscTypes = async (params, compilerOptionsParam, generateMts = true) => {
|
|
41
|
-
const pkg = process.env.INIT_CWD;
|
|
41
|
+
const pkg = process.env.INIT_CWD ?? (0, import_process.cwd)();
|
|
42
42
|
if (params == null ? void 0 : params.verbose) {
|
|
43
43
|
console.log(`Compiling types with TSC [${pkg}]`);
|
|
44
44
|
}
|
|
45
45
|
const compilerOptions = {
|
|
46
46
|
...(0, import_getCompilerOptions.getCompilerOptions)({
|
|
47
|
+
baseUrl: pkg,
|
|
47
48
|
declaration: true,
|
|
48
49
|
declarationMap: true,
|
|
49
50
|
emitDeclarationOnly: true,
|
|
50
51
|
esModuleInterop: true,
|
|
51
52
|
outDir: "dist",
|
|
53
|
+
rootDir: "src",
|
|
54
|
+
skipDefaultLibCheck: true,
|
|
52
55
|
skipLibCheck: true,
|
|
53
56
|
sourceMap: true
|
|
54
57
|
}),
|
|
@@ -60,7 +63,7 @@ const packageCompileTscTypes = async (params, compilerOptionsParam, generateMts
|
|
|
60
63
|
exclude: ["dist", "docs", "**/*.spec.*", "**/*.stories.*", "src/**/spec/**/*"],
|
|
61
64
|
include: ["src"]
|
|
62
65
|
}).emit();
|
|
63
|
-
const diagResults = result.diagnostics.
|
|
66
|
+
const diagResults = result.diagnostics.length;
|
|
64
67
|
result.diagnostics.forEach((diag) => {
|
|
65
68
|
var _a, _b, _c;
|
|
66
69
|
switch (diag.category) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { copyTypeFiles } from './copyTypeFiles'\nimport { getCompilerOptions } from './getCompilerOptions'\n\nexport const packageCompileTscTypes = async (params?: CompileParams, compilerOptionsParam?: CompilerOptions, generateMts = true): Promise<number> => {\n const pkg = process.env.INIT_CWD\n\n if (params?.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...getCompilerOptions({\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n skipLibCheck: true,\n sourceMap: true,\n }),\n ...(compilerOptionsParam ?? {}),\n } as TsConfigCompilerOptions\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n const diagResults = result.diagnostics.
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { copyTypeFiles } from './copyTypeFiles'\nimport { getCompilerOptions } from './getCompilerOptions'\n\nexport const packageCompileTscTypes = async (params?: CompileParams, compilerOptionsParam?: CompilerOptions, generateMts = true): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (params?.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...getCompilerOptions({\n baseUrl: pkg,\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n rootDir: 'src',\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: true,\n }),\n ...(compilerOptionsParam ?? {}),\n } as TsConfigCompilerOptions\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n const diagResults = result.diagnostics.length\n result.diagnostics.forEach((diag) => {\n switch (diag.category) {\n case DiagnosticCategory.Error:\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n case DiagnosticCategory.Warning:\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n case DiagnosticCategory.Suggestion:\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n })\n if (generateMts) {\n await copyTypeFiles(compilerOptions)\n }\n return diagResults\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,qBAAoB;AACpB,sBAAiE;AACjE,wBAAoD;AAGpD,2BAA8B;AAC9B,gCAAmC;AAE5B,MAAM,yBAAyB,OAAO,QAAwB,sBAAwC,cAAc,SAA0B;AACnJ,QAAM,MAAM,QAAQ,IAAI,gBAAY,oBAAI;AAExC,MAAI,iCAAQ,SAAS;AACnB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,kBAAkB;AAAA,IACtB,OAAG,8CAAmB;AAAA,MACpB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,qBAAqB;AAAA,MACrB,cAAc;AAAA,MACd,WAAW;AAAA,IACb,CAAC;AAAA,IACD,GAAI,wBAAwB,CAAC;AAAA,EAC/B;AAEA,QAAM,aAAS,yCAAwB;AAAA,IACrC,UAAU,WAAO,oBAAI;AAAA,IACrB;AAAA,IACA,SAAS,CAAC,QAAQ,QAAQ,eAAe,kBAAkB,kBAAkB;AAAA,IAC7E,SAAS,CAAC,KAAK;AAAA,EACjB,CAAC,EAAE,KAAK;AAER,QAAM,cAAc,OAAO,YAAY;AACvC,SAAO,YAAY,QAAQ,CAAC,SAAS;AAxCvC;AAyCI,YAAQ,KAAK,UAAU;AAAA,MACrB,KAAK,qCAAmB;AACtB,gBAAQ,MAAM,aAAAA,QAAM,IAAI,KAAK,WAAW,CAAC;AACzC,gBAAQ,MAAM,aAAAA,QAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,aAAAA,QAAM,MAAK,UAAK,SAAL,mBAAW,QAAQ,CAAC;AAC7C;AAAA,MACF,KAAK,qCAAmB;AACtB,gBAAQ,MAAM,aAAAA,QAAM,OAAO,KAAK,WAAW,CAAC;AAC5C,gBAAQ,MAAM,aAAAA,QAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,aAAAA,QAAM,MAAK,UAAK,SAAL,mBAAW,QAAQ,CAAC;AAC7C;AAAA,MACF,KAAK,qCAAmB;AACtB,gBAAQ,MAAM,aAAAA,QAAM,MAAM,KAAK,WAAW,CAAC;AAC3C,gBAAQ,MAAM,aAAAA,QAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,aAAAA,QAAM,MAAK,UAAK,SAAL,mBAAW,QAAQ,CAAC;AAC7C;AAAA,IACJ;AAAA,EACF,CAAC;AACD,MAAI,aAAa;AACf,cAAM,oCAAc,eAAe;AAAA,EACrC;AACA,SAAO;AACT;","names":["chalk"]}
|
|
@@ -5,17 +5,20 @@ import { DiagnosticCategory } from "typescript";
|
|
|
5
5
|
import { copyTypeFiles } from "./copyTypeFiles";
|
|
6
6
|
import { getCompilerOptions } from "./getCompilerOptions";
|
|
7
7
|
const packageCompileTscTypes = async (params, compilerOptionsParam, generateMts = true) => {
|
|
8
|
-
const pkg = process.env.INIT_CWD;
|
|
8
|
+
const pkg = process.env.INIT_CWD ?? cwd();
|
|
9
9
|
if (params == null ? void 0 : params.verbose) {
|
|
10
10
|
console.log(`Compiling types with TSC [${pkg}]`);
|
|
11
11
|
}
|
|
12
12
|
const compilerOptions = {
|
|
13
13
|
...getCompilerOptions({
|
|
14
|
+
baseUrl: pkg,
|
|
14
15
|
declaration: true,
|
|
15
16
|
declarationMap: true,
|
|
16
17
|
emitDeclarationOnly: true,
|
|
17
18
|
esModuleInterop: true,
|
|
18
19
|
outDir: "dist",
|
|
20
|
+
rootDir: "src",
|
|
21
|
+
skipDefaultLibCheck: true,
|
|
19
22
|
skipLibCheck: true,
|
|
20
23
|
sourceMap: true
|
|
21
24
|
}),
|
|
@@ -27,7 +30,7 @@ const packageCompileTscTypes = async (params, compilerOptionsParam, generateMts
|
|
|
27
30
|
exclude: ["dist", "docs", "**/*.spec.*", "**/*.stories.*", "src/**/spec/**/*"],
|
|
28
31
|
include: ["src"]
|
|
29
32
|
}).emit();
|
|
30
|
-
const diagResults = result.diagnostics.
|
|
33
|
+
const diagResults = result.diagnostics.length;
|
|
31
34
|
result.diagnostics.forEach((diag) => {
|
|
32
35
|
var _a, _b, _c;
|
|
33
36
|
switch (diag.category) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { copyTypeFiles } from './copyTypeFiles'\nimport { getCompilerOptions } from './getCompilerOptions'\n\nexport const packageCompileTscTypes = async (params?: CompileParams, compilerOptionsParam?: CompilerOptions, generateMts = true): Promise<number> => {\n const pkg = process.env.INIT_CWD\n\n if (params?.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...getCompilerOptions({\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n skipLibCheck: true,\n sourceMap: true,\n }),\n ...(compilerOptionsParam ?? {}),\n } as TsConfigCompilerOptions\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n const diagResults = result.diagnostics.
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cwd } from 'process'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { CompileParams } from './CompileParams'\nimport { copyTypeFiles } from './copyTypeFiles'\nimport { getCompilerOptions } from './getCompilerOptions'\n\nexport const packageCompileTscTypes = async (params?: CompileParams, compilerOptionsParam?: CompilerOptions, generateMts = true): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (params?.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...getCompilerOptions({\n baseUrl: pkg,\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n rootDir: 'src',\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: true,\n }),\n ...(compilerOptionsParam ?? {}),\n } as TsConfigCompilerOptions\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n }).emit()\n\n const diagResults = result.diagnostics.length\n result.diagnostics.forEach((diag) => {\n switch (diag.category) {\n case DiagnosticCategory.Error:\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n case DiagnosticCategory.Warning:\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n case DiagnosticCategory.Suggestion:\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n })\n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MAAM,MAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,MAAM,MAAK,UAAK,SAAL,mBAAW,QAAQ,CAAC;AAC7C;AAAA,MACF,KAAK,mBAAmB;AACtB,gBAAQ,MAAM,MAAM,MAAM,KAAK,WAAW,CAAC;AAC3C,gBAAQ,MAAM,MAAM,KAAK,GAAG,CAAC;AAC7B,gBAAQ,MAAM,MAAM,MAAK,UAAK,SAAL,mBAAW,QAAQ,CAAC;AAC7C;AAAA,IACJ;AAAA,EACF,CAAC;AACD,MAAI,aAAa;AACf,UAAM,cAAc,eAAe;AAAA,EACrC;AACA,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@types/yargs": "^17.0.26",
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
|
68
68
|
"@typescript-eslint/parser": "^6.7.3",
|
|
69
|
-
"@xylabs/tsconfig": "~3.0.
|
|
69
|
+
"@xylabs/tsconfig": "~3.0.85",
|
|
70
70
|
"chalk": "^4.1.2",
|
|
71
71
|
"cosmiconfig": "^8.3.6",
|
|
72
72
|
"cpy": "^8.1.2",
|
|
@@ -111,8 +111,8 @@
|
|
|
111
111
|
"@types/license-checker": "^25.0.4",
|
|
112
112
|
"@types/lodash": "^4.14.199",
|
|
113
113
|
"@types/parse-git-config": "^3.0.2",
|
|
114
|
-
"@xylabs/eslint-config": "^3.0.
|
|
115
|
-
"@xylabs/tsconfig": "^3.0.
|
|
114
|
+
"@xylabs/eslint-config": "^3.0.85",
|
|
115
|
+
"@xylabs/tsconfig": "^3.0.85",
|
|
116
116
|
"publint": "^0.2.3",
|
|
117
117
|
"typescript": "^5.2.2"
|
|
118
118
|
},
|
|
@@ -171,5 +171,5 @@
|
|
|
171
171
|
"package-clean": "echo Not cleaning..."
|
|
172
172
|
},
|
|
173
173
|
"sideEffects": false,
|
|
174
|
-
"version": "3.0.
|
|
174
|
+
"version": "3.0.85"
|
|
175
175
|
}
|
package/src/actions/lint.ts
CHANGED
|
@@ -13,6 +13,25 @@ export interface LintPackageParams {
|
|
|
13
13
|
verbose?: boolean
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
const dumpMessages = (lintResults: ESLint.LintResult[]) => {
|
|
17
|
+
const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']
|
|
18
|
+
const severity: string[] = ['none', 'warning', 'error']
|
|
19
|
+
|
|
20
|
+
lintResults.forEach((lintResult) => {
|
|
21
|
+
if (lintResult.messages.length > 0) {
|
|
22
|
+
console.log(chalk.gray(`${lintResult.filePath}`))
|
|
23
|
+
lintResult.messages.forEach((message) => {
|
|
24
|
+
console.log(
|
|
25
|
+
chalk.gray(`\t${message.line}:${message.column}`),
|
|
26
|
+
chalk[colors[message.severity]](`\t${severity[message.severity]}`),
|
|
27
|
+
chalk.white(`\t${message.message}`),
|
|
28
|
+
chalk.gray(`\t${message.ruleId}`),
|
|
29
|
+
)
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
export const lintPackage = async ({ pkg }: LintParams) => {
|
|
17
36
|
const workspace = yarnWorkspaces().find((workspace) => workspace.name === pkg)
|
|
18
37
|
if (!workspace) {
|
|
@@ -24,7 +43,7 @@ export const lintPackage = async ({ pkg }: LintParams) => {
|
|
|
24
43
|
|
|
25
44
|
const lintResults = await engine.lintFiles(workspace.location)
|
|
26
45
|
|
|
27
|
-
|
|
46
|
+
dumpMessages(lintResults)
|
|
28
47
|
|
|
29
48
|
const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)
|
|
30
49
|
|
|
@@ -36,7 +55,7 @@ export const lintAll = async () => {
|
|
|
36
55
|
|
|
37
56
|
const lintResults = await engine.lintFiles('./**/*.*')
|
|
38
57
|
|
|
39
|
-
|
|
58
|
+
dumpMessages(lintResults)
|
|
40
59
|
|
|
41
60
|
const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)
|
|
42
61
|
|
|
@@ -1,30 +1,76 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
1
2
|
import { cwd } from 'process'
|
|
2
|
-
import {
|
|
3
|
-
|
|
3
|
+
import {
|
|
4
|
+
CompilerOptions,
|
|
5
|
+
createProgram,
|
|
6
|
+
CreateProgramOptions,
|
|
7
|
+
DiagnosticCategory,
|
|
8
|
+
FormatDiagnosticsHost,
|
|
9
|
+
formatDiagnosticsWithColorAndContext,
|
|
10
|
+
getLineAndCharacterOfPosition,
|
|
11
|
+
getPreEmitDiagnostics,
|
|
12
|
+
LineAndCharacter,
|
|
13
|
+
} from 'typescript'
|
|
4
14
|
|
|
5
15
|
import { CompileParams } from './CompileParams'
|
|
6
16
|
import { getCompilerOptions } from './getCompilerOptions'
|
|
17
|
+
import { getAllInputs2 } from './inputs'
|
|
7
18
|
|
|
8
|
-
export const packageCompileTscNoEmit = (params?: CompileParams): number => {
|
|
9
|
-
const pkg = process.env.INIT_CWD
|
|
19
|
+
export const packageCompileTscNoEmit = (params?: CompileParams, compilerOptionsParam?: CompilerOptions): number => {
|
|
20
|
+
const pkg = process.env.INIT_CWD ?? cwd()
|
|
21
|
+
|
|
22
|
+
const formatHost: FormatDiagnosticsHost = {
|
|
23
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
24
|
+
getCurrentDirectory: () => pkg,
|
|
25
|
+
getNewLine: () => '\n',
|
|
26
|
+
}
|
|
10
27
|
|
|
11
28
|
if (params?.verbose) {
|
|
12
29
|
console.log(`Compiling with NoEmit TSC [${pkg}]`)
|
|
13
30
|
}
|
|
14
31
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
32
|
+
const options: CompilerOptions = {
|
|
33
|
+
...getCompilerOptions({
|
|
34
|
+
alwaysStrict: true,
|
|
35
|
+
baseUrl: pkg,
|
|
18
36
|
declaration: false,
|
|
19
37
|
declarationMap: false,
|
|
20
|
-
|
|
38
|
+
emitDeclarationOnly: false,
|
|
21
39
|
noEmit: true,
|
|
22
|
-
|
|
40
|
+
outDir: 'dist',
|
|
41
|
+
rootDir: 'src',
|
|
42
|
+
skipDefaultLibCheck: true,
|
|
43
|
+
skipLibCheck: true,
|
|
23
44
|
sourceMap: false,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
45
|
+
strict: true,
|
|
46
|
+
strictBindCallApply: true,
|
|
47
|
+
strictFunctionTypes: true,
|
|
48
|
+
strictNullChecks: true,
|
|
49
|
+
strictPropertyInitialization: true,
|
|
50
|
+
}),
|
|
51
|
+
...(compilerOptionsParam ?? {}),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
delete options['moduleResolution']
|
|
55
|
+
|
|
56
|
+
const rootNames = getAllInputs2(options.rootDir ?? 'src')
|
|
57
|
+
|
|
58
|
+
const programOptions: CreateProgramOptions = {
|
|
59
|
+
options,
|
|
60
|
+
rootNames,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const program = createProgram(programOptions)
|
|
64
|
+
|
|
65
|
+
console.log(`noEmit-Program: [${pkg ?? cwd()}] ${JSON.stringify(program.getSourceFiles().length, null, 2)}`)
|
|
66
|
+
|
|
67
|
+
const results = getPreEmitDiagnostics(program)
|
|
68
|
+
|
|
69
|
+
results.forEach((diag) => {
|
|
70
|
+
const lineAndChar: LineAndCharacter = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 }
|
|
71
|
+
console.log(chalk.cyan(`${pkg}/${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))
|
|
72
|
+
console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))
|
|
73
|
+
})
|
|
28
74
|
|
|
29
|
-
return
|
|
75
|
+
return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0)
|
|
30
76
|
}
|
|
@@ -8,7 +8,7 @@ import { copyTypeFiles } from './copyTypeFiles'
|
|
|
8
8
|
import { getCompilerOptions } from './getCompilerOptions'
|
|
9
9
|
|
|
10
10
|
export const packageCompileTscTypes = async (params?: CompileParams, compilerOptionsParam?: CompilerOptions, generateMts = true): Promise<number> => {
|
|
11
|
-
const pkg = process.env.INIT_CWD
|
|
11
|
+
const pkg = process.env.INIT_CWD ?? cwd()
|
|
12
12
|
|
|
13
13
|
if (params?.verbose) {
|
|
14
14
|
console.log(`Compiling types with TSC [${pkg}]`)
|
|
@@ -16,11 +16,14 @@ export const packageCompileTscTypes = async (params?: CompileParams, compilerOpt
|
|
|
16
16
|
|
|
17
17
|
const compilerOptions = {
|
|
18
18
|
...getCompilerOptions({
|
|
19
|
+
baseUrl: pkg,
|
|
19
20
|
declaration: true,
|
|
20
21
|
declarationMap: true,
|
|
21
22
|
emitDeclarationOnly: true,
|
|
22
23
|
esModuleInterop: true,
|
|
23
24
|
outDir: 'dist',
|
|
25
|
+
rootDir: 'src',
|
|
26
|
+
skipDefaultLibCheck: true,
|
|
24
27
|
skipLibCheck: true,
|
|
25
28
|
sourceMap: true,
|
|
26
29
|
}),
|
|
@@ -34,7 +37,7 @@ export const packageCompileTscTypes = async (params?: CompileParams, compilerOpt
|
|
|
34
37
|
include: ['src'],
|
|
35
38
|
}).emit()
|
|
36
39
|
|
|
37
|
-
const diagResults = result.diagnostics.
|
|
40
|
+
const diagResults = result.diagnostics.length
|
|
38
41
|
result.diagnostics.forEach((diag) => {
|
|
39
42
|
switch (diag.category) {
|
|
40
43
|
case DiagnosticCategory.Error:
|