Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vuepress
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.3
Choose a base ref
...
head repository: vuejs/vuepress
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.4.0
Choose a head ref
  • 7 commits
  • 14 files changed
  • 1 contributor

Commits on Apr 15, 2018

  1. Copy the full SHA
    98e1665 View commit details
  2. refactor: use fs-extra

    yyx990803 committed Apr 15, 2018
    Copy the full SHA
    b3e1e5e View commit details
  3. Copy the full SHA
    89538fa View commit details
  4. docs: document eject

    yyx990803 committed Apr 15, 2018
    Copy the full SHA
    16a9fe7 View commit details
  5. workflow: scripts

    yyx990803 committed Apr 15, 2018
    Copy the full SHA
    b1dbc4b View commit details
  6. changelog

    yyx990803 committed Apr 15, 2018
    Copy the full SHA
    dd3868d View commit details
  7. 0.4.0

    yyx990803 committed Apr 15, 2018
    Copy the full SHA
    34e3658 View commit details
98 changes: 98 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<a name="0.3.3"></a>
## [0.3.3](https://github.com/vuejs/vuepress/compare/v0.3.2...v0.3.3) (2018-04-15)


### Bug Fixes

* fix outbound nav links (close [#37](https://github.com/vuejs/vuepress/issues/37)) ([c909007](https://github.com/vuejs/vuepress/commit/c909007))



<a name="0.3.2"></a>
## [0.3.2](https://github.com/vuejs/vuepress/compare/v0.3.1...v0.3.2) (2018-04-15)


### Bug Fixes

* added escaping of meta tag attribute value ([#29](https://github.com/vuejs/vuepress/issues/29)) ([15a1ac8](https://github.com/vuejs/vuepress/commit/15a1ac8))
* 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))
* **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)
* generate better slugs for non latin langs (close [#45](https://github.com/vuejs/vuepress/issues/45)) ([e08e3d2](https://github.com/vuejs/vuepress/commit/e08e3d2))
* hoistedTags may not always be present (close [#35](https://github.com/vuejs/vuepress/issues/35)) ([ed33515](https://github.com/vuejs/vuepress/commit/ed33515))
* home link '/' shouldn’t always stays active ([#47](https://github.com/vuejs/vuepress/issues/47)) ([67c758e](https://github.com/vuejs/vuepress/commit/67c758e))
* images should have 100% max width ([9e63974](https://github.com/vuejs/vuepress/commit/9e63974))
* renderChildren / sidebarDepth: 0 ([42f63a8](https://github.com/vuejs/vuepress/commit/42f63a8))


### Features

* add warning about node version on startup (close [#51](https://github.com/vuejs/vuepress/issues/51)) ([1118327](https://github.com/vuejs/vuepress/commit/1118327))



<a name="0.3.1"></a>
## [0.3.1](https://github.com/vuejs/vuepress/compare/v0.3.0...v0.3.1) (2018-04-14)


### Bug Fixes

* **style:** prevent scrollbar in code ([#18](https://github.com/vuejs/vuepress/issues/18)) ([a3db4d2](https://github.com/vuejs/vuepress/commit/a3db4d2))
* code margin on mobile ([695440f](https://github.com/vuejs/vuepress/commit/695440f))


### Features

* 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)



<a name="0.3.0"></a>
# [0.3.0](https://github.com/vuejs/vuepress/compare/v0.2.2...v0.3.0) (2018-04-14)



<a name="0.2.2"></a>
## [0.2.2](https://github.com/vuejs/vuepress/compare/v0.2.1...v0.2.2) (2018-04-14)



<a name="0.2.1"></a>
## [0.2.1](https://github.com/vuejs/vuepress/compare/v0.2.0...v0.2.1) (2018-04-14)


### Bug Fixes

* 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))



<a name="0.2.0"></a>
# [0.2.0](https://github.com/vuejs/vuepress/compare/v0.1.0...v0.2.0) (2018-04-13)


### Features

* auto detect invalid inbound links ([ca82906](https://github.com/vuejs/vuepress/commit/ca82906))
* google analytics ([764ccd5](https://github.com/vuejs/vuepress/commit/764ccd5))
* pwa ([664a8e0](https://github.com/vuejs/vuepress/commit/664a8e0))



<a name="0.1.0"></a>
# [0.1.0](https://github.com/vuejs/vuepress/compare/890f929...v0.1.0) (2018-04-12)


### Bug Fixes

* css extraction ([d293194](https://github.com/vuejs/vuepress/commit/d293194))
* workaround for empty style chunk ([701658a](https://github.com/vuejs/vuepress/commit/701658a))


### Features

* dev server ([890f929](https://github.com/vuejs/vuepress/commit/890f929))
* support nesting in sidebar ([1964709](https://github.com/vuejs/vuepress/commit/1964709))
* support style/script hoisting + css modules ([f97e676](https://github.com/vuejs/vuepress/commit/f97e676))



11 changes: 11 additions & 0 deletions bin/vuepress.js
Original file line number Diff line number Diff line change
@@ -38,6 +38,17 @@ program
wrapCommand(build)(path.resolve(dir), { debug, outDir })
})

program
.command('eject [targetDir]')
.description('copy the default theme into .vuepress/theme for customization.')
.action(async (dir = '.') => {
const { copy } = require('fs-extra')
const source = path.resolve(__dirname, '../lib/default-theme')
const target = path.resolve(dir, '.vuepress/theme')
await copy(source, target)
console.log(`Copied default theme into ${chalk.cyan(target)}.`)
})

// output help information on unknown commands
program
.arguments('<command>')
6 changes: 6 additions & 0 deletions docs/default-theme-config/README.md
Original file line number Diff line number Diff line change
@@ -31,6 +31,8 @@ footer: MIT Licensed | Copyright © 2018-present Evan You

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

If you want to use a completely custom homepage layout, you can also use a [Custom Layout](#custom-layout-for-specific-pages).

## Navbar Links

You can add links to the navbar via `themeConfig.nav`:
@@ -223,3 +225,7 @@ layout: SpecialLayout
```

This will render `.vuepress/components/SpecialLayout.vue` for the given page.

## Ejecting

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.
4 changes: 4 additions & 0 deletions docs/guide/custom-themes.md
Original file line number Diff line number Diff line change
@@ -79,3 +79,7 @@ module.exports = {
```

VuePress will attempt to locate and use `node_modules/vuepress-theme-awesome/Layout.vue`.

## Customizing the Default Theme

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.
6 changes: 3 additions & 3 deletions lib/app/app.js
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@ import Vue from 'vue'
import Router from 'vue-router'
import Content from './Content'
import ClientOnly from './ClientOnly'
import NotFound from '~notFound'
import dataMixin from './dataMixin'
import { routes } from './.temp/routes'
import { siteData } from './.temp/siteData'
import NotFound from '@notFound'
import { routes } from '@temp/routes'
import { siteData } from '@temp/siteData'

// suggest dev server restart on base change
if (module.hot) {
2 changes: 1 addition & 1 deletion lib/app/clientEntry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global BASE_URL, GA_ID, ga, SW_ENABLED */

import './.temp/polyfill'
import '@temp/polyfill'
import { createApp } from './app'
import { register } from 'register-service-worker'

25 changes: 10 additions & 15 deletions lib/build.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
module.exports = async function build (sourceDir, cliOptions = {}) {
process.env.NODE_ENV = 'production'

const fs = require('fs')
const fs = require('fs-extra')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const readline = require('readline')
const { promisify } = require('util')
const escape = require('escape-html')
const rimraf = promisify(require('rimraf'))
const mkdirp = promisify(require('mkdirp'))
const readFile = promisify(fs.readFile)
const writeFile = promisify(fs.writeFile)

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

const { outDir } = options
await rimraf(outDir)
await fs.remove(outDir)

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

// remove manifests after loading them.
await rimraf(path.resolve(outDir, 'manifest'))
await fs.remove(path.resolve(outDir, 'manifest'))

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

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

function renderPageMeta (meta) {
@@ -174,15 +169,15 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
return /styles\.\w{8}\.js$/.test(a.name)
})
const styleChunkPath = path.resolve(outDir, styleChunk.name)
const styleChunkContent = await readFile(styleChunkPath, 'utf-8')
await rimraf(styleChunkPath)
const styleChunkContent = await fs.readFile(styleChunkPath, 'utf-8')
await fs.remove(styleChunkPath)
// prepend it to app.js.
// this is necessary for the webpack runtime to work properly.
const appChunk = stats.children[0].assets.find(a => {
return /app\.\w{8}\.js$/.test(a.name)
})
const appChunkPath = path.resolve(outDir, appChunk.name)
const appChunkContent = await readFile(appChunkPath, 'utf-8')
await writeFile(appChunkPath, styleChunkContent + appChunkContent)
const appChunkContent = await fs.readFile(appChunkPath, 'utf-8')
await fs.writeFile(appChunkPath, styleChunkContent + appChunkContent)
}
}
2 changes: 1 addition & 1 deletion lib/default-theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ import Home from './Home.vue'
import Navbar from './Navbar.vue'
import Page from './Page.vue'
import Sidebar from './Sidebar.vue'
import { pathToComponentName, getTitle, getLang } from '../app/util'
import { pathToComponentName, getTitle, getLang } from '@app/util'
import { resolveSidebarItems } from './util'
export default {
2 changes: 1 addition & 1 deletion lib/default-theme/styles/config.styl
Original file line number Diff line number Diff line change
@@ -14,4 +14,4 @@ $MQNarrow = 959px
$MQMobile = 719px
$MQMobileNarrow = 419px

@import '../../app/.temp/override.styl' // generated from user config
@import '~@temp/override.styl' // generated from user config
14 changes: 5 additions & 9 deletions lib/prepare.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
const fs = require('fs')
const fs = require('fs-extra')
const path = require('path')
const globby = require('globby')
const mkdirp = require('mkdirp')
const { promisify } = require('util')
const readFile = promisify(fs.readFile)
const writeFile = promisify(fs.writeFile)
const yaml = require('yaml-front-matter')
const tempPath = path.resolve(__dirname, 'app/.temp')
const { inferTitle, extractHeaders } = require('./util')

mkdirp(tempPath)
fs.ensureDirSync(tempPath)

const tempCache = new Map()
async function writeTemp (file, content) {
// cache write to avoid hitting the dist if it didn't change
const cached = tempCache.get(file)
if (cached !== content) {
await writeFile(path.join(tempPath, file), content)
await fs.writeFile(path.join(tempPath, file), content)
tempCache.set(file, content)
}
}
@@ -150,7 +146,7 @@ async function resolveOptions (sourceDir) {
}

// extract yaml frontmatter
const content = await readFile(path.resolve(sourceDir, file), 'utf-8')
const content = await fs.readFile(path.resolve(sourceDir, file), 'utf-8')
const frontmatter = yaml.loadFront(content)
// infer title
const title = inferTitle(frontmatter)
@@ -249,7 +245,7 @@ async function genRoutesFile ({ siteData: { pages }, sourceDir, pageFiles }) {
}

return (
`import Theme from '~theme'\n` +
`import Theme from '@theme'\n` +
`export const routes = [${pages.map(genRoute).join(',')}\n]`
)
}
8 changes: 5 additions & 3 deletions lib/webpack/createBaseConfig.js
Original file line number Diff line number Diff line change
@@ -34,9 +34,11 @@ module.exports = function createBaseConfig ({
config.resolve
.set('symlinks', true)
.alias
.set('~theme', themePath)
.set('~notFound', notFoundPath)
.set('~source', sourceDir)
.set('@theme', themePath)
.set('@notFound', notFoundPath)
.set('@source', sourceDir)
.set('@app', path.resolve(__dirname, '../app'))
.set('@temp', path.resolve(__dirname, '../app/.temp'))
.end()
.extensions
.merge(['.js', '.jsx', '.vue', '.json'])
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuepress",
"version": "0.3.3",
"version": "0.4.0",
"description": "Minimalistic doc generator with Vue component based layout system",
"main": "lib/index.js",
"bin": {
@@ -10,7 +10,7 @@
"dev": "node bin/vuepress dev docs",
"build": "node bin/vuepress build docs",
"lint": "eslint bin lib test",
"deploy-gh": "GH=1 yarn build && bash scripts/deploy-gh.sh"
"prepublishOnly": "conventional-changelog -p angular -r 2 -i CHANGELOG.md -s"
},
"repository": {
"type": "git",
@@ -54,6 +54,7 @@
"es6-promise": "^4.2.4",
"escape-html": "^1.0.3",
"file-loader": "^1.1.11",
"fs-extra": "^5.0.0",
"globby": "^8.0.1",
"html-webpack-plugin": "^3.2.0",
"koa-connect": "^2.0.1",
@@ -67,15 +68,13 @@
"markdown-it-emoji": "^1.4.0",
"markdown-it-table-of-contents": "^0.3.3",
"mini-css-extract-plugin": "^0.4.0",
"mkdirp": "^0.5.1",
"nprogress": "^0.2.0",
"object-assign": "^4.1.1",
"optimize-css-assets-webpack-plugin": "^4.0.0",
"portfinder": "^1.0.13",
"postcss-loader": "^2.1.3",
"prismjs": "^1.13.0",
"register-service-worker": "^1.2.0",
"rimraf": "^2.6.2",
"semver": "^5.5.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
@@ -94,6 +93,7 @@
"yaml-front-matter": "^4.0.0"
},
"devDependencies": {
"conventional-changelog": "^1.1.23",
"eslint": "^4.19.1",
"eslint-plugin-vue-libs": "^2.1.0",
"lint-staged": "^7.0.4",
5 changes: 0 additions & 5 deletions scripts/deploy-gh.sh

This file was deleted.

Loading