mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(cli): merge greet logs (#12365)
This commit is contained in:
parent
714bb42719
commit
9065400586
@ -1,5 +1,3 @@
|
||||
import color from 'picocolors';
|
||||
import { createRequire } from 'node:module';
|
||||
import { createServer, build } from 'vite';
|
||||
import {
|
||||
getViteConfigForSiteDev,
|
||||
@ -41,11 +39,6 @@ export async function compileSite(production = false) {
|
||||
);
|
||||
const server = await createServer(config);
|
||||
await server.listen(config.server?.port);
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { version } = require('vite/package.json');
|
||||
const viteInfo = color.cyan(`vite v${version}`);
|
||||
console.log(` ${viteInfo}` + color.green(` dev server running at:\n`));
|
||||
server.printUrls();
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
// @ts-ignore
|
||||
import fs from 'node:fs';
|
||||
import { URL, fileURLToPath } from 'node:url';
|
||||
import { logger } from 'rslog';
|
||||
import { createRequire } from 'node:module';
|
||||
|
||||
const packagePath = fileURLToPath(new URL('../package.json', import.meta.url));
|
||||
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
|
||||
export const cliVersion: string = packageJson.version;
|
||||
const require = createRequire(import.meta.url);
|
||||
const { version: viteVersion } = require('vite/package.json');
|
||||
const { version: cliVersion } = require('../package.json');
|
||||
|
||||
logger.greet(` Vant CLI v${cliVersion}\n`);
|
||||
export { cliVersion };
|
||||
|
||||
logger.greet(` Vant CLI v${cliVersion} / Vite v${viteVersion}\n`);
|
||||
|
||||
process.env.VANT_CLI_VERSION = cliVersion;
|
||||
|
Loading…
x
Reference in New Issue
Block a user