UNPKG

@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
#!/usr/bin/env node 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); }); }); }