UNPKG

@funish/basis

Version:

A unified development toolkit with CLI for package management, versioning, publishing, linting, and git hooks management for JavaScript/TypeScript projects.

2 lines (1 loc) 1.28 kB
"use strict";const promises=require("node:fs/promises"),c12=require("c12"),config=require("../config.cjs");async function loadConfig(e={}){return await c12.loadConfig({name:"basis",cwd:process.cwd(),...e,defaults:{...config.defaultConfig,...e.defaults}})}async function fileExists(e){try{return await promises.access(e),!0}catch{return!1}}function getPackageManagerCommands(e){switch(e){case"yarn":return{outdated:"yarn outdated --json",audit:"yarn audit --level moderate",execPrefix:"yarn exec",remove:"yarn remove",update:"yarn upgrade",auditFix:"yarn upgrade"};case"pnpm":return{outdated:"pnpm outdated --format table",audit:"pnpm audit --audit-level moderate",execPrefix:"pnpm exec",remove:"pnpm remove",update:"pnpm update",auditFix:"pnpm audit --fix"};case"bun":return{outdated:"bun outdated",audit:null,execPrefix:"bunx",remove:"bun remove",update:"bun update",auditFix:null};case"deno":return{outdated:null,audit:null,execPrefix:"deno task",remove:null,update:null,auditFix:null};default:return{outdated:"npm outdated --json",audit:"npm audit --audit-level moderate",execPrefix:"npx",remove:"npm uninstall",update:"npm update",auditFix:"npm audit fix"}}}exports.fileExists=fileExists,exports.getPackageManagerCommands=getPackageManagerCommands,exports.loadConfig=loadConfig;