Linted scripts

This commit is contained in:
Angelos Chalaris
2018-09-15 13:04:31 +03:00
parent 83c6ab3e83
commit 17d64598e8
3 changed files with 70 additions and 82 deletions

View File

@ -57,9 +57,9 @@ try {
// Store the data to be written
const toWrite = isNodeSnippet
? `${code
.replace(`const ${snippetName}`,`export const ${snippetName}`)
// Prevents errors from being thrown in browser environment
.replace('require(', 'typeof require !== "undefined" && require(')}`
.replace(`const ${snippetName}`, `export const ${snippetName}`)
// Prevents errors from being thrown in browser environment
.replace('require(', 'typeof require !== "undefined" && require(')}`
: `export ${code}`;
// Write data to the proper file
fs.writeFileSync(`${TEMP_PATH}/${snippetName}.js`, toWrite);