Skip to content

Commit

Permalink
perf: package version
Browse files Browse the repository at this point in the history
  • Loading branch information
alex8088 committed Dec 13, 2023
1 parent 93e84f6 commit cc0df8a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
}
},
"devDependencies": {
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.5",
"@swc/core": "^1.3.100",
Expand Down
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import fs from 'node:fs/promises'
import { type Plugin, defineConfig } from 'rollup'
import ts from '@rollup/plugin-typescript'
import resolve from '@rollup/plugin-node-resolve'
import json from '@rollup/plugin-json'
import dts from 'rollup-plugin-dts'

const require = createRequire(import.meta.url)
Expand Down Expand Up @@ -47,6 +48,7 @@ export default defineConfig([
external,
plugins: [
clean('buildStart', 'dist'),
json(),
ts({ compilerOptions: { rootDir: 'src', declaration: true, declarationDir: 'dist/types' } }),
resolve()
],
Expand Down
6 changes: 2 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { createRequire } from 'node:module'
import { cac } from 'cac'
import colors from 'picocolors'
import { LogLevel, createLogger } from 'vite'
import { InlineConfig } from './config'

const _require = createRequire(import.meta.url)
import { version } from '../package.json'

const cli = cac('electron-vite')

Expand Down Expand Up @@ -163,6 +161,6 @@ cli
})

cli.help()
cli.version(_require('../package.json').version)
cli.version(version)

cli.parse()

0 comments on commit cc0df8a

Please sign in to comment.