@@ -31,10 +31,11 @@ import { theme as canvasTheme } from '@instructure/canvas-theme'
3131import { theme as canvasHighContrastTheme } from '@instructure/canvas-high-contrast-theme'
3232import type {
3333 LibraryOptions ,
34- MainDocsData , ProcessedFile
34+ MainDocsData ,
35+ ProcessedFile
3536} from './DataTypes.mjs'
3637import { getFrontMatter } from './utils/getFrontMatter.mjs'
37- import { createRequire } from " module"
38+ import { createRequire } from ' module'
3839import { fileURLToPath , pathToFileURL } from 'url'
3940
4041const __filename = fileURLToPath ( import . meta. url )
@@ -101,7 +102,7 @@ const pathsToIgnore = [
101102 // deprecated packages and modules:
102103 '**/InputModeListener.ts' ,
103104 // regression testing app:
104- '**/regression-test/**' ,
105+ '**/regression-test/**'
105106]
106107
107108if ( import . meta. url === pathToFileURL ( process . argv [ 1 ] ) . href ) {
@@ -118,6 +119,8 @@ function buildDocs() {
118119 const { COPY_VERSIONS_JSON = '1' } = process . env
119120 const shouldDoTheVersionCopy = Boolean ( parseInt ( COPY_VERSIONS_JSON ) )
120121
122+ createMarkdownFolder ( )
123+
121124 // globby needs the posix format
122125 const files = pathsToProcess . map ( ( file ) => path . posix . join ( packagesDir , file ) )
123126 const ignore = pathsToIgnore . map ( ( file ) => path . posix . join ( packagesDir , file ) )
@@ -148,7 +151,10 @@ function buildDocs() {
148151
149152 // eslint-disable-next-line no-console
150153 console . log ( 'Copying icons data...' )
151- fs . copyFileSync ( projectRoot + '/packages/ui-icons/__build__/icons-data.json' , buildDir + 'icons-data.json' )
154+ fs . copyFileSync (
155+ projectRoot + '/packages/ui-icons/__build__/icons-data.json' ,
156+ buildDir + 'icons-data.json'
157+ )
152158
153159 // eslint-disable-next-line no-console
154160 console . log ( 'Finished building documentation data' )
@@ -245,4 +251,33 @@ function parseThemes() {
245251 return parsed
246252}
247253
254+ function createMarkdownFolder ( ) {
255+ const markdownDir = buildDir + 'markdown/'
256+
257+ // Create the markdown directory if it doesn't exist
258+ if ( ! fs . existsSync ( markdownDir ) ) {
259+ fs . mkdirSync ( markdownDir , { recursive : true } )
260+ // eslint-disable-next-line no-console
261+ console . log ( 'Created markdown directory: ' + markdownDir )
262+ }
263+
264+ // Create sample.txt file
265+ const sampleFilePath = path . join ( markdownDir , 'sample.txt' )
266+ const sampleContent = `# Sample Markdown File
267+
268+ This is a sample markdown file created by the documentation build process.
269+
270+ ## Features
271+ - Created automatically during build
272+ - Located in the markdown folder
273+ - Can be used for testing or documentation purposes
274+
275+ Generated on: ${ new Date ( ) . toISOString ( ) }
276+ `
277+
278+ fs . writeFileSync ( sampleFilePath , sampleContent )
279+ // eslint-disable-next-line no-console
280+ console . log ( 'Created sample.txt in markdown directory' )
281+ }
282+
248283export { pathsToProcess , pathsToIgnore , processSingleFile , buildDocs }
0 commit comments