license-cop 1.0.2 → 1.2.0
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.md +1 -1
- package/README.md +4 -0
- package/package.json +5 -5
- package/src/index.d.ts +2 -1
- package/src/index.js +16 -4
- package/src/index.js.map +1 -1
- package/src/lib/cli/commands/init.d.ts +4 -0
- package/src/lib/cli/commands/init.js +29 -0
- package/src/lib/cli/commands/init.js.map +1 -0
- package/src/lib/cli/commands/main.d.ts +6 -0
- package/src/lib/cli/commands/main.js +44 -0
- package/src/lib/cli/commands/main.js.map +1 -0
- package/src/lib/cli/commands/version.d.ts +4 -0
- package/src/lib/cli/commands/version.js +19 -0
- package/src/lib/cli/commands/version.js.map +1 -0
- package/src/lib/cli/create-command.d.ts +5 -0
- package/src/lib/cli/create-command.js +15 -0
- package/src/lib/cli/create-command.js.map +1 -0
- package/src/lib/cli/index.d.ts +1 -1
- package/src/lib/cli/index.js +8 -59
- package/src/lib/cli/index.js.map +1 -1
- package/src/lib/cli/report-failure.d.ts +2 -0
- package/src/lib/cli/report-failure.js +34 -0
- package/src/lib/cli/report-failure.js.map +1 -0
- package/src/lib/cli/report-success.d.ts +2 -0
- package/src/lib/cli/report-success.js +20 -0
- package/src/lib/cli/report-success.js.map +1 -0
- package/src/lib/config/config-error.d.ts +4 -0
- package/src/lib/config/config-error.js +25 -0
- package/src/lib/config/config-error.js.map +1 -0
- package/src/lib/config/config.js +2 -5
- package/src/lib/config/config.js.map +1 -1
- package/src/lib/config/find-config.js +9 -7
- package/src/lib/config/find-config.js.map +1 -1
- package/src/lib/config/load-config.js +4 -6
- package/src/lib/config/load-config.js.map +1 -1
- package/src/lib/config/load-parent-config.js +2 -4
- package/src/lib/config/load-parent-config.js.map +1 -1
- package/src/lib/config/parent-resolutions/github.d.ts +1 -1
- package/src/lib/config/parent-resolutions/github.js +12 -9
- package/src/lib/config/parent-resolutions/github.js.map +1 -1
- package/src/lib/config/parent-resolutions/http.js +3 -5
- package/src/lib/config/parent-resolutions/http.js.map +1 -1
- package/src/lib/config/parent-resolutions/npm.js +2 -3
- package/src/lib/config/parent-resolutions/npm.js.map +1 -1
- package/src/lib/config/parsers/json5.js +2 -6
- package/src/lib/config/parsers/json5.js.map +1 -1
- package/src/lib/license-cop.d.ts +2 -1
- package/src/lib/license-cop.js +70 -37
- package/src/lib/license-cop.js.map +1 -1
- package/src/lib/logger.d.ts +8 -0
- package/src/lib/logger.js +39 -0
- package/src/lib/logger.js.map +1 -0
- package/src/lib/package-json.d.ts +33 -3
- package/src/lib/package-json.js +41 -8
- package/src/lib/package-json.js.map +1 -1
- package/src/lib/package-rules.d.ts +0 -1
- package/src/lib/package-rules.js +3 -15
- package/src/lib/package-rules.js.map +1 -1
- package/src/lib/result.d.ts +27 -0
- package/src/lib/result.js +3 -0
- package/src/lib/result.js.map +1 -0
- package/src/lib/spdx/calculate-issues.d.ts +2 -0
- package/src/lib/spdx/calculate-issues.js +43 -0
- package/src/lib/spdx/calculate-issues.js.map +1 -0
- package/src/lib/spdx/get-tokens.d.ts +2 -0
- package/src/lib/spdx/get-tokens.js +52 -0
- package/src/lib/spdx/get-tokens.js.map +1 -0
- package/src/lib/spdx/parse-license-expression.d.ts +2 -0
- package/src/lib/spdx/parse-license-expression.js +18 -0
- package/src/lib/spdx/parse-license-expression.js.map +1 -0
- package/src/lib/spdx/parse-tokens.d.ts +3 -0
- package/src/lib/spdx/parse-tokens.js +118 -0
- package/src/lib/spdx/parse-tokens.js.map +1 -0
- package/src/lib/spdx/types/spdx-expression.d.ts +20 -0
- package/src/lib/spdx/types/spdx-expression.js +3 -0
- package/src/lib/spdx/types/spdx-expression.js.map +1 -0
- package/src/lib/spdx/types/token.d.ts +23 -0
- package/src/lib/spdx/types/token.js +25 -0
- package/src/lib/spdx/types/token.js.map +1 -0
- package/src/lib/utils/join-string-array.d.ts +1 -0
- package/src/lib/utils/join-string-array.js +26 -0
- package/src/lib/utils/join-string-array.js.map +1 -0
- package/src/lib/cli/arguments.d.ts +0 -18
- package/src/lib/cli/arguments.js +0 -23
- package/src/lib/cli/arguments.js.map +0 -1
- package/src/lib/cli/init.d.ts +0 -1
- package/src/lib/cli/init.js +0 -24
- package/src/lib/cli/init.js.map +0 -1
- package/src/lib/cli/version.d.ts +0 -1
- package/src/lib/cli/version.js +0 -17
- package/src/lib/cli/version.js.map +0 -1
- package/src/lib/violations-error.d.ts +0 -9
- package/src/lib/violations-error.js +0 -16
- package/src/lib/violations-error.js.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "calculateIssues", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: ()=>calculateIssues
|
|
5
|
+
});
|
|
6
|
+
const calculateIssues = (license, allowedLicenses)=>{
|
|
7
|
+
const issues = [];
|
|
8
|
+
const parseNode = (node)=>{
|
|
9
|
+
switch(node.type){
|
|
10
|
+
case "identifier":
|
|
11
|
+
{
|
|
12
|
+
if (!allowedLicenses.includes(node.value)) {
|
|
13
|
+
issues.push(node.value);
|
|
14
|
+
}
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
case "AND":
|
|
18
|
+
case "OR":
|
|
19
|
+
{
|
|
20
|
+
parseNode(node.expressions[0]);
|
|
21
|
+
parseNode(node.expressions[1]);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
case "WITH":
|
|
25
|
+
{
|
|
26
|
+
if (// TODO: Verify that all exceptions make licenses 'weaker'
|
|
27
|
+
!allowedLicenses.includes(node.expressions[0]) || !allowedLicenses.includes(`${node.expressions[0]} WITH ${node.expressions[1]}`)) {
|
|
28
|
+
issues.push(`${node.expressions[0]} WITH ${node.expressions[1]}`);
|
|
29
|
+
}
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
default:
|
|
33
|
+
{
|
|
34
|
+
const _exhaustiveCheck = node;
|
|
35
|
+
throw new Error(`Unhandled license expression type: ${_exhaustiveCheck}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
parseNode(license);
|
|
40
|
+
return issues;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=calculate-issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/license-cop/src/lib/spdx/calculate-issues.ts"],"sourcesContent":["import { SpdxExpression } from \"./types/spdx-expression\";\n\nexport const calculateIssues = (license: SpdxExpression, allowedLicenses: string[]): string[] => {\n const issues: string[] = [];\n\n const parseNode = (node: SpdxExpression): void => {\n switch (node.type) {\n case \"identifier\": {\n if (!allowedLicenses.includes(node.value)) {\n issues.push(node.value);\n }\n return;\n }\n\n case \"AND\":\n case \"OR\": {\n parseNode(node.expressions[0]);\n parseNode(node.expressions[1]);\n return;\n }\n\n case \"WITH\": {\n if (\n // TODO: Verify that all exceptions make licenses 'weaker'\n !allowedLicenses.includes(node.expressions[0]) ||\n !allowedLicenses.includes(`${node.expressions[0]} WITH ${node.expressions[1]}`)\n ) {\n issues.push(`${node.expressions[0]} WITH ${node.expressions[1]}`);\n }\n return;\n }\n\n default: {\n const _exhaustiveCheck: never = node;\n throw new Error(`Unhandled license expression type: ${_exhaustiveCheck}`);\n }\n }\n };\n\n parseNode(license);\n\n return issues;\n};\n"],"names":["calculateIssues","license","allowedLicenses","issues","parseNode","node","type","includes","value","push","expressions","_exhaustiveCheck","Error"],"mappings":";+BAEaA;;aAAAA;;AAAN,MAAMA,kBAAkB,CAACC,SAAyBC,kBAAwC;IAC/F,MAAMC,SAAmB,EAAE;IAE3B,MAAMC,YAAY,CAACC,OAA+B;QAChD,OAAQA,KAAKC,IAAI;YACf,KAAK;gBAAc;oBACjB,IAAI,CAACJ,gBAAgBK,QAAQ,CAACF,KAAKG,KAAK,GAAG;wBACzCL,OAAOM,IAAI,CAACJ,KAAKG,KAAK;oBACxB,CAAC;oBACD;gBACF;YAEA,KAAK;YACL,KAAK;gBAAM;oBACTJ,UAAUC,KAAKK,WAAW,CAAC,EAAE;oBAC7BN,UAAUC,KAAKK,WAAW,CAAC,EAAE;oBAC7B;gBACF;YAEA,KAAK;gBAAQ;oBACX,IACE,0DAA0D;oBAC1D,CAACR,gBAAgBK,QAAQ,CAACF,KAAKK,WAAW,CAAC,EAAE,KAC7C,CAACR,gBAAgBK,QAAQ,CAAC,CAAC,EAAEF,KAAKK,WAAW,CAAC,EAAE,CAAC,MAAM,EAAEL,KAAKK,WAAW,CAAC,EAAE,CAAC,CAAC,GAC9E;wBACAP,OAAOM,IAAI,CAAC,CAAC,EAAEJ,KAAKK,WAAW,CAAC,EAAE,CAAC,MAAM,EAAEL,KAAKK,WAAW,CAAC,EAAE,CAAC,CAAC;oBAClE,CAAC;oBACD;gBACF;YAEA;gBAAS;oBACP,MAAMC,mBAA0BN;oBAChC,MAAM,IAAIO,MAAM,CAAC,mCAAmC,EAAED,iBAAiB,CAAC,EAAE;gBAC5E;QACF;IACF;IAEAP,UAAUH;IAEV,OAAOE;AACT"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "getTokens", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: ()=>getTokens
|
|
5
|
+
});
|
|
6
|
+
const _token = require("./types/token");
|
|
7
|
+
const getTokens = (input)=>{
|
|
8
|
+
const tokens = [];
|
|
9
|
+
let currentToken = "";
|
|
10
|
+
// Pushes the current token to the tokens array and resets the current token
|
|
11
|
+
const pushToken = ()=>{
|
|
12
|
+
if (currentToken.length === 0) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (currentToken === "WITH") {
|
|
16
|
+
tokens.push({
|
|
17
|
+
type: "with"
|
|
18
|
+
});
|
|
19
|
+
} else if ((0, _token.isOperator)(currentToken)) {
|
|
20
|
+
tokens.push({
|
|
21
|
+
type: "operator",
|
|
22
|
+
value: currentToken
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
tokens.push({
|
|
26
|
+
type: "identifier",
|
|
27
|
+
value: currentToken
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
currentToken = "";
|
|
31
|
+
};
|
|
32
|
+
for(let i = 0; i < input.length; i++){
|
|
33
|
+
const currentChar = input[i];
|
|
34
|
+
if ((0, _token.isParenthesis)(currentChar)) {
|
|
35
|
+
pushToken();
|
|
36
|
+
tokens.push({
|
|
37
|
+
type: "parenthesis",
|
|
38
|
+
value: currentChar
|
|
39
|
+
});
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (currentChar === " ") {
|
|
43
|
+
pushToken();
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
currentToken += currentChar;
|
|
47
|
+
}
|
|
48
|
+
pushToken();
|
|
49
|
+
return tokens;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=get-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/license-cop/src/lib/spdx/get-tokens.ts"],"sourcesContent":["import { isOperator, isParenthesis, Token } from \"./types/token\";\n\nexport const getTokens = (input: string): Token[] => {\n const tokens: Token[] = [];\n let currentToken = \"\";\n\n // Pushes the current token to the tokens array and resets the current token\n const pushToken = () => {\n if (currentToken.length === 0) {\n return;\n }\n\n if (currentToken === \"WITH\") {\n tokens.push({\n type: \"with\"\n });\n } else if (isOperator(currentToken)) {\n tokens.push({\n type: \"operator\",\n value: currentToken\n });\n } else {\n tokens.push({\n type: \"identifier\",\n value: currentToken\n });\n }\n\n currentToken = \"\";\n };\n\n for (let i = 0; i < input.length; i++) {\n const currentChar = input[i];\n\n if (isParenthesis(currentChar)) {\n pushToken();\n\n tokens.push({\n type: \"parenthesis\",\n value: currentChar\n });\n\n continue;\n }\n\n if (currentChar === \" \") {\n pushToken();\n continue;\n }\n\n currentToken += currentChar;\n }\n\n pushToken();\n return tokens;\n};\n"],"names":["getTokens","input","tokens","currentToken","pushToken","length","push","type","isOperator","value","i","currentChar","isParenthesis"],"mappings":";+BAEaA;;aAAAA;;uBAFoC;AAE1C,MAAMA,YAAY,CAACC,QAA2B;IACnD,MAAMC,SAAkB,EAAE;IAC1B,IAAIC,eAAe;IAEnB,4EAA4E;IAC5E,MAAMC,YAAY,IAAM;QACtB,IAAID,aAAaE,MAAM,KAAK,GAAG;YAC7B;QACF,CAAC;QAED,IAAIF,iBAAiB,QAAQ;YAC3BD,OAAOI,IAAI,CAAC;gBACVC,MAAM;YACR;QACF,OAAO,IAAIC,IAAAA,iBAAU,EAACL,eAAe;YACnCD,OAAOI,IAAI,CAAC;gBACVC,MAAM;gBACNE,OAAON;YACT;QACF,OAAO;YACLD,OAAOI,IAAI,CAAC;gBACVC,MAAM;gBACNE,OAAON;YACT;QACF,CAAC;QAEDA,eAAe;IACjB;IAEA,IAAK,IAAIO,IAAI,GAAGA,IAAIT,MAAMI,MAAM,EAAEK,IAAK;QACrC,MAAMC,cAAcV,KAAK,CAACS,EAAE;QAE5B,IAAIE,IAAAA,oBAAa,EAACD,cAAc;YAC9BP;YAEAF,OAAOI,IAAI,CAAC;gBACVC,MAAM;gBACNE,OAAOE;YACT;YAEA,QAAS;QACX,CAAC;QAED,IAAIA,gBAAgB,KAAK;YACvBP;YACA,QAAS;QACX,CAAC;QAEDD,gBAAgBQ;IAClB;IAEAP;IACA,OAAOF;AACT"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "parseLicenseExpression", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: ()=>parseLicenseExpression
|
|
5
|
+
});
|
|
6
|
+
const _getTokens = require("./get-tokens");
|
|
7
|
+
const _parseTokens = require("./parse-tokens");
|
|
8
|
+
const parseLicenseExpression = (input)=>{
|
|
9
|
+
if (input === "UNLICENSED") {
|
|
10
|
+
return {
|
|
11
|
+
type: "unlicensed"
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const tokens = (0, _getTokens.getTokens)(input);
|
|
15
|
+
return (0, _parseTokens.parseTokens)(tokens, input);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=parse-license-expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/license-cop/src/lib/spdx/parse-license-expression.ts"],"sourcesContent":["import { getTokens } from \"./get-tokens\";\nimport { parseTokens } from \"./parse-tokens\";\nimport { SpdxExpression, Unlicensed } from \"./types/spdx-expression\";\n\nexport const parseLicenseExpression = (input: string): SpdxExpression | Unlicensed => {\n if (input === \"UNLICENSED\") {\n return {\n type: \"unlicensed\"\n };\n }\n\n const tokens = getTokens(input);\n return parseTokens(tokens, input);\n};\n"],"names":["parseLicenseExpression","input","type","tokens","getTokens","parseTokens"],"mappings":";+BAIaA;;aAAAA;;2BAJa;6BACE;AAGrB,MAAMA,yBAAyB,CAACC,QAA+C;IACpF,IAAIA,UAAU,cAAc;QAC1B,OAAO;YACLC,MAAM;QACR;IACF,CAAC;IAED,MAAMC,SAASC,IAAAA,oBAAS,EAACH;IACzB,OAAOI,IAAAA,wBAAW,EAACF,QAAQF;AAC7B"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "parseTokens", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: ()=>parseTokens
|
|
5
|
+
});
|
|
6
|
+
const parseTokens = (tokens, originalInput)=>{
|
|
7
|
+
let index = 0;
|
|
8
|
+
const throwNotValid = ()=>{
|
|
9
|
+
throw new Error(`'${originalInput}' is not a valid SPDX expression`);
|
|
10
|
+
};
|
|
11
|
+
const hasMore = ()=>index < tokens.length;
|
|
12
|
+
const getCurrentToken = ()=>hasMore() ? tokens[index] : null;
|
|
13
|
+
const moveToNextToken = ()=>{
|
|
14
|
+
if (!hasMore()) {
|
|
15
|
+
throwNotValid();
|
|
16
|
+
}
|
|
17
|
+
index++;
|
|
18
|
+
};
|
|
19
|
+
const tryParseParenthesis = (operator)=>{
|
|
20
|
+
const currentToken = getCurrentToken();
|
|
21
|
+
if (currentToken && currentToken.type === "parenthesis" && operator === currentToken.value) {
|
|
22
|
+
moveToNextToken();
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
const tryParseWithToken = ()=>{
|
|
28
|
+
const currentToken = getCurrentToken();
|
|
29
|
+
if (currentToken && currentToken.type === "with") {
|
|
30
|
+
moveToNextToken();
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
};
|
|
35
|
+
const tryParseOperator = (operator)=>{
|
|
36
|
+
const currentToken = getCurrentToken();
|
|
37
|
+
if (currentToken && currentToken.type === "operator" && operator === currentToken.value) {
|
|
38
|
+
moveToNextToken();
|
|
39
|
+
return currentToken.value;
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
};
|
|
43
|
+
const tryParseLicense = ()=>{
|
|
44
|
+
const currentToken = getCurrentToken();
|
|
45
|
+
if (currentToken && currentToken.type === "identifier") {
|
|
46
|
+
moveToNextToken();
|
|
47
|
+
return {
|
|
48
|
+
type: "identifier",
|
|
49
|
+
value: currentToken.value
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
};
|
|
54
|
+
const tryParseParenthesizedExpression = ()=>{
|
|
55
|
+
const startsWithParenthesis = tryParseParenthesis("(");
|
|
56
|
+
if (!startsWithParenthesis) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const innerExpression = tryParseExpression();
|
|
60
|
+
const endsWithParenthesis = tryParseParenthesis(")");
|
|
61
|
+
if (!endsWithParenthesis) {
|
|
62
|
+
throwNotValid();
|
|
63
|
+
}
|
|
64
|
+
return innerExpression;
|
|
65
|
+
};
|
|
66
|
+
const binaryOperationFactory = (operator, tryNextParser)=>{
|
|
67
|
+
const tryParseBinaryOperation = ()=>{
|
|
68
|
+
const left = tryNextParser();
|
|
69
|
+
if (!left) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
if (!tryParseOperator(operator)) {
|
|
73
|
+
return left;
|
|
74
|
+
}
|
|
75
|
+
const right = tryParseBinaryOperation();
|
|
76
|
+
if (!right) {
|
|
77
|
+
return throwNotValid();
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
type: operator,
|
|
81
|
+
expressions: [
|
|
82
|
+
left,
|
|
83
|
+
right
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
return tryParseBinaryOperation;
|
|
88
|
+
};
|
|
89
|
+
const tryParseWith = ()=>{
|
|
90
|
+
const left = tryParseLicense();
|
|
91
|
+
if (!left) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
if (!tryParseWithToken()) {
|
|
95
|
+
return left;
|
|
96
|
+
}
|
|
97
|
+
const right = tryParseLicense();
|
|
98
|
+
if (!right) {
|
|
99
|
+
return throwNotValid();
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
type: "WITH",
|
|
103
|
+
expressions: [
|
|
104
|
+
left.value,
|
|
105
|
+
right.value
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
const parseAnd = binaryOperationFactory("AND", ()=>tryParseParenthesizedExpression() || tryParseWith());
|
|
110
|
+
const tryParseExpression = binaryOperationFactory("OR", parseAnd);
|
|
111
|
+
const node = tryParseExpression();
|
|
112
|
+
if (!node || hasMore()) {
|
|
113
|
+
return throwNotValid();
|
|
114
|
+
}
|
|
115
|
+
return node;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=parse-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/license-cop/src/lib/spdx/parse-tokens.ts"],"sourcesContent":["import { Identifier, SpdxExpression } from \"./types/spdx-expression\";\nimport { Token, Parenthesis, Operator } from \"./types/token\";\n\nexport const parseTokens = (tokens: Token[], originalInput: string): SpdxExpression => {\n let index = 0;\n\n const throwNotValid = () => {\n throw new Error(`'${originalInput}' is not a valid SPDX expression`);\n };\n\n const hasMore = (): boolean => index < tokens.length;\n\n const getCurrentToken = (): Token | null => (hasMore() ? tokens[index] : null);\n\n const moveToNextToken = () => {\n if (!hasMore()) {\n throwNotValid();\n }\n\n index++;\n };\n\n const tryParseParenthesis = (operator: Parenthesis): boolean => {\n const currentToken = getCurrentToken();\n\n if (currentToken && currentToken.type === \"parenthesis\" && operator === currentToken.value) {\n moveToNextToken();\n return true;\n }\n\n return false;\n };\n\n const tryParseWithToken = (): boolean => {\n const currentToken = getCurrentToken();\n\n if (currentToken && currentToken.type === \"with\") {\n moveToNextToken();\n return true;\n }\n\n return false;\n };\n\n const tryParseOperator = (operator: Operator): Operator | undefined => {\n const currentToken = getCurrentToken();\n\n if (currentToken && currentToken.type === \"operator\" && operator === currentToken.value) {\n moveToNextToken();\n return currentToken.value;\n }\n\n return undefined;\n };\n\n const tryParseLicense = (): Identifier | undefined => {\n const currentToken = getCurrentToken();\n if (currentToken && currentToken.type === \"identifier\") {\n moveToNextToken();\n\n return {\n type: \"identifier\",\n value: currentToken.value\n };\n }\n\n return undefined;\n };\n\n const tryParseParenthesizedExpression = () => {\n const startsWithParenthesis = tryParseParenthesis(\"(\");\n if (!startsWithParenthesis) {\n return undefined;\n }\n\n const innerExpression = tryParseExpression();\n\n const endsWithParenthesis = tryParseParenthesis(\")\");\n if (!endsWithParenthesis) {\n throwNotValid();\n }\n\n return innerExpression;\n };\n\n const binaryOperationFactory = (\n operator: Exclude<Operator, \"WITH\">,\n tryNextParser: () => SpdxExpression | undefined\n ) => {\n const tryParseBinaryOperation = (): SpdxExpression | undefined => {\n const left = tryNextParser();\n\n if (!left) {\n return undefined;\n }\n\n if (!tryParseOperator(operator)) {\n return left;\n }\n\n const right = tryParseBinaryOperation();\n if (!right) {\n return throwNotValid();\n }\n\n return {\n type: operator,\n expressions: [left, right]\n };\n };\n\n return tryParseBinaryOperation;\n };\n\n const tryParseWith = (): SpdxExpression | undefined => {\n const left = tryParseLicense();\n\n if (!left) {\n return undefined;\n }\n\n if (!tryParseWithToken()) {\n return left;\n }\n\n const right = tryParseLicense();\n if (!right) {\n return throwNotValid();\n }\n\n return {\n type: \"WITH\",\n expressions: [left.value, right.value]\n };\n };\n\n const parseAnd = binaryOperationFactory(\n \"AND\",\n () => tryParseParenthesizedExpression() || tryParseWith()\n );\n const tryParseExpression = binaryOperationFactory(\"OR\", parseAnd);\n\n const node = tryParseExpression();\n if (!node || hasMore()) {\n return throwNotValid();\n }\n\n return node;\n};\n"],"names":["parseTokens","tokens","originalInput","index","throwNotValid","Error","hasMore","length","getCurrentToken","moveToNextToken","tryParseParenthesis","operator","currentToken","type","value","tryParseWithToken","tryParseOperator","undefined","tryParseLicense","tryParseParenthesizedExpression","startsWithParenthesis","innerExpression","tryParseExpression","endsWithParenthesis","binaryOperationFactory","tryNextParser","tryParseBinaryOperation","left","right","expressions","tryParseWith","parseAnd","node"],"mappings":";+BAGaA;;aAAAA;;AAAN,MAAMA,cAAc,CAACC,QAAiBC,gBAA0C;IACrF,IAAIC,QAAQ;IAEZ,MAAMC,gBAAgB,IAAM;QAC1B,MAAM,IAAIC,MAAM,CAAC,CAAC,EAAEH,cAAc,gCAAgC,CAAC,EAAE;IACvE;IAEA,MAAMI,UAAU,IAAeH,QAAQF,OAAOM,MAAM;IAEpD,MAAMC,kBAAkB,IAAqBF,YAAYL,MAAM,CAACE,MAAM,GAAG,IAAI;IAE7E,MAAMM,kBAAkB,IAAM;QAC5B,IAAI,CAACH,WAAW;YACdF;QACF,CAAC;QAEDD;IACF;IAEA,MAAMO,sBAAsB,CAACC,WAAmC;QAC9D,MAAMC,eAAeJ;QAErB,IAAII,gBAAgBA,aAAaC,IAAI,KAAK,iBAAiBF,aAAaC,aAAaE,KAAK,EAAE;YAC1FL;YACA,OAAO,IAAI;QACb,CAAC;QAED,OAAO,KAAK;IACd;IAEA,MAAMM,oBAAoB,IAAe;QACvC,MAAMH,eAAeJ;QAErB,IAAII,gBAAgBA,aAAaC,IAAI,KAAK,QAAQ;YAChDJ;YACA,OAAO,IAAI;QACb,CAAC;QAED,OAAO,KAAK;IACd;IAEA,MAAMO,mBAAmB,CAACL,WAA6C;QACrE,MAAMC,eAAeJ;QAErB,IAAII,gBAAgBA,aAAaC,IAAI,KAAK,cAAcF,aAAaC,aAAaE,KAAK,EAAE;YACvFL;YACA,OAAOG,aAAaE,KAAK;QAC3B,CAAC;QAED,OAAOG;IACT;IAEA,MAAMC,kBAAkB,IAA8B;QACpD,MAAMN,eAAeJ;QACrB,IAAII,gBAAgBA,aAAaC,IAAI,KAAK,cAAc;YACtDJ;YAEA,OAAO;gBACLI,MAAM;gBACNC,OAAOF,aAAaE,KAAK;YAC3B;QACF,CAAC;QAED,OAAOG;IACT;IAEA,MAAME,kCAAkC,IAAM;QAC5C,MAAMC,wBAAwBV,oBAAoB;QAClD,IAAI,CAACU,uBAAuB;YAC1B,OAAOH;QACT,CAAC;QAED,MAAMI,kBAAkBC;QAExB,MAAMC,sBAAsBb,oBAAoB;QAChD,IAAI,CAACa,qBAAqB;YACxBnB;QACF,CAAC;QAED,OAAOiB;IACT;IAEA,MAAMG,yBAAyB,CAC7Bb,UACAc,gBACG;QACH,MAAMC,0BAA0B,IAAkC;YAChE,MAAMC,OAAOF;YAEb,IAAI,CAACE,MAAM;gBACT,OAAOV;YACT,CAAC;YAED,IAAI,CAACD,iBAAiBL,WAAW;gBAC/B,OAAOgB;YACT,CAAC;YAED,MAAMC,QAAQF;YACd,IAAI,CAACE,OAAO;gBACV,OAAOxB;YACT,CAAC;YAED,OAAO;gBACLS,MAAMF;gBACNkB,aAAa;oBAACF;oBAAMC;iBAAM;YAC5B;QACF;QAEA,OAAOF;IACT;IAEA,MAAMI,eAAe,IAAkC;QACrD,MAAMH,OAAOT;QAEb,IAAI,CAACS,MAAM;YACT,OAAOV;QACT,CAAC;QAED,IAAI,CAACF,qBAAqB;YACxB,OAAOY;QACT,CAAC;QAED,MAAMC,QAAQV;QACd,IAAI,CAACU,OAAO;YACV,OAAOxB;QACT,CAAC;QAED,OAAO;YACLS,MAAM;YACNgB,aAAa;gBAACF,KAAKb,KAAK;gBAAEc,MAAMd,KAAK;aAAC;QACxC;IACF;IAEA,MAAMiB,WAAWP,uBACf,OACA,IAAML,qCAAqCW;IAE7C,MAAMR,qBAAqBE,uBAAuB,MAAMO;IAExD,MAAMC,OAAOV;IACb,IAAI,CAACU,QAAQ1B,WAAW;QACtB,OAAOF;IACT,CAAC;IAED,OAAO4B;AACT"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type Identifier = {
|
|
2
|
+
type: "identifier";
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
export type AndExpression = {
|
|
6
|
+
type: "AND";
|
|
7
|
+
expressions: [SpdxExpression, SpdxExpression];
|
|
8
|
+
};
|
|
9
|
+
export type OrExpression = {
|
|
10
|
+
type: "OR";
|
|
11
|
+
expressions: [SpdxExpression, SpdxExpression];
|
|
12
|
+
};
|
|
13
|
+
export type WithExpression = {
|
|
14
|
+
type: "WITH";
|
|
15
|
+
expressions: [string, string];
|
|
16
|
+
};
|
|
17
|
+
export type SpdxExpression = Identifier | AndExpression | OrExpression | WithExpression;
|
|
18
|
+
export type Unlicensed = {
|
|
19
|
+
type: "unlicensed";
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/license-cop/src/lib/spdx/types/spdx-expression.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const operators: readonly ["AND", "OR"];
|
|
2
|
+
export declare const isOperator: (value: string) => value is "AND" | "OR";
|
|
3
|
+
export type Operator = (typeof operators)[number];
|
|
4
|
+
export type OperatorToken = {
|
|
5
|
+
type: "operator";
|
|
6
|
+
value: Operator;
|
|
7
|
+
};
|
|
8
|
+
export type WithToken = {
|
|
9
|
+
type: "with";
|
|
10
|
+
};
|
|
11
|
+
export type IdentifierToken = {
|
|
12
|
+
type: "identifier";
|
|
13
|
+
value: string;
|
|
14
|
+
};
|
|
15
|
+
declare const parenthesis: readonly ["(", ")"];
|
|
16
|
+
export declare const isParenthesis: (value: string) => value is "(" | ")";
|
|
17
|
+
export type Parenthesis = (typeof parenthesis)[number];
|
|
18
|
+
export type ParenthesisToken = {
|
|
19
|
+
type: "parenthesis";
|
|
20
|
+
value: Parenthesis;
|
|
21
|
+
};
|
|
22
|
+
export type Token = OperatorToken | WithToken | IdentifierToken | ParenthesisToken;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Operators
|
|
2
|
+
"use strict";
|
|
3
|
+
function _export(target, all) {
|
|
4
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: all[name]
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
_export(exports, {
|
|
10
|
+
isOperator: ()=>isOperator,
|
|
11
|
+
isParenthesis: ()=>isParenthesis
|
|
12
|
+
});
|
|
13
|
+
const operators = [
|
|
14
|
+
"AND",
|
|
15
|
+
"OR"
|
|
16
|
+
];
|
|
17
|
+
const isOperator = (value)=>operators.includes(value);
|
|
18
|
+
// Parenthesis
|
|
19
|
+
const parenthesis = [
|
|
20
|
+
"(",
|
|
21
|
+
")"
|
|
22
|
+
];
|
|
23
|
+
const isParenthesis = (value)=>parenthesis.includes(value);
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/license-cop/src/lib/spdx/types/token.ts"],"sourcesContent":["// Operators\n\nconst operators = [\"AND\", \"OR\"] as const;\nexport const isOperator = (value: string): value is Operator =>\n operators.includes(value as Operator);\n\nexport type Operator = (typeof operators)[number];\nexport type OperatorToken = {\n type: \"operator\";\n value: Operator;\n};\n\n// With\n\nexport type WithToken = {\n type: \"with\";\n};\n\n// Identifiers\n\nexport type IdentifierToken = {\n type: \"identifier\";\n value: string;\n};\n\n// Parenthesis\n\nconst parenthesis = [\"(\", \")\"] as const;\nexport const isParenthesis = (value: string): value is Parenthesis =>\n parenthesis.includes(value as Parenthesis);\n\nexport type Parenthesis = (typeof parenthesis)[number];\nexport type ParenthesisToken = {\n type: \"parenthesis\";\n value: Parenthesis;\n};\n\nexport type Token = OperatorToken | WithToken | IdentifierToken | ParenthesisToken;\n"],"names":["isOperator","isParenthesis","operators","value","includes","parenthesis"],"mappings":"AAAA,YAAY;;;;;;;;;IAGCA,UAAU,MAAVA;IAyBAC,aAAa,MAAbA;;AA1Bb,MAAMC,YAAY;IAAC;IAAO;CAAK;AACxB,MAAMF,aAAa,CAACG,QACzBD,UAAUE,QAAQ,CAACD;AAqBrB,cAAc;AAEd,MAAME,cAAc;IAAC;IAAK;CAAI;AACvB,MAAMJ,gBAAgB,CAACE,QAC5BE,YAAYD,QAAQ,CAACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const joinStringArray: (array: string[]) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "joinStringArray", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: ()=>joinStringArray
|
|
5
|
+
});
|
|
6
|
+
const joinStringArray = (array)=>{
|
|
7
|
+
let result = "";
|
|
8
|
+
for(let i = 0; i < array.length; i++){
|
|
9
|
+
result += array[i];
|
|
10
|
+
const isPenultimateElement = i === array.length - 2;
|
|
11
|
+
const isLastElement = i === array.length - 1;
|
|
12
|
+
if (isPenultimateElement) {
|
|
13
|
+
if (array.length === 2) {
|
|
14
|
+
result += " and ";
|
|
15
|
+
} else {
|
|
16
|
+
result += ", and ";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!isLastElement && !isPenultimateElement) {
|
|
20
|
+
result += ", ";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=join-string-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/license-cop/src/lib/utils/join-string-array.ts"],"sourcesContent":["export const joinStringArray = (array: string[]): string => {\n let result = \"\";\n\n for (let i = 0; i < array.length; i++) {\n result += array[i];\n\n const isPenultimateElement = i === array.length - 2;\n const isLastElement = i === array.length - 1;\n\n if (isPenultimateElement) {\n if (array.length === 2) {\n result += \" and \";\n } else {\n result += \", and \";\n }\n }\n\n if (!isLastElement && !isPenultimateElement) {\n result += \", \";\n }\n }\n\n return result;\n};\n"],"names":["joinStringArray","array","result","i","length","isPenultimateElement","isLastElement"],"mappings":";+BAAaA;;aAAAA;;AAAN,MAAMA,kBAAkB,CAACC,QAA4B;IAC1D,IAAIC,SAAS;IAEb,IAAK,IAAIC,IAAI,GAAGA,IAAIF,MAAMG,MAAM,EAAED,IAAK;QACrCD,UAAUD,KAAK,CAACE,EAAE;QAElB,MAAME,uBAAuBF,MAAMF,MAAMG,MAAM,GAAG;QAClD,MAAME,gBAAgBH,MAAMF,MAAMG,MAAM,GAAG;QAE3C,IAAIC,sBAAsB;YACxB,IAAIJ,MAAMG,MAAM,KAAK,GAAG;gBACtBF,UAAU;YACZ,OAAO;gBACLA,UAAU;YACZ,CAAC;QACH,CAAC;QAED,IAAI,CAACI,iBAAiB,CAACD,sBAAsB;YAC3CH,UAAU;QACZ,CAAC;IACH;IAEA,OAAOA;AACT"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Spec } from "arg";
|
|
2
|
-
export interface UserInputs {
|
|
3
|
-
version?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export interface ArgumentsWithAliases extends Spec {
|
|
6
|
-
"--init": typeof Boolean;
|
|
7
|
-
"--directory": typeof String;
|
|
8
|
-
"--dir": "--directory";
|
|
9
|
-
"-d": "--directory";
|
|
10
|
-
"--include-dev-dependencies": typeof Boolean;
|
|
11
|
-
"--dev": "--include-dev-dependencies";
|
|
12
|
-
"-D": "--include-dev-dependencies";
|
|
13
|
-
"--dev-dependencies-only": typeof Boolean;
|
|
14
|
-
"--dev-only": "--dev-dependencies-only";
|
|
15
|
-
"--version": typeof Boolean;
|
|
16
|
-
"-v": "--version";
|
|
17
|
-
}
|
|
18
|
-
export declare const argumentsWithAliases: ArgumentsWithAliases;
|
package/src/lib/cli/arguments.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "argumentsWithAliases", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>argumentsWithAliases
|
|
8
|
-
});
|
|
9
|
-
const argumentsWithAliases = {
|
|
10
|
-
"--init": Boolean,
|
|
11
|
-
"--directory": String,
|
|
12
|
-
"--dir": "--directory",
|
|
13
|
-
"-d": "--directory",
|
|
14
|
-
"--include-dev-dependencies": Boolean,
|
|
15
|
-
"--dev": "--include-dev-dependencies",
|
|
16
|
-
"-D": "--include-dev-dependencies",
|
|
17
|
-
"--dev-dependencies-only": Boolean,
|
|
18
|
-
"--dev-only": "--dev-dependencies-only",
|
|
19
|
-
"--version": Boolean,
|
|
20
|
-
"-v": "--version"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=arguments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/license-cop/src/lib/cli/arguments.ts"],"sourcesContent":["import { Spec } from \"arg\";\n\nexport interface UserInputs {\n version?: boolean;\n}\n\nexport interface ArgumentsWithAliases extends Spec {\n \"--init\": typeof Boolean;\n\n \"--directory\": typeof String;\n \"--dir\": \"--directory\";\n \"-d\": \"--directory\";\n\n \"--include-dev-dependencies\": typeof Boolean;\n \"--dev\": \"--include-dev-dependencies\";\n \"-D\": \"--include-dev-dependencies\";\n\n \"--dev-dependencies-only\": typeof Boolean;\n \"--dev-only\": \"--dev-dependencies-only\";\n\n \"--version\": typeof Boolean;\n \"-v\": \"--version\";\n}\n\nexport const argumentsWithAliases: ArgumentsWithAliases = {\n \"--init\": Boolean,\n\n \"--directory\": String,\n \"--dir\": \"--directory\",\n \"-d\": \"--directory\",\n\n \"--include-dev-dependencies\": Boolean,\n \"--dev\": \"--include-dev-dependencies\",\n \"-D\": \"--include-dev-dependencies\",\n\n \"--dev-dependencies-only\": Boolean,\n \"--dev-only\": \"--dev-dependencies-only\",\n\n \"--version\": Boolean,\n \"-v\": \"--version\"\n};\n"],"names":["argumentsWithAliases","Boolean","String"],"mappings":";;;;+BAwBaA;;aAAAA;;AAAN,MAAMA,uBAA6C;IACxD,UAAUC;IAEV,eAAeC;IACf,SAAS;IACT,MAAM;IAEN,8BAA8BD;IAC9B,SAAS;IACT,MAAM;IAEN,2BAA2BA;IAC3B,cAAc;IAEd,aAAaA;IACb,MAAM;AACR"}
|
package/src/lib/cli/init.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const init: (rootDir: string) => Promise<void>;
|
package/src/lib/cli/init.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "init", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>init
|
|
8
|
-
});
|
|
9
|
-
const _promises = require("fs/promises");
|
|
10
|
-
const _path = require("path");
|
|
11
|
-
const defaultConfig = `{
|
|
12
|
-
"licenses": ["MIT", "ISC", "Apache-2.0"],
|
|
13
|
-
"packages": []
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
const init = async (rootDir)=>{
|
|
17
|
-
console.log("Setting up a new license-cop config file...");
|
|
18
|
-
const configPath = (0, _path.join)(rootDir, ".licenses.json");
|
|
19
|
-
(0, _promises.writeFile)(configPath, defaultConfig);
|
|
20
|
-
console.log("Done!");
|
|
21
|
-
console.log("Run `npx license-cop` to check your dependencies");
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=init.js.map
|
package/src/lib/cli/init.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/license-cop/src/lib/cli/init.ts"],"sourcesContent":["import { writeFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nconst defaultConfig = `{\n \"licenses\": [\"MIT\", \"ISC\", \"Apache-2.0\"],\n \"packages\": []\n}\n`;\n\nexport const init = async (rootDir: string) => {\n console.log(\"Setting up a new license-cop config file...\");\n\n const configPath = join(rootDir, \".licenses.json\");\n writeFile(configPath, defaultConfig);\n\n console.log(\"Done!\");\n console.log(\"Run `npx license-cop` to check your dependencies\");\n};\n"],"names":["init","defaultConfig","rootDir","console","log","configPath","join","writeFile"],"mappings":";;;;+BASaA;;aAAAA;;0BATa;sBACL;AAErB,MAAMC,gBAAgB,CAAC;;;;AAIvB,CAAC;AAEM,MAAMD,OAAO,OAAOE,UAAoB;IAC7CC,QAAQC,GAAG,CAAC;IAEZ,MAAMC,aAAaC,IAAAA,UAAI,EAACJ,SAAS;IACjCK,IAAAA,mBAAS,EAACF,YAAYJ;IAEtBE,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd"}
|
package/src/lib/cli/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const printPackageVersion: () => Promise<void>;
|
package/src/lib/cli/version.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "printPackageVersion", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>printPackageVersion
|
|
8
|
-
});
|
|
9
|
-
const _path = require("path");
|
|
10
|
-
const _packageJson = require("../package-json");
|
|
11
|
-
const printPackageVersion = async ()=>{
|
|
12
|
-
const packageJsonLocation = (0, _path.join)(__dirname, "../../../package.json");
|
|
13
|
-
const { version } = await (0, _packageJson.readPackageJson)(packageJsonLocation);
|
|
14
|
-
console.log(`v${version}`);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/license-cop/src/lib/cli/version.ts"],"sourcesContent":["import { join } from \"path\";\nimport { readPackageJson } from \"../package-json\";\n\nexport const printPackageVersion = async (): Promise<void> => {\n const packageJsonLocation = join(__dirname, \"../../../package.json\");\n const { version } = await readPackageJson(packageJsonLocation);\n console.log(`v${version}`);\n};\n"],"names":["printPackageVersion","packageJsonLocation","join","__dirname","version","readPackageJson","console","log"],"mappings":";;;;+BAGaA;;aAAAA;;sBAHQ;6BACW;AAEzB,MAAMA,sBAAsB,UAA2B;IAC5D,MAAMC,sBAAsBC,IAAAA,UAAI,EAACC,WAAW;IAC5C,MAAM,EAAEC,QAAO,EAAE,GAAG,MAAMC,IAAAA,4BAAe,EAACJ;IAC1CK,QAAQC,GAAG,CAAC,CAAC,CAAC,EAAEH,QAAQ,CAAC;AAC3B"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "ViolationsError", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>ViolationsError
|
|
8
|
-
});
|
|
9
|
-
let ViolationsError = class ViolationsError extends Error {
|
|
10
|
-
constructor(violations){
|
|
11
|
-
super();
|
|
12
|
-
this.violations = violations;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=violations-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/license-cop/src/lib/violations-error.ts"],"sourcesContent":["export class ViolationsError extends Error {\n constructor(public readonly violations: Set<Violation>) {\n super();\n }\n}\n\nexport interface Violation {\n packageName: string;\n packageVersion: string;\n license: string;\n}\n"],"names":["ViolationsError","Error","constructor","violations"],"mappings":";;;;+BAAaA;;aAAAA;;AAAN,IAAA,AAAMA,kBAAN,MAAMA,wBAAwBC;IACnCC,YAA4BC,WAA4B;QACtD,KAAK;0BADqBA;IAE5B;AACF"}
|