forked from adamlaska/browser-compat-data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease-utils.js
More file actions
37 lines (31 loc) · 767 Bytes
/
release-utils.js
File metadata and controls
37 lines (31 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { execSync } = require('child_process');
function exec(command) {
return execSync(command, { encoding: 'utf8' }).trim();
}
function getLatestTag() {
return exec('git describe --abbrev=0 --tags');
}
function getRefDate(ref, querySafe = false) {
const rawDateString = exec(`git log -1 --format=%aI ${ref}`);
if (querySafe) {
return rawDateString.replace('+', '%2B');
}
return rawDateString;
}
function releaseYargsBuilder(yargs) {
yargs.positional('start-version-tag', {
type: 'string',
defaultDescription: 'most recent tag',
default: getLatestTag,
});
yargs.positional('end-version-tag', {
type: 'string',
default: 'main',
});
}
module.exports = {
exec,
getLatestTag,
getRefDate,
releaseYargsBuilder,
};