mirror of https://github.com/vuejs/vitepress
commit
876cab5b94
@ -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
|
@ -0,0 +1,81 @@
|
|||||||
|
import { computed } from 'vue'
|
||||||
|
import OutboundLink from './icons/OutboundLink.vue'
|
||||||
|
import { endingSlashRE, isExternal } from '../utils'
|
||||||
|
import { usePageData, useSiteData } from 'vitepress'
|
||||||
|
import { DefaultTheme } from '../config'
|
||||||
|
|
||||||
|
function createEditLink(
|
||||||
|
repo: string,
|
||||||
|
docsRepo: string,
|
||||||
|
docsDir: string,
|
||||||
|
docsBranch: string,
|
||||||
|
path: string
|
||||||
|
) {
|
||||||
|
const bitbucket = /bitbucket.org/
|
||||||
|
if (bitbucket.test(repo)) {
|
||||||
|
const base = isExternal(docsRepo) ? docsRepo : repo
|
||||||
|
return (
|
||||||
|
base.replace(endingSlashRE, '') +
|
||||||
|
`/src` +
|
||||||
|
`/${docsBranch}/` +
|
||||||
|
(docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') +
|
||||||
|
path +
|
||||||
|
`?mode=edit&spa=0&at=${docsBranch}&fileviewer=file-view-default`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const base = isExternal(docsRepo)
|
||||||
|
? docsRepo
|
||||||
|
: `https://github.com/${docsRepo}`
|
||||||
|
return (
|
||||||
|
base.replace(endingSlashRE, '') +
|
||||||
|
`/edit` +
|
||||||
|
`/${docsBranch}/` +
|
||||||
|
(docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') +
|
||||||
|
path
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
OutboundLink
|
||||||
|
},
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
const pageData = usePageData()
|
||||||
|
const siteData = useSiteData<DefaultTheme.Config>()
|
||||||
|
|
||||||
|
const editLink = computed(() => {
|
||||||
|
const showEditLink: boolean | undefined =
|
||||||
|
pageData.value.frontmatter.editLink == null
|
||||||
|
? siteData.value.themeConfig.editLinks
|
||||||
|
: pageData.value.frontmatter.editLink
|
||||||
|
const {
|
||||||
|
repo,
|
||||||
|
docsDir = '',
|
||||||
|
docsBranch = 'master',
|
||||||
|
docsRepo = repo
|
||||||
|
} = siteData.value.themeConfig
|
||||||
|
|
||||||
|
const { relativePath } = pageData.value
|
||||||
|
if (showEditLink && relativePath && repo) {
|
||||||
|
return createEditLink(
|
||||||
|
repo,
|
||||||
|
docsRepo || repo,
|
||||||
|
docsDir,
|
||||||
|
docsBranch,
|
||||||
|
relativePath
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
const editLinkText = computed(
|
||||||
|
() => siteData.value.themeConfig.editLinkText || 'Edit this page'
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
editLink,
|
||||||
|
editLinkText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<footer class="page-edit">
|
||||||
|
<a
|
||||||
|
v-if="editLink"
|
||||||
|
:href="editLink"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{{ editLinkText }}
|
||||||
|
<OutboundLink />
|
||||||
|
</a>
|
||||||
|
</footer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./PageEdit"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.page-edit {
|
||||||
|
padding-top: 1rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-edit a {
|
||||||
|
color: var(--text-color);
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in new issue