@eclipse-glsp/cli 1.1.0-next.164cf99.124
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.
- package/LICENSE +642 -0
- package/README.md +89 -0
- package/bin/glsp +2 -0
- package/lib/app.d.ts +3 -0
- package/lib/app.d.ts.map +1 -0
- package/lib/app.js +32 -0
- package/lib/app.js.map +1 -0
- package/lib/commands/check-header.d.ts +24 -0
- package/lib/commands/check-header.d.ts.map +1 -0
- package/lib/commands/check-header.js +267 -0
- package/lib/commands/check-header.js.map +1 -0
- package/lib/commands/coverage-report.d.ts +29 -0
- package/lib/commands/coverage-report.d.ts.map +1 -0
- package/lib/commands/coverage-report.js +100 -0
- package/lib/commands/coverage-report.js.map +1 -0
- package/lib/commands/release/common.d.ts +69 -0
- package/lib/commands/release/common.d.ts.map +1 -0
- package/lib/commands/release/common.js +273 -0
- package/lib/commands/release/common.js.map +1 -0
- package/lib/commands/release/release-client.d.ts +3 -0
- package/lib/commands/release/release-client.d.ts.map +1 -0
- package/lib/commands/release/release-client.js +53 -0
- package/lib/commands/release/release-client.js.map +1 -0
- package/lib/commands/release/release-eclipse-integration.d.ts +18 -0
- package/lib/commands/release/release-eclipse-integration.d.ts.map +1 -0
- package/lib/commands/release/release-eclipse-integration.js +90 -0
- package/lib/commands/release/release-eclipse-integration.js.map +1 -0
- package/lib/commands/release/release-java-server.d.ts +3 -0
- package/lib/commands/release/release-java-server.d.ts.map +1 -0
- package/lib/commands/release/release-java-server.js +68 -0
- package/lib/commands/release/release-java-server.js.map +1 -0
- package/lib/commands/release/release-server-node.d.ts +18 -0
- package/lib/commands/release/release-server-node.d.ts.map +1 -0
- package/lib/commands/release/release-server-node.js +51 -0
- package/lib/commands/release/release-server-node.js.map +1 -0
- package/lib/commands/release/release-theia-integration.d.ts +18 -0
- package/lib/commands/release/release-theia-integration.d.ts.map +1 -0
- package/lib/commands/release/release-theia-integration.js +62 -0
- package/lib/commands/release/release-theia-integration.js.map +1 -0
- package/lib/commands/release/release-vscode-integration.d.ts +18 -0
- package/lib/commands/release/release-vscode-integration.d.ts.map +1 -0
- package/lib/commands/release/release-vscode-integration.js +51 -0
- package/lib/commands/release/release-vscode-integration.js.map +1 -0
- package/lib/commands/release/release.d.ts +14 -0
- package/lib/commands/release/release.d.ts.map +1 -0
- package/lib/commands/release/release.js +165 -0
- package/lib/commands/release/release.js.map +1 -0
- package/lib/util/command-util.d.ts +26 -0
- package/lib/util/command-util.d.ts.map +1 -0
- package/lib/util/command-util.js +53 -0
- package/lib/util/command-util.js.map +1 -0
- package/lib/util/git-util.d.ts +62 -0
- package/lib/util/git-util.d.ts.map +1 -0
- package/lib/util/git-util.js +176 -0
- package/lib/util/git-util.js.map +1 -0
- package/lib/util/logger.d.ts +23 -0
- package/lib/util/logger.d.ts.map +1 -0
- package/lib/util/logger.js +50 -0
- package/lib/util/logger.js.map +1 -0
- package/lib/util/validation-util.d.ts +6 -0
- package/lib/util/validation-util.d.ts.map +1 -0
- package/lib/util/validation-util.js +64 -0
- package/lib/util/validation-util.js.map +1 -0
- package/package.json +64 -0
- package/src/app.ts +30 -0
- package/src/commands/check-header.ts +355 -0
- package/src/commands/coverage-report.ts +113 -0
- package/src/commands/release/common.ts +312 -0
- package/src/commands/release/release-client.ts +64 -0
- package/src/commands/release/release-eclipse-integration.ts +113 -0
- package/src/commands/release/release-java-server.ts +73 -0
- package/src/commands/release/release-server-node.ts +61 -0
- package/src/commands/release/release-theia-integration.ts +77 -0
- package/src/commands/release/release-vscode-integration.ts +65 -0
- package/src/commands/release/release.ts +215 -0
- package/src/util/command-util.ts +54 -0
- package/src/util/git-util.ts +177 -0
- package/src/util/logger.ts +57 -0
- package/src/util/validation-util.ts +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Eclipse GLSP - CLI
|
|
2
|
+
|
|
3
|
+
The `@eclipse-glsp/cli` package provides helpful scripts and commands for extension and application development.
|
|
4
|
+
The contributed `glsp`, is a command line tool that offers all contributed commands.
|
|
5
|
+
|
|
6
|
+
## Getting Started
|
|
7
|
+
|
|
8
|
+
Install `@eclipse-glsp/cli` as a dev dependency in your application.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
yarn add @eclipse-glsp/cli --dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## checkHeaders
|
|
15
|
+
|
|
16
|
+
The `checkHeaders` command can be used to validate the copyright year (range) of license headers.
|
|
17
|
+
It checks for each file (matching the include pattern) whether the defined copyright range is in line with the first and last modification date in the git repository.
|
|
18
|
+
Found violations are printed to the console and can be fixed automatically.
|
|
19
|
+
The validation check can be restricted to pending changes and/or the last commit e.g. to validate a commit before creating a PR.
|
|
20
|
+
|
|
21
|
+
```console
|
|
22
|
+
$ glsp checkHeaders -h
|
|
23
|
+
|
|
24
|
+
Usage: glsp checkHeaders [options] <rootDir>
|
|
25
|
+
|
|
26
|
+
Validates the copyright year range of license header files
|
|
27
|
+
|
|
28
|
+
Arguments:
|
|
29
|
+
rootDir The starting directory for the check
|
|
30
|
+
|
|
31
|
+
Options:
|
|
32
|
+
-t, --type <type> The scope of the check. In addition to a full recursive check, is also possible to only consider pending changes or the last commit (choices: "full", "changes", "lastCommit", default:
|
|
33
|
+
"full")
|
|
34
|
+
-f, --fileExtensions <extensions...> File extensions that should be checked (default: ["ts","tsx"])
|
|
35
|
+
-e, --exclude <exclude...> File patterns that should be excluded from the check. New exclude patterns are added to the default patterns (default: [**/@(node_modules|lib|dist|bundle)/**])
|
|
36
|
+
--no-exclude-defaults Disables the default excludes patterns. Only explicitly passed exclude patterns (-e, --exclude) are considered
|
|
37
|
+
-j, --json Also persist validation results as json file (default: false)
|
|
38
|
+
-s, --severity <severity> The severity of validation results that should be printed. (choices: "error", "warn", "ok", default: "error" (only))
|
|
39
|
+
-a, --autoFix Auto apply & commit fixes without prompting the user (default: false)
|
|
40
|
+
-h, --help display help for command
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## coverageReport
|
|
44
|
+
|
|
45
|
+
The `coverageReport` command can be used to create a full nyc test coverage report for a lerna/yarn mono repository.
|
|
46
|
+
Individual coverage reports for each package are created and then combined to a full report.
|
|
47
|
+
|
|
48
|
+
```console
|
|
49
|
+
$ glsp coverageReport -h
|
|
50
|
+
Usage: glsp coverageReport [options]
|
|
51
|
+
|
|
52
|
+
Generate a test coverage report for a glsp component
|
|
53
|
+
|
|
54
|
+
Options:
|
|
55
|
+
-p, --projectRoot <projectRoot> The root directory of the GLSP component (default: "<cwd>")
|
|
56
|
+
-c, --coverageScript <script> Script command of the package root for creating coverage reports (default: "test:coverage")
|
|
57
|
+
-h, --help display help for command
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## release
|
|
61
|
+
|
|
62
|
+
Eclipse GLSP committers can use the `release` command to prepare & publish a new Github release for a specific GLSP component.
|
|
63
|
+
|
|
64
|
+
```console
|
|
65
|
+
$ glsp release -h
|
|
66
|
+
Usage: glsp release [options] <component> <releaseType> [customVersion]
|
|
67
|
+
|
|
68
|
+
Prepare & publish a new release for a glsp component
|
|
69
|
+
|
|
70
|
+
Arguments:
|
|
71
|
+
component The glsp component to be released (choices: "client", "theia-integration", "vscode-integration", "eclipse-integration", "server-node", "server-java")
|
|
72
|
+
releaseType The release type (choices: "major", "minor", "patch", "rc", "custom")
|
|
73
|
+
customVersion Custom version number. Will be ignored if the release type is not "custom"
|
|
74
|
+
|
|
75
|
+
Options:
|
|
76
|
+
-f, --force Enable force mode (default: false)
|
|
77
|
+
-d, --checkoutDir <checkoutDir> The git checkout directory (default: "<cwd>")
|
|
78
|
+
-b, --branch <branch> The git branch to checkout (default: "master")
|
|
79
|
+
-v, --verbose Enable verbose (debug) log output (default: false)
|
|
80
|
+
--no-publish Only prepare release but do not publish to github
|
|
81
|
+
--draft Publish github releases as drafts (default: false)
|
|
82
|
+
--npm-dryRun Execute a npm dry-run for inspection. Publishes to the local npm registry and does not publish to github (default: false)
|
|
83
|
+
-h, --help display help for command
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## More information
|
|
87
|
+
|
|
88
|
+
For more information, please visit the [Eclipse GLSP Umbrella repository](https://github.com/eclipse-glsp/glsp) and the [Eclipse GLSP Website](https://www.eclipse.org/glsp/).
|
|
89
|
+
If you have questions, please raise them in the [discussions](https://github.com/eclipse-glsp/glsp/discussions) and have a look at our [communication and support options](https://www.eclipse.org/glsp/contact/).
|
package/bin/glsp
ADDED
package/lib/app.d.ts
ADDED
package/lib/app.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";AAoBA,eAAO,MAAM,eAAe,eAAe,CAAC"}
|
package/lib/app.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.COMMAND_VERSION = void 0;
|
|
5
|
+
/********************************************************************************
|
|
6
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
7
|
+
*
|
|
8
|
+
* This program and the accompanying materials are made available under the
|
|
9
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
+
*
|
|
12
|
+
* This Source Code may also be made available under the following Secondary
|
|
13
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
+
* with the GNU Classpath Exception which is available at
|
|
16
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
17
|
+
*
|
|
18
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
19
|
+
********************************************************************************/
|
|
20
|
+
const check_header_1 = require("./commands/check-header");
|
|
21
|
+
const coverage_report_1 = require("./commands/coverage-report");
|
|
22
|
+
const release_1 = require("./commands/release/release");
|
|
23
|
+
const command_util_1 = require("./util/command-util");
|
|
24
|
+
exports.COMMAND_VERSION = '1.1.0-next';
|
|
25
|
+
const app = (0, command_util_1.baseCommand)() //
|
|
26
|
+
.version(exports.COMMAND_VERSION)
|
|
27
|
+
.name('glsp')
|
|
28
|
+
.addCommand(coverage_report_1.CoverageReportCommand)
|
|
29
|
+
.addCommand(release_1.ReleaseCommand)
|
|
30
|
+
.addCommand(check_header_1.CheckHeaderCommand);
|
|
31
|
+
app.parse(process.argv);
|
|
32
|
+
//# sourceMappingURL=app.js.map
|
package/lib/app.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";;;;AACA;;;;;;;;;;;;;;kFAckF;AAClF,0DAA6D;AAC7D,gEAAmE;AACnE,wDAA4D;AAC5D,sDAAkD;AACrC,QAAA,eAAe,GAAG,YAAY,CAAC;AAE5C,MAAM,GAAG,GAAG,IAAA,0BAAW,GAAE,CAAC,EAAE;KACvB,OAAO,CAAC,uBAAe,CAAC;KACxB,IAAI,CAAC,MAAM,CAAC;KACZ,UAAU,CAAC,uCAAqB,CAAC;KACjC,UAAU,CAAC,wBAAc,CAAC;KAC1B,UAAU,CAAC,iCAAkB,CAAC,CAAC;AAEpC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface HeaderCheckOptions {
|
|
2
|
+
type: CheckType;
|
|
3
|
+
exclude: string[];
|
|
4
|
+
fileExtensions: string[];
|
|
5
|
+
json: boolean;
|
|
6
|
+
excludeDefaults: boolean;
|
|
7
|
+
autoFix: boolean;
|
|
8
|
+
severity: Severity;
|
|
9
|
+
}
|
|
10
|
+
declare const checkTypes: readonly ["full", "changes", "lastCommit"];
|
|
11
|
+
type CheckType = typeof checkTypes[number];
|
|
12
|
+
declare const severityTypes: readonly ["error", "warn", "ok"];
|
|
13
|
+
type Severity = typeof severityTypes[number];
|
|
14
|
+
export declare const CheckHeaderCommand: import("commander").Command;
|
|
15
|
+
export declare function checkHeaders(rootDir: string, options: HeaderCheckOptions): void;
|
|
16
|
+
export declare function handleValidationResults(rootDir: string, results: ValidationResult[], options: HeaderCheckOptions): void;
|
|
17
|
+
interface ValidationResult {
|
|
18
|
+
file: string;
|
|
19
|
+
severity: Severity;
|
|
20
|
+
violation: Violation;
|
|
21
|
+
}
|
|
22
|
+
type Violation = 'none' | 'noOrMissingHeader' | 'incorrectCopyrightPeriod' | 'invalidCopyrightYear';
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=check-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-header.d.ts","sourceRoot":"","sources":["../../src/commands/check-header.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACtB;AAED,QAAA,MAAM,UAAU,4CAA6C,CAAC;AAC9D,KAAK,SAAS,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAE3C,QAAA,MAAM,aAAa,kCAAmC,CAAC;AAEvD,KAAK,QAAQ,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAO7C,eAAO,MAAM,kBAAkB,6BA+BN,CAAC;AAE1B,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAgB/E;AAkJD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI,CA+BvH;AAsDD,UAAU,gBAAgB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;CACxB;AAaD,KAAK,SAAS,GAAG,MAAM,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleValidationResults = exports.checkHeaders = exports.CheckHeaderCommand = void 0;
|
|
4
|
+
/********************************************************************************
|
|
5
|
+
* Copyright (c) 2022-2023 EclipseSource and others.
|
|
6
|
+
*
|
|
7
|
+
* This program and the accompanying materials are made available under the
|
|
8
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
*
|
|
11
|
+
* This Source Code may also be made available under the following Secondary
|
|
12
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
* with the GNU Classpath Exception which is available at
|
|
15
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
*
|
|
17
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
18
|
+
********************************************************************************/
|
|
19
|
+
/* eslint-disable max-len */
|
|
20
|
+
const commander_1 = require("commander");
|
|
21
|
+
const fs = require("fs");
|
|
22
|
+
const glob_1 = require("glob");
|
|
23
|
+
const minimatch = require("minimatch");
|
|
24
|
+
const readline = require("readline-sync");
|
|
25
|
+
const sh = require("shelljs");
|
|
26
|
+
const command_util_1 = require("../util/command-util");
|
|
27
|
+
const git_util_1 = require("../util/git-util");
|
|
28
|
+
const logger_1 = require("../util/logger");
|
|
29
|
+
const validation_util_1 = require("../util/validation-util");
|
|
30
|
+
const path = require("path");
|
|
31
|
+
const checkTypes = ['full', 'changes', 'lastCommit'];
|
|
32
|
+
const severityTypes = ['error', 'warn', 'ok'];
|
|
33
|
+
const DEFAULT_EXCLUDES = ['**/@(node_modules|lib|dist|bundle)/**'];
|
|
34
|
+
const YEAR_RANGE_REGEX = /\d{4}(?:-d{4})?/g;
|
|
35
|
+
const HEADER_PATTERN = 'Copyright \\([cC]\\) \\d{4}(-d{4})?';
|
|
36
|
+
const AUTO_FIX_MESSAGE = 'Fix copyright header violations';
|
|
37
|
+
exports.CheckHeaderCommand = (0, command_util_1.baseCommand)() //
|
|
38
|
+
.name('checkHeaders')
|
|
39
|
+
.description('Validates the copyright year range of license header files')
|
|
40
|
+
.argument('<rootDir>', 'The starting directory for the check', validation_util_1.validateGitDirectory)
|
|
41
|
+
.addOption(new commander_1.Option('-t, --type <type>', 'The scope of the check. In addition to a full recursive check, is also possible to only' +
|
|
42
|
+
' consider pending changes or the last commit')
|
|
43
|
+
.choices(checkTypes)
|
|
44
|
+
.default('full'))
|
|
45
|
+
.option('-f, --fileExtensions <extensions...>', 'File extensions that should be checked', ['ts', 'tsx'])
|
|
46
|
+
.addOption(new commander_1.Option('-e, --exclude <exclude...>', 'File patterns that should be excluded from the check. New exclude patterns are added to the default patterns').default([], `[${DEFAULT_EXCLUDES}]`))
|
|
47
|
+
.option('--no-exclude-defaults', 'Disables the default excludes patterns. Only explicitly passed exclude patterns (-e, --exclude) are considered')
|
|
48
|
+
.option('-j, --json', 'Also persist validation results as json file', false)
|
|
49
|
+
.addOption(new commander_1.Option('-s, --severity <severity>', 'The severity of validation results that should be printed.')
|
|
50
|
+
.choices(severityTypes)
|
|
51
|
+
.default('error', '"error" (only)'))
|
|
52
|
+
.option('-a, --autoFix', 'Auto apply & commit fixes without prompting the user', false)
|
|
53
|
+
.action(checkHeaders);
|
|
54
|
+
function checkHeaders(rootDir, options) {
|
|
55
|
+
(0, command_util_1.configureShell)({ silent: true, fatal: true });
|
|
56
|
+
if (options.excludeDefaults) {
|
|
57
|
+
options.exclude.push(...DEFAULT_EXCLUDES);
|
|
58
|
+
}
|
|
59
|
+
sh.cd(rootDir);
|
|
60
|
+
const files = getFiles(rootDir, options);
|
|
61
|
+
logger_1.LOGGER.info(`Check copy right headers of ${files.length} files`);
|
|
62
|
+
if (files.length === 0) {
|
|
63
|
+
logger_1.LOGGER.info('Check completed');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const results = validate(rootDir, files, options);
|
|
67
|
+
handleValidationResults(rootDir, results, options);
|
|
68
|
+
}
|
|
69
|
+
exports.checkHeaders = checkHeaders;
|
|
70
|
+
function getFiles(rootDir, options) {
|
|
71
|
+
const includePattern = `**/*.@(${options.fileExtensions.join('|')})`;
|
|
72
|
+
const excludePattern = options.exclude;
|
|
73
|
+
if (options.type === 'full') {
|
|
74
|
+
return glob_1.glob.sync(includePattern, {
|
|
75
|
+
cwd: rootDir,
|
|
76
|
+
ignore: excludePattern
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
let changedFiles = options.type === 'changes' ? (0, git_util_1.getUncommittedChanges)(rootDir) : (0, git_util_1.getChangesOfLastCommit)(rootDir);
|
|
80
|
+
changedFiles = changedFiles.filter(minimatch.filter(includePattern));
|
|
81
|
+
excludePattern.forEach(pattern => {
|
|
82
|
+
changedFiles = changedFiles.filter(minimatch.filter(`!${pattern}`));
|
|
83
|
+
});
|
|
84
|
+
return changedFiles;
|
|
85
|
+
}
|
|
86
|
+
function validate(rootDir, files, options) {
|
|
87
|
+
var _a;
|
|
88
|
+
// Derives all files with valid headers, their copyright years and all files with no or invalid headers
|
|
89
|
+
const filesWithHeader = sh.grep('-l', HEADER_PATTERN, files).stdout.trim().split('\n');
|
|
90
|
+
const copyrightYears = sh
|
|
91
|
+
.grep(HEADER_PATTERN, files)
|
|
92
|
+
.stdout.trim()
|
|
93
|
+
.split('\n')
|
|
94
|
+
.map(line => line.match(YEAR_RANGE_REGEX).map(string => Number.parseInt(string, 10)));
|
|
95
|
+
const noHeaders = files.filter(file => !filesWithHeader.includes(file));
|
|
96
|
+
const results = [];
|
|
97
|
+
const allFilesLength = files.length;
|
|
98
|
+
// Create validation results for all files with no or invalid headers
|
|
99
|
+
const noHeadersLength = noHeaders.length;
|
|
100
|
+
if (noHeadersLength > 0) {
|
|
101
|
+
logger_1.LOGGER.info(`Found ${noHeadersLength} files with no (or an invalid) copyright header`);
|
|
102
|
+
}
|
|
103
|
+
noHeaders.forEach((file, i) => {
|
|
104
|
+
printFileProgress(i + 1, allFilesLength, `Validating ${file}`);
|
|
105
|
+
results.push({ file: path.resolve(rootDir, file), violation: 'noOrMissingHeader', severity: 'error' });
|
|
106
|
+
});
|
|
107
|
+
// Performance optimization: avoid retrieving the dates for each individual file by precalculating the endYear if possible.
|
|
108
|
+
let defaultEndYear;
|
|
109
|
+
if (options.type === 'changes') {
|
|
110
|
+
defaultEndYear = new Date().getFullYear();
|
|
111
|
+
}
|
|
112
|
+
else if (options.type === 'lastCommit') {
|
|
113
|
+
defaultEndYear = (_a = (0, git_util_1.getLastModificationDate)(undefined, rootDir)) === null || _a === void 0 ? void 0 : _a.getFullYear();
|
|
114
|
+
}
|
|
115
|
+
// Create validation results for all files with valid headers
|
|
116
|
+
filesWithHeader.forEach((file, i) => {
|
|
117
|
+
printFileProgress(i + 1 + noHeadersLength, allFilesLength, `Validating ${file}`);
|
|
118
|
+
const result = {
|
|
119
|
+
currentStartYear: copyrightYears[i].shift(),
|
|
120
|
+
expectedStartYear: (0, git_util_1.getFirstModificationDate)(file, rootDir, AUTO_FIX_MESSAGE).getFullYear(),
|
|
121
|
+
currentEndYear: copyrightYears[i].shift(),
|
|
122
|
+
expectedEndYear: defaultEndYear !== null && defaultEndYear !== void 0 ? defaultEndYear : (0, git_util_1.getLastModificationDate)(file, rootDir, AUTO_FIX_MESSAGE).getFullYear(),
|
|
123
|
+
file,
|
|
124
|
+
severity: 'ok',
|
|
125
|
+
violation: 'none'
|
|
126
|
+
};
|
|
127
|
+
if (result.expectedStartYear === result.expectedEndYear) {
|
|
128
|
+
validateSingleYear(result);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
validateTimePeriod(result);
|
|
132
|
+
}
|
|
133
|
+
results.push(result);
|
|
134
|
+
});
|
|
135
|
+
results.sort((a, b) => a.file.localeCompare(b.file));
|
|
136
|
+
process.stdout.clearLine(0);
|
|
137
|
+
return results;
|
|
138
|
+
}
|
|
139
|
+
function validateSingleYear(result) {
|
|
140
|
+
const { currentStartYear, expectedStartYear, currentEndYear } = result;
|
|
141
|
+
result.violation = 'invalidCopyrightYear';
|
|
142
|
+
result.severity = 'error';
|
|
143
|
+
if (!currentEndYear) {
|
|
144
|
+
if (currentStartYear === expectedStartYear) {
|
|
145
|
+
result.violation = 'none';
|
|
146
|
+
result.severity = 'ok';
|
|
147
|
+
}
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// Cornercase: For files of the initial contribution the copyright header predates the first git modification date.
|
|
151
|
+
// => declare as warning if not part of the initial contribution.
|
|
152
|
+
if (expectedStartYear === currentEndYear && currentStartYear < expectedStartYear) {
|
|
153
|
+
if ((0, git_util_1.getFirstCommit)(result.file) === (0, git_util_1.getInitialCommit)()) {
|
|
154
|
+
result.violation = 'none';
|
|
155
|
+
result.severity = 'ok';
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
result.severity = 'warn';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function validateTimePeriod(result) {
|
|
163
|
+
const { currentStartYear, expectedStartYear, expectedEndYear, currentEndYear } = result;
|
|
164
|
+
result.violation = 'incorrectCopyrightPeriod';
|
|
165
|
+
result.severity = 'error';
|
|
166
|
+
if (!currentEndYear) {
|
|
167
|
+
result.severity = 'error';
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (currentStartYear === expectedStartYear && currentEndYear === expectedEndYear) {
|
|
171
|
+
result.violation = 'none';
|
|
172
|
+
result.severity = 'ok';
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
// Cornercase: For files of the initial contribution the copyright header predates the first git modification date.
|
|
176
|
+
// => declare as warning if not part of the initial contribution.
|
|
177
|
+
if (currentEndYear === expectedEndYear && currentStartYear < expectedEndYear) {
|
|
178
|
+
if ((0, git_util_1.getFirstCommit)(result.file) === (0, git_util_1.getInitialCommit)()) {
|
|
179
|
+
result.violation = 'none';
|
|
180
|
+
result.severity = 'ok';
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
result.severity = 'warn';
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function printFileProgress(currentFileCount, maxFileCount, message, clear = true) {
|
|
188
|
+
if (clear) {
|
|
189
|
+
process.stdout.clearLine(0);
|
|
190
|
+
process.stdout.cursorTo(0);
|
|
191
|
+
}
|
|
192
|
+
process.stdout.write(`[${currentFileCount} of ${maxFileCount}] ${message}`);
|
|
193
|
+
if (!clear) {
|
|
194
|
+
process.stdout.write('\n');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function handleValidationResults(rootDir, results, options) {
|
|
198
|
+
logger_1.LOGGER.newLine();
|
|
199
|
+
logger_1.LOGGER.info(`Header validation for ${results.length} files completed`);
|
|
200
|
+
const violations = results.filter(result => result.severity === 'error');
|
|
201
|
+
// Adjust results to print based on configured severity level
|
|
202
|
+
let toPrint = results;
|
|
203
|
+
if (options.severity === 'error') {
|
|
204
|
+
toPrint = violations;
|
|
205
|
+
}
|
|
206
|
+
else if (options.severity === 'warn') {
|
|
207
|
+
toPrint = results.filter(result => result.severity !== 'ok');
|
|
208
|
+
}
|
|
209
|
+
logger_1.LOGGER.info(`Found ${toPrint.length} copyright header violations:`);
|
|
210
|
+
logger_1.LOGGER.newLine();
|
|
211
|
+
toPrint.forEach((result, i) => logger_1.LOGGER.info(`${i + 1}. `, result.file, ':', toPrintMessage(result)));
|
|
212
|
+
logger_1.LOGGER.newLine();
|
|
213
|
+
if (options.json) {
|
|
214
|
+
fs.writeFileSync(path.join(rootDir, 'headerCheck.json'), JSON.stringify(results, undefined, 2));
|
|
215
|
+
}
|
|
216
|
+
if (violations.length > 0 && (options.autoFix || readline.keyInYN('Do you want automatically fix copyright year range violations?'))) {
|
|
217
|
+
const toFix = violations.filter(violation => violation.severity === 'error' && isDateValidationResult(violation));
|
|
218
|
+
fixViolations(rootDir, toFix, options);
|
|
219
|
+
}
|
|
220
|
+
logger_1.LOGGER.info('Check completed');
|
|
221
|
+
}
|
|
222
|
+
exports.handleValidationResults = handleValidationResults;
|
|
223
|
+
function toPrintMessage(result) {
|
|
224
|
+
const colors = {
|
|
225
|
+
error: '\x1b[31m',
|
|
226
|
+
warn: '\x1b[33m',
|
|
227
|
+
ok: '\x1b[32m'
|
|
228
|
+
};
|
|
229
|
+
if (isDateValidationResult(result) &&
|
|
230
|
+
(result.violation === 'incorrectCopyrightPeriod' || result.violation === 'invalidCopyrightYear')) {
|
|
231
|
+
const expected = result.expectedStartYear !== result.expectedEndYear
|
|
232
|
+
? `${result.expectedStartYear}-${result.expectedEndYear}`
|
|
233
|
+
: result.expectedStartYear.toString();
|
|
234
|
+
const actual = result.currentEndYear ? `${result.currentStartYear}-${result.currentEndYear}` : result.currentStartYear.toString();
|
|
235
|
+
const message = result.violation === 'incorrectCopyrightPeriod' ? 'Invalid copyright period' : 'Invalid copyright year';
|
|
236
|
+
return `${colors[result.severity]} ${message}! Expected '${expected}' but is '${actual}'`;
|
|
237
|
+
}
|
|
238
|
+
else if (result.violation === 'noOrMissingHeader') {
|
|
239
|
+
return `${colors[result.severity]} No or invalid copyright header!`;
|
|
240
|
+
}
|
|
241
|
+
return `${colors[result.severity]} OK`;
|
|
242
|
+
}
|
|
243
|
+
function fixViolations(rootDir, violations, options) {
|
|
244
|
+
logger_1.LOGGER.newLine();
|
|
245
|
+
violations.forEach((violation, i) => {
|
|
246
|
+
printFileProgress(i + 1, violations.length, `Fix ${violation.file}`, false);
|
|
247
|
+
const fixedStartYear = violation.currentStartYear < violation.expectedStartYear ? violation.currentStartYear : violation.expectedStartYear;
|
|
248
|
+
const currentRange = `${violation.currentStartYear}${violation.currentEndYear ? '-' + violation.currentEndYear : ''}`;
|
|
249
|
+
let fixedRange = `${fixedStartYear}`;
|
|
250
|
+
if (violation.expectedEndYear !== violation.expectedStartYear || fixedStartYear !== violation.expectedStartYear) {
|
|
251
|
+
fixedRange = `${fixedStartYear}-${violation.expectedEndYear}`;
|
|
252
|
+
}
|
|
253
|
+
sh.sed('-i', RegExp('Copyright \\([cC]\\) ' + currentRange), `Copyright (c) ${fixedRange}`, violation.file);
|
|
254
|
+
});
|
|
255
|
+
logger_1.LOGGER.newLine();
|
|
256
|
+
if (options.autoFix || readline.keyInYN('Do you want to create a commit for the fixed files?')) {
|
|
257
|
+
logger_1.LOGGER.newLine();
|
|
258
|
+
const files = violations.map(violation => violation.file).join(' ');
|
|
259
|
+
sh.exec(`git add ${files}`, (0, command_util_1.getShellConfig)());
|
|
260
|
+
sh.exec(`git commit -m "${AUTO_FIX_MESSAGE}"`);
|
|
261
|
+
logger_1.LOGGER.newLine();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function isDateValidationResult(object) {
|
|
265
|
+
return 'currentStartYear' in object && 'expectedStartYear' in object && 'expectedEndYear' in object;
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=check-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-header.js","sourceRoot":"","sources":["../../src/commands/check-header.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,4BAA4B;AAC5B,yCAAmC;AACnC,yBAAyB;AACzB,+BAA4B;AAC5B,uCAAuC;AACvC,0CAA0C;AAC1C,8BAA8B;AAC9B,uDAAmF;AACnF,+CAO0B;AAE1B,2CAAwC;AACxC,6DAA+D;AAC/D,6BAA8B;AAW9B,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,CAAU,CAAC;AA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AqD,CAAC,EAAE;QAC5F,eAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpE,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,EAAE,EAAE,IAAA,6BAAc,GAAE,CAAC,CAAC;QAC9C,EAAE,CAAC,IAAI,CAAC,kBAAkB,gBAAgB,GAAG,CAAC,CAAC;QAC/C,eAAM,CAAC,OAAO,EAAE,CAAC;KACpB;AACL,CAAC;AAgBD,SAAS,sBAAsB,CAAC,MAAwB;IACpD,OAAO,kBAAkB,IAAI,MAAM,IAAI,mBAAmB,IAAI,MAAM,IAAI,iBAAiB,IAAI,MAAM,CAAC;AACxG,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 CoverageCmdOptions {
|
|
17
|
+
coverageScript: string;
|
|
18
|
+
projectRoot: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const CoverageReportCommand: import("commander").Command;
|
|
21
|
+
/**
|
|
22
|
+
* Generates and aggregates an 'nyc' coverage report for lerna/yarn mono repositories.
|
|
23
|
+
* First, individual reports for each package are generated. Then, they are aggregated into one combined HTML report.
|
|
24
|
+
* @param options configuration options
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateCoverageReport(options: CoverageCmdOptions): void;
|
|
27
|
+
export declare function validateAndRetrievePackages(options: CoverageCmdOptions): string[];
|
|
28
|
+
export declare function collectPackageReportFiles(packages: string[], options: CoverageCmdOptions): string[];
|
|
29
|
+
//# sourceMappingURL=coverage-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-report.d.ts","sourceRoot":"","sources":["../../src/commands/coverage-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AASlF,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,qBAAqB,6BAKC,CAAC;AAEpC;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAOxE;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAoBjF;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAWnG"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.collectPackageReportFiles = exports.validateAndRetrievePackages = exports.generateCoverageReport = exports.CoverageReportCommand = void 0;
|
|
19
|
+
const fs = require("fs");
|
|
20
|
+
const path = require("path");
|
|
21
|
+
const sh = require("shelljs");
|
|
22
|
+
const command_util_1 = require("../util/command-util");
|
|
23
|
+
const logger_1 = require("../util/logger");
|
|
24
|
+
const validation_util_1 = require("../util/validation-util");
|
|
25
|
+
exports.CoverageReportCommand = (0, command_util_1.baseCommand)() //
|
|
26
|
+
.name('coverageReport')
|
|
27
|
+
.description('Generate a test coverage report for a glsp component')
|
|
28
|
+
.option('-p, --projectRoot <projectRoot>', 'The root directory of the GLSP component', validation_util_1.validateDirectory, process.cwd())
|
|
29
|
+
.option('-c, --coverageScript <script>', 'Script command of the package root for creating coverage reports', 'test:coverage')
|
|
30
|
+
.action(generateCoverageReport);
|
|
31
|
+
/**
|
|
32
|
+
* Generates and aggregates an 'nyc' coverage report for lerna/yarn mono repositories.
|
|
33
|
+
* First, individual reports for each package are generated. Then, they are aggregated into one combined HTML report.
|
|
34
|
+
* @param options configuration options
|
|
35
|
+
*/
|
|
36
|
+
function generateCoverageReport(options) {
|
|
37
|
+
sh.cd(options.projectRoot);
|
|
38
|
+
const packages = validateAndRetrievePackages(options);
|
|
39
|
+
logger_1.LOGGER.info('Create individual package coverage reports');
|
|
40
|
+
const jsonReports = collectPackageReportFiles(packages, options);
|
|
41
|
+
combineReports(jsonReports, options);
|
|
42
|
+
logger_1.LOGGER.info('Coverage reported generation successful');
|
|
43
|
+
}
|
|
44
|
+
exports.generateCoverageReport = generateCoverageReport;
|
|
45
|
+
function validateAndRetrievePackages(options) {
|
|
46
|
+
var _a;
|
|
47
|
+
const packagePath = path.join(options.projectRoot, 'package.json');
|
|
48
|
+
if (!fs.existsSync(packagePath)) {
|
|
49
|
+
exports.CoverageReportCommand.error(`Invalid root directory. '${options.projectRoot}' does not contain a package.json.`);
|
|
50
|
+
}
|
|
51
|
+
(0, command_util_1.fatalExec)('yarn nyc -h', 'Nyc is not installed!', (0, command_util_1.getShellConfig)({ silent: true }));
|
|
52
|
+
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
|
|
53
|
+
if (!((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.scripts) === null || _a === void 0 ? void 0 : _a[options.coverageScript])) {
|
|
54
|
+
exports.CoverageReportCommand.error(`Invalid coverage script! The package.json does not have a script with name '${options.coverageScript}'!`);
|
|
55
|
+
}
|
|
56
|
+
if (!Array.isArray(packageJson.workspaces)) {
|
|
57
|
+
exports.CoverageReportCommand.error('Invalid package.json! No yarn workspaces are configured!');
|
|
58
|
+
}
|
|
59
|
+
return packageJson.workspaces.map(pkg => pkg.replace('/*', ''));
|
|
60
|
+
}
|
|
61
|
+
exports.validateAndRetrievePackages = validateAndRetrievePackages;
|
|
62
|
+
function collectPackageReportFiles(packages, options) {
|
|
63
|
+
logger_1.LOGGER.info('Create combined report');
|
|
64
|
+
sh.exec(`yarn ${options.coverageScript}`);
|
|
65
|
+
// collect reports
|
|
66
|
+
const reports = [];
|
|
67
|
+
packages.forEach(pkg => {
|
|
68
|
+
sh.find(pkg)
|
|
69
|
+
.filter(file => file.endsWith('coverage-final.json'))
|
|
70
|
+
.forEach(json => reports.push(path.resolve(options.projectRoot, json)));
|
|
71
|
+
});
|
|
72
|
+
return reports;
|
|
73
|
+
}
|
|
74
|
+
exports.collectPackageReportFiles = collectPackageReportFiles;
|
|
75
|
+
function combineReports(reportFiles, options) {
|
|
76
|
+
// Copy coverage into root/.nyc_output
|
|
77
|
+
const reportsDir = path.join(options.projectRoot, '.nyc_output');
|
|
78
|
+
if (fs.existsSync(reportsDir)) {
|
|
79
|
+
fs.rmSync(reportsDir, { force: true, recursive: true });
|
|
80
|
+
}
|
|
81
|
+
fs.mkdirSync(reportsDir);
|
|
82
|
+
for (let i = 0; i < reportFiles.length; i++) {
|
|
83
|
+
fs.copyFileSync(reportFiles[i], path.resolve('.nyc_output', `coverage-final-${i}.json`));
|
|
84
|
+
}
|
|
85
|
+
// Temporarily remove root nyc configs otherwise the report command might fail.
|
|
86
|
+
sh.cd(options.projectRoot);
|
|
87
|
+
const configFiles = ['.nycrc', '.nycrc.json', '.nyc-config.js'];
|
|
88
|
+
const tempFiles = [];
|
|
89
|
+
configFiles.forEach(config => {
|
|
90
|
+
if (fs.existsSync(path.join(options.projectRoot, config))) {
|
|
91
|
+
sh.mv(config, '_' + config);
|
|
92
|
+
tempFiles.push('_' + config);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
// Generate report
|
|
96
|
+
sh.exec('yarn nyc report --reporter html', (0, command_util_1.getShellConfig)());
|
|
97
|
+
// Restore nyc configs (if any)
|
|
98
|
+
tempFiles.forEach(config => sh.mv(config, config.substring(1)));
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=coverage-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-report.js","sourceRoot":"","sources":["../../src/commands/coverage-report.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,yBAAyB;AACzB,6BAA6B;AAC7B,8BAA8B;AAC9B,uDAA8E;AAC9E,2CAAwC;AACxC,6DAA4D;AAO/C,QAAA,qBAAqB,GAAG,IAAA,0BAAW,GAAE,CAAC,EAAE;KAChD,IAAI,CAAC,gBAAgB,CAAC;KACtB,WAAW,CAAC,sDAAsD,CAAC;KACnE,MAAM,CAAC,iCAAiC,EAAE,0CAA0C,EAAE,mCAAiB,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;KACvH,MAAM,CAAC,+BAA+B,EAAE,kEA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