|
19 | 19 | * and modified to specific requirement. |
20 | 20 | */ |
21 | 21 |
|
22 | | -import path from 'node:path'; |
23 | 22 | import fs from 'node:fs'; |
| 23 | +import path from 'node:path'; |
24 | 24 |
|
25 | 25 | import commonjs from '@rollup/plugin-commonjs'; |
26 | 26 | import json from '@rollup/plugin-json'; |
@@ -98,29 +98,51 @@ const bundleDependency = ( |
98 | 98 | }); |
99 | 99 |
|
100 | 100 | // Manual license handling for chrome-devtools-frontend third_party |
101 | | - const tsConfig = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'tsconfig.json'), 'utf-8')); |
102 | | - const thirdPartyDirectories = tsConfig.include.filter(location => { |
| 101 | + const tsConfig = JSON.parse( |
| 102 | + fs.readFileSync( |
| 103 | + path.join(process.cwd(), 'tsconfig.json'), |
| 104 | + 'utf-8', |
| 105 | + ), |
| 106 | + ); |
| 107 | + const thirdPartyDirectories = tsConfig.include.filter(location => { |
103 | 108 | return location.includes( |
104 | 109 | 'node_modules/chrome-devtools-frontend/front_end/third_party', |
105 | 110 | ); |
106 | 111 | }); |
107 | 112 |
|
108 | 113 | const manualLicenses = []; |
109 | 114 | // Add chrome-devtools-frontend main license |
110 | | - const cdtfLicensePath = path.join(process.cwd(), 'node_modules/chrome-devtools-frontend/LICENSE'); |
| 115 | + const cdtfLicensePath = path.join( |
| 116 | + process.cwd(), |
| 117 | + 'node_modules/chrome-devtools-frontend/LICENSE', |
| 118 | + ); |
111 | 119 | if (fs.existsSync(cdtfLicensePath)) { |
112 | | - manualLicenses.push(['Name: chrome-devtools-frontend', 'License: Apache-2.0', '', fs.readFileSync(cdtfLicensePath, 'utf-8')].join('\n')); |
| 120 | + manualLicenses.push( |
| 121 | + [ |
| 122 | + 'Name: chrome-devtools-frontend', |
| 123 | + 'License: Apache-2.0', |
| 124 | + '', |
| 125 | + fs.readFileSync(cdtfLicensePath, 'utf-8'), |
| 126 | + ].join('\n'), |
| 127 | + ); |
113 | 128 | } |
114 | 129 |
|
115 | 130 | for (const thirdPartyDir of thirdPartyDirectories) { |
116 | 131 | const fullPath = path.join(process.cwd(), thirdPartyDir); |
117 | 132 | const licenseFile = path.join(fullPath, 'LICENSE'); |
118 | 133 | if (fs.existsSync(licenseFile)) { |
119 | | - const name = path.basename(thirdPartyDir); |
120 | | - manualLicenses.push([`Name: ${name}`, `License: Custom`, '', fs.readFileSync(licenseFile, 'utf-8').replaceAll('\r', '')].join('\n')); |
| 134 | + const name = path.basename(thirdPartyDir); |
| 135 | + manualLicenses.push( |
| 136 | + [ |
| 137 | + `Name: ${name}`, |
| 138 | + `License: Custom`, |
| 139 | + '', |
| 140 | + fs.readFileSync(licenseFile, 'utf-8').replaceAll('\r', ''), |
| 141 | + ].join('\n'), |
| 142 | + ); |
121 | 143 | } |
122 | 144 | } |
123 | | - |
| 145 | + |
124 | 146 | if (manualLicenses.length > 0) { |
125 | 147 | stringified_dependencies.push(...manualLicenses); |
126 | 148 | } |
|
0 commit comments