@stellaris/vite-plugin-tencent-oss
Version:
Upload the production files bundled in the project to Tencent CSS, except for html
43 lines (33 loc) โข 1.07 kB
JavaScript
import { spawn } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
console.log('๐ ่ฟ่ก vite-plugin-tencent-oss ๆต่ฏๅฅไปถ\n');
// ่ฟ่กๅๅ
ๆต่ฏ
console.log('๐ ่ฟ่กๅๅ
ๆต่ฏ...');
await runTest('node', ['test/plugin.test.js']);
await runTest('node', ['test/utils.test.js']);
// ่ฟ่ก้ๆๆต่ฏ
console.log('\n๐ง ่ฟ่ก้ๆๆต่ฏ...');
await runTest('pnpm', ['-C', 'example', 'build', '--config', 'vite.config.test.js']);
console.log('\nโ
ๆๆๆต่ฏๅฎๆ๏ผ');
function runTest(command, args) {
return new Promise((resolve, reject) => {
const child = spawn(command, args, {
stdio: 'inherit',
cwd: __dirname
});
child.on('close', (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(`ๆต่ฏๅคฑ่ดฅ๏ผ้ๅบ็ : ${code}`));
}
});
child.on('error', (error) => {
reject(error);
});
});
}