@eclipse-glsp/cli 1.1.0-next.4c65907.114 → 1.1.0-next.73d6685.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -6
- package/lib/app.d.ts +1 -17
- package/lib/app.d.ts.map +1 -1
- package/lib/app.js +10 -24
- package/lib/app.js.map +1 -1
- 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 +290 -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 +123 -0
- package/lib/commands/coverage-report.js.map +1 -0
- package/lib/{release → commands/release}/common.d.ts +1 -1
- package/lib/commands/release/common.d.ts.map +1 -0
- package/lib/{release → commands/release}/common.js +44 -18
- package/lib/commands/release/common.js.map +1 -0
- package/lib/commands/release/release-client.d.ts.map +1 -0
- package/lib/{release → commands/release}/release-client.js +30 -9
- package/lib/commands/release/release-client.js.map +1 -0
- package/lib/commands/release/release-eclipse-integration.d.ts.map +1 -0
- package/lib/{release → commands/release}/release-eclipse-integration.js +26 -3
- package/lib/commands/release/release-eclipse-integration.js.map +1 -0
- package/lib/commands/release/release-java-server.d.ts.map +1 -0
- package/lib/{release → commands/release}/release-java-server.js +28 -4
- package/lib/commands/release/release-java-server.js.map +1 -0
- package/lib/commands/release/release-server-node.d.ts.map +1 -0
- package/lib/{release → commands/release}/release-server-node.js +25 -2
- package/lib/commands/release/release-server-node.js.map +1 -0
- package/lib/commands/release/release-theia-integration.d.ts.map +1 -0
- package/lib/{release → commands/release}/release-theia-integration.js +27 -15
- package/lib/commands/release/release-theia-integration.js.map +1 -0
- package/lib/commands/release/release-vscode-integration.d.ts.map +1 -0
- package/lib/{release → commands/release}/release-vscode-integration.js +26 -3
- package/lib/commands/release/release-vscode-integration.js.map +1 -0
- package/lib/{release → commands/release}/release.d.ts +3 -2
- package/lib/commands/release/release.d.ts.map +1 -0
- package/lib/{release → commands/release}/release.js +73 -18
- package/lib/commands/release/release.js.map +1 -0
- package/lib/util/command-util.d.ts +6 -11
- package/lib/util/command-util.d.ts.map +1 -1
- package/lib/util/command-util.js +50 -12
- package/lib/util/command-util.js.map +1 -1
- package/lib/util/git-util.d.ts +43 -4
- package/lib/util/git-util.d.ts.map +1 -1
- package/lib/util/git-util.js +151 -39
- package/lib/util/git-util.js.map +1 -1
- package/lib/util/logger.d.ts +21 -7
- package/lib/util/logger.d.ts.map +1 -1
- package/lib/util/logger.js +29 -13
- package/lib/util/logger.js.map +1 -1
- package/lib/util/validation-util.d.ts +1 -0
- package/lib/util/validation-util.d.ts.map +1 -1
- package/lib/util/validation-util.js +40 -6
- package/lib/util/validation-util.js.map +1 -1
- package/package.json +31 -33
- package/src/app.ts +10 -28
- package/src/commands/check-header.ts +355 -0
- package/src/commands/coverage-report.ts +113 -0
- package/src/{release → commands/release}/common.ts +9 -9
- package/src/{release → commands/release}/release-client.ts +7 -11
- package/src/{release → commands/release}/release-eclipse-integration.ts +2 -2
- package/src/{release → commands/release}/release-java-server.ts +4 -3
- package/src/{release → commands/release}/release-server-node.ts +1 -1
- package/src/{release → commands/release}/release-theia-integration.ts +7 -19
- package/src/{release → commands/release}/release-vscode-integration.ts +3 -2
- package/src/{release → commands/release}/release.ts +59 -18
- package/src/util/command-util.ts +11 -20
- package/src/util/git-util.ts +128 -38
- package/src/util/logger.ts +36 -17
- package/src/util/validation-util.ts +17 -4
- package/lib/release/common.d.ts.map +0 -1
- package/lib/release/common.js.map +0 -1
- package/lib/release/release-client.d.ts.map +0 -1
- package/lib/release/release-client.js.map +0 -1
- package/lib/release/release-eclipse-integration.d.ts.map +0 -1
- package/lib/release/release-eclipse-integration.js.map +0 -1
- package/lib/release/release-java-server.d.ts.map +0 -1
- package/lib/release/release-java-server.js.map +0 -1
- package/lib/release/release-server-node.d.ts.map +0 -1
- package/lib/release/release-server-node.js.map +0 -1
- package/lib/release/release-theia-integration.d.ts.map +0 -1
- package/lib/release/release-theia-integration.js.map +0 -1
- package/lib/release/release-vscode-integration.d.ts.map +0 -1
- package/lib/release/release-vscode-integration.js.map +0 -1
- package/lib/release/release.d.ts.map +0 -1
- package/lib/release/release.js.map +0 -1
- /package/lib/{release → commands/release}/release-client.d.ts +0 -0
- /package/lib/{release → commands/release}/release-eclipse-integration.d.ts +0 -0
- /package/lib/{release → commands/release}/release-java-server.d.ts +0 -0
- /package/lib/{release → commands/release}/release-server-node.d.ts +0 -0
- /package/lib/{release → commands/release}/release-theia-integration.d.ts +0 -0
- /package/lib/{release → commands/release}/release-vscode-integration.d.ts +0 -0
package/README.md
CHANGED
|
@@ -11,12 +11,57 @@ Install `@eclipse-glsp/cli` as a dev dependency in your application.
|
|
|
11
11
|
yarn add @eclipse-glsp/cli --dev
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## checkHeaders
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
for
|
|
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.
|
|
18
20
|
|
|
19
|
-
```
|
|
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
|
|
20
65
|
$ glsp release -h
|
|
21
66
|
Usage: glsp release [options] <component> <releaseType> [customVersion]
|
|
22
67
|
|
|
@@ -28,9 +73,8 @@ Arguments:
|
|
|
28
73
|
customVersion Custom version number. Will be ignored if the release type is not "custom"
|
|
29
74
|
|
|
30
75
|
Options:
|
|
31
|
-
-V, --version output the version number
|
|
32
76
|
-f, --force Enable force mode (default: false)
|
|
33
|
-
-d, --checkoutDir <checkoutDir> The git checkout directory (default: "
|
|
77
|
+
-d, --checkoutDir <checkoutDir> The git checkout directory (default: "<cwd>")
|
|
34
78
|
-b, --branch <branch> The git branch to checkout (default: "master")
|
|
35
79
|
-v, --verbose Enable verbose (debug) log output (default: false)
|
|
36
80
|
--no-publish Only prepare release but do not publish to github
|
package/lib/app.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
* Copyright (c) 2022 EclipseSource and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
import { Command } from 'commander';
|
|
18
|
-
export declare const ReleaseCommand: Command;
|
|
2
|
+
export declare const COMMAND_VERSION = "1.1.0-next";
|
|
19
3
|
//# sourceMappingURL=app.d.ts.map
|
package/lib/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";AAqBA,eAAO,MAAM,eAAe,eAAe,CAAC"}
|
package/lib/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.COMMAND_VERSION = void 0;
|
|
5
5
|
/********************************************************************************
|
|
6
6
|
* Copyright (c) 2022 EclipseSource and others.
|
|
7
7
|
*
|
|
@@ -17,30 +17,16 @@ exports.ReleaseCommand = void 0;
|
|
|
17
17
|
*
|
|
18
18
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
19
19
|
********************************************************************************/
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const release_1 = require("./release/release");
|
|
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");
|
|
24
23
|
const command_util_1 = require("./util/command-util");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
.description('Prepare & publish a new release for a glsp component')
|
|
29
|
-
.addArgument(new commander_1.Argument('<component>', 'The glsp component to be released').choices(common_1.Component.CLI_CHOICES).argParser(common_1.Component.parse))
|
|
30
|
-
.addArgument(new commander_1.Argument('<releaseType>', 'The release type').choices(common_1.ReleaseType.CLI_CHOICES))
|
|
31
|
-
.argument('[customVersion]', 'Custom version number. Will be ignored if the release type is not "custom"', validation_util_1.validateVersion)
|
|
32
|
-
.option('-f, --force', 'Enable force mode', false)
|
|
33
|
-
.option('-d, --checkoutDir <checkoutDir>', 'The git checkout directory', validation_util_1.validateDirectory, sh.pwd().stdout)
|
|
34
|
-
.option('-b, --branch <branch>', 'The git branch to checkout', 'master')
|
|
35
|
-
.option('-v, --verbose', 'Enable verbose (debug) log output', false)
|
|
36
|
-
.option('--no-publish', 'Only prepare release but do not publish to github', true)
|
|
37
|
-
.option('--draft', 'Publish github releases as drafts', false)
|
|
38
|
-
.option('--npm-dryRun', 'Execute a npm dry-run for inspection. Publishes to the local npm registry and does not publish to github', false)
|
|
39
|
-
.action(release_1.release);
|
|
40
|
-
const app = (0, command_util_1.baseConfiguration)(new commander_1.Command())
|
|
41
|
-
.showSuggestionAfterError(true)
|
|
42
|
-
.showHelpAfterError(true)
|
|
24
|
+
exports.COMMAND_VERSION = '1.1.0-next';
|
|
25
|
+
const app = (0, command_util_1.baseCommand)() //
|
|
26
|
+
.version(exports.COMMAND_VERSION)
|
|
43
27
|
.name('glsp')
|
|
44
|
-
.addCommand(
|
|
28
|
+
.addCommand(coverage_report_1.CoverageReportCommand)
|
|
29
|
+
.addCommand(release_1.ReleaseCommand)
|
|
30
|
+
.addCommand(check_header_1.CheckHeaderCommand);
|
|
45
31
|
app.parse(process.argv);
|
|
46
32
|
//# sourceMappingURL=app.js.map
|
package/lib/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";;;;AACA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";;;;AACA;;;;;;;;;;;;;;kFAckF;AAClF,0DAA6D;AAC7D,gEAAmE;AACnE,wDAA4D;AAC5D,sDAAkD;AAErC,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,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.handleValidationResults = exports.checkHeaders = exports.CheckHeaderCommand = void 0;
|
|
27
|
+
/********************************************************************************
|
|
28
|
+
* Copyright (c) 2022-2023 EclipseSource and others.
|
|
29
|
+
*
|
|
30
|
+
* This program and the accompanying materials are made available under the
|
|
31
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
32
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
33
|
+
*
|
|
34
|
+
* This Source Code may also be made available under the following Secondary
|
|
35
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
36
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
37
|
+
* with the GNU Classpath Exception which is available at
|
|
38
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
39
|
+
*
|
|
40
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
41
|
+
********************************************************************************/
|
|
42
|
+
/* eslint-disable max-len */
|
|
43
|
+
const commander_1 = require("commander");
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const glob_1 = require("glob");
|
|
46
|
+
const minimatch = __importStar(require("minimatch"));
|
|
47
|
+
const readline = __importStar(require("readline-sync"));
|
|
48
|
+
const sh = __importStar(require("shelljs"));
|
|
49
|
+
const command_util_1 = require("../util/command-util");
|
|
50
|
+
const git_util_1 = require("../util/git-util");
|
|
51
|
+
const logger_1 = require("../util/logger");
|
|
52
|
+
const validation_util_1 = require("../util/validation-util");
|
|
53
|
+
const path = require("path");
|
|
54
|
+
const checkTypes = ['full', 'changes', 'lastCommit'];
|
|
55
|
+
const severityTypes = ['error', 'warn', 'ok'];
|
|
56
|
+
const DEFAULT_EXCLUDES = ['**/@(node_modules|lib|dist|bundle)/**'];
|
|
57
|
+
const YEAR_RANGE_REGEX = /\d{4}(?:-d{4})?/g;
|
|
58
|
+
const HEADER_PATTERN = 'Copyright \\([cC]\\) \\d{4}(-d{4})?';
|
|
59
|
+
const AUTO_FIX_MESSAGE = 'Fix copyright header violations';
|
|
60
|
+
exports.CheckHeaderCommand = (0, command_util_1.baseCommand)() //
|
|
61
|
+
.name('checkHeaders')
|
|
62
|
+
.description('Validates the copyright year range of license header files')
|
|
63
|
+
.argument('<rootDir>', 'The starting directory for the check', validation_util_1.validateGitDirectory)
|
|
64
|
+
.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' +
|
|
65
|
+
' consider pending changes or the last commit')
|
|
66
|
+
.choices(checkTypes)
|
|
67
|
+
.default('full'))
|
|
68
|
+
.option('-f, --fileExtensions <extensions...>', 'File extensions that should be checked', ['ts', 'tsx'])
|
|
69
|
+
.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}]`))
|
|
70
|
+
.option('--no-exclude-defaults', 'Disables the default excludes patterns. Only explicitly passed exclude patterns (-e, --exclude) are considered')
|
|
71
|
+
.option('-j, --json', 'Also persist validation results as json file', false)
|
|
72
|
+
.addOption(new commander_1.Option('-s, --severity <severity>', 'The severity of validation results that should be printed.')
|
|
73
|
+
.choices(severityTypes)
|
|
74
|
+
.default('error', '"error" (only)'))
|
|
75
|
+
.option('-a, --autoFix', 'Auto apply & commit fixes without prompting the user', false)
|
|
76
|
+
.action(checkHeaders);
|
|
77
|
+
function checkHeaders(rootDir, options) {
|
|
78
|
+
(0, command_util_1.configureShell)({ silent: true, fatal: true });
|
|
79
|
+
if (options.excludeDefaults) {
|
|
80
|
+
options.exclude.push(...DEFAULT_EXCLUDES);
|
|
81
|
+
}
|
|
82
|
+
sh.cd(rootDir);
|
|
83
|
+
const files = getFiles(rootDir, options);
|
|
84
|
+
logger_1.LOGGER.info(`Check copy right headers of ${files.length} files`);
|
|
85
|
+
if (files.length === 0) {
|
|
86
|
+
logger_1.LOGGER.info('Check completed');
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const results = validate(rootDir, files, options);
|
|
90
|
+
handleValidationResults(rootDir, results, options);
|
|
91
|
+
}
|
|
92
|
+
exports.checkHeaders = checkHeaders;
|
|
93
|
+
function getFiles(rootDir, options) {
|
|
94
|
+
const includePattern = `**/*.@(${options.fileExtensions.join('|')})`;
|
|
95
|
+
const excludePattern = options.exclude;
|
|
96
|
+
if (options.type === 'full') {
|
|
97
|
+
return glob_1.glob.sync(includePattern, {
|
|
98
|
+
cwd: rootDir,
|
|
99
|
+
ignore: excludePattern
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
let changedFiles = options.type === 'changes' ? (0, git_util_1.getUncommittedChanges)(rootDir) : (0, git_util_1.getChangesOfLastCommit)(rootDir);
|
|
103
|
+
changedFiles = changedFiles.filter(minimatch.filter(includePattern));
|
|
104
|
+
excludePattern.forEach(pattern => {
|
|
105
|
+
changedFiles = changedFiles.filter(minimatch.filter(`!${pattern}`));
|
|
106
|
+
});
|
|
107
|
+
return changedFiles.filter(file => fs.existsSync(file));
|
|
108
|
+
}
|
|
109
|
+
function validate(rootDir, files, options) {
|
|
110
|
+
var _a;
|
|
111
|
+
// Derives all files with valid headers, their copyright years and all files with no or invalid headers
|
|
112
|
+
const filesWithHeader = sh.grep('-l', HEADER_PATTERN, files).stdout.trim().split('\n');
|
|
113
|
+
const copyrightYears = sh
|
|
114
|
+
.grep(HEADER_PATTERN, files)
|
|
115
|
+
.stdout.trim()
|
|
116
|
+
.split('\n')
|
|
117
|
+
.map(line => line.match(YEAR_RANGE_REGEX).map(string => Number.parseInt(string, 10)));
|
|
118
|
+
const noHeaders = files.filter(file => !filesWithHeader.includes(file));
|
|
119
|
+
const results = [];
|
|
120
|
+
const allFilesLength = files.length;
|
|
121
|
+
// Create validation results for all files with no or invalid headers
|
|
122
|
+
const noHeadersLength = noHeaders.length;
|
|
123
|
+
if (noHeadersLength > 0) {
|
|
124
|
+
logger_1.LOGGER.info(`Found ${noHeadersLength} files with no (or an invalid) copyright header`);
|
|
125
|
+
}
|
|
126
|
+
noHeaders.forEach((file, i) => {
|
|
127
|
+
printFileProgress(i + 1, allFilesLength, `Validating ${file}`);
|
|
128
|
+
results.push({ file: path.resolve(rootDir, file), violation: 'noOrMissingHeader', severity: 'error' });
|
|
129
|
+
});
|
|
130
|
+
// Performance optimization: avoid retrieving the dates for each individual file by precalculating the endYear if possible.
|
|
131
|
+
let defaultEndYear;
|
|
132
|
+
if (options.type === 'changes') {
|
|
133
|
+
defaultEndYear = new Date().getFullYear();
|
|
134
|
+
}
|
|
135
|
+
else if (options.type === 'lastCommit') {
|
|
136
|
+
defaultEndYear = (_a = (0, git_util_1.getLastModificationDate)(undefined, rootDir)) === null || _a === void 0 ? void 0 : _a.getFullYear();
|
|
137
|
+
}
|
|
138
|
+
// Create validation results for all files with valid headers
|
|
139
|
+
filesWithHeader.forEach((file, i) => {
|
|
140
|
+
printFileProgress(i + 1 + noHeadersLength, allFilesLength, `Validating ${file}`);
|
|
141
|
+
const result = {
|
|
142
|
+
currentStartYear: copyrightYears[i].shift(),
|
|
143
|
+
expectedStartYear: (0, git_util_1.getFirstModificationDate)(file, rootDir, AUTO_FIX_MESSAGE).getFullYear(),
|
|
144
|
+
currentEndYear: copyrightYears[i].shift(),
|
|
145
|
+
expectedEndYear: defaultEndYear !== null && defaultEndYear !== void 0 ? defaultEndYear : (0, git_util_1.getLastModificationDate)(file, rootDir, AUTO_FIX_MESSAGE).getFullYear(),
|
|
146
|
+
file,
|
|
147
|
+
severity: 'ok',
|
|
148
|
+
violation: 'none'
|
|
149
|
+
};
|
|
150
|
+
if (result.expectedStartYear === result.expectedEndYear) {
|
|
151
|
+
validateSingleYear(result);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
validateTimePeriod(result);
|
|
155
|
+
}
|
|
156
|
+
results.push(result);
|
|
157
|
+
});
|
|
158
|
+
results.sort((a, b) => a.file.localeCompare(b.file));
|
|
159
|
+
process.stdout.clearLine(0);
|
|
160
|
+
return results;
|
|
161
|
+
}
|
|
162
|
+
function validateSingleYear(result) {
|
|
163
|
+
const { currentStartYear, expectedStartYear, currentEndYear } = result;
|
|
164
|
+
result.violation = 'invalidCopyrightYear';
|
|
165
|
+
result.severity = 'error';
|
|
166
|
+
if (!currentEndYear) {
|
|
167
|
+
if (currentStartYear === expectedStartYear) {
|
|
168
|
+
result.violation = 'none';
|
|
169
|
+
result.severity = 'ok';
|
|
170
|
+
}
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// Cornercase: For files of the initial contribution the copyright header predates the first git modification date.
|
|
174
|
+
// => declare as warning if not part of the initial contribution.
|
|
175
|
+
if (expectedStartYear === currentEndYear && currentStartYear < expectedStartYear) {
|
|
176
|
+
if ((0, git_util_1.getFirstCommit)(result.file) === (0, git_util_1.getInitialCommit)()) {
|
|
177
|
+
result.violation = 'none';
|
|
178
|
+
result.severity = 'ok';
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
result.severity = 'warn';
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function validateTimePeriod(result) {
|
|
186
|
+
const { currentStartYear, expectedStartYear, expectedEndYear, currentEndYear } = result;
|
|
187
|
+
result.violation = 'incorrectCopyrightPeriod';
|
|
188
|
+
result.severity = 'error';
|
|
189
|
+
if (!currentEndYear) {
|
|
190
|
+
result.severity = 'error';
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (currentStartYear === expectedStartYear && currentEndYear === expectedEndYear) {
|
|
194
|
+
result.violation = 'none';
|
|
195
|
+
result.severity = 'ok';
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
// Cornercase: For files of the initial contribution the copyright header predates the first git modification date.
|
|
199
|
+
// => declare as warning if not part of the initial contribution.
|
|
200
|
+
if (currentEndYear === expectedEndYear && currentStartYear < expectedEndYear) {
|
|
201
|
+
if ((0, git_util_1.getFirstCommit)(result.file) === (0, git_util_1.getInitialCommit)()) {
|
|
202
|
+
result.violation = 'none';
|
|
203
|
+
result.severity = 'ok';
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
result.severity = 'warn';
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function printFileProgress(currentFileCount, maxFileCount, message, clear = true) {
|
|
211
|
+
if (clear) {
|
|
212
|
+
process.stdout.clearLine(0);
|
|
213
|
+
process.stdout.cursorTo(0);
|
|
214
|
+
}
|
|
215
|
+
process.stdout.write(`[${currentFileCount} of ${maxFileCount}] ${message}`);
|
|
216
|
+
if (!clear) {
|
|
217
|
+
process.stdout.write('\n');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function handleValidationResults(rootDir, results, options) {
|
|
221
|
+
logger_1.LOGGER.newLine();
|
|
222
|
+
logger_1.LOGGER.info(`Header validation for ${results.length} files completed`);
|
|
223
|
+
const violations = results.filter(result => result.severity === 'error');
|
|
224
|
+
// Adjust results to print based on configured severity level
|
|
225
|
+
let toPrint = results;
|
|
226
|
+
if (options.severity === 'error') {
|
|
227
|
+
toPrint = violations;
|
|
228
|
+
}
|
|
229
|
+
else if (options.severity === 'warn') {
|
|
230
|
+
toPrint = results.filter(result => result.severity !== 'ok');
|
|
231
|
+
}
|
|
232
|
+
logger_1.LOGGER.info(`Found ${toPrint.length} copyright header violations:`);
|
|
233
|
+
logger_1.LOGGER.newLine();
|
|
234
|
+
toPrint.forEach((result, i) => logger_1.LOGGER.info(`${i + 1}. `, result.file, ':', toPrintMessage(result)));
|
|
235
|
+
logger_1.LOGGER.newLine();
|
|
236
|
+
if (options.json) {
|
|
237
|
+
fs.writeFileSync(path.join(rootDir, 'headerCheck.json'), JSON.stringify(results, undefined, 2));
|
|
238
|
+
}
|
|
239
|
+
if (violations.length > 0 && (options.autoFix || readline.keyInYN('Do you want automatically fix copyright year range violations?'))) {
|
|
240
|
+
const toFix = violations.filter(violation => violation.severity === 'error' && isDateValidationResult(violation));
|
|
241
|
+
fixViolations(rootDir, toFix, options);
|
|
242
|
+
}
|
|
243
|
+
logger_1.LOGGER.info('Check completed');
|
|
244
|
+
}
|
|
245
|
+
exports.handleValidationResults = handleValidationResults;
|
|
246
|
+
function toPrintMessage(result) {
|
|
247
|
+
const colors = {
|
|
248
|
+
error: '\x1b[31m',
|
|
249
|
+
warn: '\x1b[33m',
|
|
250
|
+
ok: '\x1b[32m'
|
|
251
|
+
};
|
|
252
|
+
if (isDateValidationResult(result) &&
|
|
253
|
+
(result.violation === 'incorrectCopyrightPeriod' || result.violation === 'invalidCopyrightYear')) {
|
|
254
|
+
const expected = result.expectedStartYear !== result.expectedEndYear
|
|
255
|
+
? `${result.expectedStartYear}-${result.expectedEndYear}`
|
|
256
|
+
: result.expectedStartYear.toString();
|
|
257
|
+
const actual = result.currentEndYear ? `${result.currentStartYear}-${result.currentEndYear}` : result.currentStartYear.toString();
|
|
258
|
+
const message = result.violation === 'incorrectCopyrightPeriod' ? 'Invalid copyright period' : 'Invalid copyright year';
|
|
259
|
+
return `${colors[result.severity]} ${message}! Expected '${expected}' but is '${actual}'`;
|
|
260
|
+
}
|
|
261
|
+
else if (result.violation === 'noOrMissingHeader') {
|
|
262
|
+
return `${colors[result.severity]} No or invalid copyright header!`;
|
|
263
|
+
}
|
|
264
|
+
return `${colors[result.severity]} OK`;
|
|
265
|
+
}
|
|
266
|
+
function fixViolations(rootDir, violations, options) {
|
|
267
|
+
logger_1.LOGGER.newLine();
|
|
268
|
+
violations.forEach((violation, i) => {
|
|
269
|
+
printFileProgress(i + 1, violations.length, `Fix ${violation.file}`, false);
|
|
270
|
+
const fixedStartYear = violation.currentStartYear < violation.expectedStartYear ? violation.currentStartYear : violation.expectedStartYear;
|
|
271
|
+
const currentRange = `${violation.currentStartYear}${violation.currentEndYear ? '-' + violation.currentEndYear : ''}`;
|
|
272
|
+
let fixedRange = `${fixedStartYear}`;
|
|
273
|
+
if (violation.expectedEndYear !== violation.expectedStartYear || fixedStartYear !== violation.expectedStartYear) {
|
|
274
|
+
fixedRange = `${fixedStartYear}-${violation.expectedEndYear}`;
|
|
275
|
+
}
|
|
276
|
+
sh.sed('-i', RegExp('Copyright \\([cC]\\) ' + currentRange), `Copyright (c) ${fixedRange}`, violation.file);
|
|
277
|
+
});
|
|
278
|
+
logger_1.LOGGER.newLine();
|
|
279
|
+
if (options.autoFix || readline.keyInYN('Do you want to create a commit for the fixed files?')) {
|
|
280
|
+
logger_1.LOGGER.newLine();
|
|
281
|
+
const files = violations.map(violation => violation.file).join(' ');
|
|
282
|
+
sh.exec(`git add ${files}`, (0, command_util_1.getShellConfig)());
|
|
283
|
+
sh.exec(`git commit -m "${AUTO_FIX_MESSAGE}"`);
|
|
284
|
+
logger_1.LOGGER.newLine();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function isDateValidationResult(object) {
|
|
288
|
+
return 'currentStartYear' in object && 'expectedStartYear' in object && 'expectedEndYear' in object;
|
|
289
|
+
}
|
|
290
|
+
//# 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,uCAAyB;AACzB,+BAA4B;AAC5B,qDAAuC;AACvC,wDAA0C;AAC1C,4CAA8B;AAC9B,uDAAmF;AACnF,+CAO0B;AAE1B,2CAAwC;AACxC,6DAA+D;AAC/D,6BAA8B;AAW9B,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,CAAU,CAAC;AAG9D,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAU,CAAC;AAIvD,MAAM,gBAAgB,GAAG,CAAC,uCAAuC,CAAC,CAAC;AACnE,MAAM,gBAAgB,GA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AM,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"}
|