Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Commit be709ef

Browse files
committed
feat(generator): add dist_tauri to .gitignore
1 parent 9d30ef7 commit be709ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

generator/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const execa = require('execa')
22
const { error } = require('@vue/cli-shared-utils')
3+
const fs = require('fs-extra')
34

45
module.exports = async api => {
56
await execa('cargo', ['tauri-cli', '--version']).catch(() => {
@@ -14,4 +15,15 @@ module.exports = async api => {
1415
'tauri:build': 'vue-cli-service tauri:build'
1516
}
1617
})
18+
api.onCreateComplete(() => {
19+
// Update .gitignore if it exists
20+
if (fs.existsSync(api.resolve('./.gitignore'))) {
21+
let gitignore = fs.readFileSync(api.resolve('./.gitignore'), 'utf8')
22+
if (!/(# Tauri build output|\/dist_tauri)/.test(gitignore)) {
23+
// Add /dist_tauri to .gitignore if it doesn't exist already
24+
gitignore = gitignore + '\n#Tauri build output\n/dist_tauri'
25+
fs.writeFileSync(api.resolve('./.gitignore'), gitignore)
26+
}
27+
}
28+
})
1729
}

0 commit comments

Comments
 (0)