@eclipse-glsp/cli 1.1.0-next.4846de1.120

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 (79) hide show
  1. package/LICENSE +642 -0
  2. package/README.md +89 -0
  3. package/bin/glsp +2 -0
  4. package/lib/app.d.ts +3 -0
  5. package/lib/app.d.ts.map +1 -0
  6. package/lib/app.js +32 -0
  7. package/lib/app.js.map +1 -0
  8. package/lib/commands/check-header.d.ts +24 -0
  9. package/lib/commands/check-header.d.ts.map +1 -0
  10. package/lib/commands/check-header.js +234 -0
  11. package/lib/commands/check-header.js.map +1 -0
  12. package/lib/commands/coverage-report.d.ts +29 -0
  13. package/lib/commands/coverage-report.d.ts.map +1 -0
  14. package/lib/commands/coverage-report.js +100 -0
  15. package/lib/commands/coverage-report.js.map +1 -0
  16. package/lib/commands/release/common.d.ts +69 -0
  17. package/lib/commands/release/common.d.ts.map +1 -0
  18. package/lib/commands/release/common.js +273 -0
  19. package/lib/commands/release/common.js.map +1 -0
  20. package/lib/commands/release/release-client.d.ts +3 -0
  21. package/lib/commands/release/release-client.d.ts.map +1 -0
  22. package/lib/commands/release/release-client.js +53 -0
  23. package/lib/commands/release/release-client.js.map +1 -0
  24. package/lib/commands/release/release-eclipse-integration.d.ts +18 -0
  25. package/lib/commands/release/release-eclipse-integration.d.ts.map +1 -0
  26. package/lib/commands/release/release-eclipse-integration.js +90 -0
  27. package/lib/commands/release/release-eclipse-integration.js.map +1 -0
  28. package/lib/commands/release/release-java-server.d.ts +3 -0
  29. package/lib/commands/release/release-java-server.d.ts.map +1 -0
  30. package/lib/commands/release/release-java-server.js +68 -0
  31. package/lib/commands/release/release-java-server.js.map +1 -0
  32. package/lib/commands/release/release-server-node.d.ts +18 -0
  33. package/lib/commands/release/release-server-node.d.ts.map +1 -0
  34. package/lib/commands/release/release-server-node.js +51 -0
  35. package/lib/commands/release/release-server-node.js.map +1 -0
  36. package/lib/commands/release/release-theia-integration.d.ts +18 -0
  37. package/lib/commands/release/release-theia-integration.d.ts.map +1 -0
  38. package/lib/commands/release/release-theia-integration.js +62 -0
  39. package/lib/commands/release/release-theia-integration.js.map +1 -0
  40. package/lib/commands/release/release-vscode-integration.d.ts +18 -0
  41. package/lib/commands/release/release-vscode-integration.d.ts.map +1 -0
  42. package/lib/commands/release/release-vscode-integration.js +51 -0
  43. package/lib/commands/release/release-vscode-integration.js.map +1 -0
  44. package/lib/commands/release/release.d.ts +14 -0
  45. package/lib/commands/release/release.d.ts.map +1 -0
  46. package/lib/commands/release/release.js +165 -0
  47. package/lib/commands/release/release.js.map +1 -0
  48. package/lib/util/command-util.d.ts +26 -0
  49. package/lib/util/command-util.d.ts.map +1 -0
  50. package/lib/util/command-util.js +53 -0
  51. package/lib/util/command-util.js.map +1 -0
  52. package/lib/util/git-util.d.ts +60 -0
  53. package/lib/util/git-util.d.ts.map +1 -0
  54. package/lib/util/git-util.js +171 -0
  55. package/lib/util/git-util.js.map +1 -0
  56. package/lib/util/logger.d.ts +23 -0
  57. package/lib/util/logger.d.ts.map +1 -0
  58. package/lib/util/logger.js +50 -0
  59. package/lib/util/logger.js.map +1 -0
  60. package/lib/util/validation-util.d.ts +6 -0
  61. package/lib/util/validation-util.d.ts.map +1 -0
  62. package/lib/util/validation-util.js +64 -0
  63. package/lib/util/validation-util.js.map +1 -0
  64. package/package.json +64 -0
  65. package/src/app.ts +30 -0
  66. package/src/commands/check-header.ts +315 -0
  67. package/src/commands/coverage-report.ts +113 -0
  68. package/src/commands/release/common.ts +312 -0
  69. package/src/commands/release/release-client.ts +64 -0
  70. package/src/commands/release/release-eclipse-integration.ts +113 -0
  71. package/src/commands/release/release-java-server.ts +73 -0
  72. package/src/commands/release/release-server-node.ts +61 -0
  73. package/src/commands/release/release-theia-integration.ts +77 -0
  74. package/src/commands/release/release-vscode-integration.ts +65 -0
  75. package/src/commands/release/release.ts +215 -0
  76. package/src/util/command-util.ts +54 -0
  77. package/src/util/git-util.ts +172 -0
  78. package/src/util/logger.ts +57 -0
  79. package/src/util/validation-util.ts +63 -0
@@ -0,0 +1,171 @@
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.getLatestGithubRelease = exports.getFirstCommit = exports.getInitialCommit = exports.getFilesOfCommit = exports.getFirstModificationDate = exports.getLastModificationDate = exports.getChangesOfLastCommit = exports.getUncommittedChanges = exports.hasGitChanges = exports.getGitRoot = exports.isGitRepository = void 0;
19
+ const path_1 = require("path");
20
+ const sh = require("shelljs");
21
+ const command_util_1 = require("./command-util");
22
+ function isGitRepository(path) {
23
+ cdIfPresent(path);
24
+ const isGitRepo = sh
25
+ .exec('git rev-parse --is-inside-work-tree', (0, command_util_1.getShellConfig)({ silent: true }))
26
+ .stdout.trim()
27
+ .toLocaleLowerCase() === 'true';
28
+ return isGitRepo;
29
+ }
30
+ exports.isGitRepository = isGitRepository;
31
+ function getGitRoot(path) {
32
+ cdIfPresent(path);
33
+ const fileString = sh.exec('git rev-parse --show-toplevel', (0, command_util_1.getShellConfig)()).stdout.trim();
34
+ return (0, path_1.resolve)(fileString);
35
+ }
36
+ exports.getGitRoot = getGitRoot;
37
+ function hasGitChanges(path) {
38
+ return getUncommittedChanges(path).length > 0;
39
+ }
40
+ exports.hasGitChanges = hasGitChanges;
41
+ /**
42
+ * Returns the files that have uncommitted changes (staged, not staged and untracked) of a git repository.
43
+ * Filepaths are absolute.
44
+ */
45
+ function getUncommittedChanges(path) {
46
+ cdIfPresent(path);
47
+ return sh
48
+ .exec('git status --porcelain', (0, command_util_1.getShellConfig)())
49
+ .stdout.trim()
50
+ .split('\n')
51
+ .map(fileInfo => { var _a;
52
+ // Extract relative file path from the info string and convert to absolute path
53
+ return (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), (_a = fileInfo.trim().split(' ').pop()) !== null && _a !== void 0 ? _a : ''); });
54
+ }
55
+ exports.getUncommittedChanges = getUncommittedChanges;
56
+ /**
57
+ * Returns the files tha have been changed with the last commit (also includes currently staged but uncommitted changes)
58
+ * Filepaths are absolute.
59
+ */
60
+ function getChangesOfLastCommit(path) {
61
+ cdIfPresent(path);
62
+ return sh
63
+ .exec('git diff --name-only HEAD^', (0, command_util_1.getShellConfig)())
64
+ .stdout.trim()
65
+ .split('\n')
66
+ .map(file => (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), file));
67
+ }
68
+ exports.getChangesOfLastCommit = getChangesOfLastCommit;
69
+ /**
70
+ * Returns the last modification date of a file (or the last commit) in a git repo.
71
+ * @param filePath The file. If undefined the modification date of the last commit will be returned
72
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
73
+ * @returns The date or undefined if the file is outside of the git repo.
74
+ */
75
+ function getLastModificationDate(filePath, repoRoot) {
76
+ cdIfPresent(repoRoot);
77
+ const result = sh.exec(`git log -1 --pretty="format:%ci" ${filePath !== null && filePath !== void 0 ? filePath : ''}`, (0, command_util_1.getShellConfig)());
78
+ if (result.code !== 0) {
79
+ return undefined;
80
+ }
81
+ return new Date(result.stdout.trim());
82
+ }
83
+ exports.getLastModificationDate = getLastModificationDate;
84
+ /**
85
+ * Returns the last modification date of a file in a git repo.
86
+ * @param filePath The file
87
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
88
+ * @returns The date or undefined if the file is outside of the git repo.
89
+ */
90
+ function getFirstModificationDate(filePath, repoRoot) {
91
+ cdIfPresent(repoRoot);
92
+ const result = sh.exec(`git log --pretty="format:%ci" --follow ${filePath}`, (0, command_util_1.getShellConfig)());
93
+ if (result.code !== 0) {
94
+ return undefined;
95
+ }
96
+ const datesString = result.stdout.trim();
97
+ if (datesString.length === 0) {
98
+ return new Date();
99
+ }
100
+ const date = datesString.split('\n').pop();
101
+ return date ? new Date(date) : undefined;
102
+ }
103
+ exports.getFirstModificationDate = getFirstModificationDate;
104
+ function getFilesOfCommit(commitHash, repoRoot) {
105
+ cdIfPresent(repoRoot);
106
+ const result = sh.exec(`git show --pretty="" --name-only ${commitHash}`, (0, command_util_1.getShellConfig)());
107
+ if (result.code !== 0) {
108
+ return [];
109
+ }
110
+ return result.stdout.trim().split('\n');
111
+ }
112
+ exports.getFilesOfCommit = getFilesOfCommit;
113
+ /**
114
+ * Returns the commit hash of the initial commit of the given repository
115
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
116
+ * @returns The commit hash or undefined if something went wrong.
117
+ */
118
+ function getInitialCommit(repoRoot) {
119
+ cdIfPresent(repoRoot);
120
+ const result = sh.exec('git log --pretty=oneline --reverse', (0, command_util_1.getShellConfig)());
121
+ if (result.code !== 0) {
122
+ return undefined;
123
+ }
124
+ const commits = result.stdout.trim();
125
+ if (commits.length === 0) {
126
+ return undefined;
127
+ }
128
+ return commits.substring(0, commits.indexOf(' '));
129
+ }
130
+ exports.getInitialCommit = getInitialCommit;
131
+ /**
132
+ * Returns the commit hash of the first commit for a given file (across renames).
133
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
134
+ * @returns The commit hash or undefined if something went wrong.
135
+ */
136
+ function getFirstCommit(filePath, repoRoot) {
137
+ cdIfPresent(repoRoot);
138
+ const result = sh.exec(`git log --follow --pretty=format:"%H" ${filePath}`, (0, command_util_1.getShellConfig)());
139
+ if (result.code !== 0) {
140
+ return undefined;
141
+ }
142
+ return result.stdout.trim().split('\n').pop();
143
+ }
144
+ exports.getFirstCommit = getFirstCommit;
145
+ function getLatestGithubRelease(path) {
146
+ cdIfPresent(path);
147
+ const release = sh.exec('gh release list --exclude-drafts -L 1', (0, command_util_1.getShellConfig)()).stdout.trim().split('\t');
148
+ return release[release.length - 2];
149
+ }
150
+ exports.getLatestGithubRelease = getLatestGithubRelease;
151
+ function getLatestTag(path) {
152
+ cdIfPresent(path);
153
+ return sh.exec('git describe --abbrev=0 --tags', (0, command_util_1.getShellConfig)()).stdout.trim();
154
+ }
155
+ exports.getLatestTag = getLatestTag;
156
+ function hasBranch(branch, path) {
157
+ cdIfPresent(path);
158
+ return sh.exec(`git branch --list ${branch}`, (0, command_util_1.getShellConfig)()).stdout.trim().length !== 0;
159
+ }
160
+ exports.hasBranch = hasBranch;
161
+ function getRemoteUrl(path) {
162
+ cdIfPresent(path);
163
+ return sh.exec('git config --get remote.origin.url', (0, command_util_1.getShellConfig)()).stdout.trim();
164
+ }
165
+ exports.getRemoteUrl = getRemoteUrl;
166
+ function cdIfPresent(path) {
167
+ if (path) {
168
+ sh.cd(path);
169
+ }
170
+ }
171
+ //# sourceMappingURL=git-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-util.js","sourceRoot":"","sources":["../../src/util/git-util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,+BAA+B;AAC/B,8BAA8B;AAC9B,iDAAgD;AAEhD,SAAgB,eAAe,CAAC,IAAa;IACzC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClB,MAAM,SAAS,GACX,EAAE;SACG,IAAI,CAAC,qCAAqC,EAAE,IAAA,6BAAc,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SAC7E,MAAM,CAAC,IAAI,EAAE;SACb,iBAAiB,EAAE,KAAK,MAAM,CAAC;IACxC,OAAO,SAAS,CAAC;AACrB,CAAC;AARD,0CAQC;AAED,SAAgB,UAAU,CAAC,IAAa;IACpC,W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AAC,IAAI,CAAC,CAAC;IAClB,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,uCAAuC,EAAE,IAAA,6BAAc,GAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7G,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAJD,wDAIC;AAED,SAAgB,YAAY,CAAC,IAAa;IACtC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,EAAE,CAAC,IAAI,CAAC,gCAAgC,EAAE,IAAA,6BAAc,GAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACrF,CAAC;AAHD,oCAGC;AAED,SAAgB,SAAS,CAAC,MAAc,EAAE,IAAa;IACnD,WAAW,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,EAAE,CAAC,IAAI,CAAC,qBAAqB,MAAM,EAAE,EAAE,IAAA,6BAAc,GAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC;AAC/F,CAAC;AAHD,8BAGC;AAED,SAAgB,YAAY,CAAC,IAAa;IACtC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,EAAE,CAAC,IAAI,CAAC,oCAAoC,EAAE,IAAA,6BAAc,GAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACzF,CAAC;AAHD,oCAGC;AAED,SAAS,WAAW,CAAC,IAAa;IAC9B,IAAI,IAAI,EAAE;QACN,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;KACf;AACL,CAAC"}
@@ -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 interface Logger extends Pick<Console, LogLevel> {
17
+ newLine(): void;
18
+ }
19
+ export type LogLevel = 'info' | 'debug' | 'error' | 'warn';
20
+ export declare const LOGGER: Logger;
21
+ export declare function configureLogger(level: LogLevel): void;
22
+ export declare function configureLogger(verbose: boolean): void;
23
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,MAAM,WAAW,MAAO,SAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;IACnD,OAAO,IAAI,IAAI,CAAC;CACnB;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAW3D,eAAO,MAAM,MAAM,EAAE,MAMX,CAAC;AAUX,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;AACvD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC"}
@@ -0,0 +1,50 @@
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.configureLogger = exports.LOGGER = void 0;
19
+ const levels = {
20
+ error: { threshold: 0, color: '\x1b[31m' },
21
+ warn: { threshold: 1, color: '\x1b[33m' },
22
+ info: { threshold: 2, color: '\x1b[0m' },
23
+ debug: { threshold: 3, color: '\x1b[32m' } // green
24
+ };
25
+ let levelThreshold = levels.info.threshold;
26
+ exports.LOGGER = {
27
+ info: (...args) => log('info', ...args),
28
+ error: (...args) => log('error', ...args),
29
+ warn: (...args) => log('warn', ...args),
30
+ debug: (...args) => log('debug', ...args),
31
+ newLine: () => console.log('')
32
+ };
33
+ function log(level, ...args) {
34
+ const levelData = levels[level];
35
+ if (levelThreshold < levelData.threshold) {
36
+ return;
37
+ }
38
+ console[level](levelData.color, ...args, '\x1b[0m');
39
+ }
40
+ function configureLogger(levelOrVerbose) {
41
+ if (typeof levelOrVerbose === 'boolean') {
42
+ const level = levelOrVerbose ? 'debug' : 'info';
43
+ levelThreshold = levels[level].threshold;
44
+ }
45
+ else {
46
+ levelThreshold = levels[levelOrVerbose].threshold;
47
+ }
48
+ }
49
+ exports.configureLogger = configureLogger;
50
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAQlF,MAAM,MAAM,GAA2D;IACnE,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE;IAC1C,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE;IACzC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE;IACxC,KAAK,EAAE,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}
@@ -0,0 +1,6 @@
1
+ export declare const COMMAND_VERSION = "1.1.0-next";
2
+ export declare function validateDirectory(rootDir: string): string;
3
+ export declare function validateFile(filePath: string, hasToExist?: boolean): string;
4
+ export declare function validateVersion(version: string): string;
5
+ export declare function validateGitDirectory(repository: string): string;
6
+ //# 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,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,UAAQ,GAAG,MAAM,CAUzE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO/D"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateGitDirectory = exports.validateVersion = exports.validateFile = 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 validateFile(filePath, hasToExist = false) {
38
+ const path = (0, path_1.resolve)(filePath);
39
+ if (hasToExist && !fs.existsSync(path)) {
40
+ throw new commander_1.InvalidArgumentError('Not a valid file path!');
41
+ }
42
+ if (!fs.statSync(path).isFile()) {
43
+ throw new commander_1.InvalidArgumentError('Not a file!');
44
+ }
45
+ return path;
46
+ }
47
+ exports.validateFile = validateFile;
48
+ function validateVersion(version) {
49
+ logger_1.LOGGER.debug(`Validate version format of: ${version}`);
50
+ if (!semver.valid(version)) {
51
+ throw new commander_1.InvalidArgumentError(`Not a valid version: ${version}`);
52
+ }
53
+ return version;
54
+ }
55
+ exports.validateVersion = validateVersion;
56
+ function validateGitDirectory(repository) {
57
+ const repoPath = validateDirectory(repository);
58
+ if (!(0, git_util_1.isGitRepository)(repoPath)) {
59
+ throw new commander_1.InvalidArgumentError('Not a valid git repository');
60
+ }
61
+ return (0, git_util_1.getGitRoot)(repository);
62
+ }
63
+ exports.validateGitDirectory = validateGitDirectory;
64
+ //# 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,yCAAyD;AACzD,qCAAkC;AACrB,QAAA,eAAe,GAAG,YAAY,CAAC;AAE5C,SAAgB,iBAAi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,EAAE;QAC5B,MAAM,IAAI,gCAAoB,CAAC,4BAA4B,CAAC,CAAC;KAChE;IAED,OAAO,IAAA,qBAAU,EAAC,UAAU,CAAC,CAAC;AAClC,CAAC;AAPD,oDAOC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@eclipse-glsp/cli",
3
+ "version": "1.1.0-next.4846de1.120+4846de1",
4
+ "description": "CLI Tooling & scripts for GLSP components",
5
+ "keywords": [
6
+ "eclipse",
7
+ "tsconfig"
8
+ ],
9
+ "homepage": "https://www.eclipse.org/glsp/",
10
+ "bugs": "https://github.com/eclipse-glsp/glsp/issues",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/eclipse-glsp/glsp.git"
14
+ },
15
+ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
16
+ "author": {
17
+ "name": "Eclipse GLSP"
18
+ },
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
+ "bin": {
27
+ "glsp": "bin/glsp"
28
+ },
29
+ "files": [
30
+ "src",
31
+ "bin",
32
+ "lib"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsc -b",
36
+ "clean": "rimraf lib tsconfig.tsbuildinfo",
37
+ "lint": "eslint --ext .ts,.tsx ./src",
38
+ "lint:ci": "yarn lint -o eslint.xml -f checkstyle",
39
+ "prepare": "yarn clean && yarn build ",
40
+ "start": "node --enable-source-maps lib/app.js",
41
+ "watch": "tsc -w"
42
+ },
43
+ "dependencies": {
44
+ "commander": "^9.4.0",
45
+ "glob": "^8.0.3",
46
+ "node-fetch": "2.6.7",
47
+ "readline-sync": "^1.4.10",
48
+ "semver": "^7.3.7",
49
+ "shelljs": "0.8.5"
50
+ },
51
+ "devDependencies": {
52
+ "@eclipse-glsp/config": "1.1.0-next.4846de1.120+4846de1",
53
+ "@types/glob": "^8.0.0",
54
+ "@types/node-fetch": "2.6.2",
55
+ "@types/readline-sync": "1.4.4",
56
+ "@types/semver": "7.3.12",
57
+ "@types/shelljs": "0.8.11",
58
+ "ts-node": "^10.9.1"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public"
62
+ },
63
+ "gitHead": "4846de1a07e293bcfc06a3afde3ae3c4c2292fb2"
64
+ }
package/src/app.ts ADDED
@@ -0,0 +1,30 @@
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 { CheckHeaderCommand } from './commands/check-header';
18
+ import { CoverageReportCommand } from './commands/coverage-report';
19
+ import { ReleaseCommand } from './commands/release/release';
20
+ import { baseCommand } from './util/command-util';
21
+ export const COMMAND_VERSION = '1.1.0-next';
22
+
23
+ const app = baseCommand() //
24
+ .version(COMMAND_VERSION)
25
+ .name('glsp')
26
+ .addCommand(CoverageReportCommand)
27
+ .addCommand(ReleaseCommand)
28
+ .addCommand(CheckHeaderCommand);
29
+
30
+ app.parse(process.argv);