@@ -253,37 +253,33 @@ ${content3}`)
253253 } ,
254254
255255 async docsImporterJava ( ) {
256- const destinationFolder = '.. /content/docs/project/import-export/import' ;
256+ const destinationFolder = 'src /content/docs/project/import-export/import' ;
257257 const imageFolder = path . join ( destinationFolder , 'images' ) ;
258258
259- // Ensure destination folders exist
260259 if ( ! fs . existsSync ( destinationFolder ) ) {
261- fs . mkdirSync ( destinationFolder , { recursive : true } ) ;
260+ fs . mkdirSync ( destinationFolder , { recursive : true } ) ;
262261 }
263262
264263 if ( ! fs . existsSync ( imageFolder ) ) {
265- fs . mkdirSync ( imageFolder , { recursive : true } ) ;
264+ fs . mkdirSync ( imageFolder , { recursive : true } ) ;
266265 }
267266
268- // Step 1: Download README.md from java-check-tests
269267 const readmeUrl = 'https://raw.githubusercontent.com/testomatio/java-check-tests/main/README.md' ;
270268 const response = await axios . get ( readmeUrl ) ;
271269 let content = response . data . toString ( ) ;
272270
273- // Step 2: Remove the first Markdown H1 title (e.g., "# Java Check Tests")
274271 content = content . replace ( / ^ # .* \n + / , '' ) ;
275272
276- // Step 3: Replace img/ with images/ in Markdown image paths
277273 content = content . replace ( / ! \[ ( .* ?) \] \( ( i m g \/ .* ?) \) / g, ( match , alt , imgPath ) => {
278274 const imageName = path . basename ( imgPath ) ;
279275 return `` ;
280276 } ) ;
281277
282- // Step 4: Add frontmatter and indentation
283278 const frontmatter = `---
284279title: Java Check Tests
285280description: Java command-line tool for Testomat.io import Java test source code, sync test IDs (for JUnit/TestNG), and clean test annotations.
286281type: article
282+ url: https://docs.testomat.io/project/import-export/import/java-check-tests
287283head:
288284 - tag: meta
289285 attrs:
@@ -292,22 +288,20 @@ head:
292288---\n\n` ;
293289 const finalContent = frontmatter + content ;
294290
295- // Step 5: Save the processed README.md as java-check-tests.md
296291 const outputPath = path . join ( destinationFolder , 'java-check-tests.md' ) ;
297292 fs . writeFileSync ( outputPath , finalContent ) ;
298293 console . log ( '✅ Saved java-check-tests.md' ) ;
299294
300- // Step 6: Download the specific image: syncRunConsoleResult.png
301295 const imageName = 'syncRunConsoleResult.png' ;
302296 const imageUrl = `https://raw.githubusercontent.com/testomatio/java-check-tests/main/img/${ imageName } ` ;
303297 const imagePath = path . join ( imageFolder , imageName ) ;
304298
305299 try {
306- const imageResponse = await axios . get ( imageUrl , { responseType : 'arraybuffer' } ) ;
300+ const imageResponse = await axios . get ( imageUrl , { responseType : 'arraybuffer' } ) ;
307301 fs . writeFileSync ( imagePath , imageResponse . data ) ;
308302 console . log ( `🖼️ Downloaded image: ${ imageName } ` ) ;
309303 } catch ( err ) {
310- console . warn ( `⚠️ Failed to download image: ${ imageName } ` , err . message ) ;
304+ console . warn ( `⚠️ Failed to download image: ${ imageName } , ${ err . message } ` ) ;
311305 }
312306 } ,
313307
@@ -317,10 +311,10 @@ head:
317311 const branch = '1.x' ;
318312 const readmeUrl = `https://raw.githubusercontent.com/${ repo } /${ branch } /README.md` ;
319313 const apiUrl = `https://api.github.com/repos/${ repo } /contents/img?ref=${ branch } ` ;
320- const destinationFolder = '../content/docs/test-reporting' ;
314+
315+ const destinationFolder = 'src/content/docs/test-reporting' ;
321316 const imageFolder = path . join ( destinationFolder , 'images' ) ;
322317
323- // Ensure folders exist
324318 if ( ! fs . existsSync ( destinationFolder ) ) {
325319 fs . mkdirSync ( destinationFolder , { recursive : true } ) ;
326320 }
@@ -329,44 +323,35 @@ head:
329323 }
330324
331325 try {
332- // Step 1: Download README.md
333326 const readmeResponse = await axios . get ( readmeUrl ) ;
334327 let content = readmeResponse . data . toString ( ) ;
335328
336- // Step 2: Remove the first Markdown H1 title (e.g., "# Java Reporter")
337329 content = content . replace ( / ^ # .* \n + / , '' ) ;
338330
339- // Step 3: Replace image paths in Markdown (img/ → images/)
340331 content = content . replace ( / ! \[ ( .* ?) \] \( ( i m g \/ .* ?) \) / g, ( match , alt , imgPath ) => {
341332 const imageName = path . basename ( imgPath ) ;
342333 return `` ;
343334 } ) ;
344335
345- // ✅ Step 3.1: Also replace relative ./img/ → ./images/
346336 content = content . replace ( / \. \/ i m g \/ / g, './images/' ) ;
347337
348- // Step 4: Prepend YAML front matter
349338 const frontMatter = `---
350339title: Testomat.io Java Reporter
351340description: Official Java reporter for Testomat.io — integrates with JUnit, TestNG and Cucumber to auto-send test results, sync test IDs, support parametrized tests, artifacts (screenshots/logs), step-by-step reporting and collaborative team test-runs.
352341type: article
342+ url: https://docs.testomat.io/test-reporting/java-reporter
353343head:
354344 - tag: meta
355345 attrs:
356346 name: keywords
357347 content: Testomat.io, Java reporter, JUnit, TestNG, Cucumber, test results, test management, test automation, test IDs sync, parametrized tests, test artifacts, step-by-step reporting, CLI tool, continuous integration, test run grouping
358- ---
359-
360- ` ;
361-
348+ ---` ;
362349 content = frontMatter + content ;
363350
364- // Step 5: Save renamed README
365351 const readmePath = path . join ( destinationFolder , 'java-reporter.md' ) ;
366352 fs . writeFileSync ( readmePath , content ) ;
367353 console . log ( `✅ Saved: ${ readmePath } ` ) ;
368354
369- // Step 6: Get image list from GitHub API and download them
370355 const apiHeaders = typeof token !== 'undefined' ? { Authorization : `token ${ token } ` } : { } ;
371356 const imageListResponse = await axios . get ( apiUrl , { headers : apiHeaders } ) ;
372357 const images = imageListResponse . data ;
0 commit comments