mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-08-16 12:52:48 +08:00
chore: use pnpm CLI to get versions
This commit is contained in:
20
scripts/utils.ts
Normal file
20
scripts/utils.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
export function resolvePath(url: string, ...parts: string[]) {
|
||||
return resolve(dirname(fileURLToPath(url)), ...parts);
|
||||
}
|
||||
|
||||
type PackageVersions = {
|
||||
name: string;
|
||||
version: string;
|
||||
devDependencies: Record<string, { version: string }>;
|
||||
};
|
||||
|
||||
export function getPackageVersions(devDeps?: string[]): PackageVersions {
|
||||
const stdOut = execSync(`pnpm ls ${devDeps?.join(" ") || ""} --json`, {
|
||||
encoding: "utf-8",
|
||||
});
|
||||
return JSON.parse(stdOut)[0];
|
||||
}
|
Reference in New Issue
Block a user