vuepress / ecosystem

Official plugins and themes for VuePress2
https://ecosystem.vuejs.press
MIT License
29 stars 41 forks source link

[Bug report] create-vuepress is not working properly #202

Closed ditoukanyun closed 5 months ago

ditoukanyun commented 5 months ago

Description

pnpm create vuepress vuepress-starter

"docs:dev": "vuepress dev docs",

image

Reproduction

1

Used Package Manager

pnpm

System Info

"vuepress": "^2.0.0-rc.7",
Alanyaeer commented 5 months ago

I encountered the same issue when building VuePress today.

github-actions[bot] commented 5 months ago

Hello @ditoukanyun. Please provide a minimal reproduction using a GitHub repository or v2.vuepress.vuejs.org/new. Issues marked with need reproduction will be closed if they have no activity within 7 days.

meteorlxy commented 5 months ago

I see, the create-vuepress package is still using old version. Please add tests for the package, cuz it's the first recommended setup in our docs @pengzhanbo @Mister-Hope

Mister-Hope commented 5 months ago

Yes, because lerna won't bump that package unless it's code has been changed.

@meteorlxy @pengzhanbo any ideas to have its version bumped automatically while ensuring core and ecosystem are not misaligned (while core just released a new version)?

My current idea is to add those deps in to devDeps and config graphType in lerna publish config to all

pengzhanbo commented 5 months ago

@meteorlxy @Mister-Hope

We can use pacote to check the latest version numbers of vuepress@next and @vuepress/*@next, and then insert them into package.json. This way, create-vuepress will not be strongly coupled with the versions.

Just like this:

const res = await pacote.packument('vuepress')
const distTags = res['dist-tags']
console.log(distTags['next'])

Alternatively,wen can dynamically install vuepress@next, @vuepress/*@next, and other packages using install-pkg after generating the project to ensure that the installed package contents are always up-to-date.

Mister-Hope commented 5 months ago

Alternatively,wen can dynamically install vuepress@next, @vuepress/*@next, and other packages using install-pkg after generating the project to ensure that the installed package contents are always up-to-date.

We couldn't. Like I said before, there could be times where core release a new version and the ecosystem has not suport it.

The helper should always try to use core version that ecosystem supports.

Mister-Hope commented 5 months ago

The simplest hack could be announcing all the needed packages as optional peers and reference them as workspace, So that the package could be automatically bumped and get the correct version in this repo.

The version can be obtained later by importing the package.json

pengzhanbo commented 5 months ago

The vuepress/core repository uses the combination of bumpp + pnpm publish -r to ensure that all packages within the repository have the same version number. Perhaps vuepress/ecosystem should also consider implementing having all packages within the repository share the same version number.

Subsequently, we can utilize this approach to use pacote to retrieve package information for @vuepress/theme-default, including its version number and the vuepress version number from its peer deps, in order to determine the versions of other packages that should be installed.

Mister-Hope commented 5 months ago

Perhaps vuepress/ecosystem should also consider implementing having all packages within the repository share the same version number.

Absolutely, no. We use lerna, Because we want to make sure if a single plugin is modified then other unrelated packages won't release any new versions.

You may annoy users if they found the plugins and theme-default are bumped for no reason.

Once vp turned into stable, then we may remove the work space protocol in the package.json, And make it a minor version range.

Mister-Hope commented 5 months ago

https://github.com/vuepress/ecosystem/commit/e8da8b81a9b515e4a5b0838468be78724ffe2120