mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-23 17:31:11 +01:00
34 lines
831 B
Go
34 lines
831 B
Go
import fs from 'fs';
|
|
import { spawn } from 'child_process';
|
|
import { resolve, join, dirname } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { log } from './utils.js';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
|
function main() {
|
|
const typingsPath = resolve(join(__dirname, '..', 'typings'));
|
|
if (fs.existsSync(typingsPath)) {
|
|
fs.rmSync(typingsPath, { recursive: true });
|
|
}
|
|
|
|
const child = spawn(
|
|
'vue-tsc',
|
|
'--declaration --emitDeclarationOnly --declarationDir ./typings --rootDir ./src'.split(
|
|
' '
|
|
),
|
|
{ shell: true }
|
|
);
|
|
child.stdout.on('data', data => {
|
|
log(`${data}`, 'info');
|
|
});
|
|
child.stderr.on('data', data => {
|
|
log(`${data}`, 'error');
|
|
});
|
|
child.on('close', code => {
|
|
log(`child process exited with code ${code}`, 'info');
|
|
});
|
|
}
|
|
|
|
main();
|