Skip to content

Commit

Permalink
chore: migrated from esbuild to Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulCatalinas committed May 30, 2024
1 parent 2a792b6 commit 31b816f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
Binary file modified bun.lockb
Binary file not shown.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "huskybc",
"main": "dist/index.js",
"main": "dist/index.cjs",
"type": "module",
"version": "1.0.0",
"bin": {
"huskybc": "dist/index.js"
"huskybc": "dist/index.cjs"
},
"scripts": {
"prepare": "husky",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"format": "prettier src --check",
"format:write": "prettier src --write",
"build": "esbuild --minify --bundle --format=esm --platform=node --outfile=dist/index.js --packages=external src/index.ts",
"build": "vite build",
"prepublishOnly": "bun run build"
},
"dependencies": {
Expand All @@ -32,7 +32,6 @@
"@types/inquirer": "9.0.7",
"@types/npmcli__promise-spawn": "6.0.3",
"@types/opener": "1.4.3",
"esbuild": "0.21.4",
"eslint": "^8.0.1",
"eslint-config-love": "51.0.1",
"eslint-config-prettier": "9.1.0",
Expand All @@ -41,7 +40,9 @@
"lint-staged": "15.2.5",
"markdownlint": "0.34.0",
"prettier": "3.2.5",
"typescript": "5.4.5"
"typescript": "5.4.5",
"vite": "5.2.12",
"vite-tsconfig-paths": "4.3.2"
},
"contributors": [
{
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

// Config
import { configureCLI } from './config/cli'
import { configureDefaultOption, configureOptions } from './config/options'
Expand Down
23 changes: 23 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Vite
import { defineConfig } from 'vite'

// Plugins
import tsConfigPaths from 'vite-tsconfig-paths'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [tsConfigPaths()],
ssr: {
// bundle and treeshake everything
noExternal: true
},
build: {
ssr: true,
lib: {
entry: ['src/index.ts'],
formats: ['cjs']
},
outDir: 'dist',
minify: true
}
})

0 comments on commit 31b816f

Please sign in to comment.