Skip to content

Commit 5030421

Browse files
committed
Merge branch 'master' into dropdown
2 parents 3397dc2 + 580774b commit 5030421

25 files changed

+722
-73
lines changed

CHANGELOG.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<a name="0.4.0"></a>
2+
# [0.4.0](https://github.com/vuejs/vuepress/compare/v0.3.3...v0.4.0) (2018-04-15)
3+
4+
5+
### Features
6+
7+
* allow default theme to be copied as custom theme ([98e1665](https://github.com/vuejs/vuepress/commit/98e1665))
8+
* vuepress eject for customizing default theme ([89538fa](https://github.com/vuejs/vuepress/commit/89538fa))
9+
10+
11+
12+
<a name="0.3.3"></a>
13+
## [0.3.3](https://github.com/vuejs/vuepress/compare/v0.3.2...v0.3.3) (2018-04-15)
14+
15+
16+
### Bug Fixes
17+
18+
* fix outbound nav links (close [#37](https://github.com/vuejs/vuepress/issues/37)) ([c909007](https://github.com/vuejs/vuepress/commit/c909007))
19+
20+
21+
22+
<a name="0.3.2"></a>
23+
## [0.3.2](https://github.com/vuejs/vuepress/compare/v0.3.1...v0.3.2) (2018-04-15)
24+
25+
26+
### Bug Fixes
27+
28+
* added escaping of meta tag attribute value ([#29](https://github.com/vuejs/vuepress/issues/29)) ([15a1ac8](https://github.com/vuejs/vuepress/commit/15a1ac8))
29+
* escape text in code block when lang is text or not specified [#31](https://github.com/vuejs/vuepress/issues/31) ([#32](https://github.com/vuejs/vuepress/issues/32)) ([ac4acab](https://github.com/vuejs/vuepress/commit/ac4acab))
30+
* **dev build:** use portfinder ([#30](https://github.com/vuejs/vuepress/issues/30)) ([f2a8229](https://github.com/vuejs/vuepress/commit/f2a8229)), closes [#26](https://github.com/vuejs/vuepress/issues/26)
31+
* generate better slugs for non latin langs (close [#45](https://github.com/vuejs/vuepress/issues/45)) ([e08e3d2](https://github.com/vuejs/vuepress/commit/e08e3d2))
32+
* hoistedTags may not always be present (close [#35](https://github.com/vuejs/vuepress/issues/35)) ([ed33515](https://github.com/vuejs/vuepress/commit/ed33515))
33+
* home link '/' shouldn’t always stays active ([#47](https://github.com/vuejs/vuepress/issues/47)) ([67c758e](https://github.com/vuejs/vuepress/commit/67c758e))
34+
* images should have 100% max width ([9e63974](https://github.com/vuejs/vuepress/commit/9e63974))
35+
* renderChildren / sidebarDepth: 0 ([42f63a8](https://github.com/vuejs/vuepress/commit/42f63a8))
36+
37+
38+
### Features
39+
40+
* add warning about node version on startup (close [#51](https://github.com/vuejs/vuepress/issues/51)) ([1118327](https://github.com/vuejs/vuepress/commit/1118327))
41+
42+
43+
44+
<a name="0.3.1"></a>
45+
## [0.3.1](https://github.com/vuejs/vuepress/compare/v0.3.0...v0.3.1) (2018-04-14)
46+
47+
48+
### Bug Fixes
49+
50+
* **style:** prevent scrollbar in code ([#18](https://github.com/vuejs/vuepress/issues/18)) ([a3db4d2](https://github.com/vuejs/vuepress/commit/a3db4d2))
51+
* code margin on mobile ([695440f](https://github.com/vuejs/vuepress/commit/695440f))
52+
53+
54+
### Features
55+
56+
* commands now defaults targetDir to cwd. ([#25](https://github.com/vuejs/vuepress/issues/25)) ([22b7943](https://github.com/vuejs/vuepress/commit/22b7943)), closes [#8](https://github.com/vuejs/vuepress/issues/8)
57+
58+
59+
60+
<a name="0.3.0"></a>
61+
# [0.3.0](https://github.com/vuejs/vuepress/compare/v0.2.2...v0.3.0) (2018-04-14)
62+
63+
64+
65+
<a name="0.2.2"></a>
66+
## [0.2.2](https://github.com/vuejs/vuepress/compare/v0.2.1...v0.2.2) (2018-04-14)
67+
68+
69+
70+
<a name="0.2.1"></a>
71+
## [0.2.1](https://github.com/vuejs/vuepress/compare/v0.2.0...v0.2.1) (2018-04-14)
72+
73+
74+
### Bug Fixes
75+
76+
* fix vuepress cant resolve custom theme under .vuepress/theme ([#3](https://github.com/vuejs/vuepress/issues/3)) ([133bdb3](https://github.com/vuejs/vuepress/commit/133bdb3))
77+
78+
79+
80+
<a name="0.2.0"></a>
81+
# [0.2.0](https://github.com/vuejs/vuepress/compare/v0.1.0...v0.2.0) (2018-04-13)
82+
83+
84+
### Features
85+
86+
* auto detect invalid inbound links ([ca82906](https://github.com/vuejs/vuepress/commit/ca82906))
87+
* google analytics ([764ccd5](https://github.com/vuejs/vuepress/commit/764ccd5))
88+
* pwa ([664a8e0](https://github.com/vuejs/vuepress/commit/664a8e0))
89+
90+
91+
92+
<a name="0.1.0"></a>
93+
# [0.1.0](https://github.com/vuejs/vuepress/compare/890f929...v0.1.0) (2018-04-12)
94+
95+
96+
### Bug Fixes
97+
98+
* css extraction ([d293194](https://github.com/vuejs/vuepress/commit/d293194))
99+
* workaround for empty style chunk ([701658a](https://github.com/vuejs/vuepress/commit/701658a))
100+
101+
102+
### Features
103+
104+
* dev server ([890f929](https://github.com/vuejs/vuepress/commit/890f929))
105+
* support nesting in sidebar ([1964709](https://github.com/vuejs/vuepress/commit/1964709))
106+
* support style/script hoisting + css modules ([f97e676](https://github.com/vuejs/vuepress/commit/f97e676))
107+
108+
109+

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Contributions are welcome!
3737
## Development
3838

3939
``` bash
40-
npm install
41-
npm run dev # serves VuePress' own docs with itself
40+
yarn
41+
yarn dev # serves VuePress' own docs with itself
4242
```
4343

4444
## License

bin/vuepress.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
#!/usr/bin/env node
22

3-
const path = require('path')
43
const chalk = require('chalk')
4+
const semver = require('semver')
5+
const requiredVersion = require('../package.json').engines.node
6+
7+
if (!semver.satisfies(process.version, requiredVersion)) {
8+
console.log(chalk.red(
9+
`You are using Node ${process.version}, but VuePress ` +
10+
`requires Node ${requiredVersion}.\nPlease upgrade your Node version.`
11+
))
12+
process.exit(1)
13+
}
14+
15+
const path = require('path')
516
const { dev, build } = require('../lib')
617

718
const program = require('commander')
@@ -27,6 +38,17 @@ program
2738
wrapCommand(build)(path.resolve(dir), { debug, outDir })
2839
})
2940

41+
program
42+
.command('eject [targetDir]')
43+
.description('copy the default theme into .vuepress/theme for customization.')
44+
.action(async (dir = '.') => {
45+
const { copy } = require('fs-extra')
46+
const source = path.resolve(__dirname, '../lib/default-theme')
47+
const target = path.resolve(dir, '.vuepress/theme')
48+
await copy(source, target)
49+
console.log(`Copied default theme into ${chalk.cyan(target)}.`)
50+
})
51+
3052
// output help information on unknown commands
3153
program
3254
.arguments('<command>')

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ footer: MIT Licensed | Copyright © 2018-present Evan You
2020
npm install -g vuepress
2121

2222
# create a markdown file
23-
echo "# Hello VuePress" > README.md
23+
echo # Hello VuePress > README.md
2424

2525
# start writing
2626
vuepress dev

docs/config/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,26 @@ Provide config options to the used theme. The options will vary depending on the
113113

114114
## Markdown
115115

116+
### markdown.slugify
117+
118+
- Type: `Function`
119+
- Default: [source](https://github.com/vuejs/vuepress/blob/master/lib/markdown/slugify.js)
120+
121+
Function for transforming header texts into slugs. This affects the ids/links generated for header anchors, table of contents and sidebar links.
122+
116123
### markdown.anchor
117124

118125
- Type: `Object`
119126
- Default: `{ permalink: true, permalinkBefore: true, permalinkSymbol: '#' }`
120127

121-
Options for [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor).
128+
Options for [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor). (Note: prefer `markdown.slugify` if you want to customize header ids.)
122129

123130
### markdown.toc
124131

125132
- Type: `Object`
126133
- Default: `{ includeLevel: [2, 3] }`
127134

128-
Options for [markdown-it-table-of-contents](https://github.com/Oktavilla/markdown-it-table-of-contents).
135+
Options for [markdown-it-table-of-contents](https://github.com/Oktavilla/markdown-it-table-of-contents). (Note: prefer `markdown.slugify` if you want to customize header ids.)
129136

130137
### markdown.config
131138

docs/default-theme-config/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ footer: MIT Licensed | Copyright © 2018-present Evan You
3131

3232
Any additional content after the front matter will be parsed as normal markdown and rendered after the features section.
3333

34+
If you want to use a completely custom homepage layout, you can also use a [Custom Layout](#custom-layout-for-specific-pages).
35+
3436
## Navbar Links
3537

3638
You can add links to the navbar via `themeConfig.nav`:
@@ -240,4 +242,8 @@ layout: SpecialLayout
240242
---
241243
```
242244

243-
This will render `.vuepress/components/SpecialLayout/vue` for the given page.
245+
This will render `.vuepress/components/SpecialLayout.vue` for the given page.
246+
247+
## Ejecting
248+
249+
You can copy the default theme source code into `.vuepress/theme` to fully customize the theme using the `vuepress eject [targetDir]` command. Note, however, once you eject, you are on your own and won't be receiving future updates or bug fixes to the default theme even if you upgrade VuePress.

docs/guide/custom-themes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,7 @@ module.exports = {
7979
```
8080

8181
VuePress will attempt to locate and use `node_modules/vuepress-theme-awesome/Layout.vue`.
82+
83+
## Customizing the Default Theme
84+
85+
The `vuepress eject [targetDir]` command will copy the default theme source code into `.vuepress/theme` to allow complete customization. Note, however, once you eject, you are on your own and won't be receiving future updates or bug fixes to the default theme even if you upgrade VuePress.

docs/guide/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ If you just want to play around with VuePress, you can install it globally:
99
npm install -g vuepress
1010

1111
# create a markdown file
12-
echo "# Hello VuePress" > README.md
12+
echo # Hello VuePress > README.md
1313

1414
# start writing
1515
vuepress dev
@@ -29,7 +29,7 @@ npm install -D vuepress
2929
# create a docs directory
3030
mkdir docs
3131
# create a markdown file
32-
echo "# Hello VuePress!" > docs/README.md
32+
echo # Hello VuePress > docs/README.md
3333

3434
# start writing
3535
npx vuepress dev docs

lib/app/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import Vue from 'vue'
22
import Router from 'vue-router'
33
import Content from './Content'
44
import ClientOnly from './ClientOnly'
5-
import NotFound from '~notFound'
65
import dataMixin from './dataMixin'
7-
import { routes } from './.temp/routes'
8-
import { siteData } from './.temp/siteData'
6+
import NotFound from '@notFound'
7+
import { routes } from '@temp/routes'
8+
import { siteData } from '@temp/siteData'
99

1010
// suggest dev server restart on base change
1111
if (module.hot) {

lib/app/clientEntry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* global BASE_URL, GA_ID, ga, SW_ENABLED */
22

3-
import './.temp/polyfill'
3+
import '@temp/polyfill'
44
import { createApp } from './app'
55
import { register } from 'register-service-worker'
66

lib/build.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
module.exports = async function build (sourceDir, cliOptions = {}) {
22
process.env.NODE_ENV = 'production'
33

4-
const fs = require('fs')
4+
const fs = require('fs-extra')
55
const path = require('path')
66
const chalk = require('chalk')
77
const webpack = require('webpack')
88
const readline = require('readline')
9-
const { promisify } = require('util')
109
const escape = require('escape-html')
11-
const rimraf = promisify(require('rimraf'))
12-
const mkdirp = promisify(require('mkdirp'))
13-
const readFile = promisify(fs.readFile)
14-
const writeFile = promisify(fs.writeFile)
1510

1611
const prepare = require('./prepare')
1712
const createClientConfig = require('./webpack/createClientConfig')
@@ -26,7 +21,7 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
2621
}
2722

2823
const { outDir } = options
29-
await rimraf(outDir)
24+
await fs.remove(outDir)
3025

3126
let clientConfig = createClientConfig(options, cliOptions).toConfig()
3227
let serverConfig = createServerConfig(options, cliOptions).toConfig()
@@ -48,7 +43,7 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
4843
const clientManifest = require(path.resolve(outDir, 'manifest/client.json'))
4944

5045
// remove manifests after loading them.
51-
await rimraf(path.resolve(outDir, 'manifest'))
46+
await fs.remove(path.resolve(outDir, 'manifest'))
5247

5348
// find and remove empty style chunk caused by
5449
// https://github.com/webpack-contrib/mini-css-extract-plugin/issues/85
@@ -60,7 +55,7 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
6055
clientManifest,
6156
runInNewContext: false,
6257
inject: false,
63-
template: fs.readFileSync(path.resolve(__dirname, 'app/index.ssr.html'), 'utf-8')
58+
template: await fs.readFile(path.resolve(__dirname, 'app/index.ssr.html'), 'utf-8')
6459
})
6560

6661
// pre-render head tags from user config
@@ -154,8 +149,8 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
154149
}
155150
const filename = pagePath.replace(/\/$/, '/index.html').replace(/^\//, '')
156151
const filePath = path.resolve(outDir, filename)
157-
await mkdirp(path.dirname(filePath))
158-
await writeFile(filePath, html)
152+
await fs.ensureDir(path.dirname(filePath))
153+
await fs.writeFile(filePath, html)
159154
}
160155

161156
function renderPageMeta (meta) {
@@ -174,15 +169,15 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
174169
return /styles\.\w{8}\.js$/.test(a.name)
175170
})
176171
const styleChunkPath = path.resolve(outDir, styleChunk.name)
177-
const styleChunkContent = await readFile(styleChunkPath, 'utf-8')
178-
await rimraf(styleChunkPath)
172+
const styleChunkContent = await fs.readFile(styleChunkPath, 'utf-8')
173+
await fs.remove(styleChunkPath)
179174
// prepend it to app.js.
180175
// this is necessary for the webpack runtime to work properly.
181176
const appChunk = stats.children[0].assets.find(a => {
182177
return /app\.\w{8}\.js$/.test(a.name)
183178
})
184179
const appChunkPath = path.resolve(outDir, appChunk.name)
185-
const appChunkContent = await readFile(appChunkPath, 'utf-8')
186-
await writeFile(appChunkPath, styleChunkContent + appChunkContent)
180+
const appChunkContent = await fs.readFile(appChunkPath, 'utf-8')
181+
await fs.writeFile(appChunkPath, styleChunkContent + appChunkContent)
187182
}
188183
}

lib/default-theme/Layout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import Home from './Home.vue'
2424
import Navbar from './Navbar.vue'
2525
import Page from './Page.vue'
2626
import Sidebar from './Sidebar.vue'
27-
import { pathToComponentName, getTitle, getLang } from '../app/util'
27+
import { pathToComponentName, getTitle, getLang } from '@app/util'
2828
import { resolveSidebarItems } from './util'
2929
3030
export default {

lib/default-theme/NavLinks.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242

4343
<script>
4444
import OutboundLink from './OutboundLink.vue'
45+
import { isActive, ensureExt, resolveNavLinkItem, outboundRE } from './util'
4546
import NavLink from './NavLink.vue'
46-
import { isActive, resolveNavLinkItem } from './util'
4747
4848
export default {
4949
components: { OutboundLink, NavLink },

lib/default-theme/styles/config.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ $MQNarrow = 959px
1414
$MQMobile = 719px
1515
$MQMobileNarrow = 419px
1616

17-
@import '../../app/.temp/override.styl' // generated from user config
17+
@import '~@temp/override.styl' // generated from user config

0 commit comments

Comments
 (0)