refactor: using a more semver-like prerelease version format

This commit is contained in:
LeoYuan 袁力皓 2022-05-27 10:25:30 +08:00
parent 5ea53f706b
commit d16bbc3287
2 changed files with 4 additions and 2 deletions

View File

@ -40,7 +40,9 @@ export class LowCodePluginManager implements ILowCodePluginManager {
isEngineVersionMatched(versionExp: string): boolean { isEngineVersionMatched(versionExp: string): boolean {
const engineVersion = engineConfig.get('ENGINE_VERSION'); const engineVersion = engineConfig.get('ENGINE_VERSION');
return semverSatisfies(engineVersion, versionExp); // ref: https://github.com/npm/node-semver#functions
// 1.0.1-beta should match '^1.0.0'
return semverSatisfies(engineVersion, versionExp, { includePrerelease: true });
} }
/** /**

View File

@ -17,7 +17,7 @@ function getVersion() {
const [_, version, beta] = match; const [_, version, beta] = match;
return beta && beta.endsWith('beta') ? `${version}(beta)` : version; return beta && beta.endsWith('beta') ? `${version}-beta` : version;
} }
const releaseVersion = getVersion(); const releaseVersion = getVersion();