@@ -2155,10 +2155,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
2155
2155
error ( message ) ;
2156
2156
}
2157
2157
exports . setFailed = setFailed2 ;
2158
- function isDebug2 ( ) {
2158
+ function isDebug ( ) {
2159
2159
return process . env [ "RUNNER_DEBUG" ] === "1" ;
2160
2160
}
2161
- exports . isDebug = isDebug2 ;
2161
+ exports . isDebug = isDebug ;
2162
2162
function debug2 ( message ) {
2163
2163
command_1 . issueCommand ( "debug" , { } , message ) ;
2164
2164
}
@@ -3088,11 +3088,10 @@ var require_dist2 = __commonJS({
3088
3088
} ) ;
3089
3089
3090
3090
// src/index.ts
3091
- var import_core2 = __toESM ( require_core ( ) , 1 ) ;
3091
+ var import_core = __toESM ( require_core ( ) , 1 ) ;
3092
3092
var import_console_table_printer = __toESM ( require_dist2 ( ) , 1 ) ;
3093
3093
3094
3094
// src/get-package-licenses.ts
3095
- var import_core = __toESM ( require_core ( ) , 1 ) ;
3096
3095
import { spawn } from "node:child_process" ;
3097
3096
import { resolve } from "node:path" ;
3098
3097
import { cwd } from "node:process" ;
@@ -3106,10 +3105,6 @@ async function getLicenses(directory) {
3106
3105
proc . on ( "close" , resolve2 ) ;
3107
3106
proc . on ( "error" , reject ) ;
3108
3107
} ) ;
3109
- if ( ( 0 , import_core . isDebug ) ( ) ) {
3110
- ( 0 , import_core . debug ) ( "Licenses JSON" ) ;
3111
- ( 0 , import_core . debug ) ( stdout ) ;
3112
- }
3113
3108
return stdout . startsWith ( "{" ) ? JSON . parse ( stdout ) : { } ;
3114
3109
}
3115
3110
@@ -3167,19 +3162,22 @@ async function action(directory, allowedLicenses, ignoredPackages) {
3167
3162
3168
3163
// src/index.ts
3169
3164
try {
3170
- const directory = ( ( 0 , import_core2 . getInput ) ( "directory" , { required : false , trimWhitespace : true } ) || "." ) . replaceAll ( "'" , "" ) ;
3171
- const allowed_licenses = new Set ( ( 0 , import_core2 . getMultilineInput ) ( "allowed" , { required : false } ) ?? [ ] ) ;
3172
- const ignored_packages = new Set ( ( 0 , import_core2 . getMultilineInput ) ( "ignored" , { required : false } ) . map ( ( pkg ) => {
3165
+ const directory = ( ( 0 , import_core . getInput ) ( "directory" , { required : false , trimWhitespace : true } ) || "." ) . replaceAll ( "'" , "" ) ;
3166
+ const allowedLicenses = new Set ( ( 0 , import_core . getMultilineInput ) ( "allowed" , { required : false , trimWhitespace : true } ) ) ;
3167
+ const ignoredPackages = new Set ( ( 0 , import_core . getMultilineInput ) ( "ignored" , { required : false , trimWhitespace : true } ) . map ( ( pkg ) => pkg . replace ( / # . * / , "" ) . trim ( ) ) . map ( ( pkg ) => {
3173
3168
if ( pkg . startsWith ( "@" ) ) {
3174
3169
const [ _ , name2 = "" , version3 = "" ] = pkg . split ( "@" ) ;
3175
3170
return { name : `@${ name2 } ` , version : version3 } ;
3176
3171
}
3177
3172
const [ name = "" , version2 = "" ] = pkg . split ( "@" ) ;
3178
3173
return { name, version : version2 } ;
3179
3174
} ) ) ;
3180
- const result = await action ( directory , allowed_licenses , ignored_packages ) ;
3175
+ ( 0 , import_core . debug ) ( `directory: ${ directory } ` ) ;
3176
+ ( 0 , import_core . debug ) ( `allowed: ${ [ ...allowedLicenses ] . join ( ", " ) } ` ) ;
3177
+ ( 0 , import_core . debug ) ( `ignored: ${ [ ...ignoredPackages ] . map ( ( pkg ) => `${ pkg . name } @${ pkg . version } ` ) . join ( ", " ) } ` ) ;
3178
+ const result = await action ( directory , allowedLicenses , ignoredPackages ) ;
3181
3179
if ( result . success ) {
3182
- ( 0 , import_core2 . info ) ( "All licenses are valid" ) ;
3180
+ ( 0 , import_core . info ) ( "All licenses are valid" ) ;
3183
3181
const table = new import_console_table_printer . Table ( {
3184
3182
columns : [
3185
3183
{ alignment : "left" , name : "license" , title : "License" } ,
@@ -3190,11 +3188,11 @@ try {
3190
3188
license : pkg [ 0 ] ,
3191
3189
count : pkg [ 1 ] . size
3192
3190
} ) ) ) ;
3193
- ( 0 , import_core2 . info ) ( table . render ( ) ) ;
3191
+ ( 0 , import_core . info ) ( table . render ( ) ) ;
3194
3192
} else {
3195
- ( 0 , import_core2 . setFailed ) ( "Invalid licenses found" ) ;
3193
+ ( 0 , import_core . setFailed ) ( "Invalid licenses found" ) ;
3196
3194
for ( const license of result . invalidLicenses ) {
3197
- ( 0 , import_core2 . warning ) ( `Invalid license ${ license } ` ) ;
3195
+ ( 0 , import_core . warning ) ( `Invalid license ${ license } ` ) ;
3198
3196
const table = new import_console_table_printer . Table ( {
3199
3197
columns : [
3200
3198
{ alignment : "left" , name : "name" , title : "Name" } ,
@@ -3214,13 +3212,13 @@ try {
3214
3212
homepage : pkg . homepage
3215
3213
// todo include chain `pnpm why <package> --json`
3216
3214
} ) ) ) ;
3217
- ( 0 , import_core2 . info ) ( table . render ( ) ) ;
3215
+ ( 0 , import_core . info ) ( table . render ( ) ) ;
3218
3216
}
3219
3217
}
3220
3218
} catch ( error ) {
3221
3219
if ( error instanceof Error ) {
3222
- ( 0 , import_core2 . setFailed ) ( error . message ) ;
3220
+ ( 0 , import_core . setFailed ) ( error . message ) ;
3223
3221
} else {
3224
- ( 0 , import_core2 . setFailed ) ( error ? error . toString ( ) : "Unknown error" ) ;
3222
+ ( 0 , import_core . setFailed ) ( error ? error . toString ( ) : "Unknown error" ) ;
3225
3223
}
3226
3224
}
0 commit comments