Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
feat: compatible with latest vuepress rc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Feb 2, 2024
1 parent 57fcb24 commit 4909ab4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
33 changes: 9 additions & 24 deletions src/config/official.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,21 @@ export const VUE_RELATED_PACKAGES = [
export const OFFICIAL_PACKAGES = [
"@vuepress/bundler-vite",
"@vuepress/bundler-webpack",
"vuepress",
];

export const OFFICIAL_PLUGINS_AND_THEMES_REGEXP =
/^@vuepress\/(?:plugin|theme)-/;

export const REMOVED_PACKAGES = ["vuepress-webpack", "vuepress-vite"];

export const DEPRECATED_PACKAGES = [
"@vuepress/cli",
"@vuepress/client",
"@vuepress/core",
"@vuepress/markdown",
"@vuepress/shared",
"@vuepress/utils",
"vuepress",
"vuepress-webpack",
"vuepress-vite",
];

export const OFFICIAL_PLUGINS = [
"@vuepress/plugin-active-header-links",
"@vuepress/plugin-back-to-top",
"@vuepress/plugin-container",
"@vuepress/plugin-docsearch",
"@vuepress/plugin-external-link-icon",
"@vuepress/plugin-git",
"@vuepress/plugin-google-analytics",
"@vuepress/plugin-medium-zoom",
"@vuepress/plugin-nprogress",
"@vuepress/plugin-palette",
"@vuepress/plugin-prismjs",
"@vuepress/plugin-pwa",
"@vuepress/plugin-pwa-popup",
"@vuepress/plugin-register-components",
"@vuepress/plugin-search",
"@vuepress/plugin-shiki",
"@vuepress/plugin-theme-data",
"@vuepress/plugin-toc",
];

export const THIRD_PARTY_PLUGINS = /^(@.*\/)?vuepress-plugin-/;
Expand Down
25 changes: 22 additions & 3 deletions src/utils/updatePackage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
DEPRECATED_PACKAGES,
OFFICIAL_PACKAGES,
OFFICIAL_PLUGINS,
OFFICIAL_PLUGINS_AND_THEMES_REGEXP,
REMOVED_PACKAGES,
THIRD_PARTY_PLUGINS,
THIRD_PARTY_THEMES,
VUE_RELATED_PACKAGES,
Expand All @@ -14,7 +16,24 @@ export const updatePackages = async (
): Promise<void> => {
await Promise.all(
Object.keys(dependencies).map(async (dependency) => {
if (VUE_RELATED_PACKAGES.includes(dependency)) {
if (REMOVED_PACKAGES.includes(dependency)) {
console.error(
`Removing "${dependency}" from your dependencies, as it's no longer maintained.`
);
delete dependencies[dependency];
} else if (DEPRECATED_PACKAGES.includes(dependency)) {
console.error(
`"${dependency}"is deprecated, please remove it from your dependencies and import "${dependency.substring(
1
)}" from "vuepress" directly.`
);

dependencies[dependency] = `^${await getVersion(
packageManager,
dependency,
"next"
)}`;
} else if (VUE_RELATED_PACKAGES.includes(dependency)) {
dependencies[dependency] = `^${await getVersion(
packageManager,
dependency,
Expand All @@ -26,7 +45,7 @@ export const updatePackages = async (
dependency,
"next"
);
} else if (OFFICIAL_PLUGINS.includes(dependency)) {
} else if (OFFICIAL_PLUGINS_AND_THEMES_REGEXP.test(dependency)) {
dependencies[dependency] = await getVersion(
packageManager,
dependency,
Expand Down

0 comments on commit 4909ab4

Please sign in to comment.