Skip to content

Commit

Permalink
Merge branch 'develop' into weblate-fluidd-translate
Browse files Browse the repository at this point in the history
  • Loading branch information
matmen committed Jul 2, 2023
2 parents 7eef824 + 68cdbfe commit 18e237a
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions vite.config.inject-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ import { version } from './package.json'

import type { Plugin } from 'vite'

const writeVersionFile = async () => {
const versionFile = await fs.promises.open(path.resolve(__dirname, 'dist/.version'), 'w')

await versionFile.writeFile(`v${version}`)

await versionFile.close()
}

const writeReleaseInfoFile = async () => {
const releaseInfoFile = await fs.promises.open(path.resolve(__dirname, 'dist/release_info.json'), 'w')

await releaseInfoFile.writeFile(JSON.stringify({
project_name: 'fluidd',
project_owner: 'fluidd-core',
version: `v${version}`
}))

await releaseInfoFile.close()
}

const vitePluginInjectVersion = (): Plugin => {
return {
name: 'version',
Expand All @@ -22,11 +42,8 @@ const vitePluginInjectVersion = (): Plugin => {
},
writeBundle: () => {
setImmediate(async () => {
const versionFile = await fs.promises.open(path.resolve(__dirname, 'dist/.version'), 'w')

await versionFile.writeFile(`v${version}`)

await versionFile.close()
await writeVersionFile()
await writeReleaseInfoFile()
})
}
}
Expand Down

0 comments on commit 18e237a

Please sign in to comment.