-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove console for every sandbox file and add colors to sandbox creat…
…e success and fail
- Loading branch information
1 parent
8d4c11b
commit 9f83f56
Showing
4 changed files
with
62 additions
and
41 deletions.
There are no files selected for viewing
53 changes: 33 additions & 20 deletions
53
packages/embla-carousel-docs/src/components/CodeSandbox/Compilation/build-after.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
import fs from 'fs' | ||
import { readFiles, PATHS_TO_SANDBOX_FILES } from './build-utils' | ||
import { | ||
readFiles, | ||
PATHS_TO_SANDBOX_FILES, | ||
CONSOLE_FONT_COLOR_RED, | ||
CONSOLE_FONT_COLOR_GREEN, | ||
} from './build-utils' | ||
|
||
PATHS_TO_SANDBOX_FILES.forEach((path) => { | ||
readFiles( | ||
`${path}/`, | ||
(filename, content) => { | ||
fs.writeFile( | ||
filename, | ||
content.replace( | ||
/\/\* The TypeScript compiler won't clear this empty line! \*\//gm, | ||
'', | ||
), | ||
(error) => { | ||
if (error) return console.log(error) | ||
console.log('The file was saved!') | ||
}, | ||
) | ||
}, | ||
(error) => { | ||
throw error | ||
}, | ||
) | ||
try { | ||
readFiles( | ||
`${path}/`, | ||
(filename, content) => { | ||
fs.writeFile( | ||
filename, | ||
content.replace( | ||
/\/\* The TypeScript compiler won't clear this empty line! \*\//gm, | ||
'', | ||
), | ||
(error) => { | ||
if (error) return console.log(error) | ||
}, | ||
) | ||
}, | ||
(error) => { | ||
throw error | ||
}, | ||
) | ||
|
||
console.log( | ||
CONSOLE_FONT_COLOR_GREEN, | ||
`Sandboxes created succesfully: ${path}`, | ||
) | ||
} catch (error) { | ||
console.log(CONSOLE_FONT_COLOR_RED, error) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters