blob: d61ad1a86065700a1ca6e1a5949bb2a912863025 (
plain)
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
38
39
40
41
42
43
44
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only
import { execSync } from 'child_process';
import * as path from 'path';
import * as fs from 'fs';
interface RootPackage {
version: string;
}
export function getExtensionVersion(extensionRoot: string): string {
const packageJsonPath = path.join(extensionRoot, 'package.json');
const packageJson = JSON.parse(
fs.readFileSync(packageJsonPath, 'utf-8')
) as RootPackage;
return packageJson.version;
}
export function pushTag(
extensionRoot: string,
extension: string,
version: string,
remote: string
) {
const tag = `${extension}/${version}`;
execSync(`git tag -am "${tag}" ${tag}`, {
cwd: extensionRoot,
stdio: 'inherit'
});
execSync(`git push ${remote} ${tag}`, {
cwd: extensionRoot,
stdio: 'inherit'
});
}
export function checkForUncommittedChanges() {
const status = execSync('git status --porcelain').toString();
if (status.trim().length > 0) {
throw new Error(
'Uncommitted changes found. Please commit or stash them before proceeding.'
);
}
}
|