Skip to content

Commit

Permalink
fix(create-vuepress): sync output folder with docs (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Jan 27, 2024
1 parent b61754f commit e7887aa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
9 changes: 3 additions & 6 deletions tools/create-vuepress/src/flow/createPackageJson.ts
Expand Up @@ -35,17 +35,14 @@ export const createPackageJson = async ({
bundler,
}: CreatePackageJsonOptions): Promise<void> => {
const packageJsonPath = join(targetDir, 'package.json')
// TODO: Update it
const devDependencies = {
'@vuepress/client': '^2.0.0-rc.2',
[`@vuepress/bundler-${bundler}`]: '^2.0.0-rc.2',
'@vuepress/theme-default': '^2.0.0-rc.2',
'vue': '^3.4.0',
'vuepress': '^2.0.0-rc.2',
}

if (preset === 'blog') {
devDependencies['@vuepress/core'] = '^2.0.0-rc.2'
devDependencies['vue-router'] = '^4.2.5'
}

Expand Down Expand Up @@ -87,11 +84,11 @@ export const createPackageJson = async ({
type: 'module',
scripts: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'docs:build': `vuepress build src`,
'docs:build': `vuepress build docs`,
// eslint-disable-next-line @typescript-eslint/naming-convention
'docs:clean-dev': `vuepress dev src --clean-cache`,
'docs:clean-dev': `vuepress dev docs --clean-cache`,
// eslint-disable-next-line @typescript-eslint/naming-convention
'docs:dev': `vuepress dev src`,
'docs:dev': `vuepress dev docs`,
// eslint-disable-next-line @typescript-eslint/naming-convention
'docs:update-package': `${
packageManager === 'npm' ? 'npx' : `${packageManager} dlx`
Expand Down
8 changes: 4 additions & 4 deletions tools/create-vuepress/src/flow/generateTemplate.ts
Expand Up @@ -83,7 +83,7 @@ ${
NODE_OPTIONS: --max_old_space_size=8192
run: |-
${packageManager} run docs:build
> src/.vuepress/dist/.nojekyll
> docs/.vuepress/dist/.nojekyll
- name: ${lang === '简体中文' ? '部署文档' : 'Deploy Docs'}
uses: JamesIves/github-pages-deploy-action@v4
Expand All @@ -94,7 +94,7 @@ ${
: 'This is the branch where the docs are deployed to'
}
branch: gh-pages
folder: src/.vuepress/dist
folder: docs/.vuepress/dist
`

interface GenerateTemplateOptions {
Expand Down Expand Up @@ -128,9 +128,9 @@ export const generateTemplate = async ({
console.log(locale.flow.generateTemplate)

// copy template
copy(join(templateFolder, preset), join(targetDirPath, 'src'))
copy(join(templateFolder, preset), join(targetDirPath, 'docs'))

const configFilePath = join(targetDirPath, 'src/.vuepress/config.js')
const configFilePath = join(targetDirPath, 'docs/.vuepress/config.js')

const content = readFileSync(configFilePath, { encoding: 'utf-8' })

Expand Down
@@ -1,4 +1,4 @@
import { createPage } from '@vuepress/core'
import { createPage } from 'vuepress/core'

const slugify = (name) =>
name
Expand Down

0 comments on commit e7887aa

Please sign in to comment.