SvelteKit adapter that automatically detects deployment environment and installs appropriate platform-specific adapter
Overall
score
96%
Build a utility that detects which package manager is being used in a Node.js project by scanning for lockfiles in the directory hierarchy.
Create a function that traverses up the directory tree from a given starting path to identify which package manager is being used based on the presence of specific lockfiles. The function should check directories from the starting path up to the filesystem root.
When multiple lockfiles are found at the same directory level, use this priority order:
pnpm-lock.yaml indicates pnpmyarn.lock indicates yarnpackage-lock.json indicates npmbun.lockb or bun.lock indicates bundeno.lock indicates denoIf no lockfile is found after traversing to the root, default to npm.
pnpm-lock.yaml, the function returns 'pnpm' @testyarn.lock, the function returns 'yarn' @testpackage-lock.json, the function returns 'npm' @testpnpm-lock.yaml, the function returns 'pnpm' @test@generates
/**
* Detects which package manager is being used by scanning for lockfiles
* in the directory hierarchy.
*
* @param {string} startPath - The directory path to start searching from
* @returns {string} The detected package manager name ('pnpm', 'yarn', 'npm', 'bun', or 'deno')
*/
export function detectPackageManager(startPath) {
// IMPLEMENTATION HERE
}Provides file system operations for checking lockfile existence and directory traversal.
Install with Tessl CLI
npx tessl i tessl/npm-sveltejs--adapter-autodocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10