Skip to content

Commit 7ada6b0

Browse files
committed
Improve CI process
1 parent ecf4fc9 commit 7ada6b0

File tree

3 files changed

+114
-26
lines changed

3 files changed

+114
-26
lines changed

.circleci/config.yml

+110-24
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,122 @@
22
#
33
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
44
#
5-
version: 2
5+
version: 2.1
6+
7+
defaults: &defaults
8+
working_directory: ~/project
9+
docker:
10+
- image: circleci/node:latest
11+
612
jobs:
7-
build:
8-
docker:
9-
# specify the version you desire here
10-
- image: circleci/node:10.15.2
1113

12-
# Specify service dependencies here if necessary
13-
# CircleCI maintains a library of pre-built images
14-
# documented at https://circleci.com/docs/2.0/circleci-images/
15-
# - image: circleci/mongo:3.4.4
14+
#------------------------------------------------------------
15+
# 1. Install dependencies
16+
#------------------------------------------------------------
17+
18+
install-dependencies:
19+
<<: *defaults
20+
steps:
21+
- checkout
22+
23+
- restore_cache:
24+
keys:
25+
- v1-deps-{{ checksum "yarn.lock" }}
26+
- v1-deps
27+
28+
- run:
29+
name: 'Install dependencies'
30+
command: yarn --frozen-lockfile --non-interactive
31+
32+
- save_cache:
33+
key: v1-deps-{{ checksum "yarn.lock" }}
34+
paths:
35+
- ~/.cache/yarn
36+
37+
- persist_to_workspace:
38+
root: ~/project
39+
paths:
40+
- node_modules
41+
- packages/*/node_modules
42+
- packages/@vuepress/*/node_modules
43+
44+
#------------------------------------------------------------
45+
# 2. Run parallel jobs:
46+
# => lerna-boostrap
47+
# => tsc
48+
# => tests
49+
# => linter
50+
#------------------------------------------------------------
1651

17-
working_directory: ~/repo
52+
lerna-bootstrap:
53+
<<: *defaults
54+
steps:
55+
- checkout
56+
- attach_workspace:
57+
at: ~/project
58+
- run:
59+
name: 'Lerna bootstrap'
60+
command: yarn lerna:bootstrap
61+
62+
run-tsc:
63+
<<: *defaults
64+
steps:
65+
- checkout
66+
- attach_workspace:
67+
at: ~/project
68+
- run:
69+
name: 'Run tsc'
70+
command: yarn tsc
71+
- persist_to_workspace:
72+
root: ~/project
73+
paths:
74+
- packages/@vuepress/shared-utils/lib
75+
76+
run-tests:
77+
<<: *defaults
78+
steps:
79+
- checkout
80+
- attach_workspace:
81+
at: ~/project
82+
- run:
83+
name: 'Run tests'
84+
command: yarn test
1885

86+
run-linter-check:
87+
<<: *defaults
1988
steps:
20-
- checkout
89+
- checkout
90+
- attach_workspace:
91+
at: ~/project
92+
- run:
93+
name: 'Run linter'
94+
command: yarn lint:check
2195

22-
# Download and cache dependencies
23-
- restore_cache:
24-
keys:
25-
- v1-dependencies-{{ checksum "package.json" }}
26-
# fallback to using the latest cache if no exact match is found
27-
- v1-dependencies-
96+
#------------------------------------------------------------
97+
# 3. Build VuePress
98+
#------------------------------------------------------------
2899

29-
- run: yarn bootstrap
100+
build:
101+
<<: *defaults
102+
steps:
103+
- checkout
104+
- attach_workspace:
105+
at: ~/project
106+
- run:
107+
name: 'Run tests'
108+
command: yarn build
30109

31-
- save_cache:
32-
paths:
33-
- node_modules
34-
key: v1-dependencies-{{ checksum "package.json" }}
110+
#------------------------------------------------------------
111+
# Workflows
112+
#------------------------------------------------------------
35113

36-
# run tests!
37-
- run: yarn build && yarn lint && yarn test
114+
workflows:
115+
version: 2
116+
build:
117+
jobs:
118+
- install-dependencies
119+
- lerna-bootstrap: { requires: [install-dependencies] }
120+
- run-linter-check: { requires: [install-dependencies] }
121+
- run-tsc: { requires: [install-dependencies] }
122+
- run-tests: { requires: [run-tsc] }
123+
- build: { requires: [run-tests, run-linter-check, lerna-bootstrap] }

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
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 lerna:bootstrap && yarn tsc",
12+
"lerna:bootstrap": "lerna bootstrap",
1213
"clean": "lerna clean && rm -rf node_modules",
1314
"boot": "node scripts/bootstrap.js",
1415
"remote-version": "node scripts/remote-version.js",
@@ -20,6 +21,7 @@
2021
"show-help": "yarn workspace docs show-help",
2122
"register-vuepress": "lerna exec --scope vuepress -- yarn link",
2223
"lint": "eslint packages --fix --ext .js,.vue",
24+
"lint:check": "eslint packages --ext .js,.vue",
2325
"release": "yarn --pure-lockfile && yarn tsc && node scripts/release.js",
2426
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2",
2527
"test": "node scripts/test.js",

packages/@vuepress/theme-default/components/SidebarLink.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default {
3838
$themeLocaleConfig.sidebarDepth,
3939
$themeConfig.sidebarDepth,
4040
1
41-
].find(depth => depth !== undefined);
41+
].find(depth => depth !== undefined)
4242
4343
const displayAllHeaders = $themeLocaleConfig.displayAllHeaders
4444
|| $themeConfig.displayAllHeaders

0 commit comments

Comments
 (0)