Skip to content

Commit f889759

Browse files
author
fgiraud
authored
Merge pull request #1811 from vuejs/feat/docs-local-development
docs(dev): adding doc to local development and add more script
2 parents a81ef8a + 852c5fe commit f889759

File tree

6 files changed

+183
-66
lines changed

6 files changed

+183
-66
lines changed

lerna.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"lerna": "2.5.1",
32
"npmClient": "yarn",
43
"useWorkspaces": true,
54
"version": "1.0.3"

package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
"description": "Minimalistic doc generator with Vue component based layout system",
99
"scripts": {
1010
"precommit": "lint-staged",
11-
"bootstrap": "yarn && lerna bootstrap && yarn tsc",
11+
"bootstrap": "yarn && yarn tsc",
1212
"clean": "lerna clean && rm -rf node_modules",
13+
"packages:list": "lerna ls -l",
14+
"packages:diff": "lerna diff",
15+
"packages:changed": "lerna changed",
1316
"boot": "node scripts/bootstrap.js",
1417
"remote-version": "node scripts/remote-version.js",
1518
"dev": "yarn tsc && yarn dev:docs",
@@ -19,11 +22,12 @@
1922
"view-info": "yarn tsc && yarn workspace docs view-info",
2023
"show-help": "yarn workspace docs show-help",
2124
"register-vuepress": "lerna exec --scope vuepress -- yarn link",
25+
"unregister-vuepress": "lerna exec --scope vuepress -- yarn unlink",
2226
"lint": "eslint packages --fix --ext .js,.vue",
23-
"release": "yarn --pure-lockfile && yarn tsc && node scripts/release.js",
27+
"release": "yarn --pure-lockfile && yarn tsc && node scripts/release.js",
2428
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2",
2529
"test": "node scripts/test.js",
26-
"tsc": "lerna run tsc"
30+
"tsc": "yarn workspace @vuepress/shared-utils tsc"
2731
},
2832
"devDependencies": {
2933
"@types/escape-html": "^0.0.20",
+35-31
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,74 @@
11
module.exports = [
22
{
3-
text: 'Guide',
4-
link: '/guide/',
3+
text: "Guide",
4+
link: "/guide/"
55
},
66
{
7-
text: 'Config Reference',
8-
link: '/config/'
7+
text: "Config Reference",
8+
link: "/config/"
99
},
1010
{
11-
text: 'Plugin',
12-
link: '/plugin/'
11+
text: "Plugin",
12+
link: "/plugin/"
1313
},
1414
{
15-
text: 'Theme',
16-
link: '/theme/'
15+
text: "Theme",
16+
link: "/theme/"
1717
},
1818
{
19-
text: 'Learn More',
19+
text: "Learn More",
2020
items: [
2121
{
22-
text: 'API',
22+
text: "API",
2323
items: [
2424
{
25-
text: 'CLI',
26-
link: '/api/cli.html'
25+
text: "CLI",
26+
link: "/api/cli.html"
2727
},
2828
{
29-
text: 'Node',
30-
link: '/api/node.html'
31-
},
29+
text: "Node",
30+
link: "/api/node.html"
31+
}
3232
]
3333
},
3434
{
35-
text: 'Contributing Guide',
35+
text: "Contributing Guide",
3636
items: [
3737
{
38-
text: 'Design Concepts',
39-
link: '/miscellaneous/design-concepts.html'
38+
text: "Local Development",
39+
link: "/miscellaneous/local-development.html"
4040
},
4141
{
42-
text: 'FAQ',
43-
link: '/faq/',
42+
text: "Design Concepts",
43+
link: "/miscellaneous/design-concepts.html"
4444
},
4545
{
46-
text: 'Glossary',
47-
link: '/miscellaneous/glossary.html'
46+
text: "FAQ",
47+
link: "/faq/"
4848
},
49+
{
50+
text: "Glossary",
51+
link: "/miscellaneous/glossary.html"
52+
}
4953
]
5054
},
5155
{
52-
text: 'Miscellaneous',
56+
text: "Miscellaneous",
5357
items: [
5458
{
55-
text: 'Migrate from 0.x',
56-
link: '/miscellaneous/migration-guide.html'
59+
text: "Migrate from 0.x",
60+
link: "/miscellaneous/migration-guide.html"
5761
},
5862
{
59-
text: 'Changelog',
60-
link: 'https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md'
63+
text: "Changelog",
64+
link: "https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md"
6165
}
6266
]
6367
}
6468
]
6569
},
6670
{
67-
text: '0.x',
68-
link: 'https://vuepress.vuejs.org/'
69-
},
70-
]
71+
text: "0.x",
72+
link: "https://vuepress.vuejs.org/"
73+
}
74+
];
+35-31
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,74 @@
11
module.exports = [
22
{
3-
text: '指南',
4-
link: '/zh/guide/',
3+
text: "指南",
4+
link: "/zh/guide/"
55
},
66
{
7-
text: '配置',
8-
link: '/zh/config/'
7+
text: "配置",
8+
link: "/zh/config/"
99
},
1010
{
11-
text: '插件',
12-
link: '/zh/plugin/'
11+
text: "插件",
12+
link: "/zh/plugin/"
1313
},
1414
{
15-
text: '主题',
16-
link: '/zh/theme/'
15+
text: "主题",
16+
link: "/zh/theme/"
1717
},
1818
{
19-
text: '了解更多',
19+
text: "了解更多",
2020
items: [
2121
{
22-
text: 'API',
22+
text: "API",
2323
items: [
2424
{
25-
text: 'CLI',
26-
link: '/zh/api/cli.html'
25+
text: "CLI",
26+
link: "/zh/api/cli.html"
2727
},
2828
{
29-
text: 'Node',
30-
link: '/zh/api/node.html'
31-
},
29+
text: "Node",
30+
link: "/zh/api/node.html"
31+
}
3232
]
3333
},
3434
{
35-
text: '开发指南',
35+
text: "开发指南",
3636
items: [
3737
{
38-
text: '设计理念',
39-
link: '/zh/miscellaneous/design-concepts.html'
38+
text: "Local Development",
39+
link: "/miscellaneous/local-development.html"
4040
},
4141
{
42-
text: 'FAQ',
43-
link: '/zh/faq/',
42+
text: "设计理念",
43+
link: "/zh/miscellaneous/design-concepts.html"
4444
},
4545
{
46-
text: '术语',
47-
link: '/zh/miscellaneous/glossary.html'
46+
text: "FAQ",
47+
link: "/zh/faq/"
4848
},
49+
{
50+
text: "术语",
51+
link: "/zh/miscellaneous/glossary.html"
52+
}
4953
]
5054
},
5155
{
52-
text: '其他',
56+
text: "其他",
5357
items: [
5458
{
55-
text: '从 0.x 迁移',
56-
link: '/zh/miscellaneous/migration-guide.html'
59+
text: "从 0.x 迁移",
60+
link: "/zh/miscellaneous/migration-guide.html"
5761
},
5862
{
59-
text: 'Changelog',
60-
link: 'https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md'
63+
text: "Changelog",
64+
link: "https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md"
6165
}
6266
]
6367
}
6468
]
6569
},
6670
{
67-
text: '0.x',
68-
link: 'https://vuepress.vuejs.org/'
69-
},
70-
]
71+
text: "0.x",
72+
link: "https://vuepress.vuejs.org/"
73+
}
74+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
sidebar: auto
3+
---
4+
5+
# Local Development
6+
7+
## Informations
8+
9+
If you here youh may be intereset of improve core vuepress.
10+
11+
Vuepress is using a combo with [Yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) and [Lerna](https://github.com/lerna/lerna).
12+
13+
## Init packages
14+
15+
```bash
16+
yarn bootstrap // it will run and install into the root all packages subfolders
17+
```
18+
19+
yarn bootstrap will use hoisting. What it mean for you ?
20+
21+
It will regroup all dependencies in the workspace root and link all packages.
22+
23+
to check the link you can run
24+
25+
```bash
26+
ls -la node_modules/@vuepress
27+
```
28+
29+
You will all symlinks
30+
31+
:::warning
32+
You have to take care to declare all dependencies inside subFolders package.json. When publish the lib if dependencie from a package is not declare it will just not work.
33+
:::
34+
35+
:::warning
36+
There is a special package you should have a look is @vuepress/shared-utils that are in typescript.
37+
:::
38+
39+
After install everything it will run `yarn tsc`. This command will tell to @vuepress/shared-utils workspace to compile his js.
40+
41+
:::warning
42+
From here if you are making change inside this package you will have to
43+
run `yarn tsc` all the time or run in separate shell `yarn run tsc -w`. This will re run tsc at any change from shared-utils
44+
:::
45+
46+
## Link
47+
48+
Good from here you have everything ready. You need to link vuepress to your project.
49+
50+
```bash
51+
yarn register-vuepress
52+
```
53+
54+
You will have something like this: `success Registered "vuepress".`
55+
56+
It will link the package vuepress from packages/vuepress. So you will have access to vuepress cli and vuepress packages.
57+
58+
they are decalre in the `packages/vuepress/package.json`
59+
60+
```js
61+
{
62+
"main": "index.js",
63+
///
64+
"bin": {
65+
"vuepress": "cli.js"
66+
}
67+
///
68+
}
69+
```
70+
71+
Now go to your project and run `yarn link vuepress`.
72+
73+
You should have it `success Using linked package for "vuepress".`
74+
75+
## Unlink
76+
77+
You may want to unlink everything. For it in the workspace root folder. Run
78+
79+
```bash
80+
yarn unregister-vuepress
81+
```
82+
83+
Now you can run `yarn unlink vuepress` into your project folder.
84+
85+
If everything work properly you should have an error telling you there is no package found called vuepress, if you run `yarn link vuepress` in you project folder.
86+
87+
## BUGS / QA
88+
89+
You will maybe find some difficulty with link. If you encounter something like `There's already a package called "vuepress" registered`.
90+
You have already vuepress registered. so:
91+
92+
- if you already link vuepress from [Link](#link). It's totally fine. If you make changes because it is symlink you dont have to re run something. You will have to rerun yarn tsc if you update shared-utils package. Nothing more
93+
- if you have done nothing. You have already vuepress linked somewhere. What you have to do is to delete folder where you already run `yarn link` or run `yarn unlink` inside it.
94+
95+
## More
96+
97+
You will have interesting commands available:
98+
99+
- `yarn packages:list` will list you every packages present and their versions [More...](https://github.com/lerna/lerna/tree/master/commands/list#readme)
100+
- `yarn packages:changed` will tell you which package will be affect by the next lerna publish / version [More...](https://github.com/lerna/lerna/tree/master/commands/changed#readme)
101+
- `yarn packages:diff` will show you all diff from last release [More...](https://github.com/lerna/lerna/tree/master/commands/diff#readme)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
sidebar: auto
3+
---
4+
5+
# need trad

0 commit comments

Comments
 (0)