@rio-cloud/rio-license-checker 1.2.2-alpha.1 → 1.2.2
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/dist/index.mjs +1 -12
- package/package.json +5 -9
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,6 @@ import logger from "loglevel";
|
|
|
7
7
|
import { GetObjectCommand, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
|
8
8
|
import { GetParameterCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
9
9
|
import { $, fs as fs$1, path as path$1 } from "zx";
|
|
10
|
-
|
|
11
10
|
//#region src/s3/license-bucket.ts
|
|
12
11
|
let ossLicensesBucketName;
|
|
13
12
|
const OSS_LICENSES_BUCKET_NAME_SSM_PARAMETER = "/config/oss-licenses/bucket-name";
|
|
@@ -54,7 +53,6 @@ const uploadLicenseReport = async (accountName, serviceName, type, report) => {
|
|
|
54
53
|
});
|
|
55
54
|
await s3Client.send(putObjectCommand);
|
|
56
55
|
};
|
|
57
|
-
|
|
58
56
|
//#endregion
|
|
59
57
|
//#region src/cli/downloadWhitelistFileCommand.ts
|
|
60
58
|
const downloadWhitelistFileCommand = new Command("download-whitelist").description("Download the license whitelist (experimental)").addOption(new Option("-t, --type <type>", "Type of the license check. (only supports \"npm-frontend-bundled\" for now)").makeOptionMandatory(true).choices(["npm-frontend-bundled"])).option("-d, --directory <directory>", "Directory to save the downloaded whitelist file to", process.cwd()).option("-v, --verbose", "Enable debug logging", false).action(async ({ type, directory, verbose }) => {
|
|
@@ -72,7 +70,6 @@ const saveWhitelistFile = async (directory, checkType, content) => {
|
|
|
72
70
|
await fs.promises.writeFile(filePath, content, "utf8");
|
|
73
71
|
return filePath;
|
|
74
72
|
};
|
|
75
|
-
|
|
76
73
|
//#endregion
|
|
77
74
|
//#region src/types.ts
|
|
78
75
|
var LicenseCheckError = class extends Error {
|
|
@@ -92,7 +89,6 @@ const automaticWhitelists = [
|
|
|
92
89
|
"npm-frontend",
|
|
93
90
|
"gradle"
|
|
94
91
|
];
|
|
95
|
-
|
|
96
92
|
//#endregion
|
|
97
93
|
//#region src/integrations/license-checker-gradle.ts
|
|
98
94
|
const normalizeLicenseReport = (report) => {
|
|
@@ -147,7 +143,6 @@ const discoverGradleWrapper = async (directory) => {
|
|
|
147
143
|
if (fs$1.existsSync(path$1.join(directory, "..", "gradlew"))) return "../gradlew";
|
|
148
144
|
throw new LicenseCheckError(`Could not find gradle wrapper in ${directory} or the parent directory. Please ensure that the gradle wrapper is present.`);
|
|
149
145
|
};
|
|
150
|
-
|
|
151
146
|
//#endregion
|
|
152
147
|
//#region src/integrations/license-checker-npm.ts
|
|
153
148
|
const resolveLicenseCheckerPath = () => {
|
|
@@ -174,7 +169,6 @@ const callNpmLicenseChecker = async ({ directory, licenseWhitelist, excludePacka
|
|
|
174
169
|
if (result.exitCode !== 0) throw new LicenseCheckError(result.stderr.trimEnd());
|
|
175
170
|
return result.stdout;
|
|
176
171
|
};
|
|
177
|
-
|
|
178
172
|
//#endregion
|
|
179
173
|
//#region src/cli/validations.ts
|
|
180
174
|
const validateAccountName = (accountName) => {
|
|
@@ -183,7 +177,6 @@ const validateAccountName = (accountName) => {
|
|
|
183
177
|
const validateServiceName = (serviceName) => {
|
|
184
178
|
if (!serviceName.match(/^[a-zA-Z0-9-_]+$/)) throw new CliArgsError("Service name must only contain alphanumeric characters, hyphens and underscores");
|
|
185
179
|
};
|
|
186
|
-
|
|
187
180
|
//#endregion
|
|
188
181
|
//#region src/cli/runCheckCommand.ts
|
|
189
182
|
const runCheckCommand = new Command("run-check").summary("(default) Run an automated license check and optionally upload the report to S3").description("This is the default command to be used for backend and \"traditional\" frontend projects.\n\nWill download the whitelist, then perform the check and upload the report in one single step.").addOption(new Option("-t, --type <type>", "Type of the license check").makeOptionMandatory(true).choices(automaticWhitelists)).option("-a, --account-name <account>", "Account / context name").option("-s, --service-name <service>", "Service name").option("-d, --directory <directory>", "Directory of the project to check licenses for", process.cwd()).option("-u, --upload", "Upload license report to S3", false).option("-v, --verbose", "Enable debug logging", false).action(async (options) => {
|
|
@@ -239,7 +232,6 @@ const readIgnorePackages = (directory) => {
|
|
|
239
232
|
if (fs.existsSync(ignorePackagesFile)) ignorePackages = fs.readFileSync(ignorePackagesFile, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
240
233
|
return ignorePackages;
|
|
241
234
|
};
|
|
242
|
-
|
|
243
235
|
//#endregion
|
|
244
236
|
//#region src/cli/uploadReportCommand.ts
|
|
245
237
|
const uploadReportCommand = new Command("upload-report").description("Upload a license report (placeholder)").addOption(new Option("-t, --type <type>", "Type of the license check. (only supports \"npm-frontend-bundled\" for now)").makeOptionMandatory(true).choices(["npm-frontend-bundled"])).addOption(new Option("-a, --account-name <account>", "Account / context name").makeOptionMandatory(true)).addOption(new Option("-s, --service-name <service>", "Service name").makeOptionMandatory(true)).addOption(new Option("-r, --report-file <file>", "Path to the license report file").makeOptionMandatory(true)).option("-v, --verbose", "Enable debug logging", false).action(async ({ type, accountName, serviceName, reportFile, verbose }) => {
|
|
@@ -251,7 +243,6 @@ const uploadReportCommand = new Command("upload-report").description("Upload a l
|
|
|
251
243
|
await uploadLicenseReport(accountName, serviceName, type, reportFileContent);
|
|
252
244
|
logger.info(`Uploaded license report for ${accountName}/${serviceName}_${type}`);
|
|
253
245
|
});
|
|
254
|
-
|
|
255
246
|
//#endregion
|
|
256
247
|
//#region src/cli.ts
|
|
257
248
|
const wrapCommand = (command) => command.exitOverride((error) => {
|
|
@@ -262,7 +253,6 @@ const cli = (args) => {
|
|
|
262
253
|
program.name("npx @rio-cloud/rio-license-checker").addCommand(wrapCommand(runCheckCommand), { isDefault: true }).addCommand(wrapCommand(downloadWhitelistFileCommand)).addCommand(wrapCommand(uploadReportCommand)).addHelpText("after", `\n"run-check" is the default command if you don't specify one.\nRun "npx @rio-cloud/rio-license-checker help run-check" for details.`);
|
|
263
254
|
return program.parseAsync(args);
|
|
264
255
|
};
|
|
265
|
-
|
|
266
256
|
//#endregion
|
|
267
257
|
//#region src/index.ts
|
|
268
258
|
try {
|
|
@@ -280,6 +270,5 @@ try {
|
|
|
280
270
|
process.exit(1);
|
|
281
271
|
}
|
|
282
272
|
}
|
|
283
|
-
|
|
284
273
|
//#endregion
|
|
285
|
-
export {
|
|
274
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rio-cloud/rio-license-checker",
|
|
3
|
-
"version": "1.2.2
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/client-s3": "3.
|
|
36
|
-
"@aws-sdk/client-ssm": "3.
|
|
35
|
+
"@aws-sdk/client-s3": "3.1016.0",
|
|
36
|
+
"@aws-sdk/client-ssm": "3.1016.0",
|
|
37
37
|
"commander": "14.0.3",
|
|
38
38
|
"license-checker-rseidelsohn": "4.4.2",
|
|
39
39
|
"loglevel": "1.9.2",
|
|
40
40
|
"zx": "8.8.5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@biomejs/biome": "2.4.
|
|
43
|
+
"@biomejs/biome": "2.4.7",
|
|
44
44
|
"@rio-cloud/biome-config-claid": "1.0.0",
|
|
45
45
|
"@tsconfig/node22": "22.0.5",
|
|
46
46
|
"@types/jest": "30.0.0",
|
|
@@ -50,14 +50,10 @@
|
|
|
50
50
|
"aws-sdk-client-mock-jest": "4.1.0",
|
|
51
51
|
"chalk": "5.6.2",
|
|
52
52
|
"commit-and-tag-version": "12.6.1",
|
|
53
|
-
"tsdown": "0.
|
|
53
|
+
"tsdown": "0.21.3",
|
|
54
54
|
"typescript": "5.9.3",
|
|
55
55
|
"vitest": "4.0.18"
|
|
56
56
|
},
|
|
57
|
-
"overrides": {
|
|
58
|
-
"glob": ">=10.5.0",
|
|
59
|
-
"minimatch": ">=10.2.1"
|
|
60
|
-
},
|
|
61
57
|
"commit-and-tag-version": {
|
|
62
58
|
"commitUrlFormat": "https://bitbucket.collaboration-man.com/projects/RIODEV/repos/rio-license-checker/commits/{{hash}}",
|
|
63
59
|
"compareUrlFormat": "{{host}}/projects/RIODEV/repos/rio-license-checker/compare/commits?targetBranch=refs%2Ftags%2F{{previousTag}}&sourceBranch=refs%2Ftags%2F{{currentTag}}",
|