diff --git a/CHANGELOG.md b/CHANGELOG.md index d530627b..cc0fd5d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,88 +1,92 @@ -# [0.5.0](https://github.com/vuejs/vitepress/compare/v0.4.1...v0.5.0) (2020-07-21) - +# [0.6.0](https://github.com/vuejs/vitepress/compare/v0.5.0...v0.6.0) (2020-09-17) ### Bug Fixes -* decode hash before selecting ([e782c4c](https://github.com/vuejs/vitepress/commit/e782c4cb86dbb8ff294d0670e171692651618a0e)) -* fix navbar withBase ([e9ab56b](https://github.com/vuejs/vitepress/commit/e9ab56b0dbe859c0a147e2a2755bfcf2c0b92904)) -* typings field in package.json ([#48](https://github.com/vuejs/vitepress/issues/48)) ([692a490](https://github.com/vuejs/vitepress/commit/692a490986ab81eb5be5bc7fdce0434ce84aa620)) - +- **client:** use relative import ([725a04c](https://github.com/vuejs/vitepress/commit/725a04cdf02f208c85de01e4f1e74168511b95aa)) +- **links:** keep relative hash links as is ([a90d971](https://github.com/vuejs/vitepress/commit/a90d971b40d775e2bac19bcfd17cbeafbc878d34)) +- **router:** allow open new tab with ctrl + click ([#69](https://github.com/vuejs/vitepress/issues/69)) ([092ee77](https://github.com/vuejs/vitepress/commit/092ee772dafa78a66c2e35524bd921eb0aa31b16)) +- **sidebar:** no margin on mobile ([#89](https://github.com/vuejs/vitepress/issues/89)) ([218c729](https://github.com/vuejs/vitepress/commit/218c72915489e25e1d6ca7b09979c45abf64a3a3)) +- sidebar not working correctly when path starts with slash ([610cc17](https://github.com/vuejs/vitepress/commit/610cc17af0624d82d0eb3ed652f0b5fa1c2402f0)) +- **sidebar:** fix sidebar when you open a nested link ([#73](https://github.com/vuejs/vitepress/issues/73)) ([d2b6d39](https://github.com/vuejs/vitepress/commit/d2b6d39228a03ad122ab09420dab2cba2c2b4167)) ### Features -* add external link support for nav items ([#46](https://github.com/vuejs/vitepress/issues/46)) ([44e91bb](https://github.com/vuejs/vitepress/commit/44e91bb98631c843f9accad1cffd24fbc6337fe0)) -* add multi sidebar support ([#38](https://github.com/vuejs/vitepress/issues/38)) ([#49](https://github.com/vuejs/vitepress/issues/49)) ([050fa4c](https://github.com/vuejs/vitepress/commit/050fa4cf245f9f33d25684f8bcf218a6b5d6dedb)) -* i18n support ([#50](https://github.com/vuejs/vitepress/issues/50)) ([7802cb5](https://github.com/vuejs/vitepress/commit/7802cb55c2a82cc1878fc1ebc4dc2fcf1f2f1ff0)) -* nav dropdown ([#51](https://github.com/vuejs/vitepress/issues/51)) ([5780461](https://github.com/vuejs/vitepress/commit/578046145ff4ef445f7a7704016ab791a4ef330f)) - - - -## [0.4.1](https://github.com/vuejs/vitepress/compare/v0.4.0...v0.4.1) (2020-07-02) +- add blockquote styling ([8c1aada](https://github.com/vuejs/vitepress/commit/8c1aada6288609c2f01c14f353359a14d1264244)) +- add charset and viewport meta tags ([#77](https://github.com/vuejs/vitepress/issues/77)) ([2e8e1f5](https://github.com/vuejs/vitepress/commit/2e8e1f57cc7618c4cbc198153dde3927b076b08c)) +- add git repo link and edit links ([#55](https://github.com/vuejs/vitepress/issues/55)) ([0ea34cb](https://github.com/vuejs/vitepress/commit/0ea34cbb1de0db8a2ff34bb858c2904c89369ccd)) +- add prev/next links ([#56](https://github.com/vuejs/vitepress/issues/56)) ([f52b1d5](https://github.com/vuejs/vitepress/commit/f52b1d576b024443f737604d2220a0edb1571355)) +- add responsive sidebar support ([#75](https://github.com/vuejs/vitepress/issues/75)) ([39dbd78](https://github.com/vuejs/vitepress/commit/39dbd7806e96e18e60de87311ae7b162ebb61c3c)) +- add table css from vuepress ([#88](https://github.com/vuejs/vitepress/issues/88)) ([8435e36](https://github.com/vuejs/vitepress/commit/8435e36374e2d5c96bbab781f378602e2372f5d4)) +- close the sidebar when clicking outside of the sidebar ([#78](https://github.com/vuejs/vitepress/issues/78)) ([e93ee09](https://github.com/vuejs/vitepress/commit/e93ee094ea5696d692323546738d0643ed82f154)) +- navlinks in sidebar ([#80](https://github.com/vuejs/vitepress/issues/80)) ([a20bcf3](https://github.com/vuejs/vitepress/commit/a20bcf3cd7c4d8e243d6547f099b9fdc702ee350)) +- overwrite prev/next link ([#61](https://github.com/vuejs/vitepress/issues/61)) ([1b96f63](https://github.com/vuejs/vitepress/commit/1b96f631b83585591a1436b8a7dadf52fad61c25)) +- support config alias ([#59](https://github.com/vuejs/vitepress/issues/59)) ([63a3691](https://github.com/vuejs/vitepress/commit/63a36919601df678a0f8225627d66dff67c81c3a)) +- top and bottom slots for sidebar and page ([#90](https://github.com/vuejs/vitepress/issues/90)) ([1106013](https://github.com/vuejs/vitepress/commit/11060136c4bf2ec1d39e0d0d6951b9093e3edc06)) +- **sidebar:** use base when creating link ([#74](https://github.com/vuejs/vitepress/issues/74)) ([79bc9fb](https://github.com/vuejs/vitepress/commit/79bc9fb15a9560932228f22e7bd152272d577da6)) +# [0.5.0](https://github.com/vuejs/vitepress/compare/v0.4.1...v0.5.0) (2020-07-21) ### Bug Fixes -* avoid error when requesting non-existing md file ([e77ea63](https://github.com/vuejs/vitepress/commit/e77ea6323720f19d7401cb1a9fa94d1963f29e15)) -* resolve relative path on windows ([#27](https://github.com/vuejs/vitepress/issues/27)) ([9116c9c](https://github.com/vuejs/vitepress/commit/9116c9c3e06071f34b523cb488d9e5d963808a3c)) -* use resolve instead of join ([#33](https://github.com/vuejs/vitepress/issues/33)) ([6f10ed6](https://github.com/vuejs/vitepress/commit/6f10ed6c63b7486f678fdd7eedc888925feb473c)) - +- decode hash before selecting ([e782c4c](https://github.com/vuejs/vitepress/commit/e782c4cb86dbb8ff294d0670e171692651618a0e)) +- fix navbar withBase ([e9ab56b](https://github.com/vuejs/vitepress/commit/e9ab56b0dbe859c0a147e2a2755bfcf2c0b92904)) +- typings field in package.json ([#48](https://github.com/vuejs/vitepress/issues/48)) ([692a490](https://github.com/vuejs/vitepress/commit/692a490986ab81eb5be5bc7fdce0434ce84aa620)) ### Features -* add array sidebar support ([#35](https://github.com/vuejs/vitepress/issues/35)) ([4a8388e](https://github.com/vuejs/vitepress/commit/4a8388e113f978f6afc6936a86b06effc42a8304)) +- add external link support for nav items ([#46](https://github.com/vuejs/vitepress/issues/46)) ([44e91bb](https://github.com/vuejs/vitepress/commit/44e91bb98631c843f9accad1cffd24fbc6337fe0)) +- add multi sidebar support ([#38](https://github.com/vuejs/vitepress/issues/38)) ([#49](https://github.com/vuejs/vitepress/issues/49)) ([050fa4c](https://github.com/vuejs/vitepress/commit/050fa4cf245f9f33d25684f8bcf218a6b5d6dedb)) +- i18n support ([#50](https://github.com/vuejs/vitepress/issues/50)) ([7802cb5](https://github.com/vuejs/vitepress/commit/7802cb55c2a82cc1878fc1ebc4dc2fcf1f2f1ff0)) +- nav dropdown ([#51](https://github.com/vuejs/vitepress/issues/51)) ([5780461](https://github.com/vuejs/vitepress/commit/578046145ff4ef445f7a7704016ab791a4ef330f)) +## [0.4.1](https://github.com/vuejs/vitepress/compare/v0.4.0...v0.4.1) (2020-07-02) +### Bug Fixes -# [0.4.0](https://github.com/vuejs/vitepress/compare/v0.3.1...v0.4.0) (2020-06-19) +- avoid error when requesting non-existing md file ([e77ea63](https://github.com/vuejs/vitepress/commit/e77ea6323720f19d7401cb1a9fa94d1963f29e15)) +- resolve relative path on windows ([#27](https://github.com/vuejs/vitepress/issues/27)) ([9116c9c](https://github.com/vuejs/vitepress/commit/9116c9c3e06071f34b523cb488d9e5d963808a3c)) +- use resolve instead of join ([#33](https://github.com/vuejs/vitepress/issues/33)) ([6f10ed6](https://github.com/vuejs/vitepress/commit/6f10ed6c63b7486f678fdd7eedc888925feb473c)) +### Features +- add array sidebar support ([#35](https://github.com/vuejs/vitepress/issues/35)) ([4a8388e](https://github.com/vuejs/vitepress/commit/4a8388e113f978f6afc6936a86b06effc42a8304)) -## [0.3.1](https://github.com/vuejs/vitepress/compare/v0.3.0...v0.3.1) (2020-06-05) +# [0.4.0](https://github.com/vuejs/vitepress/compare/v0.3.1...v0.4.0) (2020-06-19) +## [0.3.1](https://github.com/vuejs/vitepress/compare/v0.3.0...v0.3.1) (2020-06-05) ### Bug Fixes -* avoid using __DEV__ + throttle active header link ([a63b0cf](https://github.com/vuejs/vitepress/commit/a63b0cf69a4d1f8b1b7e44f76c6283f28d437b59)) - - +- avoid using **DEV** + throttle active header link ([a63b0cf](https://github.com/vuejs/vitepress/commit/a63b0cf69a4d1f8b1b7e44f76c6283f28d437b59)) # [0.3.0](https://github.com/vuejs/vitepress/compare/v0.2.0...v0.3.0) (2020-06-02) - ### Bug Fixes -* lazy load @vue/server-render for production build ([382e1b6](https://github.com/vuejs/vitepress/commit/382e1b6514035f69dc9e505fad38a781cd35166e)) - +- lazy load @vue/server-render for production build ([382e1b6](https://github.com/vuejs/vitepress/commit/382e1b6514035f69dc9e505fad38a781cd35166e)) ### Features -* active sidebar links ([d2ea963](https://github.com/vuejs/vitepress/commit/d2ea9637eeafc1c1510d038f1f749e650a086a32)) - - +- active sidebar links ([d2ea963](https://github.com/vuejs/vitepress/commit/d2ea9637eeafc1c1510d038f1f749e650a086a32)) # [0.2.0](https://github.com/vuejs/vitepress/compare/v0.1.1...v0.2.0) (2020-05-22) - ### Bug Fixes -* avoid unnecessary prefetches ([0a81525](https://github.com/vuejs/vitepress/commit/0a815255b9f226ec5ac032d6db5b151caa9c58fb)) -* handle links that embed other elements ([#2](https://github.com/vuejs/vitepress/issues/2)) ([4cbfc60](https://github.com/vuejs/vitepress/commit/4cbfc60a58f7b7ef0d82c6a2b1a48b67ace3d924)) - +- avoid unnecessary prefetches ([0a81525](https://github.com/vuejs/vitepress/commit/0a815255b9f226ec5ac032d6db5b151caa9c58fb)) +- handle links that embed other elements ([#2](https://github.com/vuejs/vitepress/issues/2)) ([4cbfc60](https://github.com/vuejs/vitepress/commit/4cbfc60a58f7b7ef0d82c6a2b1a48b67ace3d924)) ### Features -* copy public dir ([ddc9d51](https://github.com/vuejs/vitepress/commit/ddc9d519c60423e2432c1f3c0ab5b2ccbabd34a6)) -* lean builds ([b61e239](https://github.com/vuejs/vitepress/commit/b61e2398fc40be98cd8372834fa3b1e5277c8e1f)) -* prefetch in viewport inbound page chunks ([da4852a](https://github.com/vuejs/vitepress/commit/da4852a61bd73a8b46c4971c330f95761237c733)) -* use hashed page file names ([a873564](https://github.com/vuejs/vitepress/commit/a8735646e8aae04d7091decc8c4fd54025ceb181)) -* use modulepreload links ([0025af1](https://github.com/vuejs/vitepress/commit/0025af12f4ec8e021ea1b7b9d48b0b4025924d83)) - +- copy public dir ([ddc9d51](https://github.com/vuejs/vitepress/commit/ddc9d519c60423e2432c1f3c0ab5b2ccbabd34a6)) +- lean builds ([b61e239](https://github.com/vuejs/vitepress/commit/b61e2398fc40be98cd8372834fa3b1e5277c8e1f)) +- prefetch in viewport inbound page chunks ([da4852a](https://github.com/vuejs/vitepress/commit/da4852a61bd73a8b46c4971c330f95761237c733)) +- use hashed page file names ([a873564](https://github.com/vuejs/vitepress/commit/a8735646e8aae04d7091decc8c4fd54025ceb181)) +- use modulepreload links ([0025af1](https://github.com/vuejs/vitepress/commit/0025af12f4ec8e021ea1b7b9d48b0b4025924d83)) ### Performance Improvements -* inject script tags for page common chunk imports ([57d900d](https://github.com/vuejs/vitepress/commit/57d900d4b357f15f3dec28e822bd5fd8d100d589)) - - +- inject script tags for page common chunk imports ([57d900d](https://github.com/vuejs/vitepress/commit/57d900d4b357f15f3dec28e822bd5fd8d100d589)) ## 0.1.1 (2020-04-30) @@ -90,13 +94,9 @@ # 0.1.0 (2020-04-30) - ### Features -* add markdown processing ([5c47bbb](https://github.com/vuejs/vitepress/commit/5c47bbb4638d7f78ae38fe02732f5b639654c134)) -* spa navigation ([21d3cd8](https://github.com/vuejs/vitepress/commit/21d3cd8cbe4102293d2903c3d060764d86a8f785)) -* update head tags during dev ([bdbbdd5](https://github.com/vuejs/vitepress/commit/bdbbdd556fe7e3906a5997291ff692cf2b78d632)) -* update title & description during dev ([0b9bf27](https://github.com/vuejs/vitepress/commit/0b9bf273ef4f31bf448f7813c50e474b4035b7dc)) - - - +- add markdown processing ([5c47bbb](https://github.com/vuejs/vitepress/commit/5c47bbb4638d7f78ae38fe02732f5b639654c134)) +- spa navigation ([21d3cd8](https://github.com/vuejs/vitepress/commit/21d3cd8cbe4102293d2903c3d060764d86a8f785)) +- update head tags during dev ([bdbbdd5](https://github.com/vuejs/vitepress/commit/bdbbdd556fe7e3906a5997291ff692cf2b78d632)) +- update title & description during dev ([0b9bf27](https://github.com/vuejs/vitepress/commit/0b9bf273ef4f31bf448f7813c50e474b4035b7dc)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 874726fe..205721d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,4 +64,8 @@ This is a guide to help those who are interested in contributing to VitePress! listening at http://localhost:3000 ``` -And with that, you are now ready to contribute to the VitePress project! 🎉 \ No newline at end of file +And with that, you are now ready to contribute to the VitePress project! 🎉 + +## Releasing + +After making sure tests are passing, run `yarn run release` (to be tested in non-unix environments like Windows) to run the bash script `scripts/release.sh`. diff --git a/README.md b/README.md index 1f2bc817..62f6d952 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # (WIP) VitePress 📝💨 +[![npm](https://img.shields.io/npm/v/vitepress)](https://www.npmjs.com/package/vitepress) + > [VuePress](http://vuepress.vuejs.org/)' little brother, built on top of [vite](https://github.com/vuejs/vite) **Note this is early WIP! Currently the focus is on making Vite stable and feature complete first. It is not recommended to use this for anything serious yet.** diff --git a/package.json b/package.json index 5112e096..8b54bbb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vitepress", - "version": "0.5.0", + "version": "0.6.0", "description": "", "main": "dist/node/index.js", "typings": "types/index.d.ts", @@ -32,10 +32,9 @@ "dev-client-copy": "node scripts/watchAndCopy", "dev-node": "tsc -w -p src/node", "dev-shared": "tsc -w -p src/shared", + "release": "bash scripts/release.sh", "build": "rimraf -rf dist && tsc -p src/client && tsc -p src/node && tsc -p src/shared && node scripts/copy", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", - "prepublishOnly": "yarn build && yarn changelog", - "postpublish": "git add CHANGELOG.md && git commit -m 'chore: changelog [ci skip]'" + "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s" }, "engines": { "node": ">=10.0.0" @@ -54,15 +53,15 @@ "author": "Evan You", "license": "MIT", "dependencies": { - "@vue/compiler-sfc": "^3.0.0-rc.4", - "@vue/server-renderer": "^3.0.0-rc.4", + "@vue/compiler-sfc": "^3.0.0-rc.11", + "@vue/server-renderer": "^3.0.0-rc.11", "debug": "^4.1.1", "diacritics": "^1.3.0", "escape-html": "^1.0.3", "fs-extra": "^9.0.0", - "globby": "^11.0.0", + "globby": "^11.0.1", "gray-matter": "^4.0.2", - "lru-cache": "^5.1.1", + "lru-cache": "^6.0.0", "markdown-it": "^10.0.0", "markdown-it-anchor": "^5.2.7", "markdown-it-container": "^2.0.0", @@ -71,18 +70,18 @@ "minimist": "^1.2.5", "prismjs": "^1.20.0", "slash": "^3.0.0", - "vite": "^1.0.0-rc.3", - "vue": "^3.0.0-rc.4" + "vite": "^1.0.0-rc.4", + "vue": "^3.0.0-rc.11" }, "devDependencies": { - "@types/fs-extra": "^8.1.0", + "@types/fs-extra": "^9.0.1", "@types/lru-cache": "^5.1.0", - "@types/markdown-it": "^10.0.1", + "@types/markdown-it": "^10.0.2", "@types/node": "^13.13.4", "@types/postcss-load-config": "^2.0.1", - "chokidar": "^3.4.0", - "conventional-changelog-cli": "^2.0.31", - "lint-staged": "^10.2.1", + "chokidar": "^3.4.2", + "conventional-changelog-cli": "^2.1.0", + "lint-staged": "^10.3.0", "npm-run-all": "^4.1.5", "prettier": "^2.0.5", "rimraf": "^3.0.2", diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100644 index 00000000..22b92c33 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,34 @@ +set -e +echo "Current version:" $(grep version package.json | sed -E 's/^.*"([0-9][^"]+)".*$/\1/') +echo "Enter the new version you want to publish e.g., 0.0.2: " +read VERSION + +read -p "Releasing v$VERSION - are you sure? (y/n)" -n 1 -r +echo # (optional) move to a new line +if [[ $REPLY =~ ^[Yy]$ ]] +then + echo "Releasing v$VERSION ..." + + # generate the version so that the changelog can be generated too + yarn version --no-git-tag-version --no-commit-hooks --new-version $VERSION + + yarn run build + + # changelog + yarn run changelog + yarn prettier --write CHANGELOG.md + echo "Please check the git history and the changelog and press enter" + read OKAY + + # commit and tag + git add CHANGELOG.md package.json + git commit -m "release: v$VERSION" + git tag "v$VERSION" + + # commit + yarn publish --new-version "$VERSION" --no-commit-hooks --no-git-tag-version + + # publish + git push origin refs/tags/v$VERSION + git push +fi diff --git a/src/client/app/composables/siteData.ts b/src/client/app/composables/siteData.ts index 09b3ead3..f27f6c83 100644 --- a/src/client/app/composables/siteData.ts +++ b/src/client/app/composables/siteData.ts @@ -6,8 +6,8 @@ const parse = (data: string) => readonly(JSON.parse(data)) as SiteData export const siteDataRef: Ref = ref(parse(serialized)) -export function useSiteData() { - return siteDataRef +export function useSiteData() { + return siteDataRef as Ref> } // hmr diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 63f209b5..df9f31ce 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -26,7 +26,8 @@ export function createRouter( loadComponent: (route: Route) => Component | Promise, fallbackComponent?: Component ): Router { - const route = reactive(getDefaultRoute()) + // TODO: the cast shouldn't be necessary + const route = reactive(getDefaultRoute()) as Route const inBrowser = typeof window !== 'undefined' function go(href?: string) { diff --git a/src/client/theme-default/Layout.vue b/src/client/theme-default/Layout.vue index fb446a38..5b777afc 100644 --- a/src/client/theme-default/Layout.vue +++ b/src/client/theme-default/Layout.vue @@ -5,7 +5,14 @@ diff --git a/src/client/theme-default/components/NavBar.vue b/src/client/theme-default/components/NavBar.vue index b99bfafa..564b07ec 100644 --- a/src/client/theme-default/components/NavBar.vue +++ b/src/client/theme-default/components/NavBar.vue @@ -12,7 +12,7 @@ /> {{ $site.title }} - + diff --git a/src/client/theme-default/components/NavBarLinks.ts b/src/client/theme-default/components/NavBarLinks.ts index e41aa966..f1133d63 100644 --- a/src/client/theme-default/components/NavBarLinks.ts +++ b/src/client/theme-default/components/NavBarLinks.ts @@ -1,7 +1,12 @@ import { computed } from 'vue' -import { useSiteDataByRoute } from 'vitepress' +import { useSiteData, useSiteDataByRoute } from 'vitepress' import NavBarLink from './NavBarLink.vue' import NavDropdownLink from './NavDropdownLink.vue' +import { DefaultTheme } from '../config' + +const platforms = ['GitHub', 'GitLab', 'Bitbucket'].map( + (platform) => [platform, new RegExp(platform, 'i')] as const +) export default { components: { @@ -10,13 +15,39 @@ export default { }, setup() { + const siteDataByRoute = useSiteDataByRoute() + const siteData = useSiteData() + const repoInfo = computed(() => { + const theme = siteData.value.themeConfig as DefaultTheme.Config + const repo = theme.docsRepo || theme.repo + let text: string | undefined = theme.repoLabel + + if (repo) { + const link = /^https?:/.test(repo) ? repo : `https://github.com/${repo}` + if (!text) { + // if no label is provided, deduce it from the repo url + const repoHosts = link.match(/^https?:\/\/[^/]+/) + if (repoHosts) { + const repoHost = repoHosts[0] + const foundPlatform = platforms.find(([_platform, re]) => + re.test(repoHost) + ) + text = foundPlatform && foundPlatform[0] + } + } + + return { link, text: text || 'Source' } + } + return null + }) return { navData: process.env.NODE_ENV === 'production' ? // navbar items do not change in production - useSiteDataByRoute().value.themeConfig.nav + siteDataByRoute.value.themeConfig.nav : // use computed in dev for hot reload - computed(() => useSiteDataByRoute().value.themeConfig.nav) + computed(() => siteDataByRoute.value.themeConfig.nav), + repoInfo } } } diff --git a/src/client/theme-default/components/NavBarLinks.vue b/src/client/theme-default/components/NavBarLinks.vue index df0907ae..ab02e2b4 100644 --- a/src/client/theme-default/components/NavBarLinks.vue +++ b/src/client/theme-default/components/NavBarLinks.vue @@ -1,9 +1,12 @@