0.2.0 • Published 8 months ago

has-vite v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

has-vite

CI NPM VERSION NPM DOWNLOADS Coverage Status LICENSE

Check if a project is using vite

Install

npm:

npm install has-vite

yarn

yarn add has-vite

pnpm

pnpm add has-vite

Usage

.
├── foo
│   └── package.json
└── bar
    ├── package.json
    └── vite.config.ts
import { hasVite } from 'has-vite'

hasVite('foo') // => false

hasVite('bar') // => true

API

hasVite(cwd?)

Returns a boolean of whether the project is using vite.

Returns true if one of bellow functions return true:

  • hasViteConfig
  • hasViteInPkg

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()

License

MIT License © 2022-PRESENT ntnyq

0.2.0

8 months ago

0.1.0

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

2 years ago

0.0.1

2 years ago