@eclipse-glsp/cli 1.1.0-next.4c65907.114

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.
Files changed (69) hide show
  1. package/LICENSE +642 -0
  2. package/README.md +45 -0
  3. package/bin/glsp +2 -0
  4. package/lib/app.d.ts +19 -0
  5. package/lib/app.d.ts.map +1 -0
  6. package/lib/app.js +46 -0
  7. package/lib/app.js.map +1 -0
  8. package/lib/release/common.d.ts +69 -0
  9. package/lib/release/common.d.ts.map +1 -0
  10. package/lib/release/common.js +273 -0
  11. package/lib/release/common.js.map +1 -0
  12. package/lib/release/release-client.d.ts +3 -0
  13. package/lib/release/release-client.d.ts.map +1 -0
  14. package/lib/release/release-client.js +53 -0
  15. package/lib/release/release-client.js.map +1 -0
  16. package/lib/release/release-eclipse-integration.d.ts +18 -0
  17. package/lib/release/release-eclipse-integration.d.ts.map +1 -0
  18. package/lib/release/release-eclipse-integration.js +90 -0
  19. package/lib/release/release-eclipse-integration.js.map +1 -0
  20. package/lib/release/release-java-server.d.ts +3 -0
  21. package/lib/release/release-java-server.d.ts.map +1 -0
  22. package/lib/release/release-java-server.js +67 -0
  23. package/lib/release/release-java-server.js.map +1 -0
  24. package/lib/release/release-server-node.d.ts +18 -0
  25. package/lib/release/release-server-node.d.ts.map +1 -0
  26. package/lib/release/release-server-node.js +51 -0
  27. package/lib/release/release-server-node.js.map +1 -0
  28. package/lib/release/release-theia-integration.d.ts +18 -0
  29. package/lib/release/release-theia-integration.d.ts.map +1 -0
  30. package/lib/release/release-theia-integration.js +62 -0
  31. package/lib/release/release-theia-integration.js.map +1 -0
  32. package/lib/release/release-vscode-integration.d.ts +18 -0
  33. package/lib/release/release-vscode-integration.d.ts.map +1 -0
  34. package/lib/release/release-vscode-integration.js +51 -0
  35. package/lib/release/release-vscode-integration.js.map +1 -0
  36. package/lib/release/release.d.ts +13 -0
  37. package/lib/release/release.d.ts.map +1 -0
  38. package/lib/release/release.js +133 -0
  39. package/lib/release/release.js.map +1 -0
  40. package/lib/util/command-util.d.ts +31 -0
  41. package/lib/util/command-util.d.ts.map +1 -0
  42. package/lib/util/command-util.js +38 -0
  43. package/lib/util/command-util.js.map +1 -0
  44. package/lib/util/git-util.d.ts +23 -0
  45. package/lib/util/git-util.d.ts.map +1 -0
  46. package/lib/util/git-util.js +87 -0
  47. package/lib/util/git-util.js.map +1 -0
  48. package/lib/util/logger.d.ts +9 -0
  49. package/lib/util/logger.d.ts.map +1 -0
  50. package/lib/util/logger.js +34 -0
  51. package/lib/util/logger.js.map +1 -0
  52. package/lib/util/validation-util.d.ts +5 -0
  53. package/lib/util/validation-util.d.ts.map +1 -0
  54. package/lib/util/validation-util.js +53 -0
  55. package/lib/util/validation-util.js.map +1 -0
  56. package/package.json +65 -0
  57. package/src/app.ts +49 -0
  58. package/src/release/common.ts +312 -0
  59. package/src/release/release-client.ts +64 -0
  60. package/src/release/release-eclipse-integration.ts +113 -0
  61. package/src/release/release-java-server.ts +72 -0
  62. package/src/release/release-server-node.ts +61 -0
  63. package/src/release/release-theia-integration.ts +77 -0
  64. package/src/release/release-vscode-integration.ts +65 -0
  65. package/src/release/release.ts +174 -0
  66. package/src/util/command-util.ts +63 -0
  67. package/src/util/git-util.ts +87 -0
  68. package/src/util/logger.ts +38 -0
  69. package/src/util/validation-util.ts +50 -0
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fatalExec = exports.initialConfiguration = exports.getShellConfig = exports.SH_CONFIG = exports.baseConfiguration = exports.COMMAND_VERSION = void 0;
4
+ const sh = require("shelljs");
5
+ const logger_1 = require("./logger");
6
+ exports.COMMAND_VERSION = '1.1.0-next';
7
+ function baseConfiguration(cmd) {
8
+ return cmd
9
+ .version(exports.COMMAND_VERSION) //
10
+ .showSuggestionAfterError(true)
11
+ .showHelpAfterError(true)
12
+ .allowUnknownOption(false);
13
+ }
14
+ exports.baseConfiguration = baseConfiguration;
15
+ exports.SH_CONFIG = {
16
+ async: false,
17
+ fatal: true,
18
+ silent: false
19
+ };
20
+ function getShellConfig(options = {}) {
21
+ return Object.assign(Object.assign({}, exports.SH_CONFIG), options);
22
+ }
23
+ exports.getShellConfig = getShellConfig;
24
+ function initialConfiguration(verbose) {
25
+ sh.config.reset();
26
+ exports.SH_CONFIG.silent = !verbose;
27
+ (0, logger_1.configureLogger)(verbose);
28
+ }
29
+ exports.initialConfiguration = initialConfiguration;
30
+ function fatalExec(command, fatalErrorMessage, options = {}) {
31
+ const result = sh.exec(command, getShellConfig(options));
32
+ if (result.code !== 0) {
33
+ throw new Error(fatalErrorMessage);
34
+ }
35
+ return result;
36
+ }
37
+ exports.fatalExec = fatalExec;
38
+ //# sourceMappingURL=command-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-util.js","sourceRoot":"","sources":["../../src/util/command-util.ts"],"names":[],"mappings":";;;AAgBA,8BAA8B;AAC9B,qCAA2C;AAC9B,QAAA,eAAe,GAAG,YAAY,CAAC;AAE5C,SAAgB,iBAAiB,CAAC,GAAY;IAC1C,OAAO,GAAG;SACL,OAAO,CAAC,uBAAe,CAAC,CAAC,EAAE;SAC3B,wBAAwB,CAAC,IAAI,CAAC;SAC9B,kBAAkB,CAAC,IAAI,CAAC;SACxB,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAND,8CAMC;AAMY,QAAA,SAAS,GAAsC;IACxD,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,KAAK;CAChB,CAAC;AAEF,SAAgB,cAAc,CAAC,UAAkD,EAAE;IAC/E,uCACO,iBAAS,GACT,OAAO,EACZ;AACN,CAAC;AALD,wCAKC;AAED,SAAgB,oBAAoB,CAAC,OAAgB;IACjD,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAElB,iBAAS,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC;IAC5B,IAAA,wBAAe,EAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AALD,oDAKC;AAED,SAAgB,SAAS,CACrB,OAAe,EACf,iBAAyB,EACzB,UAAkD,EAAE;IAEpD,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;KACtC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAVD,8BAUC"}
@@ -0,0 +1,23 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2022 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
+ export declare function isGithubCLIAuthenticated(): boolean;
17
+ export declare function isGitRepository(path: string): boolean;
18
+ export declare function hasGitChanges(path?: string): boolean;
19
+ export declare function getLatestRelease(path?: string): string;
20
+ export declare function getLatestTag(path?: string): string;
21
+ export declare function hasBranch(branch: string, path?: string): boolean;
22
+ export declare function getRemoteUrl(path?: string): string;
23
+ //# sourceMappingURL=git-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-util.d.ts","sourceRoot":"","sources":["../../src/util/git-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAOlF,wBAAgB,wBAAwB,IAAI,OAAO,CAiBlD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIrD;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAIpD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAIhE;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAIlD"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2022 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getRemoteUrl = exports.hasBranch = exports.getLatestTag = exports.getLatestRelease = exports.hasGitChanges = exports.isGitRepository = exports.isGithubCLIAuthenticated = void 0;
19
+ const sh = require("shelljs");
20
+ const command_util_1 = require("./command-util");
21
+ const logger_1 = require("./logger");
22
+ const validation_util_1 = require("./validation-util");
23
+ function isGithubCLIAuthenticated() {
24
+ logger_1.LOGGER.debug('Verify that Github CLI is installed');
25
+ (0, command_util_1.fatalExec)('which gh', 'Github CLI is not installed!');
26
+ const status = sh.exec('gh auth status', (0, command_util_1.getShellConfig)());
27
+ if (status.code !== 0) {
28
+ if (status.stderr.includes('You are not logged into any GitHub hosts')) {
29
+ return false;
30
+ }
31
+ throw new Error(status.stderr);
32
+ }
33
+ if (!status.stderr.trim().includes('Logged in to github.com')) {
34
+ logger_1.LOGGER.debug("No user is logged in for host 'github.com'");
35
+ return false;
36
+ }
37
+ logger_1.LOGGER.debug('Github CLI is authenticated and ready to use');
38
+ return true;
39
+ }
40
+ exports.isGithubCLIAuthenticated = isGithubCLIAuthenticated;
41
+ function isGitRepository(path) {
42
+ logger_1.LOGGER.debug(`Check if the given directory is a git repo: ${path}`);
43
+ sh.cd(path);
44
+ return sh.exec('git rev-parse --is-inside-work-tree', (0, command_util_1.getShellConfig)()).stdout.trim().toLocaleLowerCase() === 'true';
45
+ }
46
+ exports.isGitRepository = isGitRepository;
47
+ function hasGitChanges(path) {
48
+ logger_1.LOGGER.debug(`Check if the directory has git changes: ${asDebugArg(path)}`);
49
+ cdIfPresent(path);
50
+ return sh.exec('git status --porcelain').stdout.trim().length !== 0;
51
+ }
52
+ exports.hasGitChanges = hasGitChanges;
53
+ function getLatestRelease(path) {
54
+ logger_1.LOGGER.debug(`Retrieve latest release from repo: ${asDebugArg(path)}`);
55
+ cdIfPresent(path);
56
+ const release = sh.exec('gh release list --exclude-drafts -L 1', (0, command_util_1.getShellConfig)()).stdout.trim().split('\t');
57
+ return release[release.length - 2];
58
+ }
59
+ exports.getLatestRelease = getLatestRelease;
60
+ function getLatestTag(path) {
61
+ logger_1.LOGGER.debug(`Retrieve latest tag from local repo : ${asDebugArg(path)}`);
62
+ cdIfPresent(path);
63
+ return sh.exec('git describe --abbrev=0 --tags', (0, command_util_1.getShellConfig)()).stdout.trim();
64
+ }
65
+ exports.getLatestTag = getLatestTag;
66
+ function hasBranch(branch, path) {
67
+ logger_1.LOGGER.debug(`Check if branch exists: ${asDebugArg(path)}`);
68
+ cdIfPresent(path);
69
+ return sh.exec(`git branch --list ${branch}`, (0, command_util_1.getShellConfig)()).stdout.trim().length !== 0;
70
+ }
71
+ exports.hasBranch = hasBranch;
72
+ function getRemoteUrl(path) {
73
+ logger_1.LOGGER.debug(`Retrieve remote git url for: ${asDebugArg(path)}`);
74
+ cdIfPresent(path);
75
+ return sh.exec('git config --get remote.origin.url', (0, command_util_1.getShellConfig)()).stdout.trim();
76
+ }
77
+ exports.getRemoteUrl = getRemoteUrl;
78
+ function cdIfPresent(path) {
79
+ if (path) {
80
+ (0, validation_util_1.validateGitDirectory)(path);
81
+ sh.cd(path);
82
+ }
83
+ }
84
+ function asDebugArg(path) {
85
+ return path !== null && path !== void 0 ? path : sh.pwd().stdout;
86
+ }
87
+ //# sourceMappingURL=git-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-util.js","sourceRoot":"","sources":["../../src/util/git-util.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ export declare const LOGGER: Logger;
2
+ export declare function configureLogger(isVerbose: boolean): void;
3
+ export interface Logger {
4
+ info(message: string, ...args: any[]): void;
5
+ error(message: string, ...args: any[]): void;
6
+ warn(message: string, ...args: any[]): void;
7
+ debug(message: string, ...args: any[]): void;
8
+ }
9
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,MAAM,EAAE,MASpB,CAAC;AAEF,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAExD;AAED,MAAM,WAAW,MAAM;IACnB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC7C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAChD"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureLogger = exports.LOGGER = void 0;
4
+ /********************************************************************************
5
+ * Copyright (c) 2022 EclipseSource and others.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License v. 2.0 which is available at
9
+ * http://www.eclipse.org/legal/epl-2.0.
10
+ *
11
+ * This Source Code may also be made available under the following Secondary
12
+ * Licenses when the conditions for such availability set forth in the Eclipse
13
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
+ * with the GNU Classpath Exception which is available at
15
+ * https://www.gnu.org/software/classpath/license.html.
16
+ *
17
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
+ ********************************************************************************/
19
+ let verbose = false;
20
+ exports.LOGGER = {
21
+ info: (message, ...args) => console.info(`[INFO] ${message}`, ...args),
22
+ error: (message, ...args) => console.error(`[ERROR] ${message}`, ...args),
23
+ warn: (message, ...args) => console.warn(`[WARNING] ${message}`, ...args),
24
+ debug: (message, ...args) => {
25
+ if (verbose) {
26
+ console.log(`[DEBUG] ${message}`, ...args);
27
+ }
28
+ }
29
+ };
30
+ function configureLogger(isVerbose) {
31
+ verbose = isVerbose;
32
+ }
33
+ exports.configureLogger = configureLogger;
34
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,IAAI,OAAO,GAAG,KAAK,CAAC;AAEP,QAAA,MAAM,GAAW;IAC1B,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC;IACtE,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC;IACzE,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC;IACzE,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE;QACxB,IAAI,OAAO,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;SAC9C;IACL,CAAC;CACJ,CAAC;AAEF,SAAgB,eAAe,CAAC,SAAkB;IAC9C,OAAO,GAAG,SAAS,CAAC;AACxB,CAAC;AAFD,0CAEC"}
@@ -0,0 +1,5 @@
1
+ export declare const COMMAND_VERSION = "1.1.0-next";
2
+ export declare function validateDirectory(rootDir: string): string;
3
+ export declare function validateVersion(version: string): string;
4
+ export declare function validateGitDirectory(repository: string): string;
5
+ //# sourceMappingURL=validation-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-util.d.ts","sourceRoot":"","sources":["../../src/util/validation-util.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUzD;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAM/D"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateGitDirectory = exports.validateVersion = exports.validateDirectory = exports.COMMAND_VERSION = void 0;
4
+ /********************************************************************************
5
+ * Copyright (c) 2022 EclipseSource and others.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License v. 2.0 which is available at
9
+ * http://www.eclipse.org/legal/epl-2.0.
10
+ *
11
+ * This Source Code may also be made available under the following Secondary
12
+ * Licenses when the conditions for such availability set forth in the Eclipse
13
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
+ * with the GNU Classpath Exception which is available at
15
+ * https://www.gnu.org/software/classpath/license.html.
16
+ *
17
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
+ ********************************************************************************/
19
+ const commander_1 = require("commander");
20
+ const fs = require("fs");
21
+ const path_1 = require("path");
22
+ const semver = require("semver");
23
+ const git_util_1 = require("./git-util");
24
+ const logger_1 = require("./logger");
25
+ exports.COMMAND_VERSION = '1.1.0-next';
26
+ function validateDirectory(rootDir) {
27
+ const path = (0, path_1.resolve)(rootDir);
28
+ if (!fs.existsSync(path)) {
29
+ throw new commander_1.InvalidArgumentError('Not a valid file path!');
30
+ }
31
+ if (!fs.statSync(path).isDirectory()) {
32
+ throw new commander_1.InvalidArgumentError('Not a directory!');
33
+ }
34
+ return path;
35
+ }
36
+ exports.validateDirectory = validateDirectory;
37
+ function validateVersion(version) {
38
+ logger_1.LOGGER.debug(`Validate version format of: ${version}`);
39
+ if (!semver.valid(version)) {
40
+ throw new Error(`Not a valid version: ${version}`);
41
+ }
42
+ return version;
43
+ }
44
+ exports.validateVersion = validateVersion;
45
+ function validateGitDirectory(repository) {
46
+ const repoPath = validateDirectory(repository);
47
+ if (!(0, git_util_1.isGitRepository)(repoPath)) {
48
+ throw new Error('Not a valid git repository');
49
+ }
50
+ return repoPath;
51
+ }
52
+ exports.validateGitDirectory = validateGitDirectory;
53
+ //# sourceMappingURL=validation-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-util.js","sourceRoot":"","sources":["../../src/util/validation-util.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAiD;AACjD,yBAAyB;AACzB,+BAA+B;AAC/B,iCAAiC;AACjC,yCAA6C;AAC7C,qCAAkC;AACrB,QAAA,eAAe,GAAG,YAAY,CAAC;AAE5C,SAAgB,iBAAiB,CAAC,OAAe;IAC7C,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACtB,MAAM,IAAI,gCAAoB,CAAC,wBAAwB,CAAC,CAAC;KAC5D;IAED,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;QAClC,MAAM,IAAI,gCAAoB,CAAC,kBAAkB,CAAC,CAAC;KACtD;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAVD,8CAUC;AAED,SAAgB,eAAe,CAAC,OAAe;IAC3C,eAAM,CAAC,KAAK,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;KACtD;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAND,0CAMC;AAED,SAAgB,oBAAoB,CAAC,UAAkB;IACnD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,IAAA,0BAAe,EAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KACjD;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAND,oDAMC"}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@eclipse-glsp/cli",
3
+ "version": "1.1.0-next.4c65907.114+4c65907",
4
+ "description": "CLI Tooling & scripts for GLSP components",
5
+ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
6
+ "keywords": [
7
+ "eclipse",
8
+ "tsconfig"
9
+ ],
10
+ "author": {
11
+ "name": "Eclipse GLSP"
12
+ },
13
+ "homepage": "https://www.eclipse.org/glsp/",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/eclipse-glsp/glsp.git"
17
+ },
18
+ "bugs": "https://github.com/eclipse-glsp/glsp/issues",
19
+ "contributors": [
20
+ {
21
+ "name": "Eclipse GLSP Project",
22
+ "email": "glsp-dev@eclipse.org",
23
+ "url": "https://projects.eclipse.org/projects/ecd.glsp"
24
+ }
25
+ ],
26
+ "scripts": {
27
+ "prepare": "yarn clean && yarn build && yarn lint",
28
+ "clean": "rimraf lib tsconfig.tsbuildinfo ",
29
+ "build": "tsc",
30
+ "lint": "eslint --ext .ts,.tsx ./src",
31
+ "lint:fix": "eslint --fix --ext .ts,.tsx ./src",
32
+ "test": "node --enable-source-maps lib/app.js"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "dependencies": {
38
+ "commander": "^9.4.0",
39
+ "node-fetch": "2.6.7",
40
+ "readline-sync": "^1.4.10",
41
+ "semver": "^7.3.7",
42
+ "shelljs": "0.8.5"
43
+ },
44
+ "devDependencies": {
45
+ "@eclipse-glsp/config": "1.1.0-next.4c65907.114+4c65907",
46
+ "@types/node": "14.x",
47
+ "@types/node-fetch": "2.6.2",
48
+ "@types/readline-sync": "1.4.4",
49
+ "@types/semver": "7.3.12",
50
+ "@types/shelljs": "0.8.11",
51
+ "reflect-metadata": "0.1.13",
52
+ "rimraf": "3.0.2",
53
+ "ts-node": "^10.9.1",
54
+ "typescript": "^4.5.0"
55
+ },
56
+ "bin": {
57
+ "glsp": "bin/glsp"
58
+ },
59
+ "files": [
60
+ "src",
61
+ "bin",
62
+ "lib"
63
+ ],
64
+ "gitHead": "4c6590739921232e7f8b1d99a85a940debb13e0b"
65
+ }
package/src/app.ts ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+ /********************************************************************************
3
+ * Copyright (c) 2022 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ import { Argument, Command } from 'commander';
18
+ import * as sh from 'shelljs';
19
+ import { Component, ReleaseType } from './release/common';
20
+ import { release } from './release/release';
21
+ import { baseConfiguration } from './util/command-util';
22
+ import { validateDirectory, validateVersion } from './util/validation-util';
23
+
24
+ export const ReleaseCommand = baseConfiguration(new Command())
25
+ .name('release')
26
+ .description('Prepare & publish a new release for a glsp component')
27
+ .addArgument(new Argument('<component>', 'The glsp component to be released').choices(Component.CLI_CHOICES).argParser(Component.parse))
28
+ .addArgument(new Argument('<releaseType>', 'The release type').choices(ReleaseType.CLI_CHOICES))
29
+ .argument('[customVersion]', 'Custom version number. Will be ignored if the release type is not "custom"', validateVersion)
30
+ .option('-f, --force', 'Enable force mode', false)
31
+ .option('-d, --checkoutDir <checkoutDir>', 'The git checkout directory', validateDirectory, sh.pwd().stdout)
32
+ .option('-b, --branch <branch>', 'The git branch to checkout', 'master')
33
+ .option('-v, --verbose', 'Enable verbose (debug) log output', false)
34
+ .option('--no-publish', 'Only prepare release but do not publish to github', true)
35
+ .option('--draft', 'Publish github releases as drafts', false)
36
+ .option(
37
+ '--npm-dryRun',
38
+ 'Execute a npm dry-run for inspection. Publishes to the local npm registry and does not publish to github',
39
+ false
40
+ )
41
+ .action(release);
42
+
43
+ const app = baseConfiguration(new Command())
44
+ .showSuggestionAfterError(true)
45
+ .showHelpAfterError(true)
46
+ .name('glsp')
47
+ .addCommand(ReleaseCommand);
48
+
49
+ app.parse(process.argv);