@xylabs/toolchain 7.10.0
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/analyze.mjs +140 -0
- package/dist/actions/analyze.mjs.map +1 -0
- package/dist/actions/build.mjs +173 -0
- package/dist/actions/build.mjs.map +1 -0
- package/dist/actions/claude-check.mjs +199 -0
- package/dist/actions/claude-check.mjs.map +1 -0
- package/dist/actions/claude-clean.mjs +70 -0
- package/dist/actions/claude-clean.mjs.map +1 -0
- package/dist/actions/claude-commands.mjs +126 -0
- package/dist/actions/claude-commands.mjs.map +1 -0
- package/dist/actions/claude-rules.mjs +151 -0
- package/dist/actions/claude-rules.mjs.map +1 -0
- package/dist/actions/claude-settings.mjs +99 -0
- package/dist/actions/claude-settings.mjs.map +1 -0
- package/dist/actions/claude-skills.mjs +131 -0
- package/dist/actions/claude-skills.mjs.map +1 -0
- package/dist/actions/clean-docs.mjs +66 -0
- package/dist/actions/clean-docs.mjs.map +1 -0
- package/dist/actions/clean-eslint.mjs +47 -0
- package/dist/actions/clean-eslint.mjs.map +1 -0
- package/dist/actions/clean.mjs +166 -0
- package/dist/actions/clean.mjs.map +1 -0
- package/dist/actions/compile.mjs +184 -0
- package/dist/actions/compile.mjs.map +1 -0
- package/dist/actions/copy-assets.mjs +81 -0
- package/dist/actions/copy-assets.mjs.map +1 -0
- package/dist/actions/cycle.mjs +275 -0
- package/dist/actions/cycle.mjs.map +1 -0
- package/dist/actions/dead.mjs +119 -0
- package/dist/actions/dead.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +1556 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/checkPackageTypes.mjs +1 -0
- package/dist/actions/deplint/checkPackage/checkPackageTypes.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getMismatchedPeerDevVersions.mjs +77 -0
- package/dist/actions/deplint/checkPackage/getMismatchedPeerDevVersions.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +158 -0
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +125 -0
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnnecessaryPeerDependencies.mjs +207 -0
- package/dist/actions/deplint/checkPackage/getUnnecessaryPeerDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnsatisfiedPeerDependencies.mjs +318 -0
- package/dist/actions/deplint/checkPackage/getUnsatisfiedPeerDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +163 -0
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +408 -0
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +75 -0
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getWorkspaceVersionProblems.mjs +128 -0
- package/dist/actions/deplint/checkPackage/getWorkspaceVersionProblems.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/index.mjs +1609 -0
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -0
- package/dist/actions/deplint/deplint.mjs +1840 -0
- package/dist/actions/deplint/deplint.mjs.map +1 -0
- package/dist/actions/deplint/engine.mjs +1736 -0
- package/dist/actions/deplint/engine.mjs.map +1 -0
- package/dist/actions/deplint/findFiles.mjs +39 -0
- package/dist/actions/deplint/findFiles.mjs.map +1 -0
- package/dist/actions/deplint/findFilesByGlob.mjs +14 -0
- package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -0
- package/dist/actions/deplint/fixer.mjs +103 -0
- package/dist/actions/deplint/fixer.mjs.map +1 -0
- package/dist/actions/deplint/getBasePackageName.mjs +13 -0
- package/dist/actions/deplint/getBasePackageName.mjs.map +1 -0
- package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs +140 -0
- package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs.map +1 -0
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +29 -0
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs.map +1 -0
- package/dist/actions/deplint/getExtendsFromTsconfigs.mjs +68 -0
- package/dist/actions/deplint/getExtendsFromTsconfigs.mjs.map +1 -0
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +143 -0
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -0
- package/dist/actions/deplint/getImportsFromFile.mjs +85 -0
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -0
- package/dist/actions/deplint/getRequiredPeerDependencies.mjs +37 -0
- package/dist/actions/deplint/getRequiredPeerDependencies.mjs.map +1 -0
- package/dist/actions/deplint/getScriptReferencedPackages.mjs +83 -0
- package/dist/actions/deplint/getScriptReferencedPackages.mjs.map +1 -0
- package/dist/actions/deplint/implicitDevDependencies.mjs +116 -0
- package/dist/actions/deplint/implicitDevDependencies.mjs.map +1 -0
- package/dist/actions/deplint/index.mjs +1848 -0
- package/dist/actions/deplint/index.mjs.map +1 -0
- package/dist/actions/deplint/packageEditor.mjs +82 -0
- package/dist/actions/deplint/packageEditor.mjs.map +1 -0
- package/dist/actions/deplint/packageJsonEditor.mjs +101 -0
- package/dist/actions/deplint/packageJsonEditor.mjs.map +1 -0
- package/dist/actions/deplint/reporters.mjs +36 -0
- package/dist/actions/deplint/reporters.mjs.map +1 -0
- package/dist/actions/deplint/rules.mjs +1223 -0
- package/dist/actions/deplint/rules.mjs.map +1 -0
- package/dist/actions/deplint/snapshot.mjs +372 -0
- package/dist/actions/deplint/snapshot.mjs.map +1 -0
- package/dist/actions/deplint/tsScriptsAliases.mjs +20 -0
- package/dist/actions/deplint/tsScriptsAliases.mjs.map +1 -0
- package/dist/actions/deplint/types.mjs +1 -0
- package/dist/actions/deplint/types.mjs.map +1 -0
- package/dist/actions/deploy.mjs +194 -0
- package/dist/actions/deploy.mjs.map +1 -0
- package/dist/actions/dupdeps.mjs +226 -0
- package/dist/actions/dupdeps.mjs.map +1 -0
- package/dist/actions/eject.mjs +142 -0
- package/dist/actions/eject.mjs.map +1 -0
- package/dist/actions/fix.mjs +359 -0
- package/dist/actions/fix.mjs.map +1 -0
- package/dist/actions/gen-docs.mjs +155 -0
- package/dist/actions/gen-docs.mjs.map +1 -0
- package/dist/actions/gitignore.mjs +159 -0
- package/dist/actions/gitignore.mjs.map +1 -0
- package/dist/actions/gitlint-fix.mjs +27 -0
- package/dist/actions/gitlint-fix.mjs.map +1 -0
- package/dist/actions/gitlint.mjs +48 -0
- package/dist/actions/gitlint.mjs.map +1 -0
- package/dist/actions/index.mjs +8259 -0
- package/dist/actions/index.mjs.map +1 -0
- package/dist/actions/knip.mjs +119 -0
- package/dist/actions/knip.mjs.map +1 -0
- package/dist/actions/license.mjs +92 -0
- package/dist/actions/license.mjs.map +1 -0
- package/dist/actions/lint-init.mjs +275 -0
- package/dist/actions/lint-init.mjs.map +1 -0
- package/dist/actions/lint.mjs +356 -0
- package/dist/actions/lint.mjs.map +1 -0
- package/dist/actions/lintNext.mjs +209 -0
- package/dist/actions/lintNext.mjs.map +1 -0
- package/dist/actions/lintlint.mjs +341 -0
- package/dist/actions/lintlint.mjs.map +1 -0
- package/dist/actions/npmignore-gen.mjs +90 -0
- package/dist/actions/npmignore-gen.mjs.map +1 -0
- package/dist/actions/orphan.mjs +110 -0
- package/dist/actions/orphan.mjs.map +1 -0
- package/dist/actions/package/clean-outputs.mjs +50 -0
- package/dist/actions/package/clean-outputs.mjs.map +1 -0
- package/dist/actions/package/clean-typescript.mjs +50 -0
- package/dist/actions/package/clean-typescript.mjs.map +1 -0
- package/dist/actions/package/clean.mjs +69 -0
- package/dist/actions/package/clean.mjs.map +1 -0
- package/dist/actions/package/compile/XyConfig.mjs +32 -0
- package/dist/actions/package/compile/XyConfig.mjs.map +1 -0
- package/dist/actions/package/compile/buildEntries.mjs +53 -0
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -0
- package/dist/actions/package/compile/compile.mjs +439 -0
- package/dist/actions/package/compile/compile.mjs.map +1 -0
- package/dist/actions/package/compile/copyTypeFiles.mjs +34 -0
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -0
- package/dist/actions/package/compile/deepMerge.mjs +27 -0
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -0
- package/dist/actions/package/compile/getCompilerOptions.mjs +12 -0
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -0
- package/dist/actions/package/compile/index.mjs +472 -0
- package/dist/actions/package/compile/index.mjs.map +1 -0
- package/dist/actions/package/compile/inputs.mjs +22 -0
- package/dist/actions/package/compile/inputs.mjs.map +1 -0
- package/dist/actions/package/compile/packageCompileTsc.mjs +93 -0
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -0
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +92 -0
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -0
- package/dist/actions/package/compile/packageCompileTsup.mjs +402 -0
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -0
- package/dist/actions/package/copy-assets.mjs +69 -0
- package/dist/actions/package/copy-assets.mjs.map +1 -0
- package/dist/actions/package/cycle.mjs +62 -0
- package/dist/actions/package/cycle.mjs.map +1 -0
- package/dist/actions/package/gen-docs.mjs +137 -0
- package/dist/actions/package/gen-docs.mjs.map +1 -0
- package/dist/actions/package/index.mjs +1131 -0
- package/dist/actions/package/index.mjs.map +1 -0
- package/dist/actions/package/lint.mjs +87 -0
- package/dist/actions/package/lint.mjs.map +1 -0
- package/dist/actions/package/publint.mjs +336 -0
- package/dist/actions/package/publint.mjs.map +1 -0
- package/dist/actions/package/recompile.mjs +510 -0
- package/dist/actions/package/recompile.mjs.map +1 -0
- package/dist/actions/package-lint-deps.mjs +348 -0
- package/dist/actions/package-lint-deps.mjs.map +1 -0
- package/dist/actions/package-lint.mjs +774 -0
- package/dist/actions/package-lint.mjs.map +1 -0
- package/dist/actions/packman/clean.mjs +144 -0
- package/dist/actions/packman/clean.mjs.map +1 -0
- package/dist/actions/packman/convert.mjs +1331 -0
- package/dist/actions/packman/convert.mjs.map +1 -0
- package/dist/actions/packman/convertToPnpm.mjs +295 -0
- package/dist/actions/packman/convertToPnpm.mjs.map +1 -0
- package/dist/actions/packman/convertToYarn.mjs +307 -0
- package/dist/actions/packman/convertToYarn.mjs.map +1 -0
- package/dist/actions/packman/index.mjs +1493 -0
- package/dist/actions/packman/index.mjs.map +1 -0
- package/dist/actions/packman/lint.mjs +109 -0
- package/dist/actions/packman/lint.mjs.map +1 -0
- package/dist/actions/packman/rewriteScripts.mjs +52 -0
- package/dist/actions/packman/rewriteScripts.mjs.map +1 -0
- package/dist/actions/packman/rewriteSourceImports.mjs +60 -0
- package/dist/actions/packman/rewriteSourceImports.mjs.map +1 -0
- package/dist/actions/packman/swapTsScriptsDependency.mjs +57 -0
- package/dist/actions/packman/swapTsScriptsDependency.mjs.map +1 -0
- package/dist/actions/publint.mjs +748 -0
- package/dist/actions/publint.mjs.map +1 -0
- package/dist/actions/publish.mjs +208 -0
- package/dist/actions/publish.mjs.map +1 -0
- package/dist/actions/reactTest.mjs +142 -0
- package/dist/actions/reactTest.mjs.map +1 -0
- package/dist/actions/readme-gen.mjs +362 -0
- package/dist/actions/readme-gen.mjs.map +1 -0
- package/dist/actions/readme-init.mjs +89 -0
- package/dist/actions/readme-init.mjs.map +1 -0
- package/dist/actions/readme-lint.mjs +147 -0
- package/dist/actions/readme-lint.mjs.map +1 -0
- package/dist/actions/rebuild.mjs +143 -0
- package/dist/actions/rebuild.mjs.map +1 -0
- package/dist/actions/recompile.mjs +196 -0
- package/dist/actions/recompile.mjs.map +1 -0
- package/dist/actions/reinstall.mjs +283 -0
- package/dist/actions/reinstall.mjs.map +1 -0
- package/dist/actions/relint.mjs +355 -0
- package/dist/actions/relint.mjs.map +1 -0
- package/dist/actions/repo-init.mjs +217 -0
- package/dist/actions/repo-init.mjs.map +1 -0
- package/dist/actions/retest.mjs +150 -0
- package/dist/actions/retest.mjs.map +1 -0
- package/dist/actions/sitemap.mjs +121 -0
- package/dist/actions/sitemap.mjs.map +1 -0
- package/dist/actions/sonar.mjs +119 -0
- package/dist/actions/sonar.mjs.map +1 -0
- package/dist/actions/start.mjs +142 -0
- package/dist/actions/start.mjs.map +1 -0
- package/dist/actions/statics.mjs +225 -0
- package/dist/actions/statics.mjs.map +1 -0
- package/dist/actions/test.mjs +144 -0
- package/dist/actions/test.mjs.map +1 -0
- package/dist/actions/up.mjs +140 -0
- package/dist/actions/up.mjs.map +1 -0
- package/dist/actions/updo.mjs +533 -0
- package/dist/actions/updo.mjs.map +1 -0
- package/dist/actions/upplug.mjs +124 -0
- package/dist/actions/upplug.mjs.map +1 -0
- package/dist/actions/upyarn.mjs +119 -0
- package/dist/actions/upyarn.mjs.map +1 -0
- package/dist/actions/yarn3only.mjs +60 -0
- package/dist/actions/yarn3only.mjs.map +1 -0
- package/dist/bin/package/build-only.mjs +451 -0
- package/dist/bin/package/build-only.mjs.map +1 -0
- package/dist/bin/package/build.mjs +451 -0
- package/dist/bin/package/build.mjs.map +1 -0
- package/dist/bin/package/clean-outputs.mjs +50 -0
- package/dist/bin/package/clean-outputs.mjs.map +1 -0
- package/dist/bin/package/clean-typescript.mjs +50 -0
- package/dist/bin/package/clean-typescript.mjs.map +1 -0
- package/dist/bin/package/clean.mjs +75 -0
- package/dist/bin/package/clean.mjs.map +1 -0
- package/dist/bin/package/compile-only.mjs +447 -0
- package/dist/bin/package/compile-only.mjs.map +1 -0
- package/dist/bin/package/compile-tsup.mjs +409 -0
- package/dist/bin/package/compile-tsup.mjs.map +1 -0
- package/dist/bin/package/compile.mjs +451 -0
- package/dist/bin/package/compile.mjs.map +1 -0
- package/dist/bin/package/copy-assets-cjs.mjs +75 -0
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -0
- package/dist/bin/package/copy-assets-esm.mjs +75 -0
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -0
- package/dist/bin/package/cycle.mjs +72 -0
- package/dist/bin/package/cycle.mjs.map +1 -0
- package/dist/bin/package/fix.mjs +97 -0
- package/dist/bin/package/fix.mjs.map +1 -0
- package/dist/bin/package/gen-docs.mjs +142 -0
- package/dist/bin/package/gen-docs.mjs.map +1 -0
- package/dist/bin/package/lint-verbose.mjs +97 -0
- package/dist/bin/package/lint-verbose.mjs.map +1 -0
- package/dist/bin/package/lint.mjs +97 -0
- package/dist/bin/package/lint.mjs.map +1 -0
- package/dist/bin/package/publint.mjs +423 -0
- package/dist/bin/package/publint.mjs.map +1 -0
- package/dist/bin/package/recompile.mjs +516 -0
- package/dist/bin/package/recompile.mjs.map +1 -0
- package/dist/bin/package/relint.mjs +97 -0
- package/dist/bin/package/relint.mjs.map +1 -0
- package/dist/bin/run-or-exec.mjs +20 -0
- package/dist/bin/run-or-exec.mjs.map +1 -0
- package/dist/bin/xy.mjs +8885 -0
- package/dist/bin/xy.mjs.map +1 -0
- package/dist/index.d.ts +1102 -0
- package/dist/index.mjs +9986 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/checkResult.mjs +16 -0
- package/dist/lib/checkResult.mjs.map +1 -0
- package/dist/lib/claudeMdTemplate.mjs +69 -0
- package/dist/lib/claudeMdTemplate.mjs.map +1 -0
- package/dist/lib/concurrency.mjs +38 -0
- package/dist/lib/concurrency.mjs.map +1 -0
- package/dist/lib/createBuildConfig.mjs +55 -0
- package/dist/lib/createBuildConfig.mjs.map +1 -0
- package/dist/lib/defaultBuildConfig.mjs +23 -0
- package/dist/lib/defaultBuildConfig.mjs.map +1 -0
- package/dist/lib/deleteGlob.mjs +13 -0
- package/dist/lib/deleteGlob.mjs.map +1 -0
- package/dist/lib/dependencies/DuplicateDetector.mjs +99 -0
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -0
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +203 -0
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -0
- package/dist/lib/dependencies/index.mjs +281 -0
- package/dist/lib/dependencies/index.mjs.map +1 -0
- package/dist/lib/dependencies/workspaceCycles.mjs +79 -0
- package/dist/lib/dependencies/workspaceCycles.mjs.map +1 -0
- package/dist/lib/file/ReadFileSyncOptions.mjs +6 -0
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -0
- package/dist/lib/file/constants.mjs +8 -0
- package/dist/lib/file/constants.mjs.map +1 -0
- package/dist/lib/file/fileLines.mjs +32 -0
- package/dist/lib/file/fileLines.mjs.map +1 -0
- package/dist/lib/file/index.mjs +42 -0
- package/dist/lib/file/index.mjs.map +1 -0
- package/dist/lib/file/tryReadFileSync.mjs +14 -0
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -0
- package/dist/lib/fillTemplate.mjs +8 -0
- package/dist/lib/fillTemplate.mjs.map +1 -0
- package/dist/lib/generateIgnoreFiles.mjs +86 -0
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -0
- package/dist/lib/generateReadmeFiles.mjs +323 -0
- package/dist/lib/generateReadmeFiles.mjs.map +1 -0
- package/dist/lib/gitignoreTemplate.mjs +12 -0
- package/dist/lib/gitignoreTemplate.mjs.map +1 -0
- package/dist/lib/index.mjs +1627 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/initCwd.mjs +8 -0
- package/dist/lib/initCwd.mjs.map +1 -0
- package/dist/lib/jsonFormatters.mjs +11 -0
- package/dist/lib/jsonFormatters.mjs.map +1 -0
- package/dist/lib/latestVersions.mjs +12 -0
- package/dist/lib/latestVersions.mjs.map +1 -0
- package/dist/lib/loadConfig.mjs +72 -0
- package/dist/lib/loadConfig.mjs.map +1 -0
- package/dist/lib/packageName.mjs +26 -0
- package/dist/lib/packageName.mjs.map +1 -0
- package/dist/lib/parsedPackageJSON.mjs +11 -0
- package/dist/lib/parsedPackageJSON.mjs.map +1 -0
- package/dist/lib/processEx.mjs +36 -0
- package/dist/lib/processEx.mjs.map +1 -0
- package/dist/lib/repoTemplates.mjs +34 -0
- package/dist/lib/repoTemplates.mjs.map +1 -0
- package/dist/lib/runInstall.mjs +30 -0
- package/dist/lib/runInstall.mjs.map +1 -0
- package/dist/lib/runSteps.mjs +118 -0
- package/dist/lib/runSteps.mjs.map +1 -0
- package/dist/lib/runStepsAsync.mjs +136 -0
- package/dist/lib/runStepsAsync.mjs.map +1 -0
- package/dist/lib/runXy.mjs +147 -0
- package/dist/lib/runXy.mjs.map +1 -0
- package/dist/lib/runXyWithWarning.mjs +36 -0
- package/dist/lib/runXyWithWarning.mjs.map +1 -0
- package/dist/lib/safeExit.mjs +61 -0
- package/dist/lib/safeExit.mjs.map +1 -0
- package/dist/lib/string/empty.mjs +8 -0
- package/dist/lib/string/empty.mjs.map +1 -0
- package/dist/lib/string/index.mjs +12 -0
- package/dist/lib/string/index.mjs.map +1 -0
- package/dist/lib/string/union.mjs +6 -0
- package/dist/lib/string/union.mjs.map +1 -0
- package/dist/lib/tryRunLocalScript.mjs +57 -0
- package/dist/lib/tryRunLocalScript.mjs.map +1 -0
- package/dist/lib/updo/applyUpdates.mjs +44 -0
- package/dist/lib/updo/applyUpdates.mjs.map +1 -0
- package/dist/lib/updo/collectWorkspaceDeps.mjs +48 -0
- package/dist/lib/updo/collectWorkspaceDeps.mjs.map +1 -0
- package/dist/lib/updo/fetchRegistryInfo.mjs +53 -0
- package/dist/lib/updo/fetchRegistryInfo.mjs.map +1 -0
- package/dist/lib/updo/index.mjs +594 -0
- package/dist/lib/updo/index.mjs.map +1 -0
- package/dist/lib/updo/interactiveSelect.mjs +185 -0
- package/dist/lib/updo/interactiveSelect.mjs.map +1 -0
- package/dist/lib/updo/interfaces.mjs +1 -0
- package/dist/lib/updo/interfaces.mjs.map +1 -0
- package/dist/lib/updo/renderTable.mjs +79 -0
- package/dist/lib/updo/renderTable.mjs.map +1 -0
- package/dist/lib/updo/resolveVersions.mjs +49 -0
- package/dist/lib/updo/resolveVersions.mjs.map +1 -0
- package/dist/lib/updo/runUpdo.mjs +511 -0
- package/dist/lib/updo/runUpdo.mjs.map +1 -0
- package/dist/lib/withErrnoException.mjs +13 -0
- package/dist/lib/withErrnoException.mjs.map +1 -0
- package/dist/lib/withError.mjs +8 -0
- package/dist/lib/withError.mjs.map +1 -0
- package/dist/lib/yarn/index.mjs +39 -0
- package/dist/lib/yarn/index.mjs.map +1 -0
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +18 -0
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -0
- package/dist/lib/yarn/workspace/Workspace.mjs +1 -0
- package/dist/lib/yarn/workspace/Workspace.mjs.map +1 -0
- package/dist/lib/yarn/workspace/index.mjs +23 -0
- package/dist/lib/yarn/workspace/index.mjs.map +1 -0
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +22 -0
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -0
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +15 -0
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -0
- package/dist/lib/yarn/yarnInitCwd.mjs +8 -0
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -0
- package/dist/loadPackageConfig.mjs +18 -0
- package/dist/loadPackageConfig.mjs.map +1 -0
- package/dist/pm/PackageManager.mjs +1 -0
- package/dist/pm/PackageManager.mjs.map +1 -0
- package/dist/pm/detectPackageManager.mjs +10 -0
- package/dist/pm/detectPackageManager.mjs.map +1 -0
- package/dist/pm/detectReact.mjs +52 -0
- package/dist/pm/detectReact.mjs.map +1 -0
- package/dist/pm/index.mjs +263 -0
- package/dist/pm/index.mjs.map +1 -0
- package/dist/pm/pnpmPackageManager.mjs +97 -0
- package/dist/pm/pnpmPackageManager.mjs.map +1 -0
- package/dist/pm/registry.mjs +27 -0
- package/dist/pm/registry.mjs.map +1 -0
- package/dist/pm/yarnPackageManager.mjs +112 -0
- package/dist/pm/yarnPackageManager.mjs.map +1 -0
- package/dist/types.d.mjs +1 -0
- package/dist/types.d.mjs.map +1 -0
- package/dist/xy/build/buildCommand.mjs +194 -0
- package/dist/xy/build/buildCommand.mjs.map +1 -0
- package/dist/xy/build/compileCommand.mjs +203 -0
- package/dist/xy/build/compileCommand.mjs.map +1 -0
- package/dist/xy/build/compileOnlyCommand.mjs +204 -0
- package/dist/xy/build/compileOnlyCommand.mjs.map +1 -0
- package/dist/xy/build/copyAssetsCommand.mjs +92 -0
- package/dist/xy/build/copyAssetsCommand.mjs.map +1 -0
- package/dist/xy/build/index.mjs +487 -0
- package/dist/xy/build/index.mjs.map +1 -0
- package/dist/xy/build/rebuildCommand.mjs +156 -0
- package/dist/xy/build/rebuildCommand.mjs.map +1 -0
- package/dist/xy/build/recompileCommand.mjs +215 -0
- package/dist/xy/build/recompileCommand.mjs.map +1 -0
- package/dist/xy/common/checkCommand.mjs +1909 -0
- package/dist/xy/common/checkCommand.mjs.map +1 -0
- package/dist/xy/common/claude/checkCommand.mjs +207 -0
- package/dist/xy/common/claude/checkCommand.mjs.map +1 -0
- package/dist/xy/common/claude/cleanCommand.mjs +78 -0
- package/dist/xy/common/claude/cleanCommand.mjs.map +1 -0
- package/dist/xy/common/claude/commandsCommand.mjs +134 -0
- package/dist/xy/common/claude/commandsCommand.mjs.map +1 -0
- package/dist/xy/common/claude/index.mjs +734 -0
- package/dist/xy/common/claude/index.mjs.map +1 -0
- package/dist/xy/common/claude/initCommand.mjs +458 -0
- package/dist/xy/common/claude/initCommand.mjs.map +1 -0
- package/dist/xy/common/claude/rulesCommand.mjs +167 -0
- package/dist/xy/common/claude/rulesCommand.mjs.map +1 -0
- package/dist/xy/common/claude/settingsCommand.mjs +115 -0
- package/dist/xy/common/claude/settingsCommand.mjs.map +1 -0
- package/dist/xy/common/claude/skillsCommand.mjs +140 -0
- package/dist/xy/common/claude/skillsCommand.mjs.map +1 -0
- package/dist/xy/common/cleanDocsCommand.mjs +74 -0
- package/dist/xy/common/cleanDocsCommand.mjs.map +1 -0
- package/dist/xy/common/deadCommand.mjs +137 -0
- package/dist/xy/common/deadCommand.mjs.map +1 -0
- package/dist/xy/common/genDocsCommand.mjs +175 -0
- package/dist/xy/common/genDocsCommand.mjs.map +1 -0
- package/dist/xy/common/gitignoreCommand.mjs +165 -0
- package/dist/xy/common/gitignoreCommand.mjs.map +1 -0
- package/dist/xy/common/gitlintCommand.mjs +89 -0
- package/dist/xy/common/gitlintCommand.mjs.map +1 -0
- package/dist/xy/common/index.mjs +4654 -0
- package/dist/xy/common/index.mjs.map +1 -0
- package/dist/xy/common/licenseCommand.mjs +108 -0
- package/dist/xy/common/licenseCommand.mjs.map +1 -0
- package/dist/xy/common/npmignoreGenCommand.mjs +100 -0
- package/dist/xy/common/npmignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/orphan/cleanCommand.mjs +102 -0
- package/dist/xy/common/orphan/cleanCommand.mjs.map +1 -0
- package/dist/xy/common/orphan/index.mjs +138 -0
- package/dist/xy/common/orphan/index.mjs.map +1 -0
- package/dist/xy/common/orphan/listCommand.mjs +100 -0
- package/dist/xy/common/orphan/listCommand.mjs.map +1 -0
- package/dist/xy/common/packmanCommand.mjs +1538 -0
- package/dist/xy/common/packmanCommand.mjs.map +1 -0
- package/dist/xy/common/readme/genCommand.mjs +395 -0
- package/dist/xy/common/readme/genCommand.mjs.map +1 -0
- package/dist/xy/common/readme/index.mjs +538 -0
- package/dist/xy/common/readme/index.mjs.map +1 -0
- package/dist/xy/common/readme/initCommand.mjs +109 -0
- package/dist/xy/common/readme/initCommand.mjs.map +1 -0
- package/dist/xy/common/readme/lintCommand.mjs +181 -0
- package/dist/xy/common/readme/lintCommand.mjs.map +1 -0
- package/dist/xy/common/repo/index.mjs +1070 -0
- package/dist/xy/common/repo/index.mjs.map +1 -0
- package/dist/xy/common/repo/initCommand.mjs +273 -0
- package/dist/xy/common/repo/initCommand.mjs.map +1 -0
- package/dist/xy/common/repo/lintCommand.mjs +789 -0
- package/dist/xy/common/repo/lintCommand.mjs.map +1 -0
- package/dist/xy/common/retestCommand.mjs +163 -0
- package/dist/xy/common/retestCommand.mjs.map +1 -0
- package/dist/xy/common/testCommand.mjs +157 -0
- package/dist/xy/common/testCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployCommand.mjs +214 -0
- package/dist/xy/deploy/deployCommand.mjs.map +1 -0
- package/dist/xy/deploy/index.mjs +289 -0
- package/dist/xy/deploy/index.mjs.map +1 -0
- package/dist/xy/deploy/publishCommand.mjs +218 -0
- package/dist/xy/deploy/publishCommand.mjs.map +1 -0
- package/dist/xy/index.mjs +8887 -0
- package/dist/xy/index.mjs.map +1 -0
- package/dist/xy/install/cleanCommand.mjs +182 -0
- package/dist/xy/install/cleanCommand.mjs.map +1 -0
- package/dist/xy/install/dupdepsCommand.mjs +234 -0
- package/dist/xy/install/dupdepsCommand.mjs.map +1 -0
- package/dist/xy/install/index.mjs +1006 -0
- package/dist/xy/install/index.mjs.map +1 -0
- package/dist/xy/install/reinstallCommand.mjs +292 -0
- package/dist/xy/install/reinstallCommand.mjs.map +1 -0
- package/dist/xy/install/staticsCommand.mjs +233 -0
- package/dist/xy/install/staticsCommand.mjs.map +1 -0
- package/dist/xy/install/upCommand.mjs +150 -0
- package/dist/xy/install/upCommand.mjs.map +1 -0
- package/dist/xy/install/updoCommand.mjs +550 -0
- package/dist/xy/install/updoCommand.mjs.map +1 -0
- package/dist/xy/lint/cycleCommand.mjs +289 -0
- package/dist/xy/lint/cycleCommand.mjs.map +1 -0
- package/dist/xy/lint/deplintCommand.mjs +1897 -0
- package/dist/xy/lint/deplintCommand.mjs.map +1 -0
- package/dist/xy/lint/fixCommand.mjs +398 -0
- package/dist/xy/lint/fixCommand.mjs.map +1 -0
- package/dist/xy/lint/index.mjs +3759 -0
- package/dist/xy/lint/index.mjs.map +1 -0
- package/dist/xy/lint/knipCommand.mjs +142 -0
- package/dist/xy/lint/knipCommand.mjs.map +1 -0
- package/dist/xy/lint/lint/index.mjs +695 -0
- package/dist/xy/lint/lint/index.mjs.map +1 -0
- package/dist/xy/lint/lint/initCommand.mjs +282 -0
- package/dist/xy/lint/lint/initCommand.mjs.map +1 -0
- package/dist/xy/lint/lint/runCommand.mjs +405 -0
- package/dist/xy/lint/lint/runCommand.mjs.map +1 -0
- package/dist/xy/lint/lintCommand.mjs +695 -0
- package/dist/xy/lint/lintCommand.mjs.map +1 -0
- package/dist/xy/lint/lintlintCommand.mjs +359 -0
- package/dist/xy/lint/lintlintCommand.mjs.map +1 -0
- package/dist/xy/lint/publintCommand.mjs +778 -0
- package/dist/xy/lint/publintCommand.mjs.map +1 -0
- package/dist/xy/lint/relintCommand.mjs +381 -0
- package/dist/xy/lint/relintCommand.mjs.map +1 -0
- package/dist/xy/lint/sonarCommand.mjs +137 -0
- package/dist/xy/lint/sonarCommand.mjs.map +1 -0
- package/dist/xy/param.mjs +8 -0
- package/dist/xy/param.mjs.map +1 -0
- package/dist/xy/react/analyzeCommand.mjs +150 -0
- package/dist/xy/react/analyzeCommand.mjs.map +1 -0
- package/dist/xy/react/ejectCommand.mjs +150 -0
- package/dist/xy/react/ejectCommand.mjs.map +1 -0
- package/dist/xy/react/index.mjs +202 -0
- package/dist/xy/react/index.mjs.map +1 -0
- package/dist/xy/react/sitemapCommand.mjs +129 -0
- package/dist/xy/react/sitemapCommand.mjs.map +1 -0
- package/dist/xy/react/startCommand.mjs +150 -0
- package/dist/xy/react/startCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +8879 -0
- package/dist/xy/xy.mjs.map +1 -0
- package/dist/xy/xyParseOptions.mjs +117 -0
- package/dist/xy/xyParseOptions.mjs.map +1 -0
- package/dist/xy/yarn/index.mjs +188 -0
- package/dist/xy/yarn/index.mjs.map +1 -0
- package/dist/xy/yarn/upplugCommand.mjs +134 -0
- package/dist/xy/yarn/upplugCommand.mjs.map +1 -0
- package/dist/xy/yarn/upyarnCommand.mjs +129 -0
- package/dist/xy/yarn/upyarnCommand.mjs.map +1 -0
- package/dist/xy/yarn/yarn3OnlyCommand.mjs +70 -0
- package/dist/xy/yarn/yarn3OnlyCommand.mjs.map +1 -0
- package/package.json +119 -0
- package/templates/claude/CLAUDE-local.md +4 -0
- package/templates/claude/CLAUDE-project.md +4 -0
- package/templates/claude/commands/xy-build.md +7 -0
- package/templates/claude/commands/xy-clean.md +7 -0
- package/templates/claude/commands/xy-compile.md +7 -0
- package/templates/claude/commands/xy-cycle.md +7 -0
- package/templates/claude/commands/xy-dead.md +7 -0
- package/templates/claude/commands/xy-deplint.md +7 -0
- package/templates/claude/commands/xy-deps.md +24 -0
- package/templates/claude/commands/xy-dupdeps.md +7 -0
- package/templates/claude/commands/xy-fix.md +7 -0
- package/templates/claude/commands/xy-gen-docs.md +7 -0
- package/templates/claude/commands/xy-gitignore.md +7 -0
- package/templates/claude/commands/xy-gitlint.md +7 -0
- package/templates/claude/commands/xy-knip.md +7 -0
- package/templates/claude/commands/xy-license.md +7 -0
- package/templates/claude/commands/xy-lint-rules.md +44 -0
- package/templates/claude/commands/xy-lint.md +7 -0
- package/templates/claude/commands/xy-publint.md +7 -0
- package/templates/claude/commands/xy-rebuild.md +7 -0
- package/templates/claude/commands/xy-recompile.md +7 -0
- package/templates/claude/commands/xy-reinstall.md +7 -0
- package/templates/claude/commands/xy-relint.md +7 -0
- package/templates/claude/commands/xy-retest.md +7 -0
- package/templates/claude/commands/xy-sonar.md +7 -0
- package/templates/claude/commands/xy-test.md +7 -0
- package/templates/claude/commands/xy-up.md +9 -0
- package/templates/claude/rules/xylabs-architecture.md +8 -0
- package/templates/claude/rules/xylabs-git-workflow.md +7 -0
- package/templates/claude/rules/xylabs-naming.md +7 -0
- package/templates/claude/rules/xylabs-style.md +17 -0
- package/templates/claude/skills/xylabs-e2e-setup/SKILL.md +223 -0
- package/templates/claude/skills/xylabs-xy-cli/SKILL.md +236 -0
- package/templates/claude/skills/xylabs-xy-deplint-fix/SKILL.md +122 -0
- package/templates/gitignore/gitignore/template.gitignore +51 -0
- package/templates/gitignore/template.gitignore +51 -0
- package/templates/readme/README.body.md +25 -0
- package/templates/readme/README.template.md +22 -0
- package/templates/repo/cli/package/package.json.tmpl +63 -0
- package/templates/repo/cli/package/src/__packageName__.ts.tmpl +21 -0
- package/templates/repo/cli/package/src/actions/index.ts +1 -0
- package/templates/repo/cli/package/src/actions/printVersion.ts.tmpl +8 -0
- package/templates/repo/cli/package/src/bin/__packageName__.ts.tmpl +12 -0
- package/templates/repo/cli/package/src/commands/index.ts +1 -0
- package/templates/repo/cli/package/src/commands/versionCommand.ts.tmpl +11 -0
- package/templates/repo/cli/package/src/index.ts.tmpl +1 -0
- package/templates/repo/cli/package/tsconfig.build.json +25 -0
- package/templates/repo/cli/package/tsconfig.json +4 -0
- package/templates/repo/cli/package/tsup.config.ts +15 -0
- package/templates/repo/cli/package/xy.config.ts +3 -0
- package/templates/repo/cli/root/CLAUDE.md.tmpl +38 -0
- package/templates/repo/cli/root/cspell.json.tmpl +13 -0
- package/templates/repo/cli/root/eslint.config.ts +28 -0
- package/templates/repo/cli/root/github/workflows/build-pnpm.yml.tmpl +34 -0
- package/templates/repo/cli/root/github/workflows/build-yarn.yml.tmpl +32 -0
- package/templates/repo/cli/root/gitignore.tmpl +47 -0
- package/templates/repo/cli/root/knip.config.ts +16 -0
- package/templates/repo/cli/root/package.json.tmpl +54 -0
- package/templates/repo/cli/root/pnpm-workspace.yaml +2 -0
- package/templates/repo/cli/root/tsconfig.json +4 -0
- package/templates/repo/cli/root/vitest.config.ts +31 -0
- package/templates/repo/cli/root/xy.config.ts.tmpl +5 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
// src/lib/concurrency.ts
|
|
2
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
3
|
+
var outputStorage = new AsyncLocalStorage();
|
|
4
|
+
var captureInstalled = false;
|
|
5
|
+
function installOutputCapture() {
|
|
6
|
+
if (captureInstalled) return;
|
|
7
|
+
captureInstalled = true;
|
|
8
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
9
|
+
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
10
|
+
function intercept(original) {
|
|
11
|
+
return function(chunk, ...args) {
|
|
12
|
+
const buffer = outputStorage.getStore();
|
|
13
|
+
if (buffer) {
|
|
14
|
+
buffer.push(typeof chunk === "string" ? chunk : new TextDecoder().decode(chunk));
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return original(chunk, ...args);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
process.stdout.write = intercept(originalStdoutWrite);
|
|
21
|
+
process.stderr.write = intercept(originalStderrWrite);
|
|
22
|
+
}
|
|
23
|
+
async function runWithConcurrency(items, concurrency, fn) {
|
|
24
|
+
let next = 0;
|
|
25
|
+
async function worker() {
|
|
26
|
+
while (next < items.length) {
|
|
27
|
+
const i = next++;
|
|
28
|
+
await fn(items[i]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, () => worker()));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/pm/detectPackageManager.ts
|
|
35
|
+
import { existsSync } from "fs";
|
|
36
|
+
function detectPackageManager() {
|
|
37
|
+
if (existsSync("pnpm-lock.yaml") || existsSync("pnpm-workspace.yaml")) return "pnpm";
|
|
38
|
+
return "yarn";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/pm/registry.ts
|
|
42
|
+
var implementations = /* @__PURE__ */ new Map();
|
|
43
|
+
function getPackageManager(name) {
|
|
44
|
+
const pmName = name ?? detectPackageManager();
|
|
45
|
+
const pm = implementations.get(pmName);
|
|
46
|
+
if (!pm) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`No package manager implementation registered for "${pmName}". Ensure registerPackageManager() has been called before getPackageManager().`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return pm;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/lib/initCwd.ts
|
|
55
|
+
function INIT_CWD() {
|
|
56
|
+
return process.env.INIT_CWD ?? process.cwd();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/lib/loadConfig.ts
|
|
60
|
+
import chalk from "chalk";
|
|
61
|
+
import { cosmiconfig } from "cosmiconfig";
|
|
62
|
+
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
63
|
+
import deepmerge from "deepmerge";
|
|
64
|
+
var config;
|
|
65
|
+
var rootConfigPath;
|
|
66
|
+
var workspaceConfigCache = /* @__PURE__ */ new Map();
|
|
67
|
+
var deprecationWarned = /* @__PURE__ */ new Set();
|
|
68
|
+
function createExplorer() {
|
|
69
|
+
return cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } });
|
|
70
|
+
}
|
|
71
|
+
var loadConfig = async (params) => {
|
|
72
|
+
if (config === void 0) {
|
|
73
|
+
const cosmicConfigResult = await createExplorer().search();
|
|
74
|
+
config = cosmicConfigResult?.config ?? {};
|
|
75
|
+
rootConfigPath = cosmicConfigResult?.filepath;
|
|
76
|
+
const configFilePath = cosmicConfigResult?.filepath;
|
|
77
|
+
if (configFilePath !== void 0) {
|
|
78
|
+
console.log(chalk.green(`Loaded config from ${configFilePath}`));
|
|
79
|
+
if (config.verbose) {
|
|
80
|
+
console.log(chalk.gray(`${JSON.stringify(config, null, 2)}`));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return deepmerge(config, params ?? {});
|
|
85
|
+
};
|
|
86
|
+
async function loadWorkspaceConfig(workspaceDir) {
|
|
87
|
+
const cached = workspaceConfigCache.get(workspaceDir);
|
|
88
|
+
if (cached !== void 0) return cached;
|
|
89
|
+
const result = await createExplorer().search(workspaceDir);
|
|
90
|
+
if (!result || result.filepath === rootConfigPath) {
|
|
91
|
+
workspaceConfigCache.set(workspaceDir, {});
|
|
92
|
+
return {};
|
|
93
|
+
}
|
|
94
|
+
const wsConfig = result.config ?? {};
|
|
95
|
+
workspaceConfigCache.set(workspaceDir, wsConfig);
|
|
96
|
+
return wsConfig;
|
|
97
|
+
}
|
|
98
|
+
var DEPRECATED_COMMAND_FIELDS = /* @__PURE__ */ new Set(["deplint", "publint"]);
|
|
99
|
+
function resolveCommandField(cfg, commandName, configPath) {
|
|
100
|
+
const commands = cfg.commands;
|
|
101
|
+
const fromCommands = commands?.[commandName];
|
|
102
|
+
const fromTopLevel = cfg[commandName];
|
|
103
|
+
if (fromCommands !== void 0 && typeof fromCommands === "object") {
|
|
104
|
+
return fromCommands;
|
|
105
|
+
}
|
|
106
|
+
if (fromTopLevel !== void 0 && typeof fromTopLevel === "object" && DEPRECATED_COMMAND_FIELDS.has(commandName)) {
|
|
107
|
+
const key = `${configPath ?? "unknown"}:${commandName}`;
|
|
108
|
+
if (!deprecationWarned.has(key)) {
|
|
109
|
+
deprecationWarned.add(key);
|
|
110
|
+
console.warn(chalk.yellow(
|
|
111
|
+
`[xy] Deprecated: top-level "${commandName}" in ${configPath ?? "xy.config"} \u2014 move to "commands.${commandName}"`
|
|
112
|
+
));
|
|
113
|
+
}
|
|
114
|
+
return fromTopLevel;
|
|
115
|
+
}
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
async function loadWorkspaceCommandConfig(workspaceDir, commandName) {
|
|
119
|
+
const root = await loadConfig();
|
|
120
|
+
const rootCmd = resolveCommandField(root, commandName, rootConfigPath);
|
|
121
|
+
const wsConfig = await loadWorkspaceConfig(workspaceDir);
|
|
122
|
+
const wsConfigPath = workspaceConfigCache.has(workspaceDir) ? workspaceDir : void 0;
|
|
123
|
+
const wsCmd = resolveCommandField(wsConfig, commandName, wsConfigPath);
|
|
124
|
+
return deepmerge(rootCmd, wsCmd);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/lib/runInstall.ts
|
|
128
|
+
import { spawnSync } from "child_process";
|
|
129
|
+
import chalk2 from "chalk";
|
|
130
|
+
function runInstall(cwd) {
|
|
131
|
+
const pm = detectPackageManager();
|
|
132
|
+
console.log(chalk2.gray(`Running ${pm} install...`));
|
|
133
|
+
const result = spawnSync(pm, ["install"], {
|
|
134
|
+
cwd,
|
|
135
|
+
stdio: "inherit"
|
|
136
|
+
});
|
|
137
|
+
if (result.status !== 0) {
|
|
138
|
+
console.warn(chalk2.yellow(`${pm} install failed`));
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
console.log(chalk2.green("Dependencies installed"));
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/actions/package-lint-deps.ts
|
|
146
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
147
|
+
import PATH from "path";
|
|
148
|
+
import chalk3 from "chalk";
|
|
149
|
+
import semver from "semver";
|
|
150
|
+
function readWorkspacePackageJson(cwd, location) {
|
|
151
|
+
const pkgPath = PATH.resolve(cwd, location, "package.json");
|
|
152
|
+
try {
|
|
153
|
+
return JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
154
|
+
} catch {
|
|
155
|
+
return void 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function writeWorkspacePackageJson(cwd, location, pkg) {
|
|
159
|
+
const pkgPath = PATH.resolve(cwd, location, "package.json");
|
|
160
|
+
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
|
|
161
|
+
`, "utf8");
|
|
162
|
+
}
|
|
163
|
+
function buildWorkspaceVersionMap(cwd, workspaces) {
|
|
164
|
+
const map = /* @__PURE__ */ new Map();
|
|
165
|
+
for (const { location, name } of workspaces) {
|
|
166
|
+
if (location === ".") continue;
|
|
167
|
+
const pkg = readWorkspacePackageJson(cwd, location);
|
|
168
|
+
if (!pkg) continue;
|
|
169
|
+
const version = pkg.version;
|
|
170
|
+
if (version) map.set(name, version);
|
|
171
|
+
}
|
|
172
|
+
return map;
|
|
173
|
+
}
|
|
174
|
+
function expectedPeerRange(devDepVersion, targetVersion) {
|
|
175
|
+
const parsed = semver.parse(targetVersion);
|
|
176
|
+
if (!parsed) return `~${targetVersion}`;
|
|
177
|
+
if (devDepVersion === "workspace:^") {
|
|
178
|
+
return `^${parsed.major}`;
|
|
179
|
+
}
|
|
180
|
+
return `~${parsed.major}.${parsed.minor}`;
|
|
181
|
+
}
|
|
182
|
+
function checkInternalPeerVersions(cwd, workspaces) {
|
|
183
|
+
const result = {
|
|
184
|
+
errors: [],
|
|
185
|
+
fixable: [],
|
|
186
|
+
warnings: []
|
|
187
|
+
};
|
|
188
|
+
const workspaceVersions = buildWorkspaceVersionMap(cwd, workspaces);
|
|
189
|
+
for (const { location, name } of workspaces) {
|
|
190
|
+
const pkg = readWorkspacePackageJson(cwd, location);
|
|
191
|
+
if (!pkg) continue;
|
|
192
|
+
const peerDeps = pkg.peerDependencies;
|
|
193
|
+
if (!peerDeps) continue;
|
|
194
|
+
const devDeps = pkg.devDependencies;
|
|
195
|
+
for (const [dep, version] of Object.entries(peerDeps)) {
|
|
196
|
+
const targetVersion = workspaceVersions.get(dep);
|
|
197
|
+
if (!targetVersion) continue;
|
|
198
|
+
if (version.startsWith("workspace:")) {
|
|
199
|
+
const expected2 = expectedPeerRange(devDeps?.[dep], targetVersion);
|
|
200
|
+
result.fixable.push(
|
|
201
|
+
`${name} (${location}) peerDependencies.${dep} uses workspace: protocol \u2014 should be "${expected2}"`
|
|
202
|
+
);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const expected = expectedPeerRange(devDeps?.[dep], targetVersion);
|
|
206
|
+
if (version !== expected && !semver.satisfies(targetVersion, version)) {
|
|
207
|
+
result.fixable.push(
|
|
208
|
+
`${name} (${location}) peerDependencies.${dep} is "${version}" \u2014 current version ${targetVersion} is not satisfied; expected "${expected}"`
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
function fixInternalPeerVersions(cwd, workspaces) {
|
|
216
|
+
const workspaceVersions = buildWorkspaceVersionMap(cwd, workspaces);
|
|
217
|
+
for (const { location, name } of workspaces) {
|
|
218
|
+
const pkg = readWorkspacePackageJson(cwd, location);
|
|
219
|
+
if (!pkg) continue;
|
|
220
|
+
const peerDeps = pkg.peerDependencies;
|
|
221
|
+
if (!peerDeps) continue;
|
|
222
|
+
const devDeps = pkg.devDependencies;
|
|
223
|
+
let modified = false;
|
|
224
|
+
for (const [dep, version] of Object.entries(peerDeps)) {
|
|
225
|
+
const targetVersion = workspaceVersions.get(dep);
|
|
226
|
+
if (!targetVersion) continue;
|
|
227
|
+
const expected = expectedPeerRange(devDeps?.[dep], targetVersion);
|
|
228
|
+
if (version !== expected) {
|
|
229
|
+
peerDeps[dep] = expected;
|
|
230
|
+
console.log(chalk3.green(` \u2714 Fixed: set peerDependencies.${dep} to "${expected}" in ${name} (${location})`));
|
|
231
|
+
modified = true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (modified) {
|
|
235
|
+
writeWorkspacePackageJson(cwd, location, pkg);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// src/actions/package/compile/XyConfig.ts
|
|
241
|
+
var ALL_PUBLINT_CHECKS = [
|
|
242
|
+
"files",
|
|
243
|
+
"importToDefault",
|
|
244
|
+
"main",
|
|
245
|
+
"module",
|
|
246
|
+
"peerDeps",
|
|
247
|
+
"publint",
|
|
248
|
+
"resolutions",
|
|
249
|
+
"rootSource",
|
|
250
|
+
"rootTypes",
|
|
251
|
+
"sideEffects",
|
|
252
|
+
"source",
|
|
253
|
+
"types"
|
|
254
|
+
];
|
|
255
|
+
var PUBLISH_ONLY_CHECKS = [
|
|
256
|
+
"files",
|
|
257
|
+
"importToDefault",
|
|
258
|
+
"main",
|
|
259
|
+
"module",
|
|
260
|
+
"publint",
|
|
261
|
+
"rootSource",
|
|
262
|
+
"rootTypes",
|
|
263
|
+
"sideEffects",
|
|
264
|
+
"source",
|
|
265
|
+
"types"
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
// src/actions/package/publint.ts
|
|
269
|
+
import { promises as fs } from "fs";
|
|
270
|
+
import path from "path";
|
|
271
|
+
import chalk4 from "chalk";
|
|
272
|
+
import { glob } from "glob";
|
|
273
|
+
import sortPackageJson from "sort-package-json";
|
|
274
|
+
var removeSourceFromExports = (exports) => {
|
|
275
|
+
let removed = false;
|
|
276
|
+
for (const [key, value] of Object.entries(exports)) {
|
|
277
|
+
if (key === "source") {
|
|
278
|
+
delete exports[key];
|
|
279
|
+
removed = true;
|
|
280
|
+
} else if (typeof value === "object" && value !== null && removeSourceFromExports(value)) removed = true;
|
|
281
|
+
}
|
|
282
|
+
return removed;
|
|
283
|
+
};
|
|
284
|
+
var hasSourceInExports = (exports) => {
|
|
285
|
+
for (const [key, value] of Object.entries(exports)) {
|
|
286
|
+
if (key === "source") return true;
|
|
287
|
+
if (typeof value === "object" && value !== null && hasSourceInExports(value)) return true;
|
|
288
|
+
}
|
|
289
|
+
return false;
|
|
290
|
+
};
|
|
291
|
+
var hasImportKeyInExports = (exports) => {
|
|
292
|
+
for (const [key, value] of Object.entries(exports)) {
|
|
293
|
+
if (key === "import" && typeof value === "string" && value.endsWith(".mjs")) return true;
|
|
294
|
+
if (typeof value === "object" && value !== null && hasImportKeyInExports(value)) return true;
|
|
295
|
+
}
|
|
296
|
+
return false;
|
|
297
|
+
};
|
|
298
|
+
var replaceImportWithDefault = (exports) => {
|
|
299
|
+
let modified = false;
|
|
300
|
+
for (const [key, value] of Object.entries(exports)) {
|
|
301
|
+
if (key === "import" && typeof value === "string" && value.endsWith(".mjs")) {
|
|
302
|
+
if (exports.default === void 0) {
|
|
303
|
+
exports.default = value;
|
|
304
|
+
}
|
|
305
|
+
delete exports.import;
|
|
306
|
+
if (exports.types === void 0) {
|
|
307
|
+
exports.types = value.replace(/\.mjs$/, ".d.ts");
|
|
308
|
+
}
|
|
309
|
+
modified = true;
|
|
310
|
+
} else if (typeof value === "object" && value !== null && replaceImportWithDefault(value)) modified = true;
|
|
311
|
+
}
|
|
312
|
+
return modified;
|
|
313
|
+
};
|
|
314
|
+
var hasTypesInExports = (exports) => {
|
|
315
|
+
for (const [key, value] of Object.entries(exports)) {
|
|
316
|
+
if (key === "types") return true;
|
|
317
|
+
if (typeof value === "object" && value !== null && hasTypesInExports(value)) return true;
|
|
318
|
+
}
|
|
319
|
+
return false;
|
|
320
|
+
};
|
|
321
|
+
function ensureExportsPath(value) {
|
|
322
|
+
if (value.startsWith("./") || value.startsWith("../")) return value;
|
|
323
|
+
return `./${value}`;
|
|
324
|
+
}
|
|
325
|
+
function emptyCustomResult() {
|
|
326
|
+
return {
|
|
327
|
+
errors: 0,
|
|
328
|
+
modified: false,
|
|
329
|
+
warnings: 0
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function mergeResults(target, source) {
|
|
333
|
+
target.errors += source.errors;
|
|
334
|
+
target.warnings += source.warnings;
|
|
335
|
+
target.modified = target.modified || source.modified;
|
|
336
|
+
}
|
|
337
|
+
function checkFiles(pkg, fix) {
|
|
338
|
+
const result = emptyCustomResult();
|
|
339
|
+
const files = pkg.files;
|
|
340
|
+
if (files === void 0) {
|
|
341
|
+
console.warn(chalk4.yellow('Publint [custom]: "files" field is missing'));
|
|
342
|
+
result.warnings++;
|
|
343
|
+
}
|
|
344
|
+
if (Array.isArray(files) && !files.includes("README.md")) {
|
|
345
|
+
files.push("README.md");
|
|
346
|
+
console.warn(chalk4.yellow('Publint [custom]: added "README.md" to "files"'));
|
|
347
|
+
result.modified = true;
|
|
348
|
+
result.warnings++;
|
|
349
|
+
}
|
|
350
|
+
if (Array.isArray(files) && files.includes("src")) {
|
|
351
|
+
if (fix) {
|
|
352
|
+
pkg.files = files.filter((f) => f !== "src");
|
|
353
|
+
console.warn(chalk4.yellow('Publint [custom]: removed "src" from "files"'));
|
|
354
|
+
result.modified = true;
|
|
355
|
+
} else {
|
|
356
|
+
console.warn(chalk4.yellow('Publint [custom]: "src" should not be in "files" (use --fix to remove)'));
|
|
357
|
+
}
|
|
358
|
+
result.warnings++;
|
|
359
|
+
}
|
|
360
|
+
return result;
|
|
361
|
+
}
|
|
362
|
+
function checkExportsSource(pkg, fix) {
|
|
363
|
+
const result = emptyCustomResult();
|
|
364
|
+
const exports = pkg.exports;
|
|
365
|
+
if (exports && typeof exports === "object" && hasSourceInExports(exports)) {
|
|
366
|
+
if (fix) {
|
|
367
|
+
removeSourceFromExports(exports);
|
|
368
|
+
console.warn(chalk4.yellow('Publint [custom]: removed "source" entries from "exports"'));
|
|
369
|
+
result.modified = true;
|
|
370
|
+
} else {
|
|
371
|
+
console.warn(chalk4.yellow('Publint [custom]: "source" entries should not be in "exports" (use --fix to remove)'));
|
|
372
|
+
}
|
|
373
|
+
result.warnings++;
|
|
374
|
+
}
|
|
375
|
+
return result;
|
|
376
|
+
}
|
|
377
|
+
function migrateFieldToExports(pkg, field, exportKey, fix) {
|
|
378
|
+
const result = emptyCustomResult();
|
|
379
|
+
if (pkg[field] === void 0) return result;
|
|
380
|
+
const fieldValue = pkg[field];
|
|
381
|
+
if (!fieldValue.endsWith(".js") && !fieldValue.endsWith(".mjs") && !fieldValue.endsWith(".cjs")) return result;
|
|
382
|
+
if (fix) {
|
|
383
|
+
const exportValue = ensureExportsPath(fieldValue);
|
|
384
|
+
const exports = pkg.exports;
|
|
385
|
+
if (exports && typeof exports === "object") {
|
|
386
|
+
const dot = exports["."];
|
|
387
|
+
if (dot && typeof dot === "object" && !dot[exportKey]) {
|
|
388
|
+
dot[exportKey] = exportValue;
|
|
389
|
+
console.warn(chalk4.yellow(`Publint [custom]: migrated "${field}" to "exports['.'].${exportKey}" (${fieldValue})`));
|
|
390
|
+
}
|
|
391
|
+
} else if (!pkg.exports) {
|
|
392
|
+
pkg.exports = { ".": { [exportKey]: exportValue } };
|
|
393
|
+
console.warn(chalk4.yellow(`Publint [custom]: migrated "${field}" to "exports" (.\u2192${fieldValue})`));
|
|
394
|
+
}
|
|
395
|
+
delete pkg[field];
|
|
396
|
+
console.warn(chalk4.yellow(`Publint [custom]: removed deprecated "${field}" field`));
|
|
397
|
+
result.modified = true;
|
|
398
|
+
} else {
|
|
399
|
+
console.warn(chalk4.yellow(`Publint [custom]: "${field}" field is deprecated, use "exports" instead (use --fix to remove)`));
|
|
400
|
+
}
|
|
401
|
+
result.warnings++;
|
|
402
|
+
return result;
|
|
403
|
+
}
|
|
404
|
+
function checkSideEffects(pkg) {
|
|
405
|
+
const result = emptyCustomResult();
|
|
406
|
+
if (pkg.sideEffects !== false) {
|
|
407
|
+
console.warn(chalk4.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
408
|
+
result.warnings++;
|
|
409
|
+
}
|
|
410
|
+
return result;
|
|
411
|
+
}
|
|
412
|
+
function checkRootSource(pkg, fix) {
|
|
413
|
+
const result = emptyCustomResult();
|
|
414
|
+
for (const field of ["source", "src"]) {
|
|
415
|
+
if (pkg[field] !== void 0) {
|
|
416
|
+
if (fix) {
|
|
417
|
+
delete pkg[field];
|
|
418
|
+
console.warn(chalk4.yellow(`Publint [custom]: removed root-level "${field}" field`));
|
|
419
|
+
result.modified = true;
|
|
420
|
+
} else {
|
|
421
|
+
console.warn(chalk4.yellow(`Publint [custom]: root-level "${field}" field should not be in package.json (use --fix to remove)`));
|
|
422
|
+
}
|
|
423
|
+
result.warnings++;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return result;
|
|
427
|
+
}
|
|
428
|
+
function checkResolutions(pkg) {
|
|
429
|
+
const result = emptyCustomResult();
|
|
430
|
+
if (pkg.resolutions !== void 0) {
|
|
431
|
+
console.warn(chalk4.yellow('Publint [custom]: "resolutions" in use'));
|
|
432
|
+
console.warn(chalk4.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
433
|
+
result.warnings++;
|
|
434
|
+
}
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
function checkImportToDefault(pkg, fix) {
|
|
438
|
+
const result = emptyCustomResult();
|
|
439
|
+
const exports = pkg.exports;
|
|
440
|
+
if (!exports || typeof exports !== "object") return result;
|
|
441
|
+
if (!hasImportKeyInExports(exports)) return result;
|
|
442
|
+
if (fix) {
|
|
443
|
+
replaceImportWithDefault(exports);
|
|
444
|
+
console.warn(chalk4.yellow('Publint [custom]: renamed "import" to "default" in "exports" and ensured "types" siblings'));
|
|
445
|
+
result.modified = true;
|
|
446
|
+
} else {
|
|
447
|
+
console.warn(chalk4.yellow('Publint [custom]: "import" entries in "exports" should use "default" instead (use --fix to rename)'));
|
|
448
|
+
}
|
|
449
|
+
result.warnings++;
|
|
450
|
+
return result;
|
|
451
|
+
}
|
|
452
|
+
function checkRootTypes(pkg, fix) {
|
|
453
|
+
const result = emptyCustomResult();
|
|
454
|
+
if (pkg.types === void 0) return result;
|
|
455
|
+
const exports = pkg.exports;
|
|
456
|
+
if (!exports || typeof exports !== "object" || !hasTypesInExports(exports)) return result;
|
|
457
|
+
if (fix) {
|
|
458
|
+
delete pkg.types;
|
|
459
|
+
console.warn(chalk4.yellow('Publint [custom]: removed redundant root "types" field (already defined in "exports")'));
|
|
460
|
+
result.modified = true;
|
|
461
|
+
} else {
|
|
462
|
+
console.warn(chalk4.yellow('Publint [custom]: root "types" field is redundant when "exports" defines types (use --fix to remove)'));
|
|
463
|
+
}
|
|
464
|
+
result.warnings++;
|
|
465
|
+
return result;
|
|
466
|
+
}
|
|
467
|
+
function customPubLint(pkg, fix = false, exclude = /* @__PURE__ */ new Set()) {
|
|
468
|
+
const result = emptyCustomResult();
|
|
469
|
+
if (!exclude.has("files")) mergeResults(result, checkFiles(pkg, fix));
|
|
470
|
+
if (!exclude.has("source")) mergeResults(result, checkExportsSource(pkg, fix));
|
|
471
|
+
if (!exclude.has("rootSource")) mergeResults(result, checkRootSource(pkg, fix));
|
|
472
|
+
if (!exclude.has("main")) mergeResults(result, migrateFieldToExports(pkg, "main", "default", fix));
|
|
473
|
+
if (!exclude.has("types")) mergeResults(result, migrateFieldToExports(pkg, "types", "types", fix));
|
|
474
|
+
if (!exclude.has("module")) mergeResults(result, migrateFieldToExports(pkg, "module", "default", fix));
|
|
475
|
+
if (!exclude.has("importToDefault")) mergeResults(result, checkImportToDefault(pkg, fix));
|
|
476
|
+
if (!exclude.has("rootTypes")) mergeResults(result, checkRootTypes(pkg, fix));
|
|
477
|
+
if (!exclude.has("sideEffects")) mergeResults(result, checkSideEffects(pkg));
|
|
478
|
+
if (!exclude.has("resolutions")) mergeResults(result, checkResolutions(pkg));
|
|
479
|
+
return [result.errors, result.warnings, result.modified];
|
|
480
|
+
}
|
|
481
|
+
var ALWAYS_INCLUDED_PATTERNS = [
|
|
482
|
+
"package.json",
|
|
483
|
+
"README",
|
|
484
|
+
"README.*",
|
|
485
|
+
"LICENCE",
|
|
486
|
+
"LICENCE.*",
|
|
487
|
+
"LICENSE",
|
|
488
|
+
"LICENSE.*",
|
|
489
|
+
"CHANGELOG",
|
|
490
|
+
"CHANGELOG.*"
|
|
491
|
+
];
|
|
492
|
+
async function resolvePackFiles(pkgDir, filesField) {
|
|
493
|
+
const patterns = [...ALWAYS_INCLUDED_PATTERNS];
|
|
494
|
+
if (filesField) {
|
|
495
|
+
for (const pattern of filesField) {
|
|
496
|
+
if (pattern.startsWith("!")) {
|
|
497
|
+
patterns.push(pattern);
|
|
498
|
+
} else {
|
|
499
|
+
patterns.push(pattern, `${pattern}/**`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
const matched = await glob(patterns, {
|
|
504
|
+
cwd: pkgDir,
|
|
505
|
+
nodir: true,
|
|
506
|
+
dot: false
|
|
507
|
+
});
|
|
508
|
+
const files = await Promise.all(
|
|
509
|
+
matched.map(async (rel) => {
|
|
510
|
+
const abs = path.join(pkgDir, rel);
|
|
511
|
+
const data = await fs.readFile(abs, "utf8").catch(() => "");
|
|
512
|
+
return { name: path.join(pkgDir, rel), data };
|
|
513
|
+
})
|
|
514
|
+
);
|
|
515
|
+
return files;
|
|
516
|
+
}
|
|
517
|
+
async function runPublintLibrary(pkgDir, pkg, strict, pack) {
|
|
518
|
+
const { publint: publint2 } = await import("publint");
|
|
519
|
+
let packOption = false;
|
|
520
|
+
if (pack) {
|
|
521
|
+
const files = await resolvePackFiles(pkgDir, pkg.files);
|
|
522
|
+
packOption = { files };
|
|
523
|
+
}
|
|
524
|
+
const { messages } = await publint2({
|
|
525
|
+
level: "suggestion",
|
|
526
|
+
pack: packOption,
|
|
527
|
+
pkgDir,
|
|
528
|
+
strict
|
|
529
|
+
});
|
|
530
|
+
const { formatMessage } = await import("publint/utils");
|
|
531
|
+
for (const message of messages) {
|
|
532
|
+
switch (message.type) {
|
|
533
|
+
case "error": {
|
|
534
|
+
console.error(chalk4.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
case "warning": {
|
|
538
|
+
console.warn(chalk4.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
default: {
|
|
542
|
+
console.log(chalk4.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
errors: messages.filter((message) => message.type === "error").length,
|
|
549
|
+
total: messages.length
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
var packagePublint = async ({
|
|
553
|
+
exclude = /* @__PURE__ */ new Set(),
|
|
554
|
+
fix = false,
|
|
555
|
+
pack = true,
|
|
556
|
+
pkgDir: pkgDirParam,
|
|
557
|
+
strict = true,
|
|
558
|
+
verbose: _verbose = false
|
|
559
|
+
} = {}) => {
|
|
560
|
+
const pkgDir = pkgDirParam ?? INIT_CWD();
|
|
561
|
+
const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
562
|
+
await fs.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
563
|
+
const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
564
|
+
const effectiveExclude = pkg.private ? /* @__PURE__ */ new Set([...exclude, ...PUBLISH_ONLY_CHECKS]) : exclude;
|
|
565
|
+
console.log(chalk4.green(`Publint: ${String(pkg.name)}${pkg.private ? chalk4.gray(" (private)") : ""}`));
|
|
566
|
+
console.log(chalk4.gray(pkgDir));
|
|
567
|
+
let libraryErrors = 0;
|
|
568
|
+
if (!effectiveExclude.has("publint")) {
|
|
569
|
+
const library = await runPublintLibrary(pkgDir, pkg, strict, pack);
|
|
570
|
+
libraryErrors = library.errors;
|
|
571
|
+
}
|
|
572
|
+
const [errorCount, _warningCount, modified] = customPubLint(pkg, fix, effectiveExclude);
|
|
573
|
+
if (modified) {
|
|
574
|
+
const sorted = sortPackageJson(JSON.stringify(pkg, null, 2));
|
|
575
|
+
await fs.writeFile(`${pkgDir}/package.json`, sorted);
|
|
576
|
+
}
|
|
577
|
+
return libraryErrors + errorCount;
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// src/actions/publint.ts
|
|
581
|
+
import chalk5 from "chalk";
|
|
582
|
+
function resolveExclude(publintConfig, cliExclude, cliInclude) {
|
|
583
|
+
const hasExclude = (publintConfig.exclude?.length ?? 0) > 0 || (cliExclude?.length ?? 0) > 0;
|
|
584
|
+
const hasInclude = (publintConfig.include?.length ?? 0) > 0 || (cliInclude?.length ?? 0) > 0;
|
|
585
|
+
if (hasExclude && hasInclude) {
|
|
586
|
+
console.error(chalk5.red("Publint: --include and --exclude cannot be used together"));
|
|
587
|
+
return void 0;
|
|
588
|
+
}
|
|
589
|
+
if (hasInclude) {
|
|
590
|
+
const include = /* @__PURE__ */ new Set([
|
|
591
|
+
...publintConfig.include ?? [],
|
|
592
|
+
...cliInclude ?? []
|
|
593
|
+
]);
|
|
594
|
+
return new Set(ALL_PUBLINT_CHECKS.filter((c) => !include.has(c)));
|
|
595
|
+
}
|
|
596
|
+
return /* @__PURE__ */ new Set([
|
|
597
|
+
...publintConfig.exclude ?? [],
|
|
598
|
+
...cliExclude ?? []
|
|
599
|
+
]);
|
|
600
|
+
}
|
|
601
|
+
function normalizePublintConfig(value) {
|
|
602
|
+
if (typeof value === "object") return value;
|
|
603
|
+
return {};
|
|
604
|
+
}
|
|
605
|
+
var publint = async ({
|
|
606
|
+
cliExclude,
|
|
607
|
+
cliInclude,
|
|
608
|
+
fix,
|
|
609
|
+
jobs,
|
|
610
|
+
pack,
|
|
611
|
+
verbose,
|
|
612
|
+
pkg
|
|
613
|
+
}) => {
|
|
614
|
+
return pkg === void 0 ? await publintAll({
|
|
615
|
+
cliExclude,
|
|
616
|
+
cliInclude,
|
|
617
|
+
fix,
|
|
618
|
+
jobs,
|
|
619
|
+
pack,
|
|
620
|
+
verbose
|
|
621
|
+
}) : await publintSingle({
|
|
622
|
+
cliExclude,
|
|
623
|
+
cliInclude,
|
|
624
|
+
fix,
|
|
625
|
+
pack,
|
|
626
|
+
pkg,
|
|
627
|
+
verbose
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
function logPublintSummary(packages, errors, ms) {
|
|
631
|
+
const color = errors > 0 ? chalk5.red : chalk5.blue;
|
|
632
|
+
console.log(color(`Checked ${packages} package(s) in ${ms.toFixed(0)}ms with ${errors} issue(s) found.`));
|
|
633
|
+
}
|
|
634
|
+
var publintSingle = async ({
|
|
635
|
+
cliExclude,
|
|
636
|
+
cliInclude,
|
|
637
|
+
fix,
|
|
638
|
+
pack,
|
|
639
|
+
pkg,
|
|
640
|
+
verbose
|
|
641
|
+
}) => {
|
|
642
|
+
const start = performance.now();
|
|
643
|
+
const pm = getPackageManager();
|
|
644
|
+
const workspace = pm.findWorkspace(pkg);
|
|
645
|
+
if (!workspace) {
|
|
646
|
+
console.error(chalk5.red(`Publint: workspace "${pkg}" not found`));
|
|
647
|
+
return 1;
|
|
648
|
+
}
|
|
649
|
+
const wsPublintConfig = normalizePublintConfig(
|
|
650
|
+
await loadWorkspaceCommandConfig(workspace.location, "publint")
|
|
651
|
+
);
|
|
652
|
+
const exclude = resolveExclude(wsPublintConfig, cliExclude, cliInclude);
|
|
653
|
+
if (!exclude) return 1;
|
|
654
|
+
const shouldPack = pack ?? wsPublintConfig.pack ?? true;
|
|
655
|
+
const errors = await packagePublint({
|
|
656
|
+
exclude,
|
|
657
|
+
fix,
|
|
658
|
+
pack: shouldPack,
|
|
659
|
+
pkgDir: workspace.location,
|
|
660
|
+
verbose
|
|
661
|
+
});
|
|
662
|
+
logPublintSummary(1, errors, performance.now() - start);
|
|
663
|
+
return errors;
|
|
664
|
+
};
|
|
665
|
+
var publintAll = async ({
|
|
666
|
+
cliExclude,
|
|
667
|
+
cliInclude,
|
|
668
|
+
fix,
|
|
669
|
+
jobs,
|
|
670
|
+
pack,
|
|
671
|
+
verbose
|
|
672
|
+
}) => {
|
|
673
|
+
const start = performance.now();
|
|
674
|
+
const pm = getPackageManager();
|
|
675
|
+
const workspaces = pm.listWorkspaces();
|
|
676
|
+
const concurrency = jobs;
|
|
677
|
+
const results = Array.from({ length: workspaces.length }, () => ({ errors: 0, output: [] }));
|
|
678
|
+
installOutputCapture();
|
|
679
|
+
await runWithConcurrency(
|
|
680
|
+
workspaces.map((ws, i) => ({ i, ws })),
|
|
681
|
+
concurrency,
|
|
682
|
+
async ({ i, ws }) => {
|
|
683
|
+
const output = [];
|
|
684
|
+
await outputStorage.run(output, async () => {
|
|
685
|
+
try {
|
|
686
|
+
const wsPublintConfig = normalizePublintConfig(
|
|
687
|
+
await loadWorkspaceCommandConfig(ws.location, "publint")
|
|
688
|
+
);
|
|
689
|
+
const exclude = resolveExclude(wsPublintConfig, cliExclude, cliInclude) ?? /* @__PURE__ */ new Set();
|
|
690
|
+
const shouldPack = pack ?? wsPublintConfig.pack ?? true;
|
|
691
|
+
const errors = await packagePublint({
|
|
692
|
+
exclude,
|
|
693
|
+
fix,
|
|
694
|
+
pack: shouldPack,
|
|
695
|
+
pkgDir: ws.location,
|
|
696
|
+
verbose
|
|
697
|
+
});
|
|
698
|
+
results[i] = { errors, output };
|
|
699
|
+
} catch (ex) {
|
|
700
|
+
output.push(chalk5.red(`Publint failed for ${ws.name}: ${ex.message}
|
|
701
|
+
`));
|
|
702
|
+
results[i] = { errors: 1, output };
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
let totalErrors = 0;
|
|
708
|
+
for (const { errors, output } of results) {
|
|
709
|
+
for (const line of output) {
|
|
710
|
+
process.stdout.write(line);
|
|
711
|
+
}
|
|
712
|
+
totalErrors += errors;
|
|
713
|
+
}
|
|
714
|
+
const allExclude = resolveExclude({}, cliExclude, cliInclude) ?? /* @__PURE__ */ new Set();
|
|
715
|
+
if (!allExclude.has("peerDeps")) {
|
|
716
|
+
const cwd = INIT_CWD();
|
|
717
|
+
const peerResult = checkInternalPeerVersions(cwd, workspaces);
|
|
718
|
+
if (peerResult.fixable.length > 0) {
|
|
719
|
+
if (fix) {
|
|
720
|
+
fixInternalPeerVersions(cwd, workspaces);
|
|
721
|
+
runInstall();
|
|
722
|
+
} else {
|
|
723
|
+
for (const msg of peerResult.fixable) {
|
|
724
|
+
console.log(chalk5.red(` \u2717 ${msg} (fixable)`));
|
|
725
|
+
}
|
|
726
|
+
totalErrors += peerResult.fixable.length;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
totalErrors += peerResult.errors.length;
|
|
730
|
+
}
|
|
731
|
+
logPublintSummary(workspaces.length, totalErrors, performance.now() - start);
|
|
732
|
+
return totalErrors;
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
// src/xy/param.ts
|
|
736
|
+
var packagePositionalParam = (yargs) => {
|
|
737
|
+
return yargs.positional("package", { describe: "Specific package to target", type: "string" });
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
// src/xy/lint/publintCommand.ts
|
|
741
|
+
var publintCommand = {
|
|
742
|
+
command: "publint [package]",
|
|
743
|
+
describe: "Publint - Run Publint",
|
|
744
|
+
builder: (yargs) => {
|
|
745
|
+
return packagePositionalParam(yargs).option("fix", {
|
|
746
|
+
describe: 'Auto-fix issues (e.g. remove "src" from files, "source" from exports, root-level "source"/"src" fields)',
|
|
747
|
+
type: "boolean",
|
|
748
|
+
default: false
|
|
749
|
+
}).option("exclude", {
|
|
750
|
+
alias: "e",
|
|
751
|
+
description: "Checks to skip (comma-separated): publint, files, source, rootSource, main, types, module, sideEffects, resolutions, peerDeps",
|
|
752
|
+
type: "string"
|
|
753
|
+
}).option("include", {
|
|
754
|
+
description: "Only run these checks (comma-separated): publint, files, source, rootSource, main, types, module, sideEffects, resolutions, peerDeps",
|
|
755
|
+
type: "string"
|
|
756
|
+
}).option("pack", {
|
|
757
|
+
description: "Run pack before publint to verify published files (default: true)",
|
|
758
|
+
type: "boolean"
|
|
759
|
+
});
|
|
760
|
+
},
|
|
761
|
+
handler: async (argv) => {
|
|
762
|
+
if (argv.verbose) console.log("Publint");
|
|
763
|
+
const parseList = (raw) => raw?.split(",").map((v) => v.trim()).filter(Boolean);
|
|
764
|
+
process.exitCode = await publint({
|
|
765
|
+
cliExclude: parseList(argv.exclude),
|
|
766
|
+
cliInclude: parseList(argv.include),
|
|
767
|
+
fix: !!argv.fix,
|
|
768
|
+
jobs: argv.jobs,
|
|
769
|
+
pack: argv.pack,
|
|
770
|
+
pkg: argv.package,
|
|
771
|
+
verbose: !!argv.verbose
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
export {
|
|
776
|
+
publintCommand
|
|
777
|
+
};
|
|
778
|
+
//# sourceMappingURL=publintCommand.mjs.map
|