Skip to content

Commit

Permalink
fix: remove dep on debug tools dir, ignore empty git tag (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterBrown committed Aug 26, 2023
1 parent c4eb48b commit 2117b02
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/toolbox/setup/moddable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ export function moddableExists(): boolean {
return (
process.env.MODDABLE !== undefined &&
filesystem.exists(process.env.MODDABLE) === 'dir' &&
releaseTools === 'dir' &&
debugTools === 'dir'
(releaseTools === 'dir' || debugTools === 'dir')
)
}

export async function getModdableVersion(): Promise<string | null> {
if (moddableExists()) {
const tags = await system.run('git tag -l --sort=-taggerdate', { cwd: process.env.MODDABLE })
const tag = tags.split('\n').shift()
if (tag === undefined) return null

const tagCommit = await system.run(`git rev-list -n 1 ${tag}`, { cwd: process.env.MODDABLE })
const latestCommit = await system.run(`git rev-parse HEAD`, { cwd: process.env.MODDABLE })
if (tagCommit === latestCommit) return tag

if (tag !== undefined && tag.length > 0) {
const tagCommit = await system.run(`git rev-list -n 1 ${tag}`, { cwd: process.env.MODDABLE })
if (tagCommit === latestCommit) return tag
}

const currentBranch = await system.run(`git branch --show-current`, { cwd: process.env.MODDABLE })
return `branch: ${currentBranch.trim()}, commit: ${latestCommit}`
Expand Down

0 comments on commit 2117b02

Please sign in to comment.