@eclipse-glsp/cli 1.1.0-next.28fb493.121 → 1.1.0-next.3b7f01d.144

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 (47) hide show
  1. package/README.md +4 -4
  2. package/lib/app.d.ts.map +1 -1
  3. package/lib/app.js.map +1 -1
  4. package/lib/commands/check-header.d.ts +2 -2
  5. package/lib/commands/check-header.d.ts.map +1 -1
  6. package/lib/commands/check-header.js +79 -23
  7. package/lib/commands/check-header.js.map +1 -1
  8. package/lib/commands/coverage-report.js +26 -3
  9. package/lib/commands/coverage-report.js.map +1 -1
  10. package/lib/commands/release/common.d.ts +1 -1
  11. package/lib/commands/release/common.d.ts.map +1 -1
  12. package/lib/commands/release/common.js +40 -14
  13. package/lib/commands/release/common.js.map +1 -1
  14. package/lib/commands/release/release-client.d.ts.map +1 -1
  15. package/lib/commands/release/release-client.js +29 -8
  16. package/lib/commands/release/release-client.js.map +1 -1
  17. package/lib/commands/release/release-eclipse-integration.js +24 -1
  18. package/lib/commands/release/release-eclipse-integration.js.map +1 -1
  19. package/lib/commands/release/release-java-server.js +24 -1
  20. package/lib/commands/release/release-java-server.js.map +1 -1
  21. package/lib/commands/release/release-server-node.js +24 -1
  22. package/lib/commands/release/release-server-node.js.map +1 -1
  23. package/lib/commands/release/release-theia-integration.d.ts.map +1 -1
  24. package/lib/commands/release/release-theia-integration.js +26 -14
  25. package/lib/commands/release/release-theia-integration.js.map +1 -1
  26. package/lib/commands/release/release-vscode-integration.js +25 -2
  27. package/lib/commands/release/release-vscode-integration.js.map +1 -1
  28. package/lib/commands/release/release.d.ts.map +1 -1
  29. package/lib/commands/release/release.js +32 -9
  30. package/lib/commands/release/release.js.map +1 -1
  31. package/lib/util/command-util.js +24 -1
  32. package/lib/util/command-util.js.map +1 -1
  33. package/lib/util/git-util.d.ts +5 -3
  34. package/lib/util/git-util.d.ts.map +1 -1
  35. package/lib/util/git-util.js +34 -6
  36. package/lib/util/git-util.js.map +1 -1
  37. package/lib/util/validation-util.js +25 -2
  38. package/lib/util/validation-util.js.map +1 -1
  39. package/package.json +8 -9
  40. package/src/app.ts +1 -0
  41. package/src/commands/check-header.ts +65 -25
  42. package/src/commands/release/common.ts +5 -5
  43. package/src/commands/release/release-client.ts +6 -10
  44. package/src/commands/release/release-theia-integration.ts +6 -18
  45. package/src/commands/release/release-vscode-integration.ts +2 -1
  46. package/src/commands/release/release.ts +11 -11
  47. package/src/util/git-util.ts +10 -5
@@ -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,yCAAyD;AACzD,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,YAAY,CAAC,QAAgB,EAAE,UAAU,GAAG,KAAK;IAC7D,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,QAAQ,CAAC,CAAC;IAE/B,IAAI,UAAU,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACpC,MAAM,IAAI,gCAAoB,CAAC,wBAAwB,CAAC,CAAC;KAC5D;IACD,IAAI,CAAC,EAAE,C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fb493",
3
+ "version": "1.1.0-next.3b7f01d.144+3b7f01d",
4
4
  "description": "CLI Tooling & scripts for GLSP components",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -41,24 +41,23 @@
41
41
  "watch": "tsc -w"
42
42
  },
43
43
  "dependencies": {
44
- "commander": "^9.4.0",
44
+ "commander": "^10.0.1",
45
45
  "glob": "^8.0.3",
46
- "node-fetch": "2.6.7",
46
+ "node-fetch": "^2.6.11",
47
47
  "readline-sync": "^1.4.10",
48
- "semver": "^7.3.7",
49
- "shelljs": "0.8.5"
48
+ "semver": "^7.5.1",
49
+ "shelljs": "^0.8.5"
50
50
  },
51
51
  "devDependencies": {
52
- "@eclipse-glsp/config": "1.1.0-next.28fb493.121+28fb493",
52
+ "@eclipse-glsp/config": "1.1.0-next.3b7f01d.144+3b7f01d",
53
53
  "@types/glob": "^8.0.0",
54
54
  "@types/node-fetch": "2.6.2",
55
55
  "@types/readline-sync": "1.4.4",
56
56
  "@types/semver": "7.3.12",
57
- "@types/shelljs": "0.8.11",
58
- "ts-node": "^10.9.1"
57
+ "@types/shelljs": "0.8.11"
59
58
  },
60
59
  "publishConfig": {
61
60
  "access": "public"
62
61
  },
63
- "gitHead": "28fb4937509ef26d95a20996b342a8344f116238"
62
+ "gitHead": "3b7f01d088c3dc4048b5428b6660aafe9783dde9"
64
63
  }
package/src/app.ts CHANGED
@@ -18,6 +18,7 @@ import { CheckHeaderCommand } from './commands/check-header';
18
18
  import { CoverageReportCommand } from './commands/coverage-report';
19
19
  import { ReleaseCommand } from './commands/release/release';
20
20
  import { baseCommand } from './util/command-util';
21
+
21
22
  export const COMMAND_VERSION = '1.1.0-next';
22
23
 
23
24
  const app = baseCommand() //
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 EclipseSource and others.
2
+ * Copyright (c) 2022-2023 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -18,8 +18,9 @@ import { Option } from 'commander';
18
18
  import * as fs from 'fs';
19
19
  import { glob } from 'glob';
20
20
  import * as minimatch from 'minimatch';
21
+ import * as readline from 'readline-sync';
21
22
  import * as sh from 'shelljs';
22
- import { baseCommand, configureShell } from '../util/command-util';
23
+ import { baseCommand, configureShell, getShellConfig } from '../util/command-util';
23
24
  import {
24
25
  getChangesOfLastCommit,
25
26
  getFirstCommit,
@@ -28,6 +29,7 @@ import {
28
29
  getLastModificationDate,
29
30
  getUncommittedChanges
30
31
  } from '../util/git-util';
32
+
31
33
  import { LOGGER } from '../util/logger';
32
34
  import { validateGitDirectory } from '../util/validation-util';
33
35
  import path = require('path');
@@ -35,9 +37,9 @@ export interface HeaderCheckOptions {
35
37
  type: CheckType;
36
38
  exclude: string[];
37
39
  fileExtensions: string[];
38
- headerPattern: string;
39
40
  json: boolean;
40
41
  excludeDefaults: boolean;
42
+ autoFix: boolean;
41
43
  severity: Severity;
42
44
  }
43
45
 
@@ -50,6 +52,8 @@ type Severity = typeof severityTypes[number];
50
52
 
51
53
  const DEFAULT_EXCLUDES = ['**/@(node_modules|lib|dist|bundle)/**'];
52
54
  const YEAR_RANGE_REGEX = /\d{4}(?:-d{4})?/g;
55
+ const HEADER_PATTERN = 'Copyright \\([cC]\\) \\d{4}(-d{4})?';
56
+ const AUTO_FIX_MESSAGE = 'Fix copyright header violations';
53
57
 
54
58
  export const CheckHeaderCommand = baseCommand() //
55
59
  .name('checkHeaders')
@@ -75,17 +79,13 @@ export const CheckHeaderCommand = baseCommand() //
75
79
  '--no-exclude-defaults',
76
80
  'Disables the default excludes patterns. Only explicitly passed exclude patterns (-e, --exclude) are considered'
77
81
  )
78
- .option(
79
- '-p, --headerPattern <pattern>',
80
- 'Regex pattern to extract the copyright year (range) from the header',
81
- 'Copyright \\([cC]\\) \\d{4}(-d{4})?'
82
- )
83
82
  .option('-j, --json', 'Also persist validation results as json file', false)
84
83
  .addOption(
85
84
  new Option('-s, --severity <severity>', 'The severity of validation results that should be printed.')
86
85
  .choices(severityTypes)
87
86
  .default('error', '"error" (only)')
88
87
  )
88
+ .option('-a, --autoFix', 'Auto apply & commit fixes without prompting the user', false)
89
89
  .action(checkHeaders);
90
90
 
91
91
  export function checkHeaders(rootDir: string, options: HeaderCheckOptions): void {
@@ -102,8 +102,8 @@ export function checkHeaders(rootDir: string, options: HeaderCheckOptions): void
102
102
  LOGGER.info('Check completed');
103
103
  return;
104
104
  }
105
- const result = validate(rootDir, files, options);
106
- displayValidationResult(rootDir, result, options);
105
+ const results = validate(rootDir, files, options);
106
+ handleValidationResults(rootDir, results, options);
107
107
  }
108
108
 
109
109
  function getFiles(rootDir: string, options: HeaderCheckOptions): string[] {
@@ -123,14 +123,14 @@ function getFiles(rootDir: string, options: HeaderCheckOptions): string[] {
123
123
  excludePattern.forEach(pattern => {
124
124
  changedFiles = changedFiles.filter(minimatch.filter(`!${pattern}`));
125
125
  });
126
- return changedFiles;
126
+ return changedFiles.filter(file => fs.existsSync(file));
127
127
  }
128
128
 
129
129
  function validate(rootDir: string, files: string[], options: HeaderCheckOptions): ValidationResult[] {
130
130
  // Derives all files with valid headers, their copyright years and all files with no or invalid headers
131
- const filesWithHeader = sh.grep('-l', options.headerPattern, files).stdout.trim().split('\n');
131
+ const filesWithHeader = sh.grep('-l', HEADER_PATTERN, files).stdout.trim().split('\n');
132
132
  const copyrightYears = sh
133
- .grep(options.headerPattern, files)
133
+ .grep(HEADER_PATTERN, files)
134
134
  .stdout.trim()
135
135
  .split('\n')
136
136
  .map(line => line.match(YEAR_RANGE_REGEX)!.map(string => Number.parseInt(string, 10)));
@@ -146,7 +146,7 @@ function validate(rootDir: string, files: string[], options: HeaderCheckOptions)
146
146
  LOGGER.info(`Found ${noHeadersLength} files with no (or an invalid) copyright header`);
147
147
  }
148
148
  noHeaders.forEach((file, i) => {
149
- printValidationProgress(i + 1, allFilesLength, file);
149
+ printFileProgress(i + 1, allFilesLength, `Validating ${file}`);
150
150
  results.push({ file: path.resolve(rootDir, file), violation: 'noOrMissingHeader', severity: 'error' });
151
151
  });
152
152
 
@@ -160,13 +160,13 @@ function validate(rootDir: string, files: string[], options: HeaderCheckOptions)
160
160
 
161
161
  // Create validation results for all files with valid headers
162
162
  filesWithHeader.forEach((file, i) => {
163
- printValidationProgress(i + 1 + noHeadersLength, allFilesLength, file);
163
+ printFileProgress(i + 1 + noHeadersLength, allFilesLength, `Validating ${file}`);
164
164
 
165
165
  const result: DateValidationResult = {
166
166
  currentStartYear: copyrightYears[i].shift()!,
167
- expectedStartYear: getFirstModificationDate(file)!.getFullYear(),
167
+ expectedStartYear: getFirstModificationDate(file, rootDir, AUTO_FIX_MESSAGE)!.getFullYear(),
168
168
  currentEndYear: copyrightYears[i].shift(),
169
- expectedEndYear: defaultEndYear ?? getLastModificationDate(file)!.getFullYear(),
169
+ expectedEndYear: defaultEndYear ?? getLastModificationDate(file, rootDir, AUTO_FIX_MESSAGE)!.getFullYear(),
170
170
  file,
171
171
  severity: 'ok',
172
172
  violation: 'none'
@@ -239,19 +239,21 @@ function validateTimePeriod(result: DateValidationResult): void {
239
239
  }
240
240
  }
241
241
 
242
- function printValidationProgress(currentFileCount: number, maxFileCount: number, file: string): void {
243
- process.stdout.clearLine(0);
244
- process.stdout.cursorTo(0);
245
- process.stdout.write(`[${currentFileCount} of ${maxFileCount}] Validating ${file}`);
242
+ function printFileProgress(currentFileCount: number, maxFileCount: number, message: string, clear = true): void {
243
+ if (clear) {
244
+ process.stdout.clearLine(0);
245
+ process.stdout.cursorTo(0);
246
+ }
247
+ process.stdout.write(`[${currentFileCount} of ${maxFileCount}] ${message}`);
248
+ if (!clear) {
249
+ process.stdout.write('\n');
250
+ }
246
251
  }
247
252
 
248
- export function displayValidationResult(rootDir: string, results: ValidationResult[], options: HeaderCheckOptions): void {
253
+ export function handleValidationResults(rootDir: string, results: ValidationResult[], options: HeaderCheckOptions): void {
249
254
  LOGGER.newLine();
250
255
  LOGGER.info(`Header validation for ${results.length} files completed`);
251
256
  const violations = results.filter(result => result.severity === 'error');
252
- LOGGER.info(`Found ${violations.length} copyright header violations:`);
253
- LOGGER.newLine();
254
-
255
257
  // Adjust results to print based on configured severity level
256
258
  let toPrint = results;
257
259
  if (options.severity === 'error') {
@@ -259,6 +261,10 @@ export function displayValidationResult(rootDir: string, results: ValidationResu
259
261
  } else if (options.severity === 'warn') {
260
262
  toPrint = results.filter(result => result.severity !== 'ok');
261
263
  }
264
+
265
+ LOGGER.info(`Found ${toPrint.length} copyright header violations:`);
266
+ LOGGER.newLine();
267
+
262
268
  toPrint.forEach((result, i) => LOGGER.info(`${i + 1}. `, result.file, ':', toPrintMessage(result)));
263
269
 
264
270
  LOGGER.newLine();
@@ -266,6 +272,14 @@ export function displayValidationResult(rootDir: string, results: ValidationResu
266
272
  if (options.json) {
267
273
  fs.writeFileSync(path.join(rootDir, 'headerCheck.json'), JSON.stringify(results, undefined, 2));
268
274
  }
275
+
276
+ if (violations.length > 0 && (options.autoFix || readline.keyInYN('Do you want automatically fix copyright year range violations?'))) {
277
+ const toFix = violations.filter(
278
+ violation => violation.severity === 'error' && isDateValidationResult(violation)
279
+ ) as DateValidationResult[];
280
+ fixViolations(rootDir, toFix, options);
281
+ }
282
+
269
283
  LOGGER.info('Check completed');
270
284
  }
271
285
 
@@ -294,6 +308,32 @@ function toPrintMessage(result: ValidationResult): string {
294
308
  return `${colors[result.severity]} OK`;
295
309
  }
296
310
 
311
+ function fixViolations(rootDir: string, violations: DateValidationResult[], options: HeaderCheckOptions): void {
312
+ LOGGER.newLine();
313
+ violations.forEach((violation, i) => {
314
+ printFileProgress(i + 1, violations.length, `Fix ${violation.file}`, false);
315
+ const fixedStartYear =
316
+ violation.currentStartYear < violation.expectedStartYear ? violation.currentStartYear : violation.expectedStartYear;
317
+
318
+ const currentRange = `${violation.currentStartYear}${violation.currentEndYear ? '-' + violation.currentEndYear : ''}`;
319
+
320
+ let fixedRange = `${fixedStartYear}`;
321
+ if (violation.expectedEndYear !== violation.expectedStartYear || fixedStartYear !== violation.expectedStartYear) {
322
+ fixedRange = `${fixedStartYear}-${violation.expectedEndYear}`;
323
+ }
324
+
325
+ sh.sed('-i', RegExp('Copyright \\([cC]\\) ' + currentRange), `Copyright (c) ${fixedRange}`, violation.file);
326
+ });
327
+ LOGGER.newLine();
328
+ if (options.autoFix || readline.keyInYN('Do you want to create a commit for the fixed files?')) {
329
+ LOGGER.newLine();
330
+ const files = violations.map(violation => violation.file).join(' ');
331
+ sh.exec(`git add ${files}`, getShellConfig());
332
+ sh.exec(`git commit -m "${AUTO_FIX_MESSAGE}"`);
333
+ LOGGER.newLine();
334
+ }
335
+ }
336
+
297
337
  // Helper types
298
338
  interface ValidationResult {
299
339
  file: string;
@@ -134,8 +134,8 @@ export function checkoutAndCd(options: ReleaseOptions): string {
134
134
  sh.exec(`gh repo clone ${ghUrl}`, getShellConfig());
135
135
  LOGGER.debug(`Successfully cloned to ${directory}`);
136
136
  sh.cd(directory);
137
- if (options.checkoutDir !== 'master') {
138
- sh.exec(`git switch ${options.branch} `);
137
+ if (options.branch !== 'master' && options.branch !== 'main') {
138
+ sh.exec(`git checkout ${options.branch} `);
139
139
  }
140
140
  return sh.pwd();
141
141
  }
@@ -186,7 +186,7 @@ function doPublish(tag: string, preRelease: boolean, latestRelease: string, draf
186
186
  fatalExec(`git push origin HEAD:${tag}`, 'Could not push release branch to Github', getShellConfig({ silent: false }));
187
187
  fatalExec(`git push origin tag ${tag}`, 'Could not push tag to Github', getShellConfig({ silent: false }));
188
188
  const version = tagToVersion(tag);
189
- const titleSuffix = preRelease ? ` Candiate ${version.substring(version.length - 1)}` : '';
189
+ const titleSuffix = preRelease ? ` Candidate ${version.substring(version.lastIndexOf('-RC') + 3)}` : '';
190
190
  const title = `${version.replace(/-.*/, '')} Release${titleSuffix} `;
191
191
  sh.exec(
192
192
  `gh release create ${tag} -t "${title}" --notes-start-tag ${latestRelease} --generate-notes ${draft ? '-d' : ''} ${
@@ -257,8 +257,8 @@ export function asMvnVersion(version: string): string {
257
257
  return mavenVersion;
258
258
  }
259
259
 
260
- export async function checkIfNpmVersionExists(pckgName: string, newVersion: string): Promise<void> {
261
- LOGGER.debug(`Check if version exists on npm: ${newVersion}`);
260
+ export async function checkIfNpmVersionIsNew(pckgName: string, newVersion: string): Promise<void> {
261
+ LOGGER.debug(`Check that the release version is new i.e. does not exist on npm: ${newVersion}`);
262
262
 
263
263
  const response = await fetch(`https://registry.npmjs.org/${pckgName}/${newVersion}`);
264
264
  const data = await response.json();
@@ -16,15 +16,13 @@
16
16
  import * as sh from 'shelljs';
17
17
  import { LOGGER } from '../../util/logger';
18
18
  import {
19
- asMvnVersion,
20
- checkJavaServerVersion,
21
19
  checkoutAndCd,
22
20
  commitAndTag,
23
21
  lernaSetVersion,
24
22
  publish,
25
23
  ReleaseOptions,
26
24
  updateLernaForDryRun,
27
- updateServerConfig,
25
+ updateVersion,
28
26
  yarnInstall
29
27
  } from './common';
30
28
 
@@ -34,7 +32,7 @@ export async function releaseClient(options: ReleaseOptions): Promise<void> {
34
32
  LOGGER.info('Prepare glsp-client release');
35
33
  LOGGER.debug('Release options: ', options.version);
36
34
  REPO_ROOT = checkoutAndCd(options);
37
- await updateDownloadServerScript(options.version, options.force);
35
+ updateExternalGLSPDependencies(options.version);
38
36
  generateChangeLog();
39
37
  lernaSetVersion(REPO_ROOT, options.version);
40
38
  build();
@@ -45,12 +43,10 @@ export async function releaseClient(options: ReleaseOptions): Promise<void> {
45
43
  publish(REPO_ROOT, options);
46
44
  }
47
45
 
48
- async function updateDownloadServerScript(version: string, force: boolean): Promise<void> {
49
- LOGGER.info('Update example server download config');
50
- const mvnVersion = asMvnVersion(version);
51
- checkJavaServerVersion(version, force);
52
- sh.cd(`${REPO_ROOT}/examples/workflow-glsp/scripts`);
53
- updateServerConfig('config.json', mvnVersion, false);
46
+ function updateExternalGLSPDependencies(version: string): void {
47
+ LOGGER.info('Update external GLSP dependencies (workflow example server)');
48
+ sh.cd(REPO_ROOT);
49
+ updateVersion({ name: '@eclipse-glsp-examples/workflow-server-bundled', version });
54
50
  }
55
51
 
56
52
  function generateChangeLog(): void {
@@ -17,15 +17,12 @@
17
17
  import * as sh from 'shelljs';
18
18
  import { LOGGER } from '../../util/logger';
19
19
  import {
20
- asMvnVersion,
21
20
  checkoutAndCd,
22
21
  commitAndTag,
23
- isExistingMavenVersion,
24
22
  lernaSetVersion,
25
23
  publish,
26
24
  ReleaseOptions,
27
25
  updateLernaForDryRun,
28
- updateServerConfig,
29
26
  updateVersion,
30
27
  yarnInstall
31
28
  } from './common';
@@ -37,7 +34,6 @@ export async function releaseTheiaIntegration(options: ReleaseOptions): Promise<
37
34
  LOGGER.debug('Release options: ', options);
38
35
  REPO_ROOT = checkoutAndCd(options);
39
36
  updateExternalGLSPDependencies(options.version);
40
- await updateDownloadServerScript(options.version);
41
37
  generateChangeLog();
42
38
  lernaSetVersion(REPO_ROOT, options.version);
43
39
  build();
@@ -49,21 +45,13 @@ export async function releaseTheiaIntegration(options: ReleaseOptions): Promise<
49
45
  }
50
46
 
51
47
  function updateExternalGLSPDependencies(version: string): void {
52
- LOGGER.info('Update external GLSP dependencies (Client and workflow example)');
48
+ LOGGER.info('Update external GLSP dependencies (Client and workflow example & server)');
53
49
  sh.cd(REPO_ROOT);
54
- updateVersion({ name: '@eclipse-glsp/client', version }, { name: '@eclipse-glsp-examples/workflow-glsp', version });
55
- }
56
-
57
- async function updateDownloadServerScript(version: string): Promise<void> {
58
- LOGGER.info('Update example server download config');
59
- const mvnVersion = asMvnVersion(version);
60
- if (!isExistingMavenVersion('org.eclipse.glsp', 'org.eclipse.glsp.server', mvnVersion)) {
61
- LOGGER.warn(`No Java GLSP server with version ${mvnVersion} found on maven central!. Please release a new Java GLSP Server version
62
- before publishing this release!`);
63
- }
64
-
65
- sh.cd(`${REPO_ROOT}/examples/workflow-theia/src/node`);
66
- updateServerConfig('server-config.json', mvnVersion, false);
50
+ updateVersion(
51
+ { name: '@eclipse-glsp/client', version },
52
+ { name: '@eclipse-glsp-examples/workflow-glsp', version },
53
+ { name: '@eclipse-glsp-examples/workflow-server', version }
54
+ );
67
55
  }
68
56
 
69
57
  function build(): void {
@@ -50,7 +50,8 @@ function updateExternalGLSPDependencies(version: string): void {
50
50
  updateVersion(
51
51
  { name: '@eclipse-glsp/protocol', version },
52
52
  { name: '@eclipse-glsp/client', version },
53
- { name: '@eclipse-glsp-examples/workflow-glsp', version }
53
+ { name: '@eclipse-glsp-examples/workflow-glsp', version },
54
+ { name: '@eclipse-glsp-examples/workflow-server', version }
54
55
  );
55
56
  }
56
57
 
@@ -21,16 +21,16 @@ import * as readline from 'readline-sync';
21
21
  import * as semver from 'semver';
22
22
  import * as sh from 'shelljs';
23
23
  import { baseCommand, configureShell, fatalExec, getShellConfig } from '../../util/command-util';
24
- import { configureLogger, LOGGER } from '../../util/logger';
24
+ import { LOGGER, configureLogger } from '../../util/logger';
25
25
  import { validateDirectory, validateVersion } from '../../util/validation-util';
26
26
  import {
27
- asMvnVersion,
28
- checkIfMavenVersionExists,
29
- checkIfNpmVersionExists,
30
27
  Component,
31
28
  ReleaseOptions,
32
29
  ReleaseType,
33
- VERDACCIO_REGISTRY
30
+ VERDACCIO_REGISTRY,
31
+ asMvnVersion,
32
+ checkIfMavenVersionExists,
33
+ checkIfNpmVersionIsNew
34
34
  } from './common';
35
35
  import { releaseClient } from './release-client';
36
36
  import { releaseEclipseIntegration } from './release-eclipse-integration';
@@ -91,19 +91,19 @@ export async function release(
91
91
  checkIfMavenVersionExists('org.eclipse.glsp', 'org.eclipse.glsp.server', asMvnVersion(version));
92
92
  return releaseJavaServer(options);
93
93
  case 'server-node':
94
- await checkIfNpmVersionExists('@eclipse-glsp/server-node', version);
94
+ await checkIfNpmVersionIsNew('@eclipse-glsp/server-node', version);
95
95
  return releaseServerNode(options);
96
96
  case 'client':
97
- await checkIfNpmVersionExists('@eclipse-glsp/client', version);
97
+ await checkIfNpmVersionIsNew('@eclipse-glsp/client', version);
98
98
  return releaseClient(options);
99
99
  case 'theia-integration':
100
- await checkIfNpmVersionExists('@eclipse-glsp/theia-integration', version);
100
+ await checkIfNpmVersionIsNew('@eclipse-glsp/theia-integration', version);
101
101
  return releaseTheiaIntegration(options);
102
102
  case 'vscode-integration':
103
- await checkIfNpmVersionExists('@eclipse-glsp/vscode-integration', version);
103
+ await checkIfNpmVersionIsNew('@eclipse-glsp/vscode-integration', version);
104
104
  return releaseVscodeIntegration(options);
105
105
  case 'eclipse-integration':
106
- await checkIfNpmVersionExists('@eclipse-glsp/ide', version);
106
+ await checkIfNpmVersionIsNew('@eclipse-glsp/ide', version);
107
107
  return releaseEclipseIntegration(options);
108
108
  }
109
109
  } catch (err) {
@@ -134,7 +134,7 @@ function isGithubCLIAuthenticated(): boolean {
134
134
  }
135
135
  throw new Error(status.stderr);
136
136
  }
137
- if (!status.stderr.trim().includes('Logged in to github.com')) {
137
+ if (!status.stdout.trim().includes('Logged in to github.com')) {
138
138
  LOGGER.debug("No user is logged in for host 'github.com'");
139
139
  return false;
140
140
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 EclipseSource and others.
2
+ * Copyright (c) 2022-2022 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -48,6 +48,7 @@ export function getUncommittedChanges(path?: string): string[] {
48
48
  .exec('git status --porcelain', getShellConfig())
49
49
  .stdout.trim()
50
50
  .split('\n')
51
+ .filter(value => value.trim().length !== 0)
51
52
  .map(fileInfo =>
52
53
  // Extract relative file path from the info string and convert to absolute path
53
54
  resolve(path ?? process.cwd(), fileInfo.trim().split(' ').pop() ?? '')
@@ -71,11 +72,13 @@ export function getChangesOfLastCommit(path?: string): string[] {
71
72
  * Returns the last modification date of a file (or the last commit) in a git repo.
72
73
  * @param filePath The file. If undefined the modification date of the last commit will be returned
73
74
  * @param repoRoot The path to the repo root. If undefined the current working directory is used.
75
+ * @param excludeMessage Only consider commits that don`t match the excludeMessage
74
76
  * @returns The date or undefined if the file is outside of the git repo.
75
77
  */
76
- export function getLastModificationDate(filePath?: string, repoRoot?: string): Date | undefined {
78
+ export function getLastModificationDate(filePath?: string, repoRoot?: string, excludeMessage?: string): Date | undefined {
77
79
  cdIfPresent(repoRoot);
78
- const result = sh.exec(`git log -1 --pretty="format:%ci" ${filePath ?? ''}`, getShellConfig());
80
+ const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : '';
81
+ const result = sh.exec(`git log -1 ${additionalArgs} --pretty="format:%ci" ${filePath ?? ''}`, getShellConfig());
79
82
  if (result.code !== 0) {
80
83
  return undefined;
81
84
  }
@@ -85,11 +88,13 @@ export function getLastModificationDate(filePath?: string, repoRoot?: string): D
85
88
  * Returns the last modification date of a file in a git repo.
86
89
  * @param filePath The file
87
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
88
92
  * @returns The date or undefined if the file is outside of the git repo.
89
93
  */
90
- export function getFirstModificationDate(filePath: string, repoRoot?: string): Date | undefined {
94
+ export function getFirstModificationDate(filePath: string, repoRoot?: string, excludeMessage?: string): Date | undefined {
91
95
  cdIfPresent(repoRoot);
92
- const result = sh.exec(`git log --pretty="format:%ci" --follow ${filePath}`, getShellConfig());
96
+ const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : '';
97
+ const result = sh.exec(`git log ${additionalArgs} --pretty="format:%ci" --follow ${filePath}`, getShellConfig());
93
98
  if (result.code !== 0) {
94
99
  return undefined;
95
100
  }