77import * as fs from 'node:fs' ;
88import * as path from 'node:path' ;
99
10- import tsConfig from '../tsconfig.json' with { type : 'json' } ;
11-
1210import { sed } from './sed.ts' ;
1311
1412const BUILD_DIR = path . join ( process . cwd ( ) , 'build' ) ;
@@ -22,29 +20,6 @@ function writeFile(filePath: string, content: string): void {
2220 fs . writeFileSync ( filePath , content , 'utf-8' ) ;
2321}
2422
25- /**
26- * Ensures that licenses for third party files we use gets copied into the build/ dir.
27- */
28- function copyThirdPartyLicenseFiles ( ) {
29- const thirdPartyDirectories = tsConfig . include . filter ( location => {
30- return location . includes (
31- 'node_modules/chrome-devtools-frontend/front_end/third_party' ,
32- ) ;
33- } ) ;
34-
35- for ( const thirdPartyDir of thirdPartyDirectories ) {
36- const fullPath = path . join ( process . cwd ( ) , thirdPartyDir ) ;
37- const licenseFile = path . join ( fullPath , 'LICENSE' ) ;
38- if ( ! fs . existsSync ( licenseFile ) ) {
39- console . error ( 'No LICENSE for' , path . basename ( thirdPartyDir ) ) ;
40- }
41-
42- const destinationDir = path . join ( BUILD_DIR , thirdPartyDir ) ;
43- const destinationFile = path . join ( destinationDir , 'LICENSE' ) ;
44- fs . copyFileSync ( licenseFile , destinationFile ) ;
45- }
46- }
47-
4823function main ( ) : void {
4924 const devtoolsThirdPartyPath =
5025 'node_modules/chrome-devtools-frontend/front_end/third_party' ;
@@ -113,30 +88,19 @@ export const experiments = {
11388 sed ( clientFile , globalAssignment , '' ) ;
11489 sed ( clientFile , registerCommands , '' ) ;
11590
116- const devtoolsLicensePath = path . join (
117- 'node_modules' ,
118- 'chrome-devtools-frontend' ,
119- 'LICENSE' ,
120- ) ;
121- const devtoolsLicenseFileSource = path . join (
122- process . cwd ( ) ,
123- devtoolsLicensePath ,
124- ) ;
125- const devtoolsLicenseFileDestination = path . join (
126- BUILD_DIR ,
127- devtoolsLicensePath ,
128- ) ;
129- fs . copyFileSync ( devtoolsLicenseFileSource , devtoolsLicenseFileDestination ) ;
130-
131- copyThirdPartyLicenseFiles ( ) ;
13291 copyDevToolsDescriptionFiles ( ) ;
13392}
13493
13594function copyDevToolsDescriptionFiles ( ) {
13695 const devtoolsIssuesDescriptionPath =
13796 'node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions' ;
13897 const sourceDir = path . join ( process . cwd ( ) , devtoolsIssuesDescriptionPath ) ;
139- const destDir = path . join ( BUILD_DIR , devtoolsIssuesDescriptionPath ) ;
98+ const destDir = path . join (
99+ BUILD_DIR ,
100+ 'src' ,
101+ 'third_party' ,
102+ 'issue-descriptions' ,
103+ ) ;
140104 fs . cpSync ( sourceDir , destDir , { recursive : true } ) ;
141105}
142106
0 commit comments