@eclipse-glsp/cli 2.3.0-next.164 → 2.3.0-next.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -38
- package/dist/cli.js +21959 -0
- package/dist/cli.js.map +6 -0
- package/package.json +22 -29
- package/bin/glsp +0 -2
- package/lib/app.d.ts +0 -2
- package/lib/app.d.ts.map +0 -1
- package/lib/app.js +0 -35
- package/lib/app.js.map +0 -1
- package/lib/commands/check-header.d.ts +0 -21
- package/lib/commands/check-header.d.ts.map +0 -1
- package/lib/commands/check-header.js +0 -240
- package/lib/commands/check-header.js.map +0 -1
- package/lib/commands/coverage-report.d.ts +0 -29
- package/lib/commands/coverage-report.d.ts.map +0 -1
- package/lib/commands/coverage-report.js +0 -126
- package/lib/commands/coverage-report.js.map +0 -1
- package/lib/commands/generate-index.d.ts +0 -46
- package/lib/commands/generate-index.d.ts.map +0 -1
- package/lib/commands/generate-index.js +0 -172
- package/lib/commands/generate-index.js.map +0 -1
- package/lib/commands/release/common.d.ts +0 -68
- package/lib/commands/release/common.d.ts.map +0 -1
- package/lib/commands/release/common.js +0 -293
- package/lib/commands/release/common.js.map +0 -1
- package/lib/commands/release/release-client.d.ts +0 -3
- package/lib/commands/release/release-client.d.ts.map +0 -1
- package/lib/commands/release/release-client.js +0 -58
- package/lib/commands/release/release-client.js.map +0 -1
- package/lib/commands/release/release-eclipse-integration.d.ts +0 -18
- package/lib/commands/release/release-eclipse-integration.d.ts.map +0 -1
- package/lib/commands/release/release-eclipse-integration.js +0 -93
- package/lib/commands/release/release-eclipse-integration.js.map +0 -1
- package/lib/commands/release/release-java-server.d.ts +0 -3
- package/lib/commands/release/release-java-server.d.ts.map +0 -1
- package/lib/commands/release/release-java-server.js +0 -71
- package/lib/commands/release/release-java-server.js.map +0 -1
- package/lib/commands/release/release-server-node.d.ts +0 -18
- package/lib/commands/release/release-server-node.d.ts.map +0 -1
- package/lib/commands/release/release-server-node.js +0 -54
- package/lib/commands/release/release-server-node.js.map +0 -1
- package/lib/commands/release/release-theia-integration.d.ts +0 -18
- package/lib/commands/release/release-theia-integration.d.ts.map +0 -1
- package/lib/commands/release/release-theia-integration.js +0 -54
- package/lib/commands/release/release-theia-integration.js.map +0 -1
- package/lib/commands/release/release-vscode-integration.d.ts +0 -18
- package/lib/commands/release/release-vscode-integration.d.ts.map +0 -1
- package/lib/commands/release/release-vscode-integration.js +0 -54
- package/lib/commands/release/release-vscode-integration.js.map +0 -1
- package/lib/commands/release/release.d.ts +0 -14
- package/lib/commands/release/release.d.ts.map +0 -1
- package/lib/commands/release/release.js +0 -191
- package/lib/commands/release/release.js.map +0 -1
- package/lib/commands/update-next.d.ts +0 -20
- package/lib/commands/update-next.d.ts.map +0 -1
- package/lib/commands/update-next.js +0 -146
- package/lib/commands/update-next.js.map +0 -1
- package/lib/util/command-util.d.ts +0 -26
- package/lib/util/command-util.d.ts.map +0 -1
- package/lib/util/command-util.js +0 -56
- package/lib/util/command-util.js.map +0 -1
- package/lib/util/git-util.d.ts +0 -42
- package/lib/util/git-util.d.ts.map +0 -1
- package/lib/util/git-util.js +0 -125
- package/lib/util/git-util.js.map +0 -1
- package/lib/util/logger.d.ts +0 -23
- package/lib/util/logger.d.ts.map +0 -1
- package/lib/util/logger.js +0 -50
- package/lib/util/logger.js.map +0 -1
- package/lib/util/validation-util.d.ts +0 -5
- package/lib/util/validation-util.d.ts.map +0 -1
- package/lib/util/validation-util.js +0 -86
- package/lib/util/validation-util.js.map +0 -1
- package/src/app.ts +0 -34
- package/src/commands/check-header.ts +0 -280
- package/src/commands/coverage-report.ts +0 -113
- package/src/commands/generate-index.ts +0 -169
- package/src/commands/release/common.ts +0 -306
- package/src/commands/release/release-client.ts +0 -55
- package/src/commands/release/release-eclipse-integration.ts +0 -113
- package/src/commands/release/release-java-server.ts +0 -73
- package/src/commands/release/release-server-node.ts +0 -61
- package/src/commands/release/release-theia-integration.ts +0 -65
- package/src/commands/release/release-vscode-integration.ts +0 -67
- package/src/commands/release/release.ts +0 -215
- package/src/commands/update-next.ts +0 -129
- package/src/util/command-util.ts +0 -54
- package/src/util/git-util.ts +0 -123
- package/src/util/logger.ts +0 -57
- package/src/util/validation-util.ts +0 -62
package/src/util/git-util.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-2024 EclipseSource and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
|
|
17
|
-
import { resolve } from 'path';
|
|
18
|
-
import sh from 'shelljs';
|
|
19
|
-
import { getShellConfig } from './command-util';
|
|
20
|
-
|
|
21
|
-
export function isGitRepository(path?: string): boolean {
|
|
22
|
-
cdIfPresent(path);
|
|
23
|
-
const isGitRepo =
|
|
24
|
-
sh
|
|
25
|
-
.exec('git rev-parse --is-inside-work-tree', getShellConfig({ silent: true }))
|
|
26
|
-
.stdout.trim()
|
|
27
|
-
.toLocaleLowerCase() === 'true';
|
|
28
|
-
return isGitRepo;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getGitRoot(path?: string): string {
|
|
32
|
-
cdIfPresent(path);
|
|
33
|
-
const fileString = sh.exec('git rev-parse --show-toplevel', getShellConfig()).stdout.trim();
|
|
34
|
-
return resolve(fileString);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function hasGitChanges(path?: string): boolean {
|
|
38
|
-
return getUncommittedChanges(path).length > 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Returns the files that have uncommitted changes (staged, not staged and untracked) of a git repository.
|
|
43
|
-
* Filepaths are absolute.
|
|
44
|
-
*/
|
|
45
|
-
export function getUncommittedChanges(path?: string): string[] {
|
|
46
|
-
cdIfPresent(path);
|
|
47
|
-
return sh
|
|
48
|
-
.exec('git status --porcelain', getShellConfig())
|
|
49
|
-
.stdout.trim()
|
|
50
|
-
.split('\n')
|
|
51
|
-
.filter(value => value.trim().length !== 0)
|
|
52
|
-
.map(fileInfo =>
|
|
53
|
-
// Extract relative file path from the info string and convert to absolute path
|
|
54
|
-
resolve(path ?? process.cwd(), fileInfo.trim().split(' ').pop() ?? '')
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Returns the files tha have been changed with the last commit (also includes currently staged but uncommitted changes)
|
|
60
|
-
* Filepaths are absolute.
|
|
61
|
-
*/
|
|
62
|
-
export function getChangesOfLastCommit(path?: string): string[] {
|
|
63
|
-
cdIfPresent(path);
|
|
64
|
-
return sh
|
|
65
|
-
.exec('git diff --name-only HEAD^', getShellConfig())
|
|
66
|
-
.stdout.trim()
|
|
67
|
-
.split('\n')
|
|
68
|
-
.map(file => resolve(path ?? process.cwd(), file));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Returns the last modification date of a file (or the last commit) in a git repo.
|
|
73
|
-
* @param filePath The file. If undefined the modification date of the last commit will be returned
|
|
74
|
-
* @param repoRoot The path to the repo root. If undefined the current working directory is used.
|
|
75
|
-
* @param excludeMessage Only consider commits that don`t match the excludeMessage
|
|
76
|
-
* @returns The date or undefined if the file is outside of the git repo.
|
|
77
|
-
*/
|
|
78
|
-
export function getLastModificationDate(filePath?: string, repoRoot?: string, excludeMessage?: string): Date | undefined {
|
|
79
|
-
cdIfPresent(repoRoot);
|
|
80
|
-
const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : '';
|
|
81
|
-
const result = sh.exec(`git log -1 ${additionalArgs} --pretty="format:%ci" ${filePath ?? ''}`, getShellConfig());
|
|
82
|
-
if (result.code !== 0) {
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
return new Date(result.stdout.trim());
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function getFilesOfCommit(commitHash: string, repoRoot?: string): string[] {
|
|
89
|
-
cdIfPresent(repoRoot);
|
|
90
|
-
const result = sh.exec(`git show --pretty="" --name-only ${commitHash}`, getShellConfig());
|
|
91
|
-
if (result.code !== 0) {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return result.stdout.trim().split('\n');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function getLatestGithubRelease(path?: string): string {
|
|
99
|
-
cdIfPresent(path);
|
|
100
|
-
const release = sh.exec('gh release list --exclude-drafts -L 1', getShellConfig()).stdout.trim().split('\t');
|
|
101
|
-
return release[release.length - 2];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function getLatestTag(path?: string): string {
|
|
105
|
-
cdIfPresent(path);
|
|
106
|
-
return sh.exec('git describe --abbrev=0 --tags', getShellConfig()).stdout.trim();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export function hasBranch(branch: string, path?: string): boolean {
|
|
110
|
-
cdIfPresent(path);
|
|
111
|
-
return sh.exec(`git branch --list ${branch}`, getShellConfig()).stdout.trim().length !== 0;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function getRemoteUrl(path?: string): string {
|
|
115
|
-
cdIfPresent(path);
|
|
116
|
-
return sh.exec('git config --get remote.origin.url', getShellConfig()).stdout.trim();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function cdIfPresent(path?: string): void {
|
|
120
|
-
if (path) {
|
|
121
|
-
sh.cd(path);
|
|
122
|
-
}
|
|
123
|
-
}
|
package/src/util/logger.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-2023 EclipseSource and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
|
|
17
|
-
export interface Logger extends Pick<Console, LogLevel> {
|
|
18
|
-
newLine(): void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type LogLevel = 'info' | 'debug' | 'error' | 'warn';
|
|
22
|
-
|
|
23
|
-
const levels: Record<LogLevel, { threshold: number; color: string }> = {
|
|
24
|
-
error: { threshold: 0, color: '\x1b[31m' }, // red
|
|
25
|
-
warn: { threshold: 1, color: '\x1b[33m' }, // yellow
|
|
26
|
-
info: { threshold: 2, color: '\x1b[0m' }, // default terminal color
|
|
27
|
-
debug: { threshold: 3, color: '\x1b[32m' } // green
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
let levelThreshold: number = levels.info.threshold;
|
|
31
|
-
|
|
32
|
-
export const LOGGER: Logger = {
|
|
33
|
-
info: (...args) => log('info', ...args),
|
|
34
|
-
error: (...args) => log('error', ...args),
|
|
35
|
-
warn: (...args) => log('warn', ...args),
|
|
36
|
-
debug: (...args) => log('debug', ...args),
|
|
37
|
-
newLine: () => console.log('')
|
|
38
|
-
} as const;
|
|
39
|
-
|
|
40
|
-
function log(level: LogLevel, ...args: any[]): void {
|
|
41
|
-
const levelData = levels[level];
|
|
42
|
-
if (levelThreshold < levelData.threshold) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
console[level](levelData.color, ...args, '\x1b[0m');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function configureLogger(level: LogLevel): void;
|
|
49
|
-
export function configureLogger(verbose: boolean): void;
|
|
50
|
-
export function configureLogger(levelOrVerbose: LogLevel | boolean): void {
|
|
51
|
-
if (typeof levelOrVerbose === 'boolean') {
|
|
52
|
-
const level: LogLevel = levelOrVerbose ? 'debug' : 'info';
|
|
53
|
-
levelThreshold = levels[level].threshold;
|
|
54
|
-
} else {
|
|
55
|
-
levelThreshold = levels[levelOrVerbose].threshold;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-2024 EclipseSource and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
import { InvalidArgumentError } from 'commander';
|
|
17
|
-
import * as fs from 'fs';
|
|
18
|
-
import { resolve } from 'path';
|
|
19
|
-
import * as semver from 'semver';
|
|
20
|
-
import { getGitRoot, isGitRepository } from './git-util';
|
|
21
|
-
import { LOGGER } from './logger';
|
|
22
|
-
|
|
23
|
-
export function validateDirectory(rootDir: string): string {
|
|
24
|
-
const path = resolve(rootDir);
|
|
25
|
-
if (!fs.existsSync(path)) {
|
|
26
|
-
throw new InvalidArgumentError('Not a valid file path!');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!fs.statSync(path).isDirectory()) {
|
|
30
|
-
throw new InvalidArgumentError('Not a directory!');
|
|
31
|
-
}
|
|
32
|
-
return path;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function validateFile(filePath: string, hasToExist = false): string {
|
|
36
|
-
const path = resolve(filePath);
|
|
37
|
-
|
|
38
|
-
if (hasToExist && !fs.existsSync(path)) {
|
|
39
|
-
throw new InvalidArgumentError('Not a valid file path!');
|
|
40
|
-
}
|
|
41
|
-
if (!fs.statSync(path).isFile()) {
|
|
42
|
-
throw new InvalidArgumentError('Not a file!');
|
|
43
|
-
}
|
|
44
|
-
return path;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function validateVersion(version: string): string {
|
|
48
|
-
LOGGER.debug(`Validate version format of: ${version}`);
|
|
49
|
-
if (!semver.valid(version)) {
|
|
50
|
-
throw new InvalidArgumentError(`Not a valid version: ${version}`);
|
|
51
|
-
}
|
|
52
|
-
return version;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function validateGitDirectory(repository: string): string {
|
|
56
|
-
const repoPath = validateDirectory(repository);
|
|
57
|
-
if (!isGitRepository(repoPath)) {
|
|
58
|
-
throw new InvalidArgumentError('Not a valid git repository');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return getGitRoot(repository);
|
|
62
|
-
}
|