@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,1006 @@
|
|
|
1
|
+
// src/lib/checkResult.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
4
|
+
if (result) {
|
|
5
|
+
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
6
|
+
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
7
|
+
console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
|
|
8
|
+
if (exitOnFail) {
|
|
9
|
+
process.exit(result);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/lib/concurrency.ts
|
|
15
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
16
|
+
var outputStorage = new AsyncLocalStorage();
|
|
17
|
+
async function runWithConcurrency(items, concurrency, fn) {
|
|
18
|
+
let next = 0;
|
|
19
|
+
async function worker() {
|
|
20
|
+
while (next < items.length) {
|
|
21
|
+
const i = next++;
|
|
22
|
+
await fn(items[i]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, () => worker()));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
29
|
+
import { execSync } from "child_process";
|
|
30
|
+
|
|
31
|
+
// src/pm/detectPackageManager.ts
|
|
32
|
+
import { existsSync } from "fs";
|
|
33
|
+
function detectPackageManager() {
|
|
34
|
+
if (existsSync("pnpm-lock.yaml") || existsSync("pnpm-workspace.yaml")) return "pnpm";
|
|
35
|
+
return "yarn";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/pm/registry.ts
|
|
39
|
+
var implementations = /* @__PURE__ */ new Map();
|
|
40
|
+
function getPackageManager(name) {
|
|
41
|
+
const pmName = name ?? detectPackageManager();
|
|
42
|
+
const pm = implementations.get(pmName);
|
|
43
|
+
if (!pm) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`No package manager implementation registered for "${pmName}". Ensure registerPackageManager() has been called before getPackageManager().`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return pm;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/lib/processEx.ts
|
|
52
|
+
import chalk2 from "chalk";
|
|
53
|
+
|
|
54
|
+
// src/lib/withError.ts
|
|
55
|
+
var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
56
|
+
return predicate(ex) ? closure(ex) : void 0;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// src/lib/withErrnoException.ts
|
|
60
|
+
var withErrnoException = (ex, closure) => {
|
|
61
|
+
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// src/lib/processEx.ts
|
|
65
|
+
var processEx = (ex) => {
|
|
66
|
+
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
67
|
+
const exitCode = withErrnoException(error, (error2) => {
|
|
68
|
+
if (error2.code === "ENOENT") {
|
|
69
|
+
console.error(chalk2.red(`'${error2.path}' not found.`));
|
|
70
|
+
} else {
|
|
71
|
+
console.error(chalk2.red(`Errno: ${error2.code}`));
|
|
72
|
+
}
|
|
73
|
+
return error2.errno ?? -1;
|
|
74
|
+
}) ?? withError(error, (error2) => {
|
|
75
|
+
console.error(chalk2.red(`${error2.name}: ${error2.message}`));
|
|
76
|
+
return -1;
|
|
77
|
+
}) ?? (() => {
|
|
78
|
+
console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
|
|
79
|
+
return -1;
|
|
80
|
+
})();
|
|
81
|
+
process.exit(process.exitCode ?? exitCode);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// src/lib/safeExit.ts
|
|
85
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
86
|
+
try {
|
|
87
|
+
const result = func();
|
|
88
|
+
if (result && exitOnFail) {
|
|
89
|
+
process.exit(result);
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
} catch (ex) {
|
|
93
|
+
return processEx(ex);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var safeExitAsync = async (func, exitOnFail = true) => {
|
|
97
|
+
try {
|
|
98
|
+
const result = await func();
|
|
99
|
+
if (result && exitOnFail) {
|
|
100
|
+
process.exit(result);
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
} catch (ex) {
|
|
104
|
+
return processEx(ex);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// src/lib/dependencies/DuplicateDetector.ts
|
|
109
|
+
import { EOL } from "os";
|
|
110
|
+
import chalk3 from "chalk";
|
|
111
|
+
|
|
112
|
+
// src/lib/jsonFormatters.ts
|
|
113
|
+
var multiLineToJSONArray = (output) => {
|
|
114
|
+
const withCommas = output.replaceAll("\r\n", "").replaceAll("\n", ",");
|
|
115
|
+
const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1));
|
|
116
|
+
const collection = `[${cleanCollection}]`;
|
|
117
|
+
return JSON.parse(collection);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// src/lib/dependencies/DuplicateDetector.ts
|
|
121
|
+
var trimVirtualMeta = (value) => {
|
|
122
|
+
const virtualParts = value.split("virtual:");
|
|
123
|
+
if (virtualParts.length > 1) {
|
|
124
|
+
const hashParts = virtualParts[1].split("#");
|
|
125
|
+
return virtualParts[0] + hashParts[1];
|
|
126
|
+
} else {
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var trimObjectDependencyVirtualMeta = (obj) => {
|
|
131
|
+
const resultObj = {};
|
|
132
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
133
|
+
resultObj[trimVirtualMeta(key)] = {
|
|
134
|
+
descriptor: trimVirtualMeta(value.descriptor),
|
|
135
|
+
locator: trimVirtualMeta(value.locator)
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return resultObj;
|
|
139
|
+
};
|
|
140
|
+
var trimDependencyVirtualMeta = (dependencies) => {
|
|
141
|
+
return dependencies.map((dependency) => {
|
|
142
|
+
return { children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value) };
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
function extractPnpmVersions(data, depName) {
|
|
146
|
+
const versions = /* @__PURE__ */ new Set();
|
|
147
|
+
function walk(obj) {
|
|
148
|
+
if (Array.isArray(obj)) {
|
|
149
|
+
for (const item of obj) walk(item);
|
|
150
|
+
} else if (obj && typeof obj === "object") {
|
|
151
|
+
const record = obj;
|
|
152
|
+
if (typeof record.version === "string" && typeof record.from === "string" && record.from === depName) {
|
|
153
|
+
versions.add(record.version);
|
|
154
|
+
}
|
|
155
|
+
for (const val of Object.values(record)) walk(val);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
walk(data);
|
|
159
|
+
return [...versions];
|
|
160
|
+
}
|
|
161
|
+
var DuplicateDetector = class {
|
|
162
|
+
dependency;
|
|
163
|
+
duplicateVersions;
|
|
164
|
+
constructor(output, dependency) {
|
|
165
|
+
this.dependency = dependency;
|
|
166
|
+
this.duplicateVersions = this.parseVersions(output, dependency);
|
|
167
|
+
}
|
|
168
|
+
detect() {
|
|
169
|
+
if (this.duplicateVersions.length > 1) {
|
|
170
|
+
console.log(chalk3.yellow(`${EOL}Duplicates found for: ${this.dependency}`));
|
|
171
|
+
const duplicateVersions = this.duplicateVersions.join(`${EOL} `);
|
|
172
|
+
console.log(chalk3.grey(` ${duplicateVersions}`, EOL));
|
|
173
|
+
return 1;
|
|
174
|
+
} else {
|
|
175
|
+
console.log(`${this.dependency} - OK`);
|
|
176
|
+
return 0;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
parseVersions(output, dependency) {
|
|
180
|
+
try {
|
|
181
|
+
const parsed = JSON.parse(output);
|
|
182
|
+
if (Array.isArray(parsed)) {
|
|
183
|
+
return extractPnpmVersions(parsed, dependency);
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
const entries = trimDependencyVirtualMeta(multiLineToJSONArray(output));
|
|
189
|
+
const versions = /* @__PURE__ */ new Set();
|
|
190
|
+
for (const entry of entries) {
|
|
191
|
+
for (const key of Object.keys(entry.children)) {
|
|
192
|
+
const version = key.includes("@virtual:") ? void 0 : key;
|
|
193
|
+
if (version) versions.add(version);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return [...versions];
|
|
197
|
+
} catch {
|
|
198
|
+
console.warn(chalk3.yellow(`Could not parse dependency output for ${dependency}`));
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
205
|
+
var detectDuplicateDependencies = (depsFromPackageJSON, DefaultDependencies2) => {
|
|
206
|
+
let exitCode = 0;
|
|
207
|
+
const dependencies = depsFromPackageJSON?.length ? depsFromPackageJSON : DefaultDependencies2;
|
|
208
|
+
return safeExit(() => {
|
|
209
|
+
if (dependencies) {
|
|
210
|
+
for (const dependency of dependencies) {
|
|
211
|
+
let output;
|
|
212
|
+
try {
|
|
213
|
+
const pm = getPackageManager();
|
|
214
|
+
const cmd = `${pm.command} why ${dependency} --json`;
|
|
215
|
+
output = execSync(cmd, { maxBuffer: 64 * 1024 * 1024 }).toString();
|
|
216
|
+
} catch (e) {
|
|
217
|
+
console.error(`Error running dependency check: ${String(e)}`);
|
|
218
|
+
exitCode = 1;
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (output) {
|
|
222
|
+
exitCode = new DuplicateDetector(output, dependency).detect();
|
|
223
|
+
} else {
|
|
224
|
+
console.log(`${dependency} - N/A`);
|
|
225
|
+
if (depsFromPackageJSON) {
|
|
226
|
+
exitCode = 1;
|
|
227
|
+
console.log(`\u{1F6A8} Library ${dependency} was requested in package.json but not found`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return exitCode;
|
|
232
|
+
} else {
|
|
233
|
+
console.log("\u{1F6A8} No dependencies where passed");
|
|
234
|
+
return exitCode;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// src/lib/initCwd.ts
|
|
240
|
+
function INIT_CWD() {
|
|
241
|
+
return process.env.INIT_CWD ?? process.cwd();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/lib/packageName.ts
|
|
245
|
+
import { readFileSync } from "fs";
|
|
246
|
+
import path from "path";
|
|
247
|
+
function packageName() {
|
|
248
|
+
if (process.env.npm_package_name) {
|
|
249
|
+
return process.env.npm_package_name;
|
|
250
|
+
}
|
|
251
|
+
try {
|
|
252
|
+
const pkgPath = path.join(INIT_CWD(), "package.json");
|
|
253
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
254
|
+
return pkg.name;
|
|
255
|
+
} catch {
|
|
256
|
+
return void 0;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// src/lib/parsedPackageJSON.ts
|
|
261
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
262
|
+
var parsedPackageJSON = (path2) => {
|
|
263
|
+
const pathToPackageJSON = path2 ?? process.env.npm_package_json ?? "";
|
|
264
|
+
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
265
|
+
return JSON.parse(packageJSON);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// src/lib/runSteps.ts
|
|
269
|
+
import { spawnSync } from "child_process";
|
|
270
|
+
import { existsSync as existsSync2 } from "fs";
|
|
271
|
+
import chalk4 from "chalk";
|
|
272
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
273
|
+
return safeExit(() => {
|
|
274
|
+
const pkgName = packageName();
|
|
275
|
+
console.log(chalk4.green(`${name} [${pkgName}]`));
|
|
276
|
+
let totalStatus = 0;
|
|
277
|
+
for (const [i, [command, args, config]] of steps.entries()) {
|
|
278
|
+
if (messages?.[i]) {
|
|
279
|
+
console.log(chalk4.gray(messages?.[i]));
|
|
280
|
+
}
|
|
281
|
+
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
282
|
+
if (command === "node" && !existsSync2(argList[0])) {
|
|
283
|
+
throw new Error(`File not found [${argList[0]}]`);
|
|
284
|
+
}
|
|
285
|
+
const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
|
|
286
|
+
...config,
|
|
287
|
+
encoding: "utf8",
|
|
288
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
289
|
+
shell: true,
|
|
290
|
+
stdio: "inherit"
|
|
291
|
+
}).status ?? 0;
|
|
292
|
+
checkResult(name, status, "error", exitOnFail);
|
|
293
|
+
totalStatus += status ?? 0;
|
|
294
|
+
}
|
|
295
|
+
return totalStatus;
|
|
296
|
+
}, !!exitOnFail);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// src/lib/runStepsAsync.ts
|
|
300
|
+
import { spawn } from "child_process";
|
|
301
|
+
import { existsSync as existsSync3 } from "fs";
|
|
302
|
+
import chalk5 from "chalk";
|
|
303
|
+
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
304
|
+
return new Promise((resolve) => {
|
|
305
|
+
const [command, args, config] = step;
|
|
306
|
+
if (message) {
|
|
307
|
+
console.log(chalk5.gray(message));
|
|
308
|
+
}
|
|
309
|
+
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
310
|
+
if (command === "node" && !existsSync3(argList[0])) {
|
|
311
|
+
throw new Error(`File not found [${argList[0]}]`);
|
|
312
|
+
}
|
|
313
|
+
spawn(command, Array.isArray(args) ? args : args.split(" "), {
|
|
314
|
+
...config,
|
|
315
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
316
|
+
shell: true,
|
|
317
|
+
stdio: "inherit"
|
|
318
|
+
}).on("close", (code) => {
|
|
319
|
+
if (code) {
|
|
320
|
+
console.error(
|
|
321
|
+
chalk5.red(
|
|
322
|
+
`Command Exited With Non-Zero Result [${chalk5.gray(code)}] | ${chalk5.yellow(command)} ${chalk5.white(
|
|
323
|
+
Array.isArray(args) ? args.join(" ") : args
|
|
324
|
+
)}`
|
|
325
|
+
)
|
|
326
|
+
);
|
|
327
|
+
checkResult(name, code, "error", exitOnFail);
|
|
328
|
+
resolve(code);
|
|
329
|
+
} else {
|
|
330
|
+
resolve(0);
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
336
|
+
return await safeExitAsync(async () => {
|
|
337
|
+
const pkgName = packageName();
|
|
338
|
+
console.log(chalk5.green(`${name} [${pkgName}]`));
|
|
339
|
+
let result = 0;
|
|
340
|
+
for (const [i, step] of steps.entries()) {
|
|
341
|
+
result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
|
|
342
|
+
}
|
|
343
|
+
return result;
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
// src/lib/updo/applyUpdates.ts
|
|
348
|
+
import { readFileSync as readFileSync3, writeFileSync } from "fs";
|
|
349
|
+
import PATH from "path";
|
|
350
|
+
import chalk6 from "chalk";
|
|
351
|
+
function applyUpdates(cwd, workspaces, updates) {
|
|
352
|
+
const updateMap = new Map(updates.map((u) => [u.name, u]));
|
|
353
|
+
let modified = 0;
|
|
354
|
+
for (const ws of workspaces) {
|
|
355
|
+
const pkgPath = PATH.resolve(cwd, ws.location, "package.json");
|
|
356
|
+
let content;
|
|
357
|
+
try {
|
|
358
|
+
content = readFileSync3(pkgPath, "utf8");
|
|
359
|
+
} catch {
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
const pkg = JSON.parse(content);
|
|
363
|
+
let changed = false;
|
|
364
|
+
for (const depField of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
365
|
+
const deps = pkg[depField];
|
|
366
|
+
if (!deps) continue;
|
|
367
|
+
for (const [name, currentRange] of Object.entries(deps)) {
|
|
368
|
+
const update = updateMap.get(name);
|
|
369
|
+
if (!update) continue;
|
|
370
|
+
const prefix = /^([~^]|>=?|<=?)/.exec(currentRange)?.[0] ?? "~";
|
|
371
|
+
const newRange = `${prefix}${update.targetVersion}`;
|
|
372
|
+
if (deps[name] !== newRange) {
|
|
373
|
+
deps[name] = newRange;
|
|
374
|
+
changed = true;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (changed) {
|
|
379
|
+
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
|
|
380
|
+
`);
|
|
381
|
+
modified++;
|
|
382
|
+
console.log(chalk6.gray(` Updated ${ws.name}`));
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return modified;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// src/lib/updo/collectWorkspaceDeps.ts
|
|
389
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
390
|
+
import PATH2 from "path";
|
|
391
|
+
var DEP_FIELDS = ["dependencies", "devDependencies", "peerDependencies"];
|
|
392
|
+
function collectWorkspaceDeps(cwd, workspaces, workspaceNames) {
|
|
393
|
+
const depMap = /* @__PURE__ */ new Map();
|
|
394
|
+
for (const ws of workspaces) {
|
|
395
|
+
const pkgPath = PATH2.resolve(cwd, ws.location, "package.json");
|
|
396
|
+
let pkg;
|
|
397
|
+
try {
|
|
398
|
+
pkg = JSON.parse(readFileSync4(pkgPath, "utf8"));
|
|
399
|
+
} catch {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
for (const depField of DEP_FIELDS) {
|
|
403
|
+
const deps = pkg[depField];
|
|
404
|
+
if (!deps) continue;
|
|
405
|
+
for (const [name, range] of Object.entries(deps)) {
|
|
406
|
+
if (workspaceNames.has(name)) continue;
|
|
407
|
+
if (range.startsWith("workspace:")) continue;
|
|
408
|
+
const existing = depMap.get(name);
|
|
409
|
+
if (existing) {
|
|
410
|
+
if (!existing.workspaces.includes(ws.name)) {
|
|
411
|
+
existing.workspaces.push(ws.name);
|
|
412
|
+
}
|
|
413
|
+
if (!existing.depTypes.includes(depField)) {
|
|
414
|
+
existing.depTypes.push(depField);
|
|
415
|
+
}
|
|
416
|
+
if (!existing.ranges.includes(range)) {
|
|
417
|
+
existing.ranges.push(range);
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
depMap.set(name, {
|
|
421
|
+
depTypes: [depField],
|
|
422
|
+
name,
|
|
423
|
+
ranges: [range],
|
|
424
|
+
workspaces: [ws.name]
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return depMap;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// src/lib/updo/fetchRegistryInfo.ts
|
|
434
|
+
var REGISTRY_BASE = "https://registry.npmjs.org";
|
|
435
|
+
async function fetchRegistryInfo(packageName2) {
|
|
436
|
+
try {
|
|
437
|
+
const url = `${REGISTRY_BASE}/${encodeURIComponent(packageName2)}`;
|
|
438
|
+
const res = await fetch(url, { headers: { Accept: "application/vnd.npm.install-v1+json" } });
|
|
439
|
+
if (!res.ok) {
|
|
440
|
+
return { distTags: {}, versions: [] };
|
|
441
|
+
}
|
|
442
|
+
const data = await res.json();
|
|
443
|
+
return {
|
|
444
|
+
distTags: data["dist-tags"] ?? {},
|
|
445
|
+
versions: Object.keys(data.versions ?? {})
|
|
446
|
+
};
|
|
447
|
+
} catch {
|
|
448
|
+
return { distTags: {}, versions: [] };
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
async function fetchAllRegistryInfo(packageNames, concurrency = 16) {
|
|
452
|
+
const results = /* @__PURE__ */ new Map();
|
|
453
|
+
let completed = 0;
|
|
454
|
+
const total = packageNames.length;
|
|
455
|
+
await runWithConcurrency(packageNames, concurrency, async (name) => {
|
|
456
|
+
results.set(name, await fetchRegistryInfo(name));
|
|
457
|
+
completed++;
|
|
458
|
+
if (completed % 25 === 0 || completed === total) {
|
|
459
|
+
process.stderr.write(`\r Fetched ${completed}/${total} packages...`);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
if (total > 0) {
|
|
463
|
+
process.stderr.write("\n");
|
|
464
|
+
}
|
|
465
|
+
return results;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// src/lib/updo/interactiveSelect.ts
|
|
469
|
+
import {
|
|
470
|
+
createPrompt,
|
|
471
|
+
ExitPromptError,
|
|
472
|
+
isDownKey,
|
|
473
|
+
isEnterKey,
|
|
474
|
+
isSpaceKey,
|
|
475
|
+
isUpKey,
|
|
476
|
+
useKeypress,
|
|
477
|
+
useRef,
|
|
478
|
+
useState
|
|
479
|
+
} from "@inquirer/core";
|
|
480
|
+
import chalk7 from "chalk";
|
|
481
|
+
import semver from "semver";
|
|
482
|
+
function versionColor(version, current) {
|
|
483
|
+
if (!version || !current) return chalk7.gray;
|
|
484
|
+
if (version === current) return chalk7.gray;
|
|
485
|
+
const diff = semver.diff(current, version);
|
|
486
|
+
if (diff === "major" || diff === "premajor") return chalk7.red;
|
|
487
|
+
if (diff === "minor" || diff === "preminor") return chalk7.yellow;
|
|
488
|
+
return chalk7.green;
|
|
489
|
+
}
|
|
490
|
+
function pad(raw, colored, width) {
|
|
491
|
+
return colored + " ".repeat(Math.max(0, width - raw.length));
|
|
492
|
+
}
|
|
493
|
+
function dot(selected) {
|
|
494
|
+
return selected ? chalk7.green("\u25CF") : chalk7.dim("\u25CB");
|
|
495
|
+
}
|
|
496
|
+
function renderHeader(w) {
|
|
497
|
+
const header = [
|
|
498
|
+
" ",
|
|
499
|
+
chalk7.bold("Package".padEnd(w.name)),
|
|
500
|
+
chalk7.bold("Current".padEnd(w.current)),
|
|
501
|
+
chalk7.bold(" Wanted".padEnd(w.wanted + 2)),
|
|
502
|
+
chalk7.bold(" Latest".padEnd(w.latest + 2)),
|
|
503
|
+
chalk7.bold(" Next/RC".padEnd(w.next + 2))
|
|
504
|
+
].join(" ");
|
|
505
|
+
const totalWidth = w.name + w.current + w.wanted + w.latest + w.next + 24;
|
|
506
|
+
return `${header}
|
|
507
|
+
${chalk7.gray("\u2500".repeat(totalWidth))}`;
|
|
508
|
+
}
|
|
509
|
+
function renderRow(dep, selection, active, w) {
|
|
510
|
+
const pointer = active ? chalk7.cyan("\u276F") : " ";
|
|
511
|
+
const rawName = dep.name;
|
|
512
|
+
const name = active ? chalk7.white(rawName) : chalk7.gray(rawName);
|
|
513
|
+
const rawCurrent = dep.current ?? "-";
|
|
514
|
+
const current = chalk7.gray(rawCurrent);
|
|
515
|
+
const rawWanted = dep.wanted ?? "-";
|
|
516
|
+
const wantedColorFn = dep.wanted ? versionColor(dep.wanted, dep.current) : chalk7.gray;
|
|
517
|
+
const wantedDot = dep.wanted ? dot(selection === 0) : " ";
|
|
518
|
+
const wanted = `${wantedDot} ${pad(rawWanted, wantedColorFn(rawWanted), w.wanted)}`;
|
|
519
|
+
const rawLatest = dep.latest ?? "-";
|
|
520
|
+
const latestColorFn = dep.latest ? versionColor(dep.latest, dep.current) : chalk7.gray;
|
|
521
|
+
const latestDot = dep.latest ? dot(selection === 1) : " ";
|
|
522
|
+
const latest = `${latestDot} ${pad(rawLatest, latestColorFn(rawLatest), w.latest)}`;
|
|
523
|
+
const rawNext = dep.next ?? "-";
|
|
524
|
+
const nextColorFn = dep.next ? versionColor(dep.next, dep.current) : chalk7.gray;
|
|
525
|
+
const nextDot = dep.next ? dot(selection === 2) : " ";
|
|
526
|
+
const next = `${nextDot} ${pad(rawNext, nextColorFn(rawNext), w.next)}`;
|
|
527
|
+
return `${pointer} ${pad(rawName, name, w.name)} ${pad(rawCurrent, current, w.current)} ${wanted} ${latest} ${next}`;
|
|
528
|
+
}
|
|
529
|
+
function getAvailableSelections(dep) {
|
|
530
|
+
const available = [-1];
|
|
531
|
+
if (dep.wanted) available.push(0);
|
|
532
|
+
if (dep.latest && dep.latest !== dep.wanted) available.push(1);
|
|
533
|
+
if (dep.next) available.push(2);
|
|
534
|
+
return available;
|
|
535
|
+
}
|
|
536
|
+
function getTargetVersion(dep, selection) {
|
|
537
|
+
if (selection === 0) return dep.wanted;
|
|
538
|
+
if (selection === 1) return dep.latest;
|
|
539
|
+
if (selection === 2) return dep.next;
|
|
540
|
+
return void 0;
|
|
541
|
+
}
|
|
542
|
+
function computeWidths(rows) {
|
|
543
|
+
let name = 7;
|
|
544
|
+
let current = 7;
|
|
545
|
+
let wanted = 6;
|
|
546
|
+
let latest = 6;
|
|
547
|
+
let next = 7;
|
|
548
|
+
for (const dep of rows) {
|
|
549
|
+
name = Math.max(name, dep.name.length);
|
|
550
|
+
current = Math.max(current, (dep.current ?? "-").length);
|
|
551
|
+
wanted = Math.max(wanted, (dep.wanted ?? "-").length);
|
|
552
|
+
latest = Math.max(latest, (dep.latest ?? "-").length);
|
|
553
|
+
next = Math.max(next, (dep.next ?? "-").length);
|
|
554
|
+
}
|
|
555
|
+
return {
|
|
556
|
+
current,
|
|
557
|
+
latest,
|
|
558
|
+
name,
|
|
559
|
+
next,
|
|
560
|
+
wanted
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
function renderPage(rows, cursor, selections, w, pageSize) {
|
|
564
|
+
const total = rows.length;
|
|
565
|
+
let start = 0;
|
|
566
|
+
if (total > pageSize) {
|
|
567
|
+
start = Math.max(0, Math.min(cursor - Math.floor(pageSize / 2), total - pageSize));
|
|
568
|
+
}
|
|
569
|
+
const end = Math.min(start + pageSize, total);
|
|
570
|
+
const lines = [];
|
|
571
|
+
for (let i = start; i < end; i++) {
|
|
572
|
+
lines.push(renderRow(rows[i], selections[i], i === cursor, w));
|
|
573
|
+
}
|
|
574
|
+
if (total > pageSize) {
|
|
575
|
+
if (start > 0) lines.unshift(chalk7.dim(" \u2191 more"));
|
|
576
|
+
if (end < total) lines.push(chalk7.dim(" \u2193 more"));
|
|
577
|
+
}
|
|
578
|
+
return lines.join("\n");
|
|
579
|
+
}
|
|
580
|
+
var updoPrompt = createPrompt((config, done) => {
|
|
581
|
+
const { rows } = config;
|
|
582
|
+
const [cursor, setCursor] = useState(0);
|
|
583
|
+
const [tick, setTick] = useState(0);
|
|
584
|
+
const availableSelections = useRef(rows.map((r) => getAvailableSelections(r)));
|
|
585
|
+
const selections = useRef(rows.map(() => -1));
|
|
586
|
+
const widths = useRef(computeWidths(rows));
|
|
587
|
+
useKeypress((key) => {
|
|
588
|
+
if (key.name === "escape" || key.ctrl && key.name === "c") {
|
|
589
|
+
done([]);
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
if (isEnterKey(key)) {
|
|
593
|
+
const results = [];
|
|
594
|
+
for (const [i, dep] of rows.entries()) {
|
|
595
|
+
const version = getTargetVersion(dep, selections.current[i]);
|
|
596
|
+
if (version) {
|
|
597
|
+
results.push({
|
|
598
|
+
depTypes: dep.depTypes,
|
|
599
|
+
name: dep.name,
|
|
600
|
+
targetVersion: version,
|
|
601
|
+
workspaces: dep.workspaces
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
done(results);
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
if (isUpKey(key)) {
|
|
609
|
+
setCursor(Math.max(0, cursor - 1));
|
|
610
|
+
} else if (isDownKey(key)) {
|
|
611
|
+
setCursor(Math.min(rows.length - 1, cursor + 1));
|
|
612
|
+
} else if (isSpaceKey(key)) {
|
|
613
|
+
const available = availableSelections.current[cursor];
|
|
614
|
+
const currentSel = selections.current[cursor];
|
|
615
|
+
const currentIdx = available.indexOf(currentSel);
|
|
616
|
+
const nextIdx = (currentIdx + 1) % available.length;
|
|
617
|
+
selections.current[cursor] = available[nextIdx];
|
|
618
|
+
setTick(tick + 1);
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
const w = widths.current;
|
|
622
|
+
const header = renderHeader(w);
|
|
623
|
+
const page = renderPage(rows, cursor, selections.current, w, 20);
|
|
624
|
+
const selectedCount = selections.current.filter((s) => s >= 0).length;
|
|
625
|
+
const status = chalk7.gray(` ${selectedCount} selected \u2191/\u2193 navigate space cycle version enter confirm`);
|
|
626
|
+
return `${header}
|
|
627
|
+
${page}
|
|
628
|
+
${status}`;
|
|
629
|
+
});
|
|
630
|
+
async function interactiveSelect(deps) {
|
|
631
|
+
const updatable = deps.filter((d) => d.updateAvailable);
|
|
632
|
+
if (updatable.length === 0) {
|
|
633
|
+
console.log(chalk7.green("\nAll packages are up to date!"));
|
|
634
|
+
return [];
|
|
635
|
+
}
|
|
636
|
+
if (!process.stdout.isTTY) {
|
|
637
|
+
console.log(chalk7.yellow("Non-interactive environment detected, skipping selection."));
|
|
638
|
+
return [];
|
|
639
|
+
}
|
|
640
|
+
try {
|
|
641
|
+
return await updoPrompt({ rows: updatable });
|
|
642
|
+
} catch (error) {
|
|
643
|
+
if (error instanceof ExitPromptError) {
|
|
644
|
+
return [];
|
|
645
|
+
}
|
|
646
|
+
throw error;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// src/lib/updo/resolveVersions.ts
|
|
651
|
+
import semver2 from "semver";
|
|
652
|
+
function computeWanted(info, ranges) {
|
|
653
|
+
const candidates = ranges.map((range) => semver2.maxSatisfying(info.versions, range));
|
|
654
|
+
const valid = candidates.filter((v) => v !== null);
|
|
655
|
+
if (valid.length === 0) return void 0;
|
|
656
|
+
let min = valid[0];
|
|
657
|
+
for (const v of valid) {
|
|
658
|
+
if (semver2.lt(v, min)) min = v;
|
|
659
|
+
}
|
|
660
|
+
return min;
|
|
661
|
+
}
|
|
662
|
+
function hasNewerVersion(version, current) {
|
|
663
|
+
return version !== void 0 && semver2.gt(version, current);
|
|
664
|
+
}
|
|
665
|
+
function isUpdateAvailable(current, wanted, latest, next) {
|
|
666
|
+
if (!current) return false;
|
|
667
|
+
return hasNewerVersion(wanted, current) || hasNewerVersion(latest, current) || hasNewerVersion(next, current);
|
|
668
|
+
}
|
|
669
|
+
function resolveVersions(deps, registry, installedVersions) {
|
|
670
|
+
const resolved = [];
|
|
671
|
+
for (const [name, dep] of deps) {
|
|
672
|
+
const info = registry.get(name);
|
|
673
|
+
const current = installedVersions.get(name);
|
|
674
|
+
const wanted = info ? computeWanted(info, dep.ranges) : void 0;
|
|
675
|
+
const latest = info?.distTags.latest;
|
|
676
|
+
const next = info?.distTags.next ?? info?.distTags.rc;
|
|
677
|
+
const updateAvailable = isUpdateAvailable(current, wanted, latest, next);
|
|
678
|
+
resolved.push({
|
|
679
|
+
current,
|
|
680
|
+
declaredRange: dep.ranges.length === 1 ? dep.ranges[0] : dep.ranges.join(" | "),
|
|
681
|
+
depTypes: dep.depTypes,
|
|
682
|
+
latest,
|
|
683
|
+
name,
|
|
684
|
+
next: next && latest && next !== latest ? next : void 0,
|
|
685
|
+
updateAvailable,
|
|
686
|
+
wanted: wanted && current && wanted !== current ? wanted : void 0,
|
|
687
|
+
workspaces: dep.workspaces
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
return resolved.toSorted((a, b) => {
|
|
691
|
+
if (a.updateAvailable !== b.updateAvailable) return a.updateAvailable ? -1 : 1;
|
|
692
|
+
return a.name.localeCompare(b.name);
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// src/lib/updo/runUpdo.ts
|
|
697
|
+
import chalk8 from "chalk";
|
|
698
|
+
async function runUpdo(pm, _options = {}) {
|
|
699
|
+
const cwd = INIT_CWD();
|
|
700
|
+
const workspaces = pm.listWorkspaces();
|
|
701
|
+
const workspaceNames = new Set(workspaces.map((ws) => ws.name));
|
|
702
|
+
console.log(chalk8.gray("Scanning workspace dependencies..."));
|
|
703
|
+
const declaredDeps = collectWorkspaceDeps(cwd, workspaces, workspaceNames);
|
|
704
|
+
console.log(chalk8.gray(` Found ${declaredDeps.size} unique dependencies across ${workspaces.length} workspaces`));
|
|
705
|
+
console.log(chalk8.gray("Fetching registry info..."));
|
|
706
|
+
const registryInfo = await fetchAllRegistryInfo([...declaredDeps.keys()]);
|
|
707
|
+
console.log(chalk8.gray("Reading installed versions..."));
|
|
708
|
+
const installedVersions = pm.listInstalledVersions();
|
|
709
|
+
const resolved = resolveVersions(declaredDeps, registryInfo, installedVersions);
|
|
710
|
+
const updates = await interactiveSelect(resolved);
|
|
711
|
+
if (updates.length === 0) {
|
|
712
|
+
console.log(chalk8.gray("No updates selected."));
|
|
713
|
+
return 0;
|
|
714
|
+
}
|
|
715
|
+
console.log(chalk8.gray(`
|
|
716
|
+
Applying ${updates.length} updates...`));
|
|
717
|
+
const modified = applyUpdates(cwd, workspaces, updates);
|
|
718
|
+
console.log(chalk8.gray(` Modified ${modified} package.json files`));
|
|
719
|
+
console.log(chalk8.gray("Installing updated dependencies..."));
|
|
720
|
+
return runSteps("Updo", [
|
|
721
|
+
pm.install(),
|
|
722
|
+
pm.dedupe()
|
|
723
|
+
], true);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// src/actions/clean.ts
|
|
727
|
+
var clean = async ({ verbose, pkg }) => {
|
|
728
|
+
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
729
|
+
};
|
|
730
|
+
var cleanPackage = ({ pkg }) => {
|
|
731
|
+
const pm = getPackageManager();
|
|
732
|
+
return runStepsAsync(`Clean [${pkg}]`, [pm.runInWorkspace(pkg, "package-clean")]);
|
|
733
|
+
};
|
|
734
|
+
var cleanAll = ({ verbose }) => {
|
|
735
|
+
const pm = getPackageManager();
|
|
736
|
+
return runStepsAsync("Clean", [pm.foreachWorkspace("package-clean", [], { jobs: 64, verbose })]);
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
// src/actions/dupdeps.ts
|
|
740
|
+
import chalk9 from "chalk";
|
|
741
|
+
var dupdeps = () => {
|
|
742
|
+
console.log(chalk9.green("Checking all Dependencies for Duplicates"));
|
|
743
|
+
const pkg = parsedPackageJSON();
|
|
744
|
+
const allDependencies = {
|
|
745
|
+
...pkg?.dependencies,
|
|
746
|
+
...pkg?.devDependencies
|
|
747
|
+
};
|
|
748
|
+
const dependencies = Object.keys(allDependencies);
|
|
749
|
+
return detectDuplicateDependencies(dependencies);
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
// src/actions/packman/clean.ts
|
|
753
|
+
import {
|
|
754
|
+
existsSync as existsSync5,
|
|
755
|
+
rmSync,
|
|
756
|
+
writeFileSync as writeFileSync2
|
|
757
|
+
} from "fs";
|
|
758
|
+
import PATH4 from "path";
|
|
759
|
+
import chalk11 from "chalk";
|
|
760
|
+
|
|
761
|
+
// src/actions/packman/convert.ts
|
|
762
|
+
import {
|
|
763
|
+
existsSync as existsSync4,
|
|
764
|
+
readdirSync,
|
|
765
|
+
readFileSync as readFileSync5,
|
|
766
|
+
statSync
|
|
767
|
+
} from "fs";
|
|
768
|
+
import PATH3 from "path";
|
|
769
|
+
import chalk10 from "chalk";
|
|
770
|
+
function detectCurrentPM(cwd) {
|
|
771
|
+
if (existsSync4(PATH3.join(cwd, "pnpm-lock.yaml")) || existsSync4(PATH3.join(cwd, "pnpm-workspace.yaml"))) {
|
|
772
|
+
return "pnpm";
|
|
773
|
+
}
|
|
774
|
+
if (existsSync4(PATH3.join(cwd, "yarn.lock")) || existsSync4(PATH3.join(cwd, ".yarnrc.yml"))) {
|
|
775
|
+
return "yarn";
|
|
776
|
+
}
|
|
777
|
+
return "unknown";
|
|
778
|
+
}
|
|
779
|
+
function findWorkspacePackagePaths(cwd) {
|
|
780
|
+
const pkgPath = PATH3.join(cwd, "package.json");
|
|
781
|
+
const pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
|
|
782
|
+
const patterns = pkg.workspaces ?? [];
|
|
783
|
+
if (patterns.length === 0) {
|
|
784
|
+
const wsPath = PATH3.join(cwd, "pnpm-workspace.yaml");
|
|
785
|
+
if (existsSync4(wsPath)) {
|
|
786
|
+
const content = readFileSync5(wsPath, "utf8");
|
|
787
|
+
const lines = content.split("\n");
|
|
788
|
+
let inPackages = false;
|
|
789
|
+
for (const line of lines) {
|
|
790
|
+
if (line.trim() === "packages:") {
|
|
791
|
+
inPackages = true;
|
|
792
|
+
continue;
|
|
793
|
+
}
|
|
794
|
+
if (inPackages && /^\s+-\s+/.test(line)) {
|
|
795
|
+
const pattern = line.replace(/^\s+-\s+/, "").replaceAll(/['"]/g, "").trim();
|
|
796
|
+
if (pattern) patterns.push(pattern);
|
|
797
|
+
} else if (inPackages && !/^\s/.test(line) && line.trim()) {
|
|
798
|
+
inPackages = false;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
const dirs = [];
|
|
804
|
+
for (const pattern of patterns) {
|
|
805
|
+
const resolved = resolveWorkspaceGlob(cwd, pattern);
|
|
806
|
+
dirs.push(...resolved);
|
|
807
|
+
}
|
|
808
|
+
return dirs;
|
|
809
|
+
}
|
|
810
|
+
function resolveWorkspaceGlob(cwd, pattern) {
|
|
811
|
+
const parts = pattern.split("/");
|
|
812
|
+
return walkGlob(cwd, parts, "");
|
|
813
|
+
}
|
|
814
|
+
function walkGlob(basePath, parts, currentPath) {
|
|
815
|
+
if (parts.length === 0) {
|
|
816
|
+
const fullPath = PATH3.join(basePath, currentPath);
|
|
817
|
+
if (existsSync4(PATH3.join(fullPath, "package.json"))) {
|
|
818
|
+
return [currentPath];
|
|
819
|
+
}
|
|
820
|
+
return [];
|
|
821
|
+
}
|
|
822
|
+
const [part, ...rest] = parts;
|
|
823
|
+
const dirPath = PATH3.join(basePath, currentPath);
|
|
824
|
+
if (!existsSync4(dirPath) || !statSync(dirPath).isDirectory()) {
|
|
825
|
+
return [];
|
|
826
|
+
}
|
|
827
|
+
if (part === "*" || part === "**") {
|
|
828
|
+
const entries = readdirSync(dirPath, { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith(".") && e.name !== "node_modules" && e.name !== "dist");
|
|
829
|
+
const results = [];
|
|
830
|
+
if (part === "**") {
|
|
831
|
+
results.push(...walkGlob(basePath, rest, currentPath));
|
|
832
|
+
}
|
|
833
|
+
for (const entry of entries) {
|
|
834
|
+
const subPath2 = currentPath ? `${currentPath}/${entry.name}` : entry.name;
|
|
835
|
+
if (part === "**") {
|
|
836
|
+
results.push(
|
|
837
|
+
...walkGlob(basePath, rest, subPath2),
|
|
838
|
+
...walkGlob(basePath, parts, subPath2)
|
|
839
|
+
);
|
|
840
|
+
} else {
|
|
841
|
+
results.push(...walkGlob(basePath, rest, subPath2));
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
return results;
|
|
845
|
+
}
|
|
846
|
+
const subPath = currentPath ? `${currentPath}/${part}` : part;
|
|
847
|
+
return walkGlob(basePath, rest, subPath);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// src/actions/packman/clean.ts
|
|
851
|
+
function removeNodeModules(dir, verbose) {
|
|
852
|
+
const nmPath = PATH4.join(dir, "node_modules");
|
|
853
|
+
if (existsSync5(nmPath)) {
|
|
854
|
+
if (verbose) console.log(chalk11.gray(`Removing ${nmPath}`));
|
|
855
|
+
rmSync(nmPath, { force: true, recursive: true });
|
|
856
|
+
return true;
|
|
857
|
+
}
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
function packmanClean({ verbose }) {
|
|
861
|
+
const cwd = process.cwd();
|
|
862
|
+
const pm = detectCurrentPM(cwd);
|
|
863
|
+
if (pm === "unknown") {
|
|
864
|
+
console.error(chalk11.red("Could not detect current package manager. No yarn.lock or pnpm-lock.yaml found."));
|
|
865
|
+
return 1;
|
|
866
|
+
}
|
|
867
|
+
console.log(chalk11.blue(`Detected package manager: ${pm}`));
|
|
868
|
+
let removedCount = 0;
|
|
869
|
+
if (removeNodeModules(cwd, verbose)) removedCount++;
|
|
870
|
+
const workspacePaths = findWorkspacePackagePaths(cwd);
|
|
871
|
+
for (const wsPath of workspacePaths) {
|
|
872
|
+
const fullPath = PATH4.join(cwd, wsPath);
|
|
873
|
+
if (removeNodeModules(fullPath, verbose)) removedCount++;
|
|
874
|
+
}
|
|
875
|
+
console.log(chalk11.green(`Removed ${removedCount} node_modules folder${removedCount === 1 ? "" : "s"}`));
|
|
876
|
+
if (pm === "yarn") {
|
|
877
|
+
const lockPath = PATH4.join(cwd, "yarn.lock");
|
|
878
|
+
if (existsSync5(lockPath)) {
|
|
879
|
+
writeFileSync2(lockPath, "");
|
|
880
|
+
console.log(chalk11.green("Truncated yarn.lock"));
|
|
881
|
+
}
|
|
882
|
+
} else if (pm === "pnpm") {
|
|
883
|
+
const lockPath = PATH4.join(cwd, "pnpm-lock.yaml");
|
|
884
|
+
if (existsSync5(lockPath)) {
|
|
885
|
+
rmSync(lockPath);
|
|
886
|
+
console.log(chalk11.green("Deleted pnpm-lock.yaml"));
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
console.log(chalk11.green("Ready for a clean install"));
|
|
890
|
+
return 0;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
// src/actions/reinstall.ts
|
|
894
|
+
var reinstall = (verbose) => {
|
|
895
|
+
const cleanResult = packmanClean({ verbose });
|
|
896
|
+
if (cleanResult !== 0) return cleanResult;
|
|
897
|
+
const pm = getPackageManager();
|
|
898
|
+
return runSteps("Reinstall", [pm.install()]);
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
// src/actions/statics.ts
|
|
902
|
+
import chalk12 from "chalk";
|
|
903
|
+
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
904
|
+
var statics = () => {
|
|
905
|
+
console.log(chalk12.green("Check Required Static Dependencies"));
|
|
906
|
+
const pkg = parsedPackageJSON();
|
|
907
|
+
const xy = pkg?.xy;
|
|
908
|
+
const deps = xy?.deps;
|
|
909
|
+
const staticsValue = deps?.statics;
|
|
910
|
+
return detectDuplicateDependencies(staticsValue, DefaultDependencies);
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
// src/actions/up.ts
|
|
914
|
+
var up = () => {
|
|
915
|
+
const pm = getPackageManager();
|
|
916
|
+
return runSteps("Up", [pm.outdated()]);
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
// src/actions/updo.ts
|
|
920
|
+
var updo = async ({ latest = true } = {}) => {
|
|
921
|
+
const pm = getPackageManager();
|
|
922
|
+
return await runUpdo(pm, { latest });
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
// src/xy/install/cleanCommand.ts
|
|
926
|
+
var cleanCommand = {
|
|
927
|
+
command: "clean [package]",
|
|
928
|
+
describe: "Clean",
|
|
929
|
+
builder: (yargs) => {
|
|
930
|
+
return yargs.positional("package", { describe: "Specific package to clean" });
|
|
931
|
+
},
|
|
932
|
+
handler: async (argv) => {
|
|
933
|
+
if (argv.verbose) {
|
|
934
|
+
console.log(`Cleaning: ${argv.package ?? "all"}`);
|
|
935
|
+
}
|
|
936
|
+
process.exitCode = await clean({
|
|
937
|
+
pkg: argv.package,
|
|
938
|
+
verbose: !!argv.verbose
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
// src/xy/install/dupdepsCommand.ts
|
|
944
|
+
var dupdepsCommand = {
|
|
945
|
+
command: "dupdeps",
|
|
946
|
+
describe: "Dupdeps - Duplicate Dependencies in package.json",
|
|
947
|
+
handler: (argv) => {
|
|
948
|
+
if (argv.verbose) console.log("Dupdeps");
|
|
949
|
+
process.exitCode = dupdeps();
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
// src/xy/install/reinstallCommand.ts
|
|
954
|
+
var reinstallCommand = {
|
|
955
|
+
command: "reinstall",
|
|
956
|
+
describe: "Reinstall - Clean & Install",
|
|
957
|
+
handler: (argv) => {
|
|
958
|
+
process.exitCode = reinstall(!!argv.verbose);
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
// src/xy/install/staticsCommand.ts
|
|
963
|
+
var staticsCommand = {
|
|
964
|
+
command: "statics",
|
|
965
|
+
describe: "Statics - Confirming Static Packages",
|
|
966
|
+
handler: (argv) => {
|
|
967
|
+
if (argv.verbose) console.log("Statics");
|
|
968
|
+
process.exitCode = statics();
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
// src/xy/install/upCommand.ts
|
|
973
|
+
var upCommand = {
|
|
974
|
+
command: "up",
|
|
975
|
+
describe: "Up - Update dependencies",
|
|
976
|
+
handler: (argv) => {
|
|
977
|
+
if (argv.verbose) console.log("Up");
|
|
978
|
+
process.exitCode = up();
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
// src/xy/install/updoCommand.ts
|
|
983
|
+
var updoCommand = {
|
|
984
|
+
builder: (yargs) => {
|
|
985
|
+
return yargs.option("latest", {
|
|
986
|
+
default: true,
|
|
987
|
+
description: "Ignore version ranges and update to latest versions",
|
|
988
|
+
type: "boolean"
|
|
989
|
+
});
|
|
990
|
+
},
|
|
991
|
+
command: "updo",
|
|
992
|
+
describe: "Updo - Update dependencies [Interactive]",
|
|
993
|
+
handler: async (argv) => {
|
|
994
|
+
if (argv.verbose) console.log("Updo");
|
|
995
|
+
process.exitCode = await updo({ latest: argv.latest });
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
// src/xy/install/index.ts
|
|
1000
|
+
var xyInstallCommands = (args) => {
|
|
1001
|
+
return args.command(cleanCommand).command(reinstallCommand).command(upCommand).command(updoCommand).command(staticsCommand).command(dupdepsCommand);
|
|
1002
|
+
};
|
|
1003
|
+
export {
|
|
1004
|
+
xyInstallCommands
|
|
1005
|
+
};
|
|
1006
|
+
//# sourceMappingURL=index.mjs.map
|