Commit f923f590 by Vben Committed by GitHub

fix: metadata version number injection error (#4606)

* fix: metadata version number injection error

* chore: update deps
1 parent 437cb02e
import type { Config } from 'tailwindcss'; import type { Config } from 'tailwindcss';
import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { getPackagesSync } from '@vben/node-utils'; import { getPackagesSync } from '@vben/node-utils';
...@@ -19,9 +18,9 @@ const tailwindPackages: string[] = []; ...@@ -19,9 +18,9 @@ const tailwindPackages: string[] = [];
packages.forEach((pkg) => { packages.forEach((pkg) => {
// apps目录下和 @vben-core/tailwind-ui 包需要使用到 tailwindcss ui // apps目录下和 @vben-core/tailwind-ui 包需要使用到 tailwindcss ui
if (fs.existsSync(path.join(pkg.dir, 'tailwind.config.mjs'))) { // if (fs.existsSync(path.join(pkg.dir, 'tailwind.config.mjs'))) {
tailwindPackages.push(pkg.dir); tailwindPackages.push(pkg.dir);
} // }
}); });
const shadcnUiColors = { const shadcnUiColors = {
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
"vite-plugin-vue-devtools": "catalog:" "vite-plugin-vue-devtools": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@pnpm/workspace.read-manifest": "catalog:",
"@types/archiver": "catalog:", "@types/archiver": "catalog:",
"@types/html-minifier-terser": "catalog:", "@types/html-minifier-terser": "catalog:",
"@vben/node-utils": "workspace:*", "@vben/node-utils": "workspace:*",
......
import type { PluginOption } from 'vite'; import type { PluginOption } from 'vite';
import { dateUtil, getPackages, readPackageJSON } from '@vben/node-utils'; import {
dateUtil,
findMonorepoRoot,
getPackages,
readPackageJSON,
} from '@vben/node-utils';
import { readWorkspaceManifest } from '@pnpm/workspace.read-manifest';
function resolvePackageVersion( function resolvePackageVersion(
pkgsMeta: Record<string, string>, pkgsMeta: Record<string, string>,
name: string, name: string,
value: string, value: string,
catalog: Record<string, string>,
) { ) {
if (value.includes('catalog:')) {
return catalog[name];
}
if (value.includes('workspace')) { if (value.includes('workspace')) {
return pkgsMeta[name]; return pkgsMeta[name];
} }
return value; return value;
} }
async function resolveMonorepoDependencies() { async function resolveMonorepoDependencies() {
const { packages } = await getPackages(); const { packages } = await getPackages();
const manifest = await readWorkspaceManifest(findMonorepoRoot());
const catalog = manifest?.catalog || {};
const resultDevDependencies: Record<string, string | undefined> = {}; const resultDevDependencies: Record<string, string | undefined> = {};
const resultDependencies: Record<string, string | undefined> = {}; const resultDependencies: Record<string, string | undefined> = {};
...@@ -27,10 +42,20 @@ async function resolveMonorepoDependencies() { ...@@ -27,10 +42,20 @@ async function resolveMonorepoDependencies() {
for (const { packageJson } of packages) { for (const { packageJson } of packages) {
const { dependencies = {}, devDependencies = {} } = packageJson; const { dependencies = {}, devDependencies = {} } = packageJson;
for (const [key, value] of Object.entries(dependencies)) { for (const [key, value] of Object.entries(dependencies)) {
resultDependencies[key] = resolvePackageVersion(pkgsMeta, key, value); resultDependencies[key] = resolvePackageVersion(
pkgsMeta,
key,
value,
catalog,
);
} }
for (const [key, value] of Object.entries(devDependencies)) { for (const [key, value] of Object.entries(devDependencies)) {
resultDevDependencies[key] = resolvePackageVersion(pkgsMeta, key, value); resultDevDependencies[key] = resolvePackageVersion(
pkgsMeta,
key,
value,
catalog,
);
} }
} }
return { return {
......
export { default } from '@vben/tailwind-config/postcss';
export { default } from '@vben/tailwind-config';
export { default } from '@vben/tailwind-config/postcss';
export { default } from '@vben/tailwind-config';
export { default } from '@vben/tailwind-config/postcss';
export { default } from '@vben/tailwind-config';
export { default } from '@vben/tailwind-config/postcss';
export { default } from '@vben/tailwind-config';
...@@ -31,10 +31,11 @@ catalog: ...@@ -31,10 +31,11 @@ catalog:
'@manypkg/get-packages': ^2.2.2 '@manypkg/get-packages': ^2.2.2
'@nolebase/vitepress-plugin-git-changelog': ^2.6.0 '@nolebase/vitepress-plugin-git-changelog': ^2.6.0
'@playwright/test': ^1.48.0 '@playwright/test': ^1.48.0
'@pnpm/workspace.read-manifest': ^2.2.1
'@stylistic/stylelint-plugin': ^3.1.1 '@stylistic/stylelint-plugin': ^3.1.1
'@tailwindcss/nesting': 0.0.0-insiders.565cd3e '@tailwindcss/nesting': 0.0.0-insiders.565cd3e
'@tailwindcss/typography': ^0.5.15 '@tailwindcss/typography': ^0.5.15
'@tanstack/vue-query': ^5.59.1 '@tanstack/vue-query': ^5.59.6
'@tanstack/vue-store': ^0.5.5 '@tanstack/vue-store': ^0.5.5
'@types/archiver': ^6.0.2 '@types/archiver': ^6.0.2
'@types/chalk': ^2.2.0 '@types/chalk': ^2.2.0
...@@ -62,7 +63,7 @@ catalog: ...@@ -62,7 +63,7 @@ catalog:
archiver: ^7.0.1 archiver: ^7.0.1
autoprefixer: ^10.4.20 autoprefixer: ^10.4.20
axios: ^1.7.7 axios: ^1.7.7
axios-mock-adapter: ^2.0.0 axios-mock-adapter: ^2.1.0
cac: ^6.7.14 cac: ^6.7.14
chalk: ^5.3.0 chalk: ^5.3.0
cheerio: 1.0.0 cheerio: 1.0.0
...@@ -126,7 +127,7 @@ catalog: ...@@ -126,7 +127,7 @@ catalog:
postcss-antd-fixes: ^0.2.0 postcss-antd-fixes: ^0.2.0
postcss-html: ^1.7.0 postcss-html: ^1.7.0
postcss-import: ^16.1.0 postcss-import: ^16.1.0
postcss-preset-env: ^10.0.6 postcss-preset-env: ^10.0.7
postcss-scss: ^4.0.9 postcss-scss: ^4.0.9
prettier: ^3.3.3 prettier: ^3.3.3
prettier-plugin-tailwindcss: ^0.6.8 prettier-plugin-tailwindcss: ^0.6.8
...@@ -173,7 +174,7 @@ catalog: ...@@ -173,7 +174,7 @@ catalog:
vue-i18n: ^10.0.4 vue-i18n: ^10.0.4
vue-router: ^4.4.5 vue-router: ^4.4.5
vue-tsc: ^2.1.6 vue-tsc: ^2.1.6
vxe-pc-ui: ^4.2.18 vxe-pc-ui: ^4.2.19
vxe-table: ^4.7.86 vxe-table: ^4.7.86
watermark-js-plus: ^1.5.7 watermark-js-plus: ^1.5.7
zod: ^3.23.8 zod: ^3.23.8
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!