mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: have correct version in driver (#10374)
This commit is contained in:
parent
293c233a49
commit
11a389c8f9
@ -31,19 +31,20 @@ if (process.argv[2] === '--alpha') {
|
||||
throw new Error('only --alpha or --beta prefixes are allowed');
|
||||
}
|
||||
|
||||
let newVersion;
|
||||
if (process.argv[3] === '--today-date') {
|
||||
const date = new Date();
|
||||
const month = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'][date.getMonth()];
|
||||
const day = date.getDate();
|
||||
const year = date.getFullYear();
|
||||
packageJSON.version = `${baseVersion}-${prefix}-${month}-${day}-${year}`;
|
||||
newVersion = `${baseVersion}-${prefix}-${month}-${day}-${year}`;
|
||||
} else if (process.argv[3] === '--commit-timestamp') {
|
||||
const timestamp = execSync('git show -s --format=%ct HEAD', {
|
||||
stdio: ['ignore', 'pipe', 'ignore']
|
||||
}).toString('utf8').trim();
|
||||
packageJSON.version = `${baseVersion}-${prefix}-${timestamp}000`;
|
||||
newVersion = `${baseVersion}-${prefix}-${timestamp}000`;
|
||||
} else {
|
||||
throw new Error('This script must be run with either --commit-timestamp or --today-date parameter');
|
||||
}
|
||||
console.log('Setting version to ' + packageJSON.version);
|
||||
fs.writeFileSync(path.join(__dirname, '..', '..', 'package.json'), JSON.stringify(packageJSON, undefined, 2) + '\n');
|
||||
console.log('Setting version to ' + newVersion);
|
||||
execSync(`node utils/bump_package_versions.js ${newVersion}`, { stdio: 'inherit' });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user