0.2.1 • Published 1 year ago
has-vite v0.2.1
has-vite
Check if a project is using vite
Install
npm:
npm install has-viteyarn
yarn add has-vitepnpm
pnpm add has-viteUsage
.
├── foo
│ └── package.json
└── bar
├── package.json
└── vite.config.tsimport { hasVite } from 'has-vite'
hasVite('foo') // => false
hasVite('bar') // => trueAPI
hasVite(cwd?)
Returns a boolean of whether the project is using vite.
Returns true if one of bellow functions return true:
hasViteConfighasViteInPkg
hasViteConfig(cwd?)
Returns a boolean of whether the project has vite.config.{js,cjs,mjs,ts,cts,mts}.
hasViteDep(cwd?)
Returns a boolean of whether the project has vite in dependencies.
hasViteDevDep(cwd?)
Returns a boolean of whether the project has vite in devDependencies.
hasVitePeerDep(cwd?)
Returns a boolean of whether the project has vite in peerDependencies.
hasViteInPkg(cwd?)
Returns a boolean of whether the project has vite in dependencies | devDependencies | peerDependencies.
readPkg(cwd?)
Returns an object of a project's package.json content, returns {} when package.json not exist in cwd.
Parameters
cwd
Current working directory.
Type: string
Default: process.cwd()