feat: commit id
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
const { execFileSync } = require('node:child_process')
|
||||||
|
|
||||||
|
const getCommitId = () => {
|
||||||
|
const easCommitId = process.env.EAS_BUILD_GIT_COMMIT_HASH?.trim()
|
||||||
|
if (easCommitId) {
|
||||||
|
return easCommitId.slice(0, 8)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return execFileSync('git', ['rev-parse', '--short=8', 'HEAD'], {
|
||||||
|
encoding: 'utf8',
|
||||||
|
}).trim()
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ({ config }) => ({
|
||||||
|
...config,
|
||||||
|
extra: {
|
||||||
|
...config.extra,
|
||||||
|
commitId: getCommitId(),
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -49,13 +49,14 @@ const SETTINGS = [
|
|||||||
|
|
||||||
const getVersionLabel = () => {
|
const getVersionLabel = () => {
|
||||||
const appVersion = Constants.expoConfig?.version || 'inconnue'
|
const appVersion = Constants.expoConfig?.version || 'inconnue'
|
||||||
const updateId = typeof Updates.updateId === 'string' ? Updates.updateId.slice(0, 8) : null
|
const commitId = Constants.expoConfig?.extra?.commitId
|
||||||
|
const source = __DEV__ ? 'développement' : Updates.isEmbeddedLaunch ? 'intégrée' : 'OTA'
|
||||||
|
|
||||||
if (updateId) {
|
if (typeof commitId === 'string' && commitId) {
|
||||||
return `Version ${appVersion} · mise à jour ${updateId}`
|
return `Version ${appVersion} · ${source} · commit ${commitId}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return `Version ${appVersion} · ${__DEV__ ? 'développement' : 'intégrée'}`
|
return `Version ${appVersion} · ${source}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const Settings = () => {
|
const Settings = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user