vite-plugin-version-mark icon indicating copy to clipboard operation
vite-plugin-version-mark copied to clipboard

[Feature] How to use multiple commands

Open chouchouji opened this issue 1 year ago • 3 comments

chouchouji avatar Dec 05 '24 07:12 chouchouji

@ZhongxuYang We should talk about how to realize this need. I think function is a better choice.

chouchouji avatar Dec 05 '24 07:12 chouchouji

Can you describe your design in pseudo-code? About input and command results.

ZhongxuYang avatar Dec 05 '24 07:12 ZhongxuYang

Can you describe your design in pseudo-code? About input and command results.

import {defineConfig} from 'vite'
import {vitePluginVersionMark} from 'vite-plugin-version-mark'

export default defineConfig(async () => {
  const branch = await exec('git branch --show-current')
  const hash = await exec('git rev-parse --short HEAD')


  return {
    plugins: [
      vitePluginVersionMark({
        // name: 'test-app',
        // version: '0.0.1',
        command: () => `${branch}-${hash}`,
        // outputFile: true,
        // ifGitSHA: true,
        ifShortSHA: true,
        ifMeta: true,
        ifLog: true,
        ifGlobal: true,
      })
    ],
}})

chouchouji avatar Dec 05 '24 07:12 chouchouji