forked from bluelovers/idea-l10n-zht
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1de2b0
commit d6aa08d
Showing
4 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { currentBranchName } from '@git-lazy/branch'; | ||
import { __root } from '../../test/__root'; | ||
import { console } from 'debug-color2'; | ||
|
||
export function parseVersionFromBranchName(branch: string) | ||
{ | ||
let m = /^(?:releases\/)?v((\d+)(?:\.(?:\d+))?)$/.exec(branch); | ||
|
||
if (m?.[1]) | ||
{ | ||
return { | ||
isVersionBranch: true as const, | ||
version: m[1], | ||
series: m[2], | ||
} | ||
} | ||
|
||
return { | ||
isVersionBranch: false as const, | ||
} | ||
} | ||
|
||
export function getBranchInfo() | ||
{ | ||
const branchName = currentBranchName(__root); | ||
|
||
const isMasterBranch = branchName === 'master' || branchName === 'main'; | ||
|
||
const { | ||
version, | ||
series, | ||
isVersionBranch, | ||
} = parseVersionFromBranchName(branchName); | ||
|
||
const data = { | ||
branchName, | ||
isMasterBranch, | ||
isVersionBranch, | ||
version, | ||
series, | ||
}; | ||
|
||
console.dir(data); | ||
|
||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
import { internalDownload } from '../lib/cli/internalDownload'; | ||
import Bluebird from 'bluebird'; | ||
import { currentBranchName } from '@git-lazy/branch'; | ||
import { __root } from '../test/__root'; | ||
import { getBranchInfo } from '../lib/git/branch-info'; | ||
|
||
export default Bluebird.resolve() | ||
.then(() => | ||
{ | ||
let name = currentBranchName(__root); | ||
const { series } = getBranchInfo(); | ||
|
||
if (name?.length > 0) | ||
{ | ||
let m = /^(?:releases\/)?v(\d+)(?:\.(?:\d+))?$/.exec(name); | ||
|
||
return internalDownload(m?.[1]) | ||
} | ||
|
||
return internalDownload() | ||
return internalDownload(series) | ||
}) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters