未验证 提交 bdfd8390 编写于 作者: R Rob Lourens

Map version string to single number - Microsoft/vscode-bing#7

上级 4571d387
......@@ -458,10 +458,20 @@ gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () =
account: process.env.AZURE_STORAGE_ACCOUNT,
key: process.env.AZURE_STORAGE_ACCESS_KEY,
container: 'configuration',
prefix: `${packageJson.version}/${commit}/`
prefix: `${versionStringToNumber(packageJson.version)}/${commit}/`
}));
});
function versionStringToNumber(versionStr) {
const semverRegex = /(\d+)\.(\d+)\.(\d+)/;
const match = versionStr.match(semverRegex);
if (!match) {
return 0;
}
return parseInt(match[1], 10) * 10000 + parseInt(match[2], 10) * 100 + parseInt(match[3], 10);
}
gulp.task('generate-vscode-configuration', () => {
return new Promise((resolve, reject) => {
const buildDir = process.env['AGENT_BUILDDIRECTORY'];
......
......@@ -888,7 +888,7 @@ interface IConfigurationExport {
settings: IExportedConfigurationNode[];
buildTime: number;
commit: string;
version: string;
version: number;
}
export class DefaultConfigurationExportHelper {
......@@ -953,9 +953,19 @@ export class DefaultConfigurationExportHelper {
settings: settings.sort((a, b) => a.name.localeCompare(b.name)),
buildTime: Date.now(),
commit: product.commit,
version: pkg.version
version: versionStringToNumber(pkg.version)
};
return result;
}
}
function versionStringToNumber(versionStr: string): number {
const semverRegex = /(\d+)\.(\d+)\.(\d+)/;
const match = versionStr.match(semverRegex);
if (!match) {
return 0;
}
return parseInt(match[1], 10) * 10000 + parseInt(match[2], 10) * 100 + parseInt(match[3], 10);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册