Skip to main content

Check if a project is using vite.

This package works with Cloudflare Workers, Node.js, Deno, Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
16 hours ago (0.2.1)

has-vite

CI NPM VERSION NPM DOWNLOADS CODECOV 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

Add Package

deno add jsr:@ntnyq/has-vite

Import symbol

import * as has_vite from "@ntnyq/has-vite";

---- OR ----

Import directly with a jsr specifier

import * as has_vite from "jsr:@ntnyq/has-vite";

Add Package

npx jsr add @ntnyq/has-vite

Import symbol

import * as has_vite from "@ntnyq/has-vite";

Add Package

yarn dlx jsr add @ntnyq/has-vite

Import symbol

import * as has_vite from "@ntnyq/has-vite";

Add Package

pnpm dlx jsr add @ntnyq/has-vite

Import symbol

import * as has_vite from "@ntnyq/has-vite";

Add Package

bunx jsr add @ntnyq/has-vite

Import symbol

import * as has_vite from "@ntnyq/has-vite";