small tweaks

This commit is contained in:
Alex Dima 2021-11-11 22:19:08 +01:00
parent e441fd4498
commit 1b00da60ec
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
2 changed files with 16 additions and 3 deletions

View file

@ -77,7 +77,7 @@ exports.removeDir = removeDir;
/**
* Launch the typescript compiler synchronously over a project.
*
* @param {string} projectPath
* @param {string} _projectPath
*/
function tsc(_projectPath) {
const projectPath = path.join(REPO_ROOT, _projectPath);
@ -87,6 +87,19 @@ function tsc(_projectPath) {
}
exports.tsc = tsc;
/**
* Launch prettier on a specific file.
*
* @param {string} _filePath
*/
function prettier(_filePath) {
const filePath = path.join(REPO_ROOT, _filePath);
cp.spawnSync(process.execPath, [path.join(__dirname, '../node_modules/prettier/bin-prettier.js'), '--write', filePath], { stdio: 'inherit', stderr: 'inherit' });
console.log(`Ran prettier over ${_filePath}`);
}
exports.prettier = prettier;
/**
* Transform an external .d.ts file to an internal .d.ts file
*
@ -128,5 +141,7 @@ function dts(_source, _destination, namespace) {
result.push(``);
fs.writeFileSync(destination, result.join('\n'));
prettier(_destination);
}
exports.dts = dts;