@xylabs/ts-scripts-yarn3 7.1.7 → 7.2.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/actions/deplint/checkPackage/checkPackage.mjs +12 -1
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +12 -1
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +12 -1
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +12 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +14 -2
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +12 -1
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +1 -1
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/index.mjs +39 -23
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +1 -1
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/relint.mjs +26 -21
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +39 -23
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +39 -23
- package/dist/index.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +1 -1
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/index.mjs.map +1 -1
- package/dist/xy/index.mjs +39 -23
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +39 -23
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +1 -1
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +38 -22
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +19 -19
package/dist/index.d.ts
CHANGED
|
@@ -371,6 +371,8 @@ declare const recompileAll: ({ jobs, verbose, target, incremental, }: RecompileP
|
|
|
371
371
|
declare const reinstall: () => number;
|
|
372
372
|
|
|
373
373
|
interface RelintParams {
|
|
374
|
+
cache?: boolean;
|
|
375
|
+
fix?: boolean;
|
|
374
376
|
incremental?: boolean;
|
|
375
377
|
pkg?: string;
|
|
376
378
|
verbose?: boolean;
|
|
@@ -379,9 +381,9 @@ interface RelintPackageParams {
|
|
|
379
381
|
pkg: string;
|
|
380
382
|
verbose?: boolean;
|
|
381
383
|
}
|
|
382
|
-
declare const relintPackage: ({ pkg }: RelintParams & Required<Pick<RelintParams, "pkg">>) => number;
|
|
383
|
-
declare const relint: ({ pkg, verbose, incremental, }?: RelintParams) => number;
|
|
384
|
-
declare const relintAllPackages: ({
|
|
384
|
+
declare const relintPackage: ({ pkg, fix, verbose, }: RelintParams & Required<Pick<RelintParams, "pkg">>) => number;
|
|
385
|
+
declare const relint: ({ pkg, verbose, incremental, fix, }?: RelintParams) => number;
|
|
386
|
+
declare const relintAllPackages: ({ fix }?: RelintParams) => number;
|
|
385
387
|
|
|
386
388
|
declare const retest: () => number;
|
|
387
389
|
|
package/dist/index.mjs
CHANGED
|
@@ -329,7 +329,7 @@ var INIT_CWD = () => {
|
|
|
329
329
|
|
|
330
330
|
// src/lib/generateIgnoreFiles.ts
|
|
331
331
|
var localeCompare = (a, b) => a.localeCompare(b);
|
|
332
|
-
var mergeEntries = (a, b) => [...union(a, b)].
|
|
332
|
+
var mergeEntries = (a, b) => [...union(a, b)].toSorted(localeCompare);
|
|
333
333
|
var generateIgnoreFiles = (filename3, pkg) => {
|
|
334
334
|
console.log(chalk4.green(`Generate ${filename3} Files`));
|
|
335
335
|
const cwd5 = INIT_CWD() ?? ".";
|
|
@@ -744,6 +744,17 @@ function getBasePackageName(importName) {
|
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
// src/actions/deplint/getImportsFromFile.ts
|
|
747
|
+
function isTypeOnlyImportClause(clause) {
|
|
748
|
+
if (clause === void 0) {
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
if ("phaseModifier" in clause) {
|
|
752
|
+
const mod = clause.phaseModifier;
|
|
753
|
+
const kind = typeof mod === "number" ? mod : mod?.kind;
|
|
754
|
+
return kind === ts.SyntaxKind.TypeKeyword;
|
|
755
|
+
}
|
|
756
|
+
return clause.isTypeOnly;
|
|
757
|
+
}
|
|
747
758
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
748
759
|
const sourceCode = fs3.readFileSync(filePath, "utf8");
|
|
749
760
|
const isMjsFile = filePath.endsWith(".mjs");
|
|
@@ -760,7 +771,7 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
760
771
|
function visit(node) {
|
|
761
772
|
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
762
773
|
const moduleSpecifier = node.moduleSpecifier?.getFullText();
|
|
763
|
-
const isTypeImport = ts.isImportDeclaration(node) ? node.importClause
|
|
774
|
+
const isTypeImport = ts.isImportDeclaration(node) ? isTypeOnlyImportClause(node.importClause) : false;
|
|
764
775
|
if (typeof moduleSpecifier === "string") {
|
|
765
776
|
const trimmed = moduleSpecifier.replaceAll("'", "").replaceAll('"', "").trim();
|
|
766
777
|
if (isTypeImport || isDeclarationFile) {
|
|
@@ -2217,43 +2228,48 @@ var reinstall = () => {
|
|
|
2217
2228
|
|
|
2218
2229
|
// src/actions/relint.ts
|
|
2219
2230
|
import chalk35 from "chalk";
|
|
2220
|
-
var relintPackage = ({
|
|
2221
|
-
|
|
2231
|
+
var relintPackage = ({
|
|
2232
|
+
pkg,
|
|
2233
|
+
fix: fix2,
|
|
2234
|
+
verbose
|
|
2235
|
+
}) => {
|
|
2236
|
+
console.log(chalk35.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2222
2237
|
const start = Date.now();
|
|
2223
|
-
const result = runSteps("
|
|
2238
|
+
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2224
2239
|
["yarn", [
|
|
2225
2240
|
"workspace",
|
|
2226
2241
|
pkg,
|
|
2227
2242
|
"run",
|
|
2228
|
-
"package-
|
|
2243
|
+
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2229
2244
|
]]
|
|
2230
2245
|
]);
|
|
2231
|
-
console.log(chalk35.gray(`${"
|
|
2246
|
+
console.log(chalk35.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
|
|
2232
2247
|
return result;
|
|
2233
2248
|
};
|
|
2234
2249
|
var relint = ({
|
|
2235
2250
|
pkg,
|
|
2236
2251
|
verbose,
|
|
2237
|
-
incremental
|
|
2252
|
+
incremental,
|
|
2253
|
+
fix: fix2
|
|
2238
2254
|
} = {}) => {
|
|
2239
|
-
return pkg
|
|
2255
|
+
return pkg === void 0 ? relintAllPackages({
|
|
2256
|
+
verbose,
|
|
2257
|
+
incremental,
|
|
2258
|
+
fix: fix2
|
|
2259
|
+
}) : relintPackage({
|
|
2260
|
+
pkg,
|
|
2261
|
+
fix: fix2,
|
|
2262
|
+
verbose
|
|
2263
|
+
});
|
|
2240
2264
|
};
|
|
2241
|
-
var relintAllPackages = ({
|
|
2242
|
-
console.log(chalk35.gray(`${"
|
|
2265
|
+
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2266
|
+
console.log(chalk35.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2243
2267
|
const start = Date.now();
|
|
2244
|
-
const
|
|
2245
|
-
const
|
|
2246
|
-
|
|
2247
|
-
["yarn", [
|
|
2248
|
-
"workspaces",
|
|
2249
|
-
"foreach",
|
|
2250
|
-
...verboseOptions,
|
|
2251
|
-
...incrementalOptions,
|
|
2252
|
-
"run",
|
|
2253
|
-
"package-relint"
|
|
2254
|
-
]]
|
|
2268
|
+
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2269
|
+
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2270
|
+
["yarn", ["eslint", ...fixOptions]]
|
|
2255
2271
|
]);
|
|
2256
|
-
console.log(chalk35.gray(
|
|
2272
|
+
console.log(chalk35.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
|
|
2257
2273
|
return result;
|
|
2258
2274
|
};
|
|
2259
2275
|
|