@eclipse-glsp/cli 1.1.0-next.4c65907.114 → 1.1.0-next.73d6685.138

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 (93) hide show
  1. package/README.md +50 -6
  2. package/lib/app.d.ts +1 -17
  3. package/lib/app.d.ts.map +1 -1
  4. package/lib/app.js +10 -24
  5. package/lib/app.js.map +1 -1
  6. package/lib/commands/check-header.d.ts +24 -0
  7. package/lib/commands/check-header.d.ts.map +1 -0
  8. package/lib/commands/check-header.js +290 -0
  9. package/lib/commands/check-header.js.map +1 -0
  10. package/lib/commands/coverage-report.d.ts +29 -0
  11. package/lib/commands/coverage-report.d.ts.map +1 -0
  12. package/lib/commands/coverage-report.js +123 -0
  13. package/lib/commands/coverage-report.js.map +1 -0
  14. package/lib/{release → commands/release}/common.d.ts +1 -1
  15. package/lib/commands/release/common.d.ts.map +1 -0
  16. package/lib/{release → commands/release}/common.js +44 -18
  17. package/lib/commands/release/common.js.map +1 -0
  18. package/lib/commands/release/release-client.d.ts.map +1 -0
  19. package/lib/{release → commands/release}/release-client.js +30 -9
  20. package/lib/commands/release/release-client.js.map +1 -0
  21. package/lib/commands/release/release-eclipse-integration.d.ts.map +1 -0
  22. package/lib/{release → commands/release}/release-eclipse-integration.js +26 -3
  23. package/lib/commands/release/release-eclipse-integration.js.map +1 -0
  24. package/lib/commands/release/release-java-server.d.ts.map +1 -0
  25. package/lib/{release → commands/release}/release-java-server.js +28 -4
  26. package/lib/commands/release/release-java-server.js.map +1 -0
  27. package/lib/commands/release/release-server-node.d.ts.map +1 -0
  28. package/lib/{release → commands/release}/release-server-node.js +25 -2
  29. package/lib/commands/release/release-server-node.js.map +1 -0
  30. package/lib/commands/release/release-theia-integration.d.ts.map +1 -0
  31. package/lib/{release → commands/release}/release-theia-integration.js +27 -15
  32. package/lib/commands/release/release-theia-integration.js.map +1 -0
  33. package/lib/commands/release/release-vscode-integration.d.ts.map +1 -0
  34. package/lib/{release → commands/release}/release-vscode-integration.js +26 -3
  35. package/lib/commands/release/release-vscode-integration.js.map +1 -0
  36. package/lib/{release → commands/release}/release.d.ts +3 -2
  37. package/lib/commands/release/release.d.ts.map +1 -0
  38. package/lib/{release → commands/release}/release.js +73 -18
  39. package/lib/commands/release/release.js.map +1 -0
  40. package/lib/util/command-util.d.ts +6 -11
  41. package/lib/util/command-util.d.ts.map +1 -1
  42. package/lib/util/command-util.js +50 -12
  43. package/lib/util/command-util.js.map +1 -1
  44. package/lib/util/git-util.d.ts +43 -4
  45. package/lib/util/git-util.d.ts.map +1 -1
  46. package/lib/util/git-util.js +151 -39
  47. package/lib/util/git-util.js.map +1 -1
  48. package/lib/util/logger.d.ts +21 -7
  49. package/lib/util/logger.d.ts.map +1 -1
  50. package/lib/util/logger.js +29 -13
  51. package/lib/util/logger.js.map +1 -1
  52. package/lib/util/validation-util.d.ts +1 -0
  53. package/lib/util/validation-util.d.ts.map +1 -1
  54. package/lib/util/validation-util.js +40 -6
  55. package/lib/util/validation-util.js.map +1 -1
  56. package/package.json +31 -33
  57. package/src/app.ts +10 -28
  58. package/src/commands/check-header.ts +355 -0
  59. package/src/commands/coverage-report.ts +113 -0
  60. package/src/{release → commands/release}/common.ts +9 -9
  61. package/src/{release → commands/release}/release-client.ts +7 -11
  62. package/src/{release → commands/release}/release-eclipse-integration.ts +2 -2
  63. package/src/{release → commands/release}/release-java-server.ts +4 -3
  64. package/src/{release → commands/release}/release-server-node.ts +1 -1
  65. package/src/{release → commands/release}/release-theia-integration.ts +7 -19
  66. package/src/{release → commands/release}/release-vscode-integration.ts +3 -2
  67. package/src/{release → commands/release}/release.ts +59 -18
  68. package/src/util/command-util.ts +11 -20
  69. package/src/util/git-util.ts +128 -38
  70. package/src/util/logger.ts +36 -17
  71. package/src/util/validation-util.ts +17 -4
  72. package/lib/release/common.d.ts.map +0 -1
  73. package/lib/release/common.js.map +0 -1
  74. package/lib/release/release-client.d.ts.map +0 -1
  75. package/lib/release/release-client.js.map +0 -1
  76. package/lib/release/release-eclipse-integration.d.ts.map +0 -1
  77. package/lib/release/release-eclipse-integration.js.map +0 -1
  78. package/lib/release/release-java-server.d.ts.map +0 -1
  79. package/lib/release/release-java-server.js.map +0 -1
  80. package/lib/release/release-server-node.d.ts.map +0 -1
  81. package/lib/release/release-server-node.js.map +0 -1
  82. package/lib/release/release-theia-integration.d.ts.map +0 -1
  83. package/lib/release/release-theia-integration.js.map +0 -1
  84. package/lib/release/release-vscode-integration.d.ts.map +0 -1
  85. package/lib/release/release-vscode-integration.js.map +0 -1
  86. package/lib/release/release.d.ts.map +0 -1
  87. package/lib/release/release.js.map +0 -1
  88. /package/lib/{release → commands/release}/release-client.d.ts +0 -0
  89. /package/lib/{release → commands/release}/release-eclipse-integration.d.ts +0 -0
  90. /package/lib/{release → commands/release}/release-java-server.d.ts +0 -0
  91. /package/lib/{release → commands/release}/release-server-node.d.ts +0 -0
  92. /package/lib/{release → commands/release}/release-theia-integration.d.ts +0 -0
  93. /package/lib/{release → commands/release}/release-vscode-integration.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /********************************************************************************
3
- * Copyright (c) 2022 EclipseSource and others.
3
+ * Copyright (c) 2022-2022 EclipseSource and others.
4
4
  *
5
5
  * This program and the accompanying materials are made available under the
6
6
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -14,74 +14,186 @@
14
14
  *
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
17
40
  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");
41
+ 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;
42
+ const path_1 = require("path");
43
+ const sh = __importStar(require("shelljs"));
20
44
  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
45
  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';
46
+ cdIfPresent(path);
47
+ const isGitRepo = sh
48
+ .exec('git rev-parse --is-inside-work-tree', (0, command_util_1.getShellConfig)({ silent: true }))
49
+ .stdout.trim()
50
+ .toLocaleLowerCase() === 'true';
51
+ return isGitRepo;
45
52
  }
46
53
  exports.isGitRepository = isGitRepository;
47
- function hasGitChanges(path) {
48
- logger_1.LOGGER.debug(`Check if the directory has git changes: ${asDebugArg(path)}`);
54
+ function getGitRoot(path) {
49
55
  cdIfPresent(path);
50
- return sh.exec('git status --porcelain').stdout.trim().length !== 0;
56
+ const fileString = sh.exec('git rev-parse --show-toplevel', (0, command_util_1.getShellConfig)()).stdout.trim();
57
+ return (0, path_1.resolve)(fileString);
58
+ }
59
+ exports.getGitRoot = getGitRoot;
60
+ function hasGitChanges(path) {
61
+ return getUncommittedChanges(path).length > 0;
51
62
  }
52
63
  exports.hasGitChanges = hasGitChanges;
53
- function getLatestRelease(path) {
54
- logger_1.LOGGER.debug(`Retrieve latest release from repo: ${asDebugArg(path)}`);
64
+ /**
65
+ * Returns the files that have uncommitted changes (staged, not staged and untracked) of a git repository.
66
+ * Filepaths are absolute.
67
+ */
68
+ function getUncommittedChanges(path) {
69
+ cdIfPresent(path);
70
+ return sh
71
+ .exec('git status --porcelain', (0, command_util_1.getShellConfig)())
72
+ .stdout.trim()
73
+ .split('\n')
74
+ .filter(value => value.trim().length !== 0)
75
+ .map(fileInfo => { var _a;
76
+ // Extract relative file path from the info string and convert to absolute path
77
+ return (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), (_a = fileInfo.trim().split(' ').pop()) !== null && _a !== void 0 ? _a : ''); });
78
+ }
79
+ exports.getUncommittedChanges = getUncommittedChanges;
80
+ /**
81
+ * Returns the files tha have been changed with the last commit (also includes currently staged but uncommitted changes)
82
+ * Filepaths are absolute.
83
+ */
84
+ function getChangesOfLastCommit(path) {
85
+ cdIfPresent(path);
86
+ return sh
87
+ .exec('git diff --name-only HEAD^', (0, command_util_1.getShellConfig)())
88
+ .stdout.trim()
89
+ .split('\n')
90
+ .map(file => (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), file));
91
+ }
92
+ exports.getChangesOfLastCommit = getChangesOfLastCommit;
93
+ /**
94
+ * Returns the last modification date of a file (or the last commit) in a git repo.
95
+ * @param filePath The file. If undefined the modification date of the last commit will be returned
96
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
97
+ * @param excludeMessage Only consider commits that don`t match the excludeMessage
98
+ * @returns The date or undefined if the file is outside of the git repo.
99
+ */
100
+ function getLastModificationDate(filePath, repoRoot, excludeMessage) {
101
+ cdIfPresent(repoRoot);
102
+ const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : '';
103
+ const result = sh.exec(`git log -1 ${additionalArgs} --pretty="format:%ci" ${filePath !== null && filePath !== void 0 ? filePath : ''}`, (0, command_util_1.getShellConfig)());
104
+ if (result.code !== 0) {
105
+ return undefined;
106
+ }
107
+ return new Date(result.stdout.trim());
108
+ }
109
+ exports.getLastModificationDate = getLastModificationDate;
110
+ /**
111
+ * Returns the last modification date of a file in a git repo.
112
+ * @param filePath The file
113
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
114
+ * @param excludeMessage Only consider commits that don`t match the excludeMessage
115
+ * @returns The date or undefined if the file is outside of the git repo.
116
+ */
117
+ function getFirstModificationDate(filePath, repoRoot, excludeMessage) {
118
+ cdIfPresent(repoRoot);
119
+ const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : '';
120
+ const result = sh.exec(`git log ${additionalArgs} --pretty="format:%ci" --follow ${filePath}`, (0, command_util_1.getShellConfig)());
121
+ if (result.code !== 0) {
122
+ return undefined;
123
+ }
124
+ const datesString = result.stdout.trim();
125
+ if (datesString.length === 0) {
126
+ return new Date();
127
+ }
128
+ const date = datesString.split('\n').pop();
129
+ return date ? new Date(date) : undefined;
130
+ }
131
+ exports.getFirstModificationDate = getFirstModificationDate;
132
+ function getFilesOfCommit(commitHash, repoRoot) {
133
+ cdIfPresent(repoRoot);
134
+ const result = sh.exec(`git show --pretty="" --name-only ${commitHash}`, (0, command_util_1.getShellConfig)());
135
+ if (result.code !== 0) {
136
+ return [];
137
+ }
138
+ return result.stdout.trim().split('\n');
139
+ }
140
+ exports.getFilesOfCommit = getFilesOfCommit;
141
+ /**
142
+ * Returns the commit hash of the initial commit of the given repository
143
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
144
+ * @returns The commit hash or undefined if something went wrong.
145
+ */
146
+ function getInitialCommit(repoRoot) {
147
+ cdIfPresent(repoRoot);
148
+ const result = sh.exec('git log --pretty=oneline --reverse', (0, command_util_1.getShellConfig)());
149
+ if (result.code !== 0) {
150
+ return undefined;
151
+ }
152
+ const commits = result.stdout.trim();
153
+ if (commits.length === 0) {
154
+ return undefined;
155
+ }
156
+ return commits.substring(0, commits.indexOf(' '));
157
+ }
158
+ exports.getInitialCommit = getInitialCommit;
159
+ /**
160
+ * Returns the commit hash of the first commit for a given file (across renames).
161
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
162
+ * @returns The commit hash or undefined if something went wrong.
163
+ */
164
+ function getFirstCommit(filePath, repoRoot) {
165
+ cdIfPresent(repoRoot);
166
+ const result = sh.exec(`git log --follow --pretty=format:"%H" ${filePath}`, (0, command_util_1.getShellConfig)());
167
+ if (result.code !== 0) {
168
+ return undefined;
169
+ }
170
+ return result.stdout.trim().split('\n').pop();
171
+ }
172
+ exports.getFirstCommit = getFirstCommit;
173
+ function getLatestGithubRelease(path) {
55
174
  cdIfPresent(path);
56
175
  const release = sh.exec('gh release list --exclude-drafts -L 1', (0, command_util_1.getShellConfig)()).stdout.trim().split('\t');
57
176
  return release[release.length - 2];
58
177
  }
59
- exports.getLatestRelease = getLatestRelease;
178
+ exports.getLatestGithubRelease = getLatestGithubRelease;
60
179
  function getLatestTag(path) {
61
- logger_1.LOGGER.debug(`Retrieve latest tag from local repo : ${asDebugArg(path)}`);
62
180
  cdIfPresent(path);
63
181
  return sh.exec('git describe --abbrev=0 --tags', (0, command_util_1.getShellConfig)()).stdout.trim();
64
182
  }
65
183
  exports.getLatestTag = getLatestTag;
66
184
  function hasBranch(branch, path) {
67
- logger_1.LOGGER.debug(`Check if branch exists: ${asDebugArg(path)}`);
68
185
  cdIfPresent(path);
69
186
  return sh.exec(`git branch --list ${branch}`, (0, command_util_1.getShellConfig)()).stdout.trim().length !== 0;
70
187
  }
71
188
  exports.hasBranch = hasBranch;
72
189
  function getRemoteUrl(path) {
73
- logger_1.LOGGER.debug(`Retrieve remote git url for: ${asDebugArg(path)}`);
74
190
  cdIfPresent(path);
75
191
  return sh.exec('git config --get remote.origin.url', (0, command_util_1.getShellConfig)()).stdout.trim();
76
192
  }
77
193
  exports.getRemoteUrl = getRemoteUrl;
78
194
  function cdIfPresent(path) {
79
195
  if (path) {
80
- (0, validation_util_1.validateGitDirectory)(path);
81
196
  sh.cd(path);
82
197
  }
83
198
  }
84
- function asDebugArg(path) {
85
- return path !== null && path !== void 0 ? path : sh.pwd().stdout;
86
- }
87
199
  //# sourceMappingURL=git-util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-util.js","sourceRoot":"","sources":["../../src/util/git-util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,8BAA8B;AAC9B,iDAA2D;AAC3D,qCAAkC;AAClC,uDAAyD;AAEzD,SAAgB,wBAAwB;IACpC,eAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACpD,IAAA,wBAAS,EAAC,UAAU,EAAE,8BAA8B,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,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E,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"}
@@ -1,9 +1,23 @@
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;
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;
8
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;
9
23
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +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"}
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"}
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configureLogger = exports.LOGGER = void 0;
4
2
  /********************************************************************************
5
3
  * Copyright (c) 2022 EclipseSource and others.
6
4
  *
@@ -16,19 +14,37 @@ exports.configureLogger = exports.LOGGER = void 0;
16
14
  *
17
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
16
  ********************************************************************************/
19
- let verbose = false;
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;
20
26
  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
- }
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('')
29
32
  };
30
- function configureLogger(isVerbose) {
31
- verbose = isVerbose;
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
+ }
32
48
  }
33
49
  exports.configureLogger = configureLogger;
34
50
  //# sourceMappingURL=logger.js.map
@@ -1 +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"}
1
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EAAE,SAAS,CAAC,CAAC;AACxD,CAAC;AAID,SAAgB,eAAe,CAAC,cAAkC;IAC9D,IAAI,OAAO,cAAc,KAAK,SAAS,EAAE;QACrC,MAAM,KAAK,GAAa,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QAC1D,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC;KAC5C;SAAM;QACH,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC;KACrD;AACL,CAAC;AAPD,0CAOC"}
@@ -1,5 +1,6 @@
1
1
  export declare const COMMAND_VERSION = "1.1.0-next";
2
2
  export declare function validateDirectory(rootDir: string): string;
3
+ export declare function validateFile(filePath: string, hasToExist?: boolean): string;
3
4
  export declare function validateVersion(version: string): string;
4
5
  export declare function validateGitDirectory(repository: string): string;
5
6
  //# sourceMappingURL=validation-util.d.ts.map
@@ -1 +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"}
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"}
@@ -1,6 +1,29 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateGitDirectory = exports.validateVersion = exports.validateDirectory = exports.COMMAND_VERSION = void 0;
26
+ exports.validateGitDirectory = exports.validateVersion = exports.validateFile = exports.validateDirectory = exports.COMMAND_VERSION = void 0;
4
27
  /********************************************************************************
5
28
  * Copyright (c) 2022 EclipseSource and others.
6
29
  *
@@ -17,9 +40,9 @@ exports.validateGitDirectory = exports.validateVersion = exports.validateDirecto
17
40
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
41
  ********************************************************************************/
19
42
  const commander_1 = require("commander");
20
- const fs = require("fs");
43
+ const fs = __importStar(require("fs"));
21
44
  const path_1 = require("path");
22
- const semver = require("semver");
45
+ const semver = __importStar(require("semver"));
23
46
  const git_util_1 = require("./git-util");
24
47
  const logger_1 = require("./logger");
25
48
  exports.COMMAND_VERSION = '1.1.0-next';
@@ -34,10 +57,21 @@ function validateDirectory(rootDir) {
34
57
  return path;
35
58
  }
36
59
  exports.validateDirectory = validateDirectory;
60
+ function validateFile(filePath, hasToExist = false) {
61
+ const path = (0, path_1.resolve)(filePath);
62
+ if (hasToExist && !fs.existsSync(path)) {
63
+ throw new commander_1.InvalidArgumentError('Not a valid file path!');
64
+ }
65
+ if (!fs.statSync(path).isFile()) {
66
+ throw new commander_1.InvalidArgumentError('Not a file!');
67
+ }
68
+ return path;
69
+ }
70
+ exports.validateFile = validateFile;
37
71
  function validateVersion(version) {
38
72
  logger_1.LOGGER.debug(`Validate version format of: ${version}`);
39
73
  if (!semver.valid(version)) {
40
- throw new Error(`Not a valid version: ${version}`);
74
+ throw new commander_1.InvalidArgumentError(`Not a valid version: ${version}`);
41
75
  }
42
76
  return version;
43
77
  }
@@ -45,9 +79,9 @@ exports.validateVersion = validateVersion;
45
79
  function validateGitDirectory(repository) {
46
80
  const repoPath = validateDirectory(repository);
47
81
  if (!(0, git_util_1.isGitRepository)(repoPath)) {
48
- throw new Error('Not a valid git repository');
82
+ throw new commander_1.InvalidArgumentError('Not a valid git repository');
49
83
  }
50
- return repoPath;
84
+ return (0, git_util_1.getGitRoot)(repository);
51
85
  }
52
86
  exports.validateGitDirectory = validateGitDirectory;
53
87
  //# sourceMappingURL=validation-util.js.map
@@ -1 +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;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AAC;AAPD,oDAOC"}
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/cli",
3
- "version": "1.1.0-next.4c65907.114+4c65907",
3
+ "version": "1.1.0-next.73d6685.138+73d6685",
4
4
  "description": "CLI Tooling & scripts for GLSP components",
5
- "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
6
5
  "keywords": [
7
6
  "eclipse",
8
7
  "tsconfig"
9
8
  ],
10
- "author": {
11
- "name": "Eclipse GLSP"
12
- },
13
9
  "homepage": "https://www.eclipse.org/glsp/",
10
+ "bugs": "https://github.com/eclipse-glsp/glsp/issues",
14
11
  "repository": {
15
12
  "type": "git",
16
13
  "url": "https://github.com/eclipse-glsp/glsp.git"
17
14
  },
18
- "bugs": "https://github.com/eclipse-glsp/glsp/issues",
15
+ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
16
+ "author": {
17
+ "name": "Eclipse GLSP"
18
+ },
19
19
  "contributors": [
20
20
  {
21
21
  "name": "Eclipse GLSP Project",
@@ -23,43 +23,41 @@
23
23
  "url": "https://projects.eclipse.org/projects/ecd.glsp"
24
24
  }
25
25
  ],
26
+ "bin": {
27
+ "glsp": "bin/glsp"
28
+ },
29
+ "files": [
30
+ "src",
31
+ "bin",
32
+ "lib"
33
+ ],
26
34
  "scripts": {
27
- "prepare": "yarn clean && yarn build && yarn lint",
28
- "clean": "rimraf lib tsconfig.tsbuildinfo ",
29
- "build": "tsc",
35
+ "build": "tsc -b",
36
+ "clean": "rimraf lib tsconfig.tsbuildinfo",
30
37
  "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"
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"
36
42
  },
37
43
  "dependencies": {
38
- "commander": "^9.4.0",
39
- "node-fetch": "2.6.7",
44
+ "commander": "^10.0.1",
45
+ "glob": "^8.0.3",
46
+ "node-fetch": "^2.6.11",
40
47
  "readline-sync": "^1.4.10",
41
- "semver": "^7.3.7",
42
- "shelljs": "0.8.5"
48
+ "semver": "^7.5.1",
49
+ "shelljs": "^0.8.5"
43
50
  },
44
51
  "devDependencies": {
45
- "@eclipse-glsp/config": "1.1.0-next.4c65907.114+4c65907",
46
- "@types/node": "14.x",
52
+ "@eclipse-glsp/config": "1.1.0-next.73d6685.138+73d6685",
53
+ "@types/glob": "^8.0.0",
47
54
  "@types/node-fetch": "2.6.2",
48
55
  "@types/readline-sync": "1.4.4",
49
56
  "@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"
57
+ "@types/shelljs": "0.8.11"
55
58
  },
56
- "bin": {
57
- "glsp": "bin/glsp"
59
+ "publishConfig": {
60
+ "access": "public"
58
61
  },
59
- "files": [
60
- "src",
61
- "bin",
62
- "lib"
63
- ],
64
- "gitHead": "4c6590739921232e7f8b1d99a85a940debb13e0b"
62
+ "gitHead": "73d668576408ca2532556520a2b9426b634480dc"
65
63
  }
package/src/app.ts CHANGED
@@ -14,36 +14,18 @@
14
14
  *
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
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';
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';
23
21
 
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);
22
+ export const COMMAND_VERSION = '1.1.0-next';
42
23
 
43
- const app = baseConfiguration(new Command())
44
- .showSuggestionAfterError(true)
45
- .showHelpAfterError(true)
24
+ const app = baseCommand() //
25
+ .version(COMMAND_VERSION)
46
26
  .name('glsp')
47
- .addCommand(ReleaseCommand);
27
+ .addCommand(CoverageReportCommand)
28
+ .addCommand(ReleaseCommand)
29
+ .addCommand(CheckHeaderCommand);
48
30
 
49
31
  app.parse(process.argv);