MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / getVersion

Function getVersion

packages/engine/build.plugin.js:9–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7// release/1.0.7-beta => 1.0.7 (beta)
8// release/1.0.7-beta.0 => 1.0.7 (beta)
9function getVersion() {
10 const gitBranchName = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' });
11 const reBranchVersion = /^(?:[\w-]+\/)(\d+\.\d+\.\d+)(-?beta)?(?:\.\d+)?$/im;
12
13 const match = reBranchVersion.exec(gitBranchName);
14 if (!match) {
15 console.warn(`[engine] gitBranchName: ${gitBranchName}`);
16 return 'N/A';
17 }
18
19 const [_, version, beta] = match;
20
21 return beta && beta.endsWith('beta') ? `${version}-beta` : version;
22}
23
24const releaseVersion = getVersion();
25

Callers 1

build.plugin.jsFile · 0.85

Calls 1

warnMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…