Skip to content

Commit

Permalink
Merge branch 'main' into new-router
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 29, 2023
2 parents 4aa2362 + 213cbb6 commit cc44ec9
Show file tree
Hide file tree
Showing 87 changed files with 2,334 additions and 2,487 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question & Discussion
url: https://github.com/vuepress/vuepress-next/discussions
url: https://github.com/vuepress/core/discussions
about: Please ask and answer questions here.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Before submitting the PR, please make sure you do the following <!-- (put an "X" next to an item) -->

- [ ] Read the [Contributing Guidelines](https://github.com/vuepress/vuepress-next/blob/main/CONTRIBUTING.md).
- [ ] Read the [Contributing Guidelines](https://github.com/vuepress/core/blob/main/CONTRIBUTING.md).
- [ ] Provide a description in this PR that addresses **what** the PR is solving. If this PR is going to solve an existing issue, please reference the issue (e.g. `close #123`).

### What is the purpose of this pull request? <!-- (put an "X" next to an item) -->
Expand Down
2,514 changes: 1,257 additions & 1,257 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ In the `packages` directory:

Here are some wrapper packages that use the above packages:

- `vuepress`: A wrapper of `vuepress-vite`.
- `vuepress-vite`: A wrapper of `@vuepress/cli` + `@vuepress/bundler-vite`. If users want to use vite, they can simply install this package.
- `vuepress-webpack`: A wrapper of `@vuepress/cli` + `@vuepress/bundler-webpack`. If users want to use webpack, they can simply install this package.
- `vuepress`: A wrapper the above packages, and provides `vuepress` command line tool. Users need to choose and install bundler and theme by themselves.

## Development Setup

Expand Down
4 changes: 1 addition & 3 deletions CONTRIBUTING_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

还有一些对上述 Package 进行封装后的 Package :

- `vuepress`: 是 `vuepress-vite` 的封装。
- `vuepress-vite`: 是 `@vuepress/cli` + `@vuepress/bundler-vite` 的封装。如果用户想使用 Vite ,仅安装这个 Package 就可以了。
- `vuepress-webpack`: 是 `@vuepress/cli` + `@vuepress/bundler-webpack` 的封装。如果用户想使用 Webpack ,仅安装这个 Package 就可以了。
- `vuepress`: 是上述包的封装,提供了 `vuepress` 命令行工具。用户需要在此包的基础上自行选择并安装打包工具和主题。

## 开发配置

Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# vuepress-next
# VuePress

[![check](https://github.com/vuepress/vuepress-next/workflows/check/badge.svg)](https://github.com/vuepress/vuepress-next/actions/workflows/check.yml?query=workflow%3Acheck)
[![check](https://github.com/vuepress/core/workflows/check/badge.svg)](https://github.com/vuepress/core/actions/workflows/check.yml?query=workflow%3Acheck)
[![npm](https://badgen.net/npm/v/vuepress/next)](https://www.npmjs.com/package/vuepress)
[![coverage](https://coveralls.io/repos/github/vuepress/vuepress-next/badge.svg?branch=main)](https://coveralls.io/github/vuepress/vuepress-next?branch=main)
[![license](https://badgen.net/github/license/vuepress/vuepress-next)](https://github.com/vuepress/vuepress-next/blob/main/LICENSE)
[![coverage](https://coveralls.io/repos/github/vuepress/core/badge.svg?branch=main)](https://coveralls.io/github/vuepress/core?branch=main)
[![license](https://badgen.net/github/license/vuepress/core)](https://github.com/vuepress/core/blob/main/LICENSE)
[![discord](https://badgen.net/discord/online-members/ptFjefy6H5?icon=discord&label=discord)](https://discord.gg/ptFjefy6H5)

Status: Release Candidate
Expand All @@ -16,10 +16,13 @@ For users from VuePress v1, please check out the [migration guide](https://v2.vu

## Contribution

See [Contributing Guide](https://github.com/vuepress/vuepress-next/blob/main/CONTRIBUTING.md)
See [Contributing Guide](https://github.com/vuepress/core/blob/main/CONTRIBUTING.md) ([中文版](https://github.com/vuepress/core/blob/main/CONTRIBUTING_zh.md))

查看 [贡献指南](https://github.com/vuepress/vuepress-next/blob/main/CONTRIBUTING_zh.md)
This is the repository for VuePress core packages.

- For plugins, themes and tools, see [vuepress/ecosystem](https://github.com/vuepress/ecosystem)
- For documentation source code, see [vuepress/docs](https://github.com/vuepress/docs)

## License

[MIT](https://github.com/vuepress/vuepress-next/blob/main/LICENSE)
[MIT](https://github.com/vuepress/core/blob/main/LICENSE)
5 changes: 5 additions & 0 deletions e2e/docs/.vuepress/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineClientConfig } from 'vuepress/client'

export default defineClientConfig({
//
})
4 changes: 2 additions & 2 deletions e2e/docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import process from 'node:process'
import { viteBundler } from '@vuepress/bundler-vite'
import { webpackBundler } from '@vuepress/bundler-webpack'
import { defineUserConfig } from '@vuepress/cli'
import { path } from '@vuepress/utils'
import { defineUserConfig } from 'vuepress'
import { path } from 'vuepress/utils'
import { e2eTheme } from './theme/node/e2eTheme.js'

const E2E_BASE = (process.env.E2E_BASE ?? '/') as '/' | `/${string}/`
Expand Down
2 changes: 1 addition & 1 deletion e2e/docs/.vuepress/theme/client/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineClientConfig } from '@vuepress/client'
import { defineClientConfig } from 'vuepress/client'
import CustomLayout from './layouts/CustomLayout.vue'
import Layout from './layouts/Layout.vue'
import NotFound from './layouts/NotFound.vue'
Expand Down
2 changes: 1 addition & 1 deletion e2e/docs/.vuepress/theme/client/layouts/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { Content, useSiteData } from '@vuepress/client'
import { Content, useSiteData } from 'vuepress/client'
const siteData = useSiteData()
</script>
Expand Down
4 changes: 2 additions & 2 deletions e2e/docs/.vuepress/theme/node/e2eTheme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Page, Theme } from '@vuepress/core'
import { getDirname, path } from '@vuepress/utils'
import type { Page, Theme } from 'vuepress/core'
import { getDirname, path } from 'vuepress/utils'

const __dirname = getDirname(import.meta.url)

Expand Down
1 change: 1 addition & 0 deletions e2e/docs/routes/non-ascii-paths/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [中文路径](./中文目录名/中文文件名.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
这是一个中文文件
17 changes: 6 additions & 11 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,27 @@
"private": true,
"type": "module",
"scripts": {
"e2e:build": "vuepress-cli build docs --clean-cache --clean-temp",
"e2e:build": "vuepress build docs --clean-cache --clean-temp",
"e2e:build-webpack": "E2E_BUNDLER=webpack pnpm e2e:build",
"e2e:ci:build": "pnpm e2e:build && start-server-and-test e2e:serve http-get://localhost:9080 e2e:run",
"e2e:ci:dev": "start-server-and-test e2e:dev http-get://127.0.0.1:9080 e2e:run",
"e2e:clean": "rimraf docs/.vuepress/.temp docs/.vuepress/.cache docs/.vuepress/dist",
"e2e:dev": "vuepress-cli dev docs --clean-cache --clean-temp",
"e2e:dev": "vuepress dev docs --clean-cache --clean-temp",
"e2e:dev-webpack": "E2E_BUNDLER=webpack pnpm e2e:dev",
"e2e:run": "cypress run",
"e2e:serve": "anywhere -s -h localhost -p 9080 -d docs/.vuepress/dist"
},
"dependencies": {
"@vuepress/bundler-vite": "workspace:*",
"@vuepress/bundler-webpack": "workspace:*",
"@vuepress/cli": "workspace:*",
"@vuepress/client": "workspace:*",
"@vuepress/core": "workspace:*",
"@vuepress/markdown": "workspace:*",
"@vuepress/shared": "workspace:*",
"@vuepress/utils": "workspace:*",
"sass": "^1.69.5",
"sass-loader": "^13.3.2",
"vue": "^3.3.13"
"sass-loader": "^13.3.3",
"vue": "^3.4.0",
"vuepress": "workspace:*"
},
"devDependencies": {
"anywhere": "^1.6.0",
"cypress": "^13.6.1",
"cypress": "^13.6.2",
"process": "^0.11.10",
"start-server-and-test": "^2.0.3"
}
Expand Down
32 changes: 15 additions & 17 deletions e2e/tests/layouts.cy.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
context('layouts', () => {
it('CustomLayout', () => {
cy.visit('/layouts/custom-layout.html')
cy.get('.e2e-theme-custom-layout').should('exist')
cy.get('.e2e-theme-custom-layout-content')
.contains('Should use CustomLayout')
.should('exist')
})
it('CustomLayout', () => {
cy.visit('/layouts/custom-layout.html')
cy.get('.e2e-theme-custom-layout').should('exist')
cy.get('.e2e-theme-custom-layout-content')
.contains('Should use CustomLayout')
.should('exist')
})

it('Layout', () => {
cy.visit('/layouts/layout.html')
cy.get('.e2e-theme').should('exist')
cy.get('.e2e-theme-content').contains('Should use Layout').should('exist')
})
it('Layout', () => {
cy.visit('/layouts/layout.html')
cy.get('.e2e-theme').should('exist')
cy.get('.e2e-theme-content').contains('Should use Layout').should('exist')
})

it('NotFound', () => {
cy.visit('/404.html')
cy.get('.e2e-theme-not-found').should('have.text', '404 Not Found')
})
it('NotFound', () => {
cy.visit('/404.html')
cy.get('.e2e-theme-not-found').should('have.text', '404 Not Found')
})
36 changes: 17 additions & 19 deletions e2e/tests/markdown/anchors.cy.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
describe('markdown > anchors', () => {
it('should render anchors and navigate correctly', () => {
cy.visit('/markdown/anchors.html')
it('should render anchors and navigate correctly', () => {
cy.visit('/markdown/anchors.html')

cy.get('.e2e-theme-content h1')
.should('have.attr', 'id', 'title')
.should('have.attr', 'tabindex', '-1')
cy.get('.e2e-theme-content h1')
.should('have.attr', 'id', 'title')
.should('have.attr', 'tabindex', '-1')

cy.get('.e2e-theme-content h1 > a')
.should('have.attr', 'class', 'header-anchor')
.should('have.attr', 'href', '#title')
.click()
cy.get('.e2e-theme-content h1 > a')
.should('have.attr', 'class', 'header-anchor')
.should('have.attr', 'href', '#title')
.click()

cy.location().should((location) => {
expect(location.hash).to.eq('#title')
})
cy.location().should((location) => {
expect(location.hash).to.eq('#title')
})

cy.get('#anchor-1-1 > a')
.should('have.attr', 'class', 'header-anchor')
.click()
cy.get('#anchor-1-1 > a')
.should('have.attr', 'class', 'header-anchor')
.click()

cy.location().should((location) => {
expect(location.hash).to.eq('#anchor-1-1')
})
cy.location().should((location) => {
expect(location.hash).to.eq('#anchor-1-1')
})
})
32 changes: 15 additions & 17 deletions e2e/tests/markdown/images.cy.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
describe('markdown > images', () => {
it('should render images correctly', () => {
cy.visit('/markdown/images/images.html')
it('should render images correctly', () => {
cy.visit('/markdown/images/images.html')

cy.get('.e2e-theme-content img')
.should('have.length', 2)
.each<HTMLImageElement>(([el]) => {
cy.request({ url: el.src, failOnStatusCode: false }).then((res) => {
expect(res.status).to.equal(200)
expect(el.naturalWidth).to.be.greaterThan(0)
})
cy.get('.e2e-theme-content img')
.should('have.length', 2)
.each<HTMLImageElement>(([el]) => {
cy.request({ url: el.src, failOnStatusCode: false }).then((res) => {
expect(res.status).to.equal(200)
expect(el.naturalWidth).to.be.greaterThan(0)
})
})

cy.get('.e2e-theme-content img')
.first()
.should('have.attr', 'alt', 'logo-public')
cy.get('.e2e-theme-content img')
.first()
.should('have.attr', 'alt', 'logo-public')

cy.get('.e2e-theme-content img')
.last()
.should('have.attr', 'alt', 'logo-relative')
})
cy.get('.e2e-theme-content img')
.last()
.should('have.attr', 'alt', 'logo-relative')
})
54 changes: 26 additions & 28 deletions e2e/tests/markdown/links.cy.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
const E2E_BASE = Cypress.env('E2E_BASE')
it('should render links and navigate between pages correctly', () => {
const E2E_BASE = Cypress.env('E2E_BASE')

describe('markdown > links', () => {
it('should render links and navigate between pages correctly', () => {
cy.visit('/markdown/links/foo.html')
cy.visit('/markdown/links/foo.html')

cy.get('.e2e-theme-content ul li a')
.should('have.length', 2)
.first()
.should('have.text', 'bar')
.click()
cy.get('.e2e-theme-content ul li a')
.should('have.length', 2)
.first()
.should('have.text', 'bar')
.click()

cy.location().should((location) => {
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/bar.html`)
})
cy.location().should((location) => {
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/bar.html`)
})

cy.get('.e2e-theme-content ul li a')
.should('have.length', 2)
.last()
.should('have.text', 'baz')
.click()
cy.get('.e2e-theme-content ul li a')
.should('have.length', 2)
.last()
.should('have.text', 'baz')
.click()

cy.location().should((location) => {
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/baz.html`)
})
cy.location().should((location) => {
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/baz.html`)
})

cy.get('.e2e-theme-content ul li a')
.should('have.length', 2)
.first()
.should('have.text', 'foo')
.click()
cy.get('.e2e-theme-content ul li a')
.should('have.length', 2)
.first()
.should('have.text', 'foo')
.click()

cy.location().should((location) => {
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/foo.html`)
})
cy.location().should((location) => {
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/foo.html`)
})
})
46 changes: 22 additions & 24 deletions e2e/tests/page-data.cy.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
describe('pageData', () => {
describe('title', () => {
it('should use title from frontmatter', () => {
cy.visit('/page-data/title-from-frontmatter.html')
cy.title().should('include', 'title from frontmatter')
})
describe('title', () => {
it('should use title from frontmatter', () => {
cy.visit('/page-data/title-from-frontmatter.html')
cy.title().should('include', 'title from frontmatter')
})

it('should use title from h1', () => {
cy.visit('/page-data/title-from-h1.html')
cy.title().should('include', 'title from h1')
})
it('should use title from h1', () => {
cy.visit('/page-data/title-from-h1.html')
cy.title().should('include', 'title from h1')
})
})

describe('frontmatter', () => {
it('should set frontmatter correctly', () => {
cy.visit('/page-data/frontmatter.html')
cy.get('.e2e-theme-content p').should(
'have.text',
JSON.stringify({
str: 'str',
num: 1,
bool: true,
arr: [1, 2, 3],
obj: { foo: 'bar', baz: 'qux' },
}),
)
})
describe('frontmatter', () => {
it('should set frontmatter correctly', () => {
cy.visit('/page-data/frontmatter.html')
cy.get('.e2e-theme-content p').should(
'have.text',
JSON.stringify({
str: 'str',
num: 1,
bool: true,
arr: [1, 2, 3],
obj: { foo: 'bar', baz: 'qux' },
}),
)
})
})
Loading

0 comments on commit cc44ec9

Please sign in to comment.