@eclipse-glsp/cli 1.1.0-next.4c65907.114 → 1.1.0-next.7026c40.129

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 +267 -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 +100 -0
  13. package/lib/commands/coverage-report.js.map +1 -0
  14. package/lib/commands/release/common.d.ts.map +1 -0
  15. package/lib/{release → commands/release}/common.js +5 -5
  16. package/lib/commands/release/common.js.map +1 -0
  17. package/lib/commands/release/release-client.d.ts.map +1 -0
  18. package/lib/{release → commands/release}/release-client.js +1 -1
  19. package/lib/commands/release/release-client.js.map +1 -0
  20. package/lib/commands/release/release-eclipse-integration.d.ts.map +1 -0
  21. package/lib/{release → commands/release}/release-eclipse-integration.js +2 -2
  22. package/lib/commands/release/release-eclipse-integration.js.map +1 -0
  23. package/lib/commands/release/release-java-server.d.ts.map +1 -0
  24. package/lib/{release → commands/release}/release-java-server.js +4 -3
  25. package/lib/commands/release/release-java-server.js.map +1 -0
  26. package/lib/commands/release/release-server-node.d.ts.map +1 -0
  27. package/lib/{release → commands/release}/release-server-node.js +1 -1
  28. package/lib/commands/release/release-server-node.js.map +1 -0
  29. package/lib/commands/release/release-theia-integration.d.ts.map +1 -0
  30. package/lib/{release → commands/release}/release-theia-integration.js +1 -1
  31. package/lib/commands/release/release-theia-integration.js.map +1 -0
  32. package/lib/commands/release/release-vscode-integration.d.ts.map +1 -0
  33. package/lib/{release → commands/release}/release-vscode-integration.js +1 -1
  34. package/lib/commands/release/release-vscode-integration.js.map +1 -0
  35. package/lib/{release → commands/release}/release.d.ts +3 -2
  36. package/lib/commands/release/release.d.ts.map +1 -0
  37. package/lib/{release → commands/release}/release.js +42 -10
  38. package/lib/commands/release/release.js.map +1 -0
  39. package/lib/util/command-util.d.ts +6 -11
  40. package/lib/util/command-util.d.ts.map +1 -1
  41. package/lib/util/command-util.js +26 -11
  42. package/lib/util/command-util.js.map +1 -1
  43. package/lib/util/git-util.d.ts +43 -4
  44. package/lib/util/git-util.d.ts.map +1 -1
  45. package/lib/util/git-util.js +127 -38
  46. package/lib/util/git-util.js.map +1 -1
  47. package/lib/util/logger.d.ts +21 -7
  48. package/lib/util/logger.d.ts.map +1 -1
  49. package/lib/util/logger.js +29 -13
  50. package/lib/util/logger.js.map +1 -1
  51. package/lib/util/validation-util.d.ts +1 -0
  52. package/lib/util/validation-util.d.ts.map +1 -1
  53. package/lib/util/validation-util.js +15 -4
  54. package/lib/util/validation-util.js.map +1 -1
  55. package/package.json +27 -28
  56. package/src/app.ts +10 -29
  57. package/src/commands/check-header.ts +355 -0
  58. package/src/commands/coverage-report.ts +113 -0
  59. package/src/{release → commands/release}/common.ts +5 -5
  60. package/src/{release → commands/release}/release-client.ts +1 -1
  61. package/src/{release → commands/release}/release-eclipse-integration.ts +2 -2
  62. package/src/{release → commands/release}/release-java-server.ts +4 -3
  63. package/src/{release → commands/release}/release-server-node.ts +1 -1
  64. package/src/{release → commands/release}/release-theia-integration.ts +1 -1
  65. package/src/{release → commands/release}/release-vscode-integration.ts +1 -1
  66. package/src/{release → commands/release}/release.ts +50 -9
  67. package/src/util/command-util.ts +11 -20
  68. package/src/util/git-util.ts +128 -38
  69. package/src/util/logger.ts +36 -17
  70. package/src/util/validation-util.ts +17 -4
  71. package/lib/release/common.d.ts.map +0 -1
  72. package/lib/release/common.js.map +0 -1
  73. package/lib/release/release-client.d.ts.map +0 -1
  74. package/lib/release/release-client.js.map +0 -1
  75. package/lib/release/release-eclipse-integration.d.ts.map +0 -1
  76. package/lib/release/release-eclipse-integration.js.map +0 -1
  77. package/lib/release/release-java-server.d.ts.map +0 -1
  78. package/lib/release/release-java-server.js.map +0 -1
  79. package/lib/release/release-server-node.d.ts.map +0 -1
  80. package/lib/release/release-server-node.js.map +0 -1
  81. package/lib/release/release-theia-integration.d.ts.map +0 -1
  82. package/lib/release/release-theia-integration.js.map +0 -1
  83. package/lib/release/release-vscode-integration.d.ts.map +0 -1
  84. package/lib/release/release-vscode-integration.js.map +0 -1
  85. package/lib/release/release.d.ts.map +0 -1
  86. package/lib/release/release.js.map +0 -1
  87. /package/lib/{release → commands/release}/common.d.ts +0 -0
  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
@@ -15,73 +15,162 @@
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getRemoteUrl = exports.hasBranch = exports.getLatestTag = exports.getLatestRelease = exports.hasGitChanges = exports.isGitRepository = exports.isGithubCLIAuthenticated = void 0;
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");
19
20
  const sh = require("shelljs");
20
21
  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
22
  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';
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;
45
29
  }
46
30
  exports.isGitRepository = isGitRepository;
47
- function hasGitChanges(path) {
48
- logger_1.LOGGER.debug(`Check if the directory has git changes: ${asDebugArg(path)}`);
31
+ function getGitRoot(path) {
49
32
  cdIfPresent(path);
50
- return sh.exec('git status --porcelain').stdout.trim().length !== 0;
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;
51
39
  }
52
40
  exports.hasGitChanges = hasGitChanges;
53
- function getLatestRelease(path) {
54
- logger_1.LOGGER.debug(`Retrieve latest release from repo: ${asDebugArg(path)}`);
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
+ .filter(value => value.trim().length !== 0)
52
+ .map(fileInfo => { var _a;
53
+ // Extract relative file path from the info string and convert to absolute path
54
+ return (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), (_a = fileInfo.trim().split(' ').pop()) !== null && _a !== void 0 ? _a : ''); });
55
+ }
56
+ exports.getUncommittedChanges = getUncommittedChanges;
57
+ /**
58
+ * Returns the files tha have been changed with the last commit (also includes currently staged but uncommitted changes)
59
+ * Filepaths are absolute.
60
+ */
61
+ function getChangesOfLastCommit(path) {
62
+ cdIfPresent(path);
63
+ return sh
64
+ .exec('git diff --name-only HEAD^', (0, command_util_1.getShellConfig)())
65
+ .stdout.trim()
66
+ .split('\n')
67
+ .map(file => (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), file));
68
+ }
69
+ exports.getChangesOfLastCommit = getChangesOfLastCommit;
70
+ /**
71
+ * Returns the last modification date of a file (or the last commit) in a git repo.
72
+ * @param filePath The file. If undefined the modification date of the last commit will be returned
73
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
74
+ * @param excludeMessage Only consider commits that don`t match the excludeMessage
75
+ * @returns The date or undefined if the file is outside of the git repo.
76
+ */
77
+ function getLastModificationDate(filePath, repoRoot, excludeMessage) {
78
+ cdIfPresent(repoRoot);
79
+ const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : '';
80
+ const result = sh.exec(`git log -1 ${additionalArgs} --pretty="format:%ci" ${filePath !== null && filePath !== void 0 ? filePath : ''}`, (0, command_util_1.getShellConfig)());
81
+ if (result.code !== 0) {
82
+ return undefined;
83
+ }
84
+ return new Date(result.stdout.trim());
85
+ }
86
+ exports.getLastModificationDate = getLastModificationDate;
87
+ /**
88
+ * Returns the last modification date of a file in a git repo.
89
+ * @param filePath The file
90
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
91
+ * @param excludeMessage Only consider commits that don`t match the excludeMessage
92
+ * @returns The date or undefined if the file is outside of the git repo.
93
+ */
94
+ function getFirstModificationDate(filePath, repoRoot, excludeMessage) {
95
+ cdIfPresent(repoRoot);
96
+ const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : '';
97
+ const result = sh.exec(`git log ${additionalArgs} --pretty="format:%ci" --follow ${filePath}`, (0, command_util_1.getShellConfig)());
98
+ if (result.code !== 0) {
99
+ return undefined;
100
+ }
101
+ const datesString = result.stdout.trim();
102
+ if (datesString.length === 0) {
103
+ return new Date();
104
+ }
105
+ const date = datesString.split('\n').pop();
106
+ return date ? new Date(date) : undefined;
107
+ }
108
+ exports.getFirstModificationDate = getFirstModificationDate;
109
+ function getFilesOfCommit(commitHash, repoRoot) {
110
+ cdIfPresent(repoRoot);
111
+ const result = sh.exec(`git show --pretty="" --name-only ${commitHash}`, (0, command_util_1.getShellConfig)());
112
+ if (result.code !== 0) {
113
+ return [];
114
+ }
115
+ return result.stdout.trim().split('\n');
116
+ }
117
+ exports.getFilesOfCommit = getFilesOfCommit;
118
+ /**
119
+ * Returns the commit hash of the initial commit of the given repository
120
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
121
+ * @returns The commit hash or undefined if something went wrong.
122
+ */
123
+ function getInitialCommit(repoRoot) {
124
+ cdIfPresent(repoRoot);
125
+ const result = sh.exec('git log --pretty=oneline --reverse', (0, command_util_1.getShellConfig)());
126
+ if (result.code !== 0) {
127
+ return undefined;
128
+ }
129
+ const commits = result.stdout.trim();
130
+ if (commits.length === 0) {
131
+ return undefined;
132
+ }
133
+ return commits.substring(0, commits.indexOf(' '));
134
+ }
135
+ exports.getInitialCommit = getInitialCommit;
136
+ /**
137
+ * Returns the commit hash of the first commit for a given file (across renames).
138
+ * @param repoRoot The path to the repo root. If undefined the current working directory is used.
139
+ * @returns The commit hash or undefined if something went wrong.
140
+ */
141
+ function getFirstCommit(filePath, repoRoot) {
142
+ cdIfPresent(repoRoot);
143
+ const result = sh.exec(`git log --follow --pretty=format:"%H" ${filePath}`, (0, command_util_1.getShellConfig)());
144
+ if (result.code !== 0) {
145
+ return undefined;
146
+ }
147
+ return result.stdout.trim().split('\n').pop();
148
+ }
149
+ exports.getFirstCommit = getFirstCommit;
150
+ function getLatestGithubRelease(path) {
55
151
  cdIfPresent(path);
56
152
  const release = sh.exec('gh release list --exclude-drafts -L 1', (0, command_util_1.getShellConfig)()).stdout.trim().split('\t');
57
153
  return release[release.length - 2];
58
154
  }
59
- exports.getLatestRelease = getLatestRelease;
155
+ exports.getLatestGithubRelease = getLatestGithubRelease;
60
156
  function getLatestTag(path) {
61
- logger_1.LOGGER.debug(`Retrieve latest tag from local repo : ${asDebugArg(path)}`);
62
157
  cdIfPresent(path);
63
158
  return sh.exec('git describe --abbrev=0 --tags', (0, command_util_1.getShellConfig)()).stdout.trim();
64
159
  }
65
160
  exports.getLatestTag = getLatestTag;
66
161
  function hasBranch(branch, path) {
67
- logger_1.LOGGER.debug(`Check if branch exists: ${asDebugArg(path)}`);
68
162
  cdIfPresent(path);
69
163
  return sh.exec(`git branch --list ${branch}`, (0, command_util_1.getShellConfig)()).stdout.trim().length !== 0;
70
164
  }
71
165
  exports.hasBranch = hasBranch;
72
166
  function getRemoteUrl(path) {
73
- logger_1.LOGGER.debug(`Retrieve remote git url for: ${asDebugArg(path)}`);
74
167
  cdIfPresent(path);
75
168
  return sh.exec('git config --get remote.origin.url', (0, command_util_1.getShellConfig)()).stdout.trim();
76
169
  }
77
170
  exports.getRemoteUrl = getRemoteUrl;
78
171
  function cdIfPresent(path) {
79
172
  if (path) {
80
- (0, validation_util_1.validateGitDirectory)(path);
81
173
  sh.cd(path);
82
174
  }
83
175
  }
84
- function asDebugArg(path) {
85
- return path !== null && path !== void 0 ? path : sh.pwd().stdout;
86
- }
87
176
  //# 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,gBAAgB,EAAE,IAAA,6BAAc,GAAE,CAAC,CAAC;IAC3D,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE;QACnB,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,OAAO,KAAK,CAAC;SAChB;QACD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KAClC;IACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE;QAC3D,eAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAC3D,OAAO,KAAK,CAAC;KAChB;IACD,eAAM,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC;AAChB,CAAC;AAjBD,4DAiBC;AAED,SAAgB,eAAe,CAAC,IAAY;IACxC,eAAM,CAAC,KAAK,CAAC,+CAA+C,IAAI,EAAE,CAAC,CAAC;IACpE,EAAE,CAAC,EAAE,CAAC,IAAI,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,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,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AAE,GAAG,IAAI,CAAC;IACzC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;IACvC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IACzC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;CACxB,CAAC;AAEX,SAAS,GAAG,CAAC,KAAe,EAAE,GAAG,IAAW;IACxC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,cAAc,GAAG,SAAS,CAAC,SAAS,EAAE;QACtC,OAAO;KACV;IACD,OAAO,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,IAAI,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,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateGitDirectory = exports.validateVersion = exports.validateDirectory = exports.COMMAND_VERSION = void 0;
3
+ exports.validateGitDirectory = exports.validateVersion = exports.validateFile = exports.validateDirectory = exports.COMMAND_VERSION = void 0;
4
4
  /********************************************************************************
5
5
  * Copyright (c) 2022 EclipseSource and others.
6
6
  *
@@ -34,10 +34,21 @@ function validateDirectory(rootDir) {
34
34
  return path;
35
35
  }
36
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;
37
48
  function validateVersion(version) {
38
49
  logger_1.LOGGER.debug(`Validate version format of: ${version}`);
39
50
  if (!semver.valid(version)) {
40
- throw new Error(`Not a valid version: ${version}`);
51
+ throw new commander_1.InvalidArgumentError(`Not a valid version: ${version}`);
41
52
  }
42
53
  return version;
43
54
  }
@@ -45,9 +56,9 @@ exports.validateVersion = validateVersion;
45
56
  function validateGitDirectory(repository) {
46
57
  const repoPath = validateDirectory(repository);
47
58
  if (!(0, git_util_1.isGitRepository)(repoPath)) {
48
- throw new Error('Not a valid git repository');
59
+ throw new commander_1.InvalidArgumentError('Not a valid git repository');
49
60
  }
50
- return repoPath;
61
+ return (0, git_util_1.getGitRoot)(repository);
51
62
  }
52
63
  exports.validateGitDirectory = validateGitDirectory;
53
64
  //# 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;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,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AAI,gCAAoB,CAAC,wBAAwB,CAAC,CAAC;KAC5D;IACD,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QAC7B,MAAM,IAAI,gCAAoB,CAAC,aAAa,CAAC,CAAC;KACjD;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAVD,oCAUC;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,gCAAoB,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;KACrE;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,gCAAoB,CAAC,4BAA4B,CAAC,CAAC;KAChE;IAED,OAAO,IAAA,qBAAU,EAAC,UAAU,CAAC,CAAC;AAClC,CAAC;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.7026c40.129+7026c40",
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,42 @@
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
44
  "commander": "^9.4.0",
45
+ "glob": "^8.0.3",
39
46
  "node-fetch": "2.6.7",
40
47
  "readline-sync": "^1.4.10",
41
48
  "semver": "^7.3.7",
42
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.7026c40.129+7026c40",
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
57
  "@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"
58
+ "ts-node": "^10.9.1"
55
59
  },
56
- "bin": {
57
- "glsp": "bin/glsp"
60
+ "publishConfig": {
61
+ "access": "public"
58
62
  },
59
- "files": [
60
- "src",
61
- "bin",
62
- "lib"
63
- ],
64
- "gitHead": "4c6590739921232e7f8b1d99a85a940debb13e0b"
63
+ "gitHead": "7026c40d0dafe0b03a94bf0813612de8179cef54"
65
64
  }
package/src/app.ts CHANGED
@@ -14,36 +14,17 @@
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';
21
+ export const COMMAND_VERSION = '1.1.0-next';
23
22
 
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)
23
+ const app = baseCommand() //
24
+ .version(COMMAND_VERSION)
46
25
  .name('glsp')
47
- .addCommand(ReleaseCommand);
26
+ .addCommand(CoverageReportCommand)
27
+ .addCommand(ReleaseCommand)
28
+ .addCommand(CheckHeaderCommand);
48
29
 
49
30
  app.parse(process.argv);