@xylabs/toolchain 7.10.1 → 7.10.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/index.mjs +162 -30
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/XyConfig.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/packman/index.mjs +270 -112
- package/dist/actions/packman/index.mjs.map +1 -1
- package/dist/actions/packman/lint.mjs +203 -36
- package/dist/actions/packman/lint.mjs.map +1 -1
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/xy.mjs +164 -32
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +21 -2
- package/dist/index.mjs +164 -32
- package/dist/index.mjs.map +1 -1
- package/dist/xy/common/checkCommand.mjs.map +1 -1
- package/dist/xy/common/index.mjs +164 -32
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/common/packmanCommand.mjs +272 -114
- package/dist/xy/common/packmanCommand.mjs.map +1 -1
- package/dist/xy/index.mjs +164 -32
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/lint/index.mjs.map +1 -1
- package/dist/xy/lint/publintCommand.mjs.map +1 -1
- package/dist/xy/xy.mjs +164 -32
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -536,12 +536,31 @@ interface ReadmeConfig {
|
|
|
536
536
|
*/
|
|
537
537
|
logoUrl?: string;
|
|
538
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* Configuration for packman lint (package manager config linting).
|
|
541
|
+
*/
|
|
542
|
+
interface PackmanConfig {
|
|
543
|
+
/**
|
|
544
|
+
* Minimum age in minutes that a package must be published before pnpm will install it.
|
|
545
|
+
* Only applies when pnpm is the detected package manager.
|
|
546
|
+
* @default 4320 (3 days)
|
|
547
|
+
*/
|
|
548
|
+
minimumReleaseAge?: number;
|
|
549
|
+
/**
|
|
550
|
+
* Package patterns to exclude from the minimumReleaseAge requirement.
|
|
551
|
+
* These packages can be installed immediately upon release.
|
|
552
|
+
* Supports exact names and scoped wildcards (e.g. '@myorg/*').
|
|
553
|
+
* @default ["'@xylabs/*'", "'@xyo-network/*'"]
|
|
554
|
+
*/
|
|
555
|
+
minimumReleaseAgeExclude?: string[];
|
|
556
|
+
}
|
|
539
557
|
/**
|
|
540
558
|
* Command-specific configuration that cascades from root to package.
|
|
541
559
|
* Settings here override the legacy top-level equivalents.
|
|
542
560
|
*/
|
|
543
561
|
interface CommandsConfig {
|
|
544
562
|
deplint?: DeplintConfig;
|
|
563
|
+
packman?: PackmanConfig;
|
|
545
564
|
publint?: boolean | PublintConfig;
|
|
546
565
|
}
|
|
547
566
|
interface XyConfigBase {
|
|
@@ -686,7 +705,7 @@ interface PackmanLintParams {
|
|
|
686
705
|
fix?: boolean;
|
|
687
706
|
verbose?: boolean;
|
|
688
707
|
}
|
|
689
|
-
declare function packmanLint({ fix, verbose }?: PackmanLintParams): number
|
|
708
|
+
declare function packmanLint({ fix, verbose }?: PackmanLintParams): Promise<number>;
|
|
690
709
|
|
|
691
710
|
type Direction = 'pnpm-to-yarn' | 'yarn-to-pnpm';
|
|
692
711
|
declare function rewriteScript(script: string, direction: Direction): string;
|
|
@@ -1101,4 +1120,4 @@ declare const xyParseOptions: () => Argv;
|
|
|
1101
1120
|
|
|
1102
1121
|
declare const xyYarnCommands: (args: Argv) => Argv<{}>;
|
|
1103
1122
|
|
|
1104
|
-
export { ALL_PUBLINT_CHECKS, type BuildParams, CROSS_PLATFORM_NEWLINE, type CleanPackageParams, type CleanParams, type CommandsConfig, type CompileConfig, type CompileParams, type ConvertParams, type CopyAssetsParams, type CycleEdge, type CycleParams, DEFAULT_README_BODY, DEFAULT_README_TEMPLATE, type DeclaredDep, type DepLintOptions, type DepType, type DeplintAppliedFix, type DeplintConfig, type DeplintDiagnostic, type DeplintFix, type DeplintPackageConfig, DeplintPackageEditor, type DeplintRefType, type DeplintReporter, type DeplintRule, type DeplintRunOptions, type DeplintRunResult, type DeplintSection, type DeplintSeverity, type DeplintSummary, type DeplintWorkspaceContext, type DeployLevel, DuplicateDetector, type DynamicShareConfig, type EntryMode, type GenDocsPackageParams, type GenDocsParams, INIT_CWD, LEGACY_COMMANDS_PREFIX, type LintInitParams, type LintNextParams, type LintPackageParams, type LintParams, type LintResult, type LiveShareConfig, type OrphanParams, PUBLISH_ONLY_CHECKS, type PackageCompileTscConfig, type PackageCompileTsupConfig, type PackageCopyAssetsParams, type PackageJsonEx, type PackageManager, type PackageManagerName, type PackagePublintParams, type PackmanCleanParams, type PackmanLintParams, type PathConfig, PnpmPackageManager, type PublintCheckName, type PublintConfig, type PublintPackageParams, type PublintParams, type ReadFileSyncOptions, type ReadmeConfig, type ReadmeGenParams, type ReadmeInitParams, type ReadmeLintParams, type RebuildParams, type RecompilePackageParams, type RecompileParams, type RegistryInfo, type RelintPackageParams, type RelintParams, type RepoInitParams, type ResolvedDep, type ResolvedPublintOptions, type RetestParams, type ScriptStep, type SelectedUpdate, type SettingsLevel, type TemplateFile, type TestParams, type UpdoOptions, type VersionChoice, WINDOWS_NEWLINE_REGEX, type Workspace, type WorkspaceForeachOptions, XYLABS_COMMANDS_PREFIX, XYLABS_RULES_PREFIX, XYLABS_SKILLS_PREFIX, type XyConfig, type XyConfigBase, type XyConfigLegacy, type XyTscConfig, type XyTsupConfig, YarnPackageManager, analyze, applyDeplintFixes, applyLogoConfig, applyPackageManager, applyUpdates, build, buildWorkspaceContext, checkInternalDepVersions, checkInternalPeerVersions, checkResult, checkVersionConsistency, checkWorkspaceProtocol, claudeCheck, claudeClean, claudeCommandTemplates, claudeCommands, claudeMdLocalTemplate, claudeMdProjectTemplate, claudeMdRuleTemplates, claudeRules, claudeSettings, claudeSkillTemplates, claudeSkills, clean, cleanAll, cleanDocs, cleanESLint, cleanPackage, collectWorkspaceDeps, compile, compileAll, compilePackage, convert, copyAssets, createBuildConfig, cycle, cycleAll, cyclePackage, dead, defaultBuildConfig, defaultReadFileSyncOptions, deleteGlob, deplint, deplintRules, deploy, deprecationMigrate, detectCurrentPM, detectDuplicateDependencies, detectPackageManager, detectReact, detectReactInMonorepo, detectWorkspaceCycles, dupdeps, eject, empty, fetchAllRegistryInfo, fetchRegistryInfo, fillTemplate, findWorkspacePackagePaths, fix, fixInternalDepVersions, fixInternalPeerVersions, fixVersionConsistency, fixWorkspaceProtocol, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, generateReadmeFiles, getDeplintReporter, getPackageManager, gitignore, gitignoreGen, gitignoreTemplate, gitlint, gitlintFix, humanDeplintReporter, installOutputCapture, interactiveSelect, isYarnVersionOrGreater, jsonDeplintReporter, knip, latestVersions, license, lint, lintAllPackages, lintInit, lintNext, lintPackage, lintlint, listRepoTemplates, loadConfig, loadPackageConfig, loadPublintOptions, loadRepoTemplateFiles, loadWorkspaceCommandConfig, logMonorepoVersion, multiLineToJSONArray, notEmpty, npmignoreGen, orphanClean, orphanList, outputStorage, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCompileTsc, packageCompileTsup, packageCopyAssets, packageCycle, packageGenDocs, packageLint, packageLintMonorepo, packageName, packagePublint, packageRecompile, packmanClean, packmanLint, parsedPackageJSON, printWorkspaceCycles, processEx, publint, publintAll, publintSingle, publish, test$1 as reactTest, readLines, readNonEmptyLines, readmeGen, readmeInit, readmeLint, rebuild, recompile, recompileAll, recompilePackage, registerPackageManager, reinstall, relint, relintAllPackages, relintPackage, renderTable, repoInit, resolveTemplatePath, resolveVersions, retest, rewriteScript, rewriteScriptsInPackageJson, runDeplint, runInstall, runStepAsync, runSteps, runStepsAsync, runUpdo, runWithConcurrency, runXy, runXyWithWarning, safeExit, safeExitAsync, scaffoldTemplate, sitemap, sonar, start, statics, syncInternalPeerVersions, test, tryReadFileSync, tryRunLocalScript, tsupOptions, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBase, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, xyReactCommands, xyYarnCommands, yarn3Only, yarnWorkspace, yarnWorkspaces };
|
|
1123
|
+
export { ALL_PUBLINT_CHECKS, type BuildParams, CROSS_PLATFORM_NEWLINE, type CleanPackageParams, type CleanParams, type CommandsConfig, type CompileConfig, type CompileParams, type ConvertParams, type CopyAssetsParams, type CycleEdge, type CycleParams, DEFAULT_README_BODY, DEFAULT_README_TEMPLATE, type DeclaredDep, type DepLintOptions, type DepType, type DeplintAppliedFix, type DeplintConfig, type DeplintDiagnostic, type DeplintFix, type DeplintPackageConfig, DeplintPackageEditor, type DeplintRefType, type DeplintReporter, type DeplintRule, type DeplintRunOptions, type DeplintRunResult, type DeplintSection, type DeplintSeverity, type DeplintSummary, type DeplintWorkspaceContext, type DeployLevel, DuplicateDetector, type DynamicShareConfig, type EntryMode, type GenDocsPackageParams, type GenDocsParams, INIT_CWD, LEGACY_COMMANDS_PREFIX, type LintInitParams, type LintNextParams, type LintPackageParams, type LintParams, type LintResult, type LiveShareConfig, type OrphanParams, PUBLISH_ONLY_CHECKS, type PackageCompileTscConfig, type PackageCompileTsupConfig, type PackageCopyAssetsParams, type PackageJsonEx, type PackageManager, type PackageManagerName, type PackagePublintParams, type PackmanCleanParams, type PackmanConfig, type PackmanLintParams, type PathConfig, PnpmPackageManager, type PublintCheckName, type PublintConfig, type PublintPackageParams, type PublintParams, type ReadFileSyncOptions, type ReadmeConfig, type ReadmeGenParams, type ReadmeInitParams, type ReadmeLintParams, type RebuildParams, type RecompilePackageParams, type RecompileParams, type RegistryInfo, type RelintPackageParams, type RelintParams, type RepoInitParams, type ResolvedDep, type ResolvedPublintOptions, type RetestParams, type ScriptStep, type SelectedUpdate, type SettingsLevel, type TemplateFile, type TestParams, type UpdoOptions, type VersionChoice, WINDOWS_NEWLINE_REGEX, type Workspace, type WorkspaceForeachOptions, XYLABS_COMMANDS_PREFIX, XYLABS_RULES_PREFIX, XYLABS_SKILLS_PREFIX, type XyConfig, type XyConfigBase, type XyConfigLegacy, type XyTscConfig, type XyTsupConfig, YarnPackageManager, analyze, applyDeplintFixes, applyLogoConfig, applyPackageManager, applyUpdates, build, buildWorkspaceContext, checkInternalDepVersions, checkInternalPeerVersions, checkResult, checkVersionConsistency, checkWorkspaceProtocol, claudeCheck, claudeClean, claudeCommandTemplates, claudeCommands, claudeMdLocalTemplate, claudeMdProjectTemplate, claudeMdRuleTemplates, claudeRules, claudeSettings, claudeSkillTemplates, claudeSkills, clean, cleanAll, cleanDocs, cleanESLint, cleanPackage, collectWorkspaceDeps, compile, compileAll, compilePackage, convert, copyAssets, createBuildConfig, cycle, cycleAll, cyclePackage, dead, defaultBuildConfig, defaultReadFileSyncOptions, deleteGlob, deplint, deplintRules, deploy, deprecationMigrate, detectCurrentPM, detectDuplicateDependencies, detectPackageManager, detectReact, detectReactInMonorepo, detectWorkspaceCycles, dupdeps, eject, empty, fetchAllRegistryInfo, fetchRegistryInfo, fillTemplate, findWorkspacePackagePaths, fix, fixInternalDepVersions, fixInternalPeerVersions, fixVersionConsistency, fixWorkspaceProtocol, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, generateReadmeFiles, getDeplintReporter, getPackageManager, gitignore, gitignoreGen, gitignoreTemplate, gitlint, gitlintFix, humanDeplintReporter, installOutputCapture, interactiveSelect, isYarnVersionOrGreater, jsonDeplintReporter, knip, latestVersions, license, lint, lintAllPackages, lintInit, lintNext, lintPackage, lintlint, listRepoTemplates, loadConfig, loadPackageConfig, loadPublintOptions, loadRepoTemplateFiles, loadWorkspaceCommandConfig, logMonorepoVersion, multiLineToJSONArray, notEmpty, npmignoreGen, orphanClean, orphanList, outputStorage, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCompileTsc, packageCompileTsup, packageCopyAssets, packageCycle, packageGenDocs, packageLint, packageLintMonorepo, packageName, packagePublint, packageRecompile, packmanClean, packmanLint, parsedPackageJSON, printWorkspaceCycles, processEx, publint, publintAll, publintSingle, publish, test$1 as reactTest, readLines, readNonEmptyLines, readmeGen, readmeInit, readmeLint, rebuild, recompile, recompileAll, recompilePackage, registerPackageManager, reinstall, relint, relintAllPackages, relintPackage, renderTable, repoInit, resolveTemplatePath, resolveVersions, retest, rewriteScript, rewriteScriptsInPackageJson, runDeplint, runInstall, runStepAsync, runSteps, runStepsAsync, runUpdo, runWithConcurrency, runXy, runXyWithWarning, safeExit, safeExitAsync, scaffoldTemplate, sitemap, sonar, start, statics, syncInternalPeerVersions, test, tryReadFileSync, tryRunLocalScript, tsupOptions, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBase, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, xyReactCommands, xyYarnCommands, yarn3Only, yarnWorkspace, yarnWorkspaces };
|
package/dist/index.mjs
CHANGED
|
@@ -7222,7 +7222,7 @@ function packageLintMonorepo(fix2 = false) {
|
|
|
7222
7222
|
fix: () => fixInternalDepVersions(cwd6, workspaces),
|
|
7223
7223
|
label: "Internal deps/devDeps use correct version ranges"
|
|
7224
7224
|
};
|
|
7225
|
-
const
|
|
7225
|
+
const checks = [
|
|
7226
7226
|
{
|
|
7227
7227
|
check: () => checkRootPrivate(pkg),
|
|
7228
7228
|
fix: fixRootPrivate,
|
|
@@ -7274,7 +7274,7 @@ function packageLintMonorepo(fix2 = false) {
|
|
|
7274
7274
|
label: "Internal peerDeps use semver ranges (not workspace: protocol)"
|
|
7275
7275
|
}
|
|
7276
7276
|
];
|
|
7277
|
-
const { errors, fixed } = runChecks(
|
|
7277
|
+
const { errors, fixed } = runChecks(checks, cwd6, pkg, fix2);
|
|
7278
7278
|
logSummary(errors, fixed);
|
|
7279
7279
|
if (fix2 && fixed > 0) {
|
|
7280
7280
|
runInstall();
|
|
@@ -7897,6 +7897,41 @@ import {
|
|
|
7897
7897
|
} from "fs";
|
|
7898
7898
|
import PATH26 from "path";
|
|
7899
7899
|
import chalk67 from "chalk";
|
|
7900
|
+
var DEFAULT_MINIMUM_RELEASE_AGE = 4320;
|
|
7901
|
+
var DEFAULT_RELEASE_AGE_EXCLUDES = ["'@xylabs/*'", "'@xyo-network/*'"];
|
|
7902
|
+
function resolvePackmanConfig(cfg) {
|
|
7903
|
+
return {
|
|
7904
|
+
minimumReleaseAge: cfg?.minimumReleaseAge ?? DEFAULT_MINIMUM_RELEASE_AGE,
|
|
7905
|
+
minimumReleaseAgeExclude: cfg?.minimumReleaseAgeExclude ?? DEFAULT_RELEASE_AGE_EXCLUDES
|
|
7906
|
+
};
|
|
7907
|
+
}
|
|
7908
|
+
function readPnpmWorkspaceYaml(cwd6) {
|
|
7909
|
+
const wsPath = PATH26.join(cwd6, "pnpm-workspace.yaml");
|
|
7910
|
+
if (!existsSync23(wsPath)) return void 0;
|
|
7911
|
+
return readFileSync30(wsPath, "utf8");
|
|
7912
|
+
}
|
|
7913
|
+
function writePnpmWorkspaceYaml(cwd6, content) {
|
|
7914
|
+
writeFileSync17(PATH26.join(cwd6, "pnpm-workspace.yaml"), content, "utf8");
|
|
7915
|
+
}
|
|
7916
|
+
function parseYamlListSection(content, sectionName) {
|
|
7917
|
+
const items = [];
|
|
7918
|
+
let inSection = false;
|
|
7919
|
+
for (const line of content.split("\n")) {
|
|
7920
|
+
if (new RegExp(String.raw`^${sectionName}\s*:`).test(line)) {
|
|
7921
|
+
inSection = true;
|
|
7922
|
+
continue;
|
|
7923
|
+
}
|
|
7924
|
+
if (inSection) {
|
|
7925
|
+
const match = /^\s+-\s+(.+)$/.exec(line);
|
|
7926
|
+
if (match) {
|
|
7927
|
+
items.push(match[1].trim());
|
|
7928
|
+
} else if (line.trim() && !/^\s/.test(line)) {
|
|
7929
|
+
break;
|
|
7930
|
+
}
|
|
7931
|
+
}
|
|
7932
|
+
}
|
|
7933
|
+
return items;
|
|
7934
|
+
}
|
|
7900
7935
|
function checkEnableScripts(cwd6, verbose, silent) {
|
|
7901
7936
|
const yarnrcPath = PATH26.join(cwd6, ".yarnrc.yml");
|
|
7902
7937
|
if (!existsSync23(yarnrcPath)) {
|
|
@@ -7904,8 +7939,7 @@ function checkEnableScripts(cwd6, verbose, silent) {
|
|
|
7904
7939
|
return true;
|
|
7905
7940
|
}
|
|
7906
7941
|
const content = readFileSync30(yarnrcPath, "utf8");
|
|
7907
|
-
const
|
|
7908
|
-
for (const line of lines) {
|
|
7942
|
+
for (const line of content.split("\n")) {
|
|
7909
7943
|
const trimmed = line.trim();
|
|
7910
7944
|
if (/^enableScripts\s*:/.test(trimmed)) {
|
|
7911
7945
|
const value = trimmed.replace(/^enableScripts\s*:\s*/, "").trim();
|
|
@@ -7920,12 +7954,9 @@ function checkEnableScripts(cwd6, verbose, silent) {
|
|
|
7920
7954
|
if (!silent) console.log(chalk67.red(" enableScripts is not set in .yarnrc.yml (expected false)"));
|
|
7921
7955
|
return false;
|
|
7922
7956
|
}
|
|
7923
|
-
function fixEnableScripts(cwd6
|
|
7957
|
+
function fixEnableScripts(cwd6) {
|
|
7924
7958
|
const yarnrcPath = PATH26.join(cwd6, ".yarnrc.yml");
|
|
7925
|
-
if (!existsSync23(yarnrcPath))
|
|
7926
|
-
if (verbose) console.log(chalk67.gray(" No .yarnrc.yml found, skipping enableScripts fix"));
|
|
7927
|
-
return true;
|
|
7928
|
-
}
|
|
7959
|
+
if (!existsSync23(yarnrcPath)) return true;
|
|
7929
7960
|
const content = readFileSync30(yarnrcPath, "utf8");
|
|
7930
7961
|
const lines = content.split("\n");
|
|
7931
7962
|
let found = false;
|
|
@@ -7959,28 +7990,129 @@ function fixEnableScripts(cwd6, verbose) {
|
|
|
7959
7990
|
console.log(chalk67.green(" Fixed: enableScripts set to false"));
|
|
7960
7991
|
return true;
|
|
7961
7992
|
}
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7993
|
+
function checkMinimumReleaseAge(cwd6, config2, verbose, silent) {
|
|
7994
|
+
if (detectPackageManager() !== "pnpm") return true;
|
|
7995
|
+
const content = readPnpmWorkspaceYaml(cwd6);
|
|
7996
|
+
if (!content) {
|
|
7997
|
+
if (!silent) console.log(chalk67.red(" No pnpm-workspace.yaml found"));
|
|
7998
|
+
return false;
|
|
7967
7999
|
}
|
|
7968
|
-
|
|
7969
|
-
|
|
8000
|
+
const { minimumReleaseAge } = config2;
|
|
8001
|
+
for (const line of content.split("\n")) {
|
|
8002
|
+
const match = /^minimumReleaseAge\s*:\s*(\d+)/.exec(line.trim());
|
|
8003
|
+
if (match) {
|
|
8004
|
+
const value = Number.parseInt(match[1], 10);
|
|
8005
|
+
if (value >= minimumReleaseAge) {
|
|
8006
|
+
if (verbose) console.log(chalk67.green(` minimumReleaseAge is ${value} (>= ${minimumReleaseAge})`));
|
|
8007
|
+
return true;
|
|
8008
|
+
}
|
|
8009
|
+
if (!silent) console.log(chalk67.red(` minimumReleaseAge is ${value} (expected >= ${minimumReleaseAge})`));
|
|
8010
|
+
return false;
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
if (!silent) console.log(chalk67.red(` minimumReleaseAge is not set in pnpm-workspace.yaml (expected >= ${minimumReleaseAge})`));
|
|
8014
|
+
return false;
|
|
8015
|
+
}
|
|
8016
|
+
function fixMinimumReleaseAge(cwd6, config2) {
|
|
8017
|
+
if (detectPackageManager() !== "pnpm") return true;
|
|
8018
|
+
const content = readPnpmWorkspaceYaml(cwd6);
|
|
8019
|
+
if (!content) return false;
|
|
8020
|
+
const { minimumReleaseAge } = config2;
|
|
8021
|
+
const lines = content.split("\n");
|
|
8022
|
+
let found = false;
|
|
8023
|
+
const newLines = lines.map((line) => {
|
|
8024
|
+
if (/^minimumReleaseAge\s*:/.test(line)) {
|
|
8025
|
+
found = true;
|
|
8026
|
+
return `minimumReleaseAge: ${minimumReleaseAge}`;
|
|
8027
|
+
}
|
|
8028
|
+
return line;
|
|
8029
|
+
});
|
|
8030
|
+
if (!found) {
|
|
8031
|
+
const lastLine = newLines.at(-1);
|
|
8032
|
+
if (lastLine === "") {
|
|
8033
|
+
newLines.splice(-1, 0, `minimumReleaseAge: ${minimumReleaseAge}`);
|
|
8034
|
+
} else {
|
|
8035
|
+
newLines.push(`minimumReleaseAge: ${minimumReleaseAge}`);
|
|
8036
|
+
}
|
|
8037
|
+
}
|
|
8038
|
+
writePnpmWorkspaceYaml(cwd6, newLines.join("\n"));
|
|
8039
|
+
console.log(chalk67.green(` Fixed: minimumReleaseAge set to ${minimumReleaseAge}`));
|
|
8040
|
+
return true;
|
|
8041
|
+
}
|
|
8042
|
+
function checkMinimumReleaseAgeExclude(cwd6, config2, verbose, silent) {
|
|
8043
|
+
if (detectPackageManager() !== "pnpm") return true;
|
|
8044
|
+
const content = readPnpmWorkspaceYaml(cwd6);
|
|
8045
|
+
if (!content) {
|
|
8046
|
+
if (!silent) console.log(chalk67.red(" No pnpm-workspace.yaml found"));
|
|
8047
|
+
return false;
|
|
8048
|
+
}
|
|
8049
|
+
const excludes = parseYamlListSection(content, "minimumReleaseAgeExclude");
|
|
8050
|
+
const missing = config2.minimumReleaseAgeExclude.filter((scope) => !excludes.includes(scope));
|
|
8051
|
+
if (missing.length === 0) {
|
|
8052
|
+
if (verbose) console.log(chalk67.green(" minimumReleaseAgeExclude includes all required scopes"));
|
|
8053
|
+
return true;
|
|
8054
|
+
}
|
|
8055
|
+
if (!silent) console.log(chalk67.red(` minimumReleaseAgeExclude is missing: ${missing.join(", ")}`));
|
|
8056
|
+
return false;
|
|
8057
|
+
}
|
|
8058
|
+
function fixMinimumReleaseAgeExclude(cwd6, config2) {
|
|
8059
|
+
if (detectPackageManager() !== "pnpm") return true;
|
|
8060
|
+
const content = readPnpmWorkspaceYaml(cwd6);
|
|
8061
|
+
if (!content) return false;
|
|
8062
|
+
const existingExcludes = parseYamlListSection(content, "minimumReleaseAgeExclude");
|
|
8063
|
+
const toAdd = config2.minimumReleaseAgeExclude.filter((scope) => !existingExcludes.includes(scope));
|
|
8064
|
+
if (toAdd.length === 0) return true;
|
|
8065
|
+
const lines = content.split("\n");
|
|
8066
|
+
const sectionIndex = lines.findIndex((line) => /^minimumReleaseAgeExclude\s*:/.test(line));
|
|
8067
|
+
if (sectionIndex === -1) {
|
|
8068
|
+
const newSection = ["minimumReleaseAgeExclude:", ...config2.minimumReleaseAgeExclude.map((s) => ` - ${s}`)];
|
|
8069
|
+
const lastLine = lines.at(-1);
|
|
8070
|
+
if (lastLine === "") {
|
|
8071
|
+
lines.splice(-1, 0, ...newSection);
|
|
8072
|
+
} else {
|
|
8073
|
+
lines.push(...newSection);
|
|
8074
|
+
}
|
|
8075
|
+
} else {
|
|
8076
|
+
let insertAt = sectionIndex + 1;
|
|
8077
|
+
while (insertAt < lines.length && /^\s+-/.test(lines[insertAt])) {
|
|
8078
|
+
insertAt++;
|
|
8079
|
+
}
|
|
8080
|
+
for (const scope of toAdd) {
|
|
8081
|
+
lines.splice(insertAt, 0, ` - ${scope}`);
|
|
8082
|
+
insertAt++;
|
|
8083
|
+
}
|
|
8084
|
+
}
|
|
8085
|
+
writePnpmWorkspaceYaml(cwd6, lines.join("\n"));
|
|
8086
|
+
console.log(chalk67.green(` Fixed: added ${toAdd.join(", ")} to minimumReleaseAgeExclude`));
|
|
8087
|
+
return true;
|
|
8088
|
+
}
|
|
8089
|
+
async function packmanLint({ fix: fix2, verbose } = {}) {
|
|
7970
8090
|
const cwd6 = process.cwd();
|
|
8091
|
+
const rootConfig = await loadConfig();
|
|
8092
|
+
const packmanConfig = resolvePackmanConfig(rootConfig.commands ? rootConfig.commands.packman : void 0);
|
|
7971
8093
|
let failures = 0;
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
8094
|
+
const enableScriptsPassed = checkEnableScripts(cwd6, verbose, fix2);
|
|
8095
|
+
if (!enableScriptsPassed) {
|
|
8096
|
+
if (fix2) {
|
|
8097
|
+
if (!fixEnableScripts(cwd6)) failures++;
|
|
8098
|
+
} else {
|
|
8099
|
+
failures++;
|
|
8100
|
+
}
|
|
8101
|
+
}
|
|
8102
|
+
const agePassed = checkMinimumReleaseAge(cwd6, packmanConfig, verbose, fix2);
|
|
8103
|
+
if (!agePassed) {
|
|
8104
|
+
if (fix2) {
|
|
8105
|
+
if (!fixMinimumReleaseAge(cwd6, packmanConfig)) failures++;
|
|
8106
|
+
} else {
|
|
8107
|
+
failures++;
|
|
8108
|
+
}
|
|
8109
|
+
}
|
|
8110
|
+
const excludePassed = checkMinimumReleaseAgeExclude(cwd6, packmanConfig, verbose, fix2);
|
|
8111
|
+
if (!excludePassed) {
|
|
8112
|
+
if (fix2) {
|
|
8113
|
+
if (!fixMinimumReleaseAgeExclude(cwd6, packmanConfig)) failures++;
|
|
8114
|
+
} else {
|
|
8115
|
+
failures++;
|
|
7984
8116
|
}
|
|
7985
8117
|
}
|
|
7986
8118
|
if (failures > 0) {
|
|
@@ -8264,14 +8396,14 @@ function lintPackages(cwd6) {
|
|
|
8264
8396
|
function readmeLint({ config: config2, verbose }) {
|
|
8265
8397
|
const cwd6 = INIT_CWD();
|
|
8266
8398
|
console.log(chalk69.green("Readme Lint"));
|
|
8267
|
-
const
|
|
8399
|
+
const checks = [
|
|
8268
8400
|
lintTemplate(cwd6),
|
|
8269
8401
|
lintLogoConfig(cwd6, config2),
|
|
8270
8402
|
lintPackages(cwd6)
|
|
8271
8403
|
];
|
|
8272
8404
|
let errorCount = 0;
|
|
8273
8405
|
let warningCount = 0;
|
|
8274
|
-
for (const { errors, warnings } of
|
|
8406
|
+
for (const { errors, warnings } of checks) {
|
|
8275
8407
|
for (const error of errors) {
|
|
8276
8408
|
console.log(chalk69.red(` \u2717 ${error}`));
|
|
8277
8409
|
errorCount++;
|
|
@@ -9104,8 +9236,8 @@ var lintCommand = {
|
|
|
9104
9236
|
type: "boolean"
|
|
9105
9237
|
});
|
|
9106
9238
|
},
|
|
9107
|
-
handler: (argv) => {
|
|
9108
|
-
process.exitCode = packmanLint({
|
|
9239
|
+
handler: async (argv) => {
|
|
9240
|
+
process.exitCode = await packmanLint({
|
|
9109
9241
|
fix: !!argv.fix,
|
|
9110
9242
|
verbose: !!argv.verbose
|
|
9111
9243
|
});
|