-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
1 parent
b55c5d3
commit e2d0016
Showing
9 changed files
with
86 additions
and
20 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
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,19 @@ | ||
'use strict'; | ||
|
||
const node_path = require('node:path'); | ||
const promises = require('node:fs/promises'); | ||
const stripAnsi = require('strip-ansi'); | ||
const writeFileAtomic = require('write-file-atomic'); | ||
|
||
/** | ||
* @param {string} content | ||
* @param {string} filePath | ||
* @returns {Promise<void>} | ||
*/ | ||
async function writeOutputFile(content, filePath) { | ||
await promises.mkdir(node_path.dirname(filePath), { recursive: true }); | ||
|
||
await writeFileAtomic(node_path.normalize(filePath), stripAnsi(content)); | ||
} | ||
|
||
module.exports = writeOutputFile; |
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
import { dirname, normalize } from 'node:path'; | ||
import { mkdir } from 'node:fs/promises'; | ||
import stripAnsi from 'strip-ansi'; | ||
import writeFileAtomic from 'write-file-atomic'; | ||
|
||
/** | ||
* @param {string} content | ||
* @param {string} filePath | ||
* @returns {Promise<void>} | ||
*/ | ||
export default async function writeOutputFile(content, filePath) { | ||
await mkdir(dirname(filePath), { recursive: true }); | ||
|
||
await writeFileAtomic(normalize(filePath), stripAnsi(content)); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
import fg from 'fast-glob'; | ||
|
||
const inputFiles = fg.globSync(['lib/**/*.mjs', '!**/__tests__/**', '!lib/testUtils/**']); | ||
|
||
export default inputFiles.map((input) => { | ||
return { | ||
input, | ||
output: { | ||
format: 'cjs', | ||
file: input.replace('.mjs', '.cjs'), | ||
generatedCode: 'es2015', | ||
}, | ||
}; | ||
}); |
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