@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
|
@@ -1,73 +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 sh from 'shelljs';
|
|
17
|
-
import { fatalExec, getShellConfig } from '../../util/command-util';
|
|
18
|
-
import { LOGGER } from '../../util/logger';
|
|
19
|
-
import { ReleaseOptions, asMvnVersion, checkoutAndCd, commitAndTag, publish } from './common';
|
|
20
|
-
|
|
21
|
-
let REPO_ROOT: string;
|
|
22
|
-
|
|
23
|
-
export async function releaseJavaServer(options: ReleaseOptions): Promise<void> {
|
|
24
|
-
LOGGER.info('Prepare glsp-server release');
|
|
25
|
-
LOGGER.debug('Release options: ', options);
|
|
26
|
-
const mvnVersion = asMvnVersion(options.version);
|
|
27
|
-
REPO_ROOT = checkoutAndCd(options);
|
|
28
|
-
sh.find();
|
|
29
|
-
setVersion(mvnVersion);
|
|
30
|
-
build();
|
|
31
|
-
generateChangeLog();
|
|
32
|
-
commitAndTag(mvnVersion, REPO_ROOT);
|
|
33
|
-
publish(REPO_ROOT, options);
|
|
34
|
-
LOGGER.info('glsp-server release successful!');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function setVersion(version: string): void {
|
|
38
|
-
LOGGER.info(`Set pom version to ${version}`);
|
|
39
|
-
sh.cd(REPO_ROOT);
|
|
40
|
-
LOGGER.debug('Preprocessing eclipse-plugins poms');
|
|
41
|
-
// Capture all poms with a `${package.type}` property
|
|
42
|
-
|
|
43
|
-
const pluginPoms = sh
|
|
44
|
-
.exec('grep -ril --include pom.xml \\${package-type}', getShellConfig()) //
|
|
45
|
-
.stdout.trim()
|
|
46
|
-
.split('\n')
|
|
47
|
-
.map(file => `${REPO_ROOT}/${file}`);
|
|
48
|
-
|
|
49
|
-
// Replace `${package.type}` property with `eclipse-plugin`
|
|
50
|
-
sh.sed('-i', /\${package-type}/, 'eclipse-plugin', pluginPoms);
|
|
51
|
-
LOGGER.debug('Preprocessing complete');
|
|
52
|
-
|
|
53
|
-
// Execute tycho-versions plugin
|
|
54
|
-
fatalExec(`mvn tycho-versions:set-version -DnewVersion=${version}`, 'Mvn set-versions failed', getShellConfig({ silent: false }));
|
|
55
|
-
|
|
56
|
-
LOGGER.debug('Restore eclipse-plugin poms');
|
|
57
|
-
sh.sed('-i', /<packaging>eclipse-plugin/, '<packaging>${package-type}', pluginPoms);
|
|
58
|
-
|
|
59
|
-
LOGGER.debug('Version update complete!');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function generateChangeLog(): void {
|
|
63
|
-
// do nothing for now
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function build(): void {
|
|
67
|
-
LOGGER.info('Build M2 & P2');
|
|
68
|
-
LOGGER.debug('M2');
|
|
69
|
-
fatalExec('mvn clean install -Pm2', 'M2 build failed', getShellConfig({ silent: false }));
|
|
70
|
-
LOGGER.newLine();
|
|
71
|
-
LOGGER.debug('P2');
|
|
72
|
-
fatalExec('mvn clean install -Pp2', 'P2 build failed', getShellConfig({ silent: false }));
|
|
73
|
-
}
|
|
@@ -1,61 +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 sh from 'shelljs';
|
|
18
|
-
import { LOGGER } from '../../util/logger';
|
|
19
|
-
import {
|
|
20
|
-
checkoutAndCd,
|
|
21
|
-
commitAndTag,
|
|
22
|
-
lernaSetVersion,
|
|
23
|
-
publish,
|
|
24
|
-
ReleaseOptions,
|
|
25
|
-
updateLernaForDryRun,
|
|
26
|
-
updateVersion,
|
|
27
|
-
yarnInstall
|
|
28
|
-
} from './common.js';
|
|
29
|
-
|
|
30
|
-
let REPO_ROOT: string;
|
|
31
|
-
|
|
32
|
-
export async function releaseServerNode(options: ReleaseOptions): Promise<void> {
|
|
33
|
-
LOGGER.info('Prepare glsp-server-node release');
|
|
34
|
-
LOGGER.debug('Release options: ', options);
|
|
35
|
-
REPO_ROOT = checkoutAndCd(options);
|
|
36
|
-
updateExternalGLSPDependencies(options.version);
|
|
37
|
-
generateChangeLog();
|
|
38
|
-
lernaSetVersion(REPO_ROOT, options.version);
|
|
39
|
-
build();
|
|
40
|
-
if (options.npmDryRun) {
|
|
41
|
-
updateLernaForDryRun();
|
|
42
|
-
}
|
|
43
|
-
commitAndTag(options.version, REPO_ROOT);
|
|
44
|
-
publish(REPO_ROOT, options);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function updateExternalGLSPDependencies(version: string): void {
|
|
48
|
-
LOGGER.info('Update external GLSP dependencies (Protocol)');
|
|
49
|
-
sh.cd(REPO_ROOT);
|
|
50
|
-
updateVersion({ name: '@eclipse-glsp/protocol', version });
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function build(): void {
|
|
54
|
-
LOGGER.info('Install & Build with yarn');
|
|
55
|
-
yarnInstall(REPO_ROOT);
|
|
56
|
-
LOGGER.debug('Build successful');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function generateChangeLog(): void {
|
|
60
|
-
// do nothing for now
|
|
61
|
-
}
|
|
@@ -1,65 +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 sh from 'shelljs';
|
|
18
|
-
import { LOGGER } from '../../util/logger';
|
|
19
|
-
import {
|
|
20
|
-
checkoutAndCd,
|
|
21
|
-
commitAndTag,
|
|
22
|
-
lernaSetVersion,
|
|
23
|
-
publish,
|
|
24
|
-
ReleaseOptions,
|
|
25
|
-
updateLernaForDryRun,
|
|
26
|
-
updateVersion,
|
|
27
|
-
yarnInstall
|
|
28
|
-
} from './common.js';
|
|
29
|
-
|
|
30
|
-
let REPO_ROOT: string;
|
|
31
|
-
|
|
32
|
-
export async function releaseTheiaIntegration(options: ReleaseOptions): Promise<void> {
|
|
33
|
-
LOGGER.info('Prepare glsp-theia-integration release');
|
|
34
|
-
LOGGER.debug('Release options: ', options);
|
|
35
|
-
REPO_ROOT = checkoutAndCd(options);
|
|
36
|
-
updateExternalGLSPDependencies(options.version);
|
|
37
|
-
generateChangeLog();
|
|
38
|
-
lernaSetVersion(REPO_ROOT, options.version);
|
|
39
|
-
build();
|
|
40
|
-
if (options.npmDryRun) {
|
|
41
|
-
updateLernaForDryRun();
|
|
42
|
-
}
|
|
43
|
-
commitAndTag(options.version, REPO_ROOT);
|
|
44
|
-
publish(REPO_ROOT, options);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function updateExternalGLSPDependencies(version: string): void {
|
|
48
|
-
LOGGER.info('Update external GLSP dependencies (Client and workflow example & server)');
|
|
49
|
-
sh.cd(REPO_ROOT);
|
|
50
|
-
updateVersion(
|
|
51
|
-
{ name: '@eclipse-glsp/client', version },
|
|
52
|
-
{ name: '@eclipse-glsp-examples/workflow-glsp', version },
|
|
53
|
-
{ name: '@eclipse-glsp-examples/workflow-server', version }
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function build(): void {
|
|
58
|
-
LOGGER.info('Install & Build with yarn');
|
|
59
|
-
yarnInstall(REPO_ROOT);
|
|
60
|
-
LOGGER.debug('Build successful');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function generateChangeLog(): void {
|
|
64
|
-
// do nothing for now
|
|
65
|
-
}
|
|
@@ -1,67 +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 sh from 'shelljs';
|
|
18
|
-
import { LOGGER } from '../../util/logger';
|
|
19
|
-
import {
|
|
20
|
-
checkoutAndCd,
|
|
21
|
-
commitAndTag,
|
|
22
|
-
lernaSetVersion,
|
|
23
|
-
publish,
|
|
24
|
-
ReleaseOptions,
|
|
25
|
-
updateLernaForDryRun,
|
|
26
|
-
updateVersion,
|
|
27
|
-
yarnInstall
|
|
28
|
-
} from './common.js';
|
|
29
|
-
|
|
30
|
-
let REPO_ROOT: string;
|
|
31
|
-
|
|
32
|
-
export async function releaseVscodeIntegration(options: ReleaseOptions): Promise<void> {
|
|
33
|
-
LOGGER.info('Prepare glsp-vscode-integration release');
|
|
34
|
-
LOGGER.debug('Release options: ', options);
|
|
35
|
-
REPO_ROOT = checkoutAndCd(options);
|
|
36
|
-
updateExternalGLSPDependencies(options.version);
|
|
37
|
-
generateChangeLog();
|
|
38
|
-
lernaSetVersion(REPO_ROOT, options.version);
|
|
39
|
-
build();
|
|
40
|
-
if (options.npmDryRun) {
|
|
41
|
-
updateLernaForDryRun();
|
|
42
|
-
}
|
|
43
|
-
commitAndTag(options.version, REPO_ROOT);
|
|
44
|
-
publish(REPO_ROOT, options);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function updateExternalGLSPDependencies(version: string): void {
|
|
48
|
-
LOGGER.info('Update external GLSP dependencies (Protocol)');
|
|
49
|
-
sh.cd(REPO_ROOT);
|
|
50
|
-
updateVersion(
|
|
51
|
-
{ name: '@eclipse-glsp/protocol', version },
|
|
52
|
-
{ name: '@eclipse-glsp/client', version },
|
|
53
|
-
{ name: '@eclipse-glsp-examples/workflow-glsp', version },
|
|
54
|
-
{ name: '@eclipse-glsp-examples/workflow-server', version },
|
|
55
|
-
{ name: '@eclipse-glsp-examples/workflow-server-bundled', version }
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function build(): void {
|
|
60
|
-
LOGGER.info('Install & Build with yarn');
|
|
61
|
-
yarnInstall(REPO_ROOT);
|
|
62
|
-
LOGGER.debug('Build successful');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function generateChangeLog(): void {
|
|
66
|
-
// do nothing for now
|
|
67
|
-
}
|
|
@@ -1,215 +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 { ChildProcess } from 'child_process';
|
|
17
|
-
import { Argument } from 'commander';
|
|
18
|
-
import { exit } from 'process';
|
|
19
|
-
import { createInterface } from 'readline';
|
|
20
|
-
import * as readline from 'readline-sync';
|
|
21
|
-
import * as semver from 'semver';
|
|
22
|
-
import sh from 'shelljs';
|
|
23
|
-
import { baseCommand, configureShell, fatalExec, getShellConfig } from '../../util/command-util';
|
|
24
|
-
import { LOGGER, configureLogger } from '../../util/logger';
|
|
25
|
-
import { validateDirectory, validateVersion } from '../../util/validation-util';
|
|
26
|
-
import {
|
|
27
|
-
Component,
|
|
28
|
-
ReleaseOptions,
|
|
29
|
-
ReleaseType,
|
|
30
|
-
VERDACCIO_REGISTRY,
|
|
31
|
-
asMvnVersion,
|
|
32
|
-
checkIfMavenVersionExists,
|
|
33
|
-
checkIfNpmVersionIsNew
|
|
34
|
-
} from './common.js';
|
|
35
|
-
import { releaseClient } from './release-client';
|
|
36
|
-
import { releaseEclipseIntegration } from './release-eclipse-integration';
|
|
37
|
-
import { releaseJavaServer } from './release-java-server';
|
|
38
|
-
import { releaseServerNode } from './release-server-node';
|
|
39
|
-
import { releaseTheiaIntegration } from './release-theia-integration';
|
|
40
|
-
import { releaseVscodeIntegration } from './release-vscode-integration';
|
|
41
|
-
|
|
42
|
-
interface ReleaseCmdOptions {
|
|
43
|
-
checkoutDir: string;
|
|
44
|
-
branch: string;
|
|
45
|
-
force: boolean;
|
|
46
|
-
publish: boolean;
|
|
47
|
-
npmDryRun: boolean;
|
|
48
|
-
draft: boolean;
|
|
49
|
-
verbose: boolean;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const ReleaseCommand = baseCommand()
|
|
53
|
-
.name('release')
|
|
54
|
-
.description('Prepare & publish a new release for a glsp component')
|
|
55
|
-
.addArgument(new Argument('<component>', 'The glsp component to be released').choices(Component.CLI_CHOICES).argParser(Component.parse))
|
|
56
|
-
.addArgument(new Argument('<releaseType>', 'The release type').choices(ReleaseType.CLI_CHOICES))
|
|
57
|
-
.argument('[customVersion]', 'Custom version number. Will be ignored if the release type is not "custom"', validateVersion)
|
|
58
|
-
.option('-f, --force', 'Enable force mode', false)
|
|
59
|
-
.option('-d, --checkoutDir <checkoutDir>', 'The git checkout directory', validateDirectory, process.cwd())
|
|
60
|
-
.option('-b, --branch <branch>', 'The git branch to checkout', 'master')
|
|
61
|
-
.option('-v, --verbose', 'Enable verbose (debug) log output', false)
|
|
62
|
-
.option('--no-publish', 'Only prepare release but do not publish to github', true)
|
|
63
|
-
.option('--draft', 'Publish github releases as drafts', false)
|
|
64
|
-
.option(
|
|
65
|
-
'--npm-dryRun',
|
|
66
|
-
'Execute a npm dry-run for inspection. Publishes to the local npm registry and does not publish to github',
|
|
67
|
-
false
|
|
68
|
-
)
|
|
69
|
-
.action(release);
|
|
70
|
-
|
|
71
|
-
let verdaccioChildProcess: ChildProcess | undefined = undefined;
|
|
72
|
-
|
|
73
|
-
export async function release(
|
|
74
|
-
component: Component,
|
|
75
|
-
releaseType: ReleaseType,
|
|
76
|
-
customVersion: string | undefined,
|
|
77
|
-
cliOptions: ReleaseCmdOptions
|
|
78
|
-
): Promise<void> {
|
|
79
|
-
try {
|
|
80
|
-
configureLogger(cliOptions.verbose);
|
|
81
|
-
LOGGER.debug('Cli options:', cliOptions);
|
|
82
|
-
configureShell({ silent: !cliOptions.verbose });
|
|
83
|
-
checkGHCli();
|
|
84
|
-
const version = deriveVersion(releaseType, customVersion);
|
|
85
|
-
const options: ReleaseOptions = { ...cliOptions, component, releaseType, version };
|
|
86
|
-
if (cliOptions.npmDryRun && options.component.releaseRepo === 'npm') {
|
|
87
|
-
await launchVerdaccio().catch(error => LOGGER.error('Error occurred during verdaccio launch', error));
|
|
88
|
-
}
|
|
89
|
-
switch (component.type) {
|
|
90
|
-
case 'server-java':
|
|
91
|
-
checkIfMavenVersionExists('org.eclipse.glsp', 'org.eclipse.glsp.server', asMvnVersion(version));
|
|
92
|
-
return releaseJavaServer(options);
|
|
93
|
-
case 'server-node':
|
|
94
|
-
await checkIfNpmVersionIsNew('@eclipse-glsp/server-node', version);
|
|
95
|
-
return releaseServerNode(options);
|
|
96
|
-
case 'client':
|
|
97
|
-
await checkIfNpmVersionIsNew('@eclipse-glsp/client', version);
|
|
98
|
-
return releaseClient(options);
|
|
99
|
-
case 'theia-integration':
|
|
100
|
-
await checkIfNpmVersionIsNew('@eclipse-glsp/theia-integration', version);
|
|
101
|
-
return releaseTheiaIntegration(options);
|
|
102
|
-
case 'vscode-integration':
|
|
103
|
-
await checkIfNpmVersionIsNew('@eclipse-glsp/vscode-integration', version);
|
|
104
|
-
return releaseVscodeIntegration(options);
|
|
105
|
-
case 'eclipse-integration':
|
|
106
|
-
await checkIfNpmVersionIsNew('@eclipse-glsp/ide', version);
|
|
107
|
-
return releaseEclipseIntegration(options);
|
|
108
|
-
}
|
|
109
|
-
} catch (err) {
|
|
110
|
-
console.error('An error occurred during command execution:', err);
|
|
111
|
-
exit(1);
|
|
112
|
-
} finally {
|
|
113
|
-
if (verdaccioChildProcess) {
|
|
114
|
-
verdaccioChildProcess.kill();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function checkGHCli(): void {
|
|
120
|
-
LOGGER.debug('Verify that Github CLI is configured correctly');
|
|
121
|
-
if (!isGithubCLIAuthenticated()) {
|
|
122
|
-
throw new Error("Github CLI is not configured properly. No user is logged in for host 'github.com'");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function isGithubCLIAuthenticated(): boolean {
|
|
127
|
-
LOGGER.debug('Verify that Github CLI is installed');
|
|
128
|
-
fatalExec('which gh', 'Github CLI is not installed!');
|
|
129
|
-
|
|
130
|
-
const status = sh.exec('gh auth status', getShellConfig());
|
|
131
|
-
if (status.code !== 0) {
|
|
132
|
-
if (status.stderr.includes('You are not logged into any GitHub hosts')) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
throw new Error(status.stderr);
|
|
136
|
-
}
|
|
137
|
-
if (!status.stdout.trim().includes('Logged in to github.com')) {
|
|
138
|
-
LOGGER.debug("No user is logged in for host 'github.com'");
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
LOGGER.debug('Github CLI is authenticated and ready to use');
|
|
142
|
-
return true;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function launchVerdaccio(): Promise<void> {
|
|
146
|
-
LOGGER.debug('Verify that verdaccio is installed and start if necessary');
|
|
147
|
-
fatalExec('which verdaccio', 'Verdaccio is not installed!');
|
|
148
|
-
// Check if verdaccio is alreaddy running
|
|
149
|
-
const result = sh.exec(`curl -i ${VERDACCIO_REGISTRY}`, getShellConfig());
|
|
150
|
-
if (result.code !== 0) {
|
|
151
|
-
LOGGER.info('Starting local verdaccio registry');
|
|
152
|
-
verdaccioChildProcess = sh.exec('verdaccio', { async: true, silent: true });
|
|
153
|
-
return new Promise(resolve => {
|
|
154
|
-
createInterface(verdaccioChildProcess!.stdout!).on('line', line => {
|
|
155
|
-
if (line.includes(`http address - ${VERDACCIO_REGISTRY}`)) {
|
|
156
|
-
resolve();
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
return Promise.resolve();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function deriveVersion(releaseType: ReleaseType, customVersion?: string): string {
|
|
165
|
-
LOGGER.debug(`Derive version from release type: ${release}`);
|
|
166
|
-
switch (releaseType) {
|
|
167
|
-
case 'custom':
|
|
168
|
-
return getCustomVersion(customVersion);
|
|
169
|
-
case 'rc':
|
|
170
|
-
return getRCVersion();
|
|
171
|
-
case 'patch':
|
|
172
|
-
case 'major':
|
|
173
|
-
case 'minor':
|
|
174
|
-
return semverInc(releaseType);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const REFERENCE_NPM_PACKAGE = '@eclipse-glsp/ide';
|
|
179
|
-
|
|
180
|
-
function getRCVersion(): string {
|
|
181
|
-
LOGGER.debug('Retrieve and new RC version');
|
|
182
|
-
const newBaseVersion = semverInc('minor');
|
|
183
|
-
const currentRcVersion = sh.exec(`npm view ${REFERENCE_NPM_PACKAGE} dist-tags.rc`, getShellConfig()).stdout.trim();
|
|
184
|
-
const currentRcBaseVersion = currentRcVersion.split('-')[0];
|
|
185
|
-
if (currentRcBaseVersion !== newBaseVersion) {
|
|
186
|
-
return `${newBaseVersion}-RC01`;
|
|
187
|
-
}
|
|
188
|
-
let rcNumber = Number.parseInt(currentRcVersion.replace(`${currentRcBaseVersion}-RC`, ''), 10);
|
|
189
|
-
rcNumber++;
|
|
190
|
-
|
|
191
|
-
return `${newBaseVersion}-RC` + `${rcNumber}`.padStart(2, '0');
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function getCustomVersion(customVersion?: string): string {
|
|
195
|
-
LOGGER.debug('Retrieve and validate custom version');
|
|
196
|
-
LOGGER.debug(customVersion ? `Custom version has been passed as argument: ${customVersion}` : 'Prompt custom version from user');
|
|
197
|
-
const version = customVersion ?? readline.question('> Please enter the new version');
|
|
198
|
-
return validateVersion(version);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function getCurrentVersion(): string {
|
|
202
|
-
LOGGER.debug('Retrieve base version by querying the latest tag of the reference npm package');
|
|
203
|
-
const version = sh.exec(`npm view ${REFERENCE_NPM_PACKAGE} dist-tags.latest`, getShellConfig()).stdout.trim();
|
|
204
|
-
return validateVersion(version);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function semverInc(releaseType: semver.ReleaseType, identifier?: string): string {
|
|
208
|
-
const currentVersion = getCurrentVersion();
|
|
209
|
-
LOGGER.debug(`Execute: semver.inc("${currentVersion}", ${releaseType}, ${identifier})`);
|
|
210
|
-
const newVersion = semver.inc(currentVersion, releaseType, identifier);
|
|
211
|
-
if (!newVersion) {
|
|
212
|
-
throw new Error(`Could not increment version: ${currentVersion} `);
|
|
213
|
-
}
|
|
214
|
-
return newVersion;
|
|
215
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 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 * as fs from 'fs';
|
|
18
|
-
import { glob } from 'glob';
|
|
19
|
-
import * as jq from 'node-jq';
|
|
20
|
-
import * as path from 'path';
|
|
21
|
-
import sh from 'shelljs';
|
|
22
|
-
import { baseCommand, configureShell } from '../util/command-util';
|
|
23
|
-
import { getUncommittedChanges } from '../util/git-util';
|
|
24
|
-
import { LOGGER, configureLogger } from '../util/logger';
|
|
25
|
-
import { validateGitDirectory } from '../util/validation-util';
|
|
26
|
-
|
|
27
|
-
export const UpdateNextCommand = baseCommand()
|
|
28
|
-
.name('updateNext')
|
|
29
|
-
.alias('u')
|
|
30
|
-
.description('Updates all `next` dependencies in GLSP project to the latest version')
|
|
31
|
-
.argument('[rootDir]', 'The repository root', validateGitDirectory, process.cwd())
|
|
32
|
-
.option('-v, --verbose', 'Enable verbose (debug) log output', false)
|
|
33
|
-
.action(updateNext);
|
|
34
|
-
|
|
35
|
-
export async function updateNext(rootDir: string, options: { verbose: boolean }): Promise<void> {
|
|
36
|
-
configureLogger(options.verbose);
|
|
37
|
-
configureShell({ silent: true, fatal: true });
|
|
38
|
-
|
|
39
|
-
const rootPackage = path.join(rootDir, 'package.json');
|
|
40
|
-
if (getUncommittedChanges(rootDir).includes(rootPackage)) {
|
|
41
|
-
LOGGER.warn('Uncommitted changes in root `package.json`. Please commit or stash them before running this command.');
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
configureShell({ silent: false, fatal: true });
|
|
46
|
-
|
|
47
|
-
LOGGER.info('Updating next dependencies ...');
|
|
48
|
-
rootDir = path.resolve(rootDir);
|
|
49
|
-
const packages = await getWorkspacePackages(rootDir);
|
|
50
|
-
LOGGER.debug(`Scanning ${packages.length} packages to derive resolutions`, packages);
|
|
51
|
-
const resolutions = await getResolutions(packages);
|
|
52
|
-
if (Object.keys(resolutions).length === 0) {
|
|
53
|
-
LOGGER.info('No next dependencies found');
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
LOGGER.info('Upgrade and rebuild packages ...');
|
|
57
|
-
const packageJson = fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8');
|
|
58
|
-
LOGGER.debug('Updating package.json with resolutions', resolutions);
|
|
59
|
-
fs.writeFileSync(path.join(rootDir, 'package.json'), JSON.stringify({ ...JSON.parse(packageJson), resolutions }, undefined, 2));
|
|
60
|
-
LOGGER.debug('Running yarn install');
|
|
61
|
-
sh.exec('yarn install --ignore-scripts');
|
|
62
|
-
LOGGER.debug('Reverting package.json');
|
|
63
|
-
sh.exec('git checkout HEAD -- package.json');
|
|
64
|
-
LOGGER.debug('Rebuild to update yarn.lock');
|
|
65
|
-
sh.exec('yarn');
|
|
66
|
-
LOGGER.info('Upgrade successfully completed');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function getWorkspacePackages(rootDir: string): Promise<string[]> {
|
|
70
|
-
const rootPackage = path.join(rootDir, 'package.json');
|
|
71
|
-
const packages = [rootPackage];
|
|
72
|
-
if (!fs.existsSync(rootPackage)) {
|
|
73
|
-
LOGGER.error('No package.json found in root directory');
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
const workspaces = await getWorkspaceConfig(rootPackage);
|
|
77
|
-
if (workspaces) {
|
|
78
|
-
workspaces
|
|
79
|
-
.map(workspace => `${workspace}/**/package.json`)
|
|
80
|
-
.forEach(pattern => {
|
|
81
|
-
glob.sync(pattern, {
|
|
82
|
-
cwd: rootDir,
|
|
83
|
-
ignore: ['**/node_modules/**']
|
|
84
|
-
}).forEach(packageJson => packages.push(path.join(rootDir, packageJson)));
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return [...new Set(packages)];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async function getResolutions(packages: string[]): Promise<Record<string, string>> {
|
|
92
|
-
let dependencies: string[] = [];
|
|
93
|
-
for (const pkg of packages) {
|
|
94
|
-
const deps = await jq.run(
|
|
95
|
-
'.dependencies //{} + .devDependencies + .peerDependencies | with_entries(select(.value == "next")) | keys',
|
|
96
|
-
pkg,
|
|
97
|
-
{
|
|
98
|
-
output: 'json'
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
if (Array.isArray(deps)) {
|
|
102
|
-
dependencies.push(...deps);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
dependencies = [...new Set(dependencies)];
|
|
106
|
-
LOGGER.debug(`Found ${dependencies.length} 'next' dependencies`, dependencies);
|
|
107
|
-
LOGGER.info('Retrieve next versions ... ');
|
|
108
|
-
const resolutions: Record<string, string> = {};
|
|
109
|
-
[...new Set(dependencies)].forEach(dep => {
|
|
110
|
-
LOGGER.info(`Retrieving next version for ${dep}`);
|
|
111
|
-
const version = sh.exec(`npm view ${dep}@next version`, { silent: true }).stdout.trim();
|
|
112
|
-
resolutions[`**/${dep}`] = version;
|
|
113
|
-
});
|
|
114
|
-
return resolutions;
|
|
115
|
-
}
|
|
116
|
-
async function getWorkspaceConfig(rootPackage: string): Promise<string[] | undefined> {
|
|
117
|
-
const result = await jq.run('.workspaces', rootPackage, { output: 'json' });
|
|
118
|
-
if (!result) {
|
|
119
|
-
return undefined;
|
|
120
|
-
}
|
|
121
|
-
if (Array.isArray(result)) {
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
if (typeof result === 'object' && 'packages' in result && Array.isArray(result.packages)) {
|
|
125
|
-
return result.packages;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return undefined;
|
|
129
|
-
}
|
package/src/util/command-util.ts
DELETED
|
@@ -1,54 +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 { Command } from 'commander';
|
|
17
|
-
import sh from 'shelljs';
|
|
18
|
-
|
|
19
|
-
// Commander.js utils
|
|
20
|
-
export function baseCommand(cmd = new Command()): Command {
|
|
21
|
-
return cmd //
|
|
22
|
-
.showSuggestionAfterError(true)
|
|
23
|
-
.showHelpAfterError(true)
|
|
24
|
-
.allowUnknownOption(false);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type ShellConfig = sh.ExecOptions & { async: false };
|
|
28
|
-
export const SH_CONFIG: ShellConfig = {
|
|
29
|
-
async: false,
|
|
30
|
-
fatal: true,
|
|
31
|
-
silent: false
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export function getShellConfig(options: Partial<Omit<ShellConfig, 'async'>> = {}): ShellConfig {
|
|
35
|
-
return {
|
|
36
|
-
...SH_CONFIG,
|
|
37
|
-
...options
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function configureShell(config: Partial<sh.ShellConfig>): void {
|
|
42
|
-
sh.config.reset();
|
|
43
|
-
getShellConfig({});
|
|
44
|
-
SH_CONFIG.silent = config.silent;
|
|
45
|
-
SH_CONFIG.fatal = config.fatal;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function fatalExec(command: string, fatalErrorMessage: string, options: Partial<Omit<ShellConfig, 'async'>> = {}): sh.ShellString {
|
|
49
|
-
const result = sh.exec(command, getShellConfig(options));
|
|
50
|
-
if (result.code !== 0) {
|
|
51
|
-
throw new Error(fatalErrorMessage);
|
|
52
|
-
}
|
|
53
|
-
return result;
|
|
54
|
-
}
|