-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const sourceFile = path.join('nbclassic', 'static', 'components', 'marked', 'lib', 'marked.umd.js'); | ||
const destFile = path.join('nbclassic', 'static', 'components', 'marked', 'lib', 'marked.js'); | ||
|
||
// Check file existence | ||
const sourceExists = fs.existsSync(sourceFile); | ||
const destExists = fs.existsSync(destFile); | ||
|
||
if (!sourceExists && !destExists) { | ||
// Both files missing - critical error | ||
console.error(`Error: ${destFile} is required but cannot be created (${sourceFile} not found)`); | ||
process.exit(1); | ||
} else if (!sourceExists) { | ||
// Source missing but dest exists - skip copy | ||
console.log(`Copy skipped: ${sourceFile} not found (using existing ${destFile})`); | ||
process.exit(0); | ||
} | ||
|
||
// Source exists, attempt copy | ||
try { | ||
fs.copyFileSync(sourceFile, destFile); | ||
console.log(`Successfully copied ${sourceFile} to ${destFile}`); | ||
} catch (err) { | ||
console.error(`Error copying file: ${err.message}`); | ||
process.exit(1); | ||
} |