11/* eslint-disable prettier/prettier */
22/* eslint-disable @typescript-eslint/restrict-template-expressions */
33import fs from 'fs' ;
4- import path from 'path' ;
54import open from 'open' ;
65import {
76 ApexAssessmentInfo ,
@@ -12,6 +11,7 @@ import {
1211} from '../interfaces' ;
1312import { ReportHeaderFormat } from '../reportGenerator/reportInterfaces' ;
1413import { OmnistudioOrgDetails } from '../orgUtils' ;
14+ import { pushAssestUtilites } from '../file/fileutil' ;
1515import { OSAssessmentReporter } from './OSAssessmentReporter' ;
1616import { IPAssessmentReporter } from './IPAssessmentReporter' ;
1717import { DRAssessmentReporter } from './DRAssessmentReporter' ;
@@ -81,8 +81,8 @@ export class AssessmentReporter {
8181 ] ;
8282
8383 await this . createMasterDocument ( nameUrls , basePath ) ;
84- this . pushAssestUtilites ( 'javascripts' , basePath ) ;
85- this . pushAssestUtilites ( 'styles' , basePath ) ;
84+ pushAssestUtilites ( 'javascripts' , basePath ) ;
85+ pushAssestUtilites ( 'styles' , basePath ) ;
8686 }
8787
8888 private static formattedOrgDetails ( orgDetails : OmnistudioOrgDetails ) : ReportHeaderFormat [ ] {
@@ -110,48 +110,6 @@ export class AssessmentReporter {
110110 ] ;
111111 }
112112
113- /**
114- * Copies `.js` and `.css` files from a source directory (based on `folderName`)
115- * to a specified destination directory.
116- *
117- * @param folderName - The subdirectory under `/src/` where source asset files are located (e.g., `'javascripts'`, `'styles'`).
118- * @param destDir - The absolute or relative path to the destination directory where the assets should be copied.
119- *
120- * @remarks
121- * - If the destination directory does not exist, the method logs a warning and exits.
122- * - Only `.js` and `.css` files are copied.
123- * - The source files remain in place after copying.
124- */
125- private static pushAssestUtilites ( folderName : string , destDir : string ) : void {
126- const sourceDir = path . join ( process . cwd ( ) , 'src' , folderName ) ;
127-
128- if ( ! fs . existsSync ( destDir ) ) {
129- // Destination directory does not exist. Skipping file copy.
130- return ;
131- }
132-
133- fs . readdir ( sourceDir , ( readDirErr , files ) => {
134- if ( readDirErr ) {
135- // Error reading source directory: readDirErr.message
136- return ;
137- }
138-
139- files . forEach ( ( file ) => {
140- const ext = path . extname ( file ) ;
141- if ( ext === '.js' || ext === '.css' ) {
142- const srcPath = path . join ( sourceDir , file ) ;
143- const destPath = path . join ( destDir , file ) ;
144-
145- fs . copyFile ( srcPath , destPath , ( copyErr ) => {
146- if ( copyErr ) {
147- // Failed to copy file: copyErr.message
148- }
149- } ) ;
150- }
151- } ) ;
152- } ) ;
153- }
154-
155113 private static async createMasterDocument ( reports : nameLocation [ ] , basePath : string ) : Promise < void > {
156114 let listBody = '' ;
157115 for ( const report of reports ) {
0 commit comments