@kitschpatrol/typescript-config 5.2.0 → 5.3.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/bin/cli.js +42 -15
- package/package.json +1 -1
- package/readme.md +6 -0
package/bin/cli.js
CHANGED
|
@@ -1978,11 +1978,11 @@ var parser = new YargsParser({
|
|
|
1978
1978
|
resolve: resolve2,
|
|
1979
1979
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
1980
1980
|
// we can exercise all the lines below:
|
|
1981
|
-
require: (
|
|
1981
|
+
require: (path5) => {
|
|
1982
1982
|
if (typeof __require !== "undefined") {
|
|
1983
|
-
return __require(
|
|
1984
|
-
} else if (
|
|
1985
|
-
return JSON.parse(readFileSync(
|
|
1983
|
+
return __require(path5);
|
|
1984
|
+
} else if (path5.match(/\.json$/)) {
|
|
1985
|
+
return JSON.parse(readFileSync(path5, "utf8"));
|
|
1986
1986
|
} else {
|
|
1987
1987
|
throw Error("only .json config files are supported in ESM");
|
|
1988
1988
|
}
|
|
@@ -5552,7 +5552,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
5552
5552
|
var yargs_default = Yargs;
|
|
5553
5553
|
|
|
5554
5554
|
// ../../package.json
|
|
5555
|
-
var version = "5.
|
|
5555
|
+
var version = "5.3.1";
|
|
5556
5556
|
|
|
5557
5557
|
// ../../src/execa-utilities.ts
|
|
5558
5558
|
function isErrorExecaError(error) {
|
|
@@ -5565,7 +5565,7 @@ import jsonColorizer from "@pinojs/json-colorizer";
|
|
|
5565
5565
|
// ../../node_modules/.pnpm/decircular@1.0.0/node_modules/decircular/index.js
|
|
5566
5566
|
function decircular(object) {
|
|
5567
5567
|
const seenObjects = /* @__PURE__ */ new WeakMap();
|
|
5568
|
-
function internalDecircular(value,
|
|
5568
|
+
function internalDecircular(value, path5 = []) {
|
|
5569
5569
|
if (!(value !== null && typeof value === "object")) {
|
|
5570
5570
|
return value;
|
|
5571
5571
|
}
|
|
@@ -5573,10 +5573,10 @@ function decircular(object) {
|
|
|
5573
5573
|
if (existingPath) {
|
|
5574
5574
|
return `[Circular *${existingPath.join(".")}]`;
|
|
5575
5575
|
}
|
|
5576
|
-
seenObjects.set(value,
|
|
5576
|
+
seenObjects.set(value, path5);
|
|
5577
5577
|
const newValue = Array.isArray(value) ? [] : {};
|
|
5578
5578
|
for (const [key2, value2] of Object.entries(value)) {
|
|
5579
|
-
newValue[key2] = internalDecircular(value2, [...
|
|
5579
|
+
newValue[key2] = internalDecircular(value2, [...path5, key2]);
|
|
5580
5580
|
}
|
|
5581
5581
|
seenObjects.delete(value);
|
|
5582
5582
|
return newValue;
|
|
@@ -6167,19 +6167,46 @@ var DESCRIPTION = {
|
|
|
6167
6167
|
};
|
|
6168
6168
|
|
|
6169
6169
|
// src/command.ts
|
|
6170
|
+
import fse3 from "fs-extra";
|
|
6171
|
+
import path4 from "node:path";
|
|
6172
|
+
async function isSvelteProject() {
|
|
6173
|
+
const packageDirectory = getPackageDirectory();
|
|
6174
|
+
const svelteConfigFiles = ["svelte.config.js", "svelte.config.mjs", "svelte.config.cjs"];
|
|
6175
|
+
const fileChecks = svelteConfigFiles.map(
|
|
6176
|
+
async (configFile) => fse3.exists(path4.join(packageDirectory, configFile))
|
|
6177
|
+
);
|
|
6178
|
+
const results = await Promise.all(fileChecks);
|
|
6179
|
+
return results.some(Boolean);
|
|
6180
|
+
}
|
|
6181
|
+
async function printSvelteWarningCommand(logStream) {
|
|
6182
|
+
logStream.write(
|
|
6183
|
+
"Skipping `tsc` since this is a Svelte project. Consider running `svelte-check` instead.\n"
|
|
6184
|
+
);
|
|
6185
|
+
return 0;
|
|
6186
|
+
}
|
|
6187
|
+
async function generateTypeScriptLintCommand() {
|
|
6188
|
+
return await isSvelteProject() ? [
|
|
6189
|
+
{
|
|
6190
|
+
execute: printSvelteWarningCommand,
|
|
6191
|
+
name: printSvelteWarningCommand.name
|
|
6192
|
+
}
|
|
6193
|
+
] : [
|
|
6194
|
+
{
|
|
6195
|
+
cwdOverride: "package-dir",
|
|
6196
|
+
name: "tsc",
|
|
6197
|
+
optionFlags: ["--noEmit"]
|
|
6198
|
+
}
|
|
6199
|
+
];
|
|
6200
|
+
}
|
|
6170
6201
|
var commandDefinition = {
|
|
6171
6202
|
commands: {
|
|
6172
6203
|
init: {
|
|
6173
6204
|
locationOptionFlag: false
|
|
6174
6205
|
},
|
|
6175
6206
|
lint: {
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
name: "tsc",
|
|
6180
|
-
optionFlags: ["--noEmit"]
|
|
6181
|
-
}
|
|
6182
|
-
],
|
|
6207
|
+
// Needs some special logic since tsc doesn't really work in Svelte projects
|
|
6208
|
+
// See https://github.com/sveltejs/language-tools/issues/2527
|
|
6209
|
+
commands: await generateTypeScriptLintCommand(),
|
|
6183
6210
|
// TODO confirm monorepo behavior
|
|
6184
6211
|
description: `Run type checking on your project. ${DESCRIPTION.packageRun} ${DESCRIPTION.monorepoRun}`,
|
|
6185
6212
|
positionalArgumentMode: "none"
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -173,6 +173,12 @@ kpi-typescript print-config
|
|
|
173
173
|
|
|
174
174
|
## Notes
|
|
175
175
|
|
|
176
|
+
### Svelte caveat
|
|
177
|
+
|
|
178
|
+
The `kpi-typescript lint` command will detect whether it's running in a Svelte project, and treat `lint` as a no-op when that's the case.
|
|
179
|
+
|
|
180
|
+
This is necessary to prevent unactionable warnings because Svelte [doesn't play well](https://github.com/sveltejs/language-tools/issues/2527) with the underlying TypeScript `tsc` command.
|
|
181
|
+
|
|
176
182
|
### General
|
|
177
183
|
|
|
178
184
|
- [tsconfig Cheat Sheet](https://www.totaltypescript.com/tsconfig-cheat-sheet)
|