From a01f0a49d422b7d687a8ee32b5ce623a21e6c23c Mon Sep 17 00:00:00 2001 From: Franck Date: Thu, 8 Aug 2019 20:57:18 +0200 Subject: [PATCH 1/6] Improve CI process --- .circleci/config.yml | 134 ++++++++++++++---- package.json | 4 +- .../theme-default/components/SidebarLink.vue | 2 +- 3 files changed, 114 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d2cebd28cf..b848bbce5e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,36 +2,122 @@ # # Check https://circleci.com/docs/2.0/language-javascript/ for more details # -version: 2 +version: 2.1 + +defaults: &defaults + working_directory: ~/project + docker: + - image: circleci/node:latest + jobs: - build: - docker: - # specify the version you desire here - - image: circleci/node:10.15.2 - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/mongo:3.4.4 + #------------------------------------------------------------ + # 1. Install dependencies + #------------------------------------------------------------ + + install-dependencies: + <<: *defaults + steps: + - checkout + + - restore_cache: + keys: + - v1-deps-{{ checksum "yarn.lock" }} + - v1-deps + + - run: + name: 'Install dependencies' + command: yarn --frozen-lockfile --non-interactive + + - save_cache: + key: v1-deps-{{ checksum "yarn.lock" }} + paths: + - ~/.cache/yarn + + - persist_to_workspace: + root: ~/project + paths: + - node_modules + - packages/*/node_modules + - packages/@vuepress/*/node_modules + + #------------------------------------------------------------ + # 2. Run parallel jobs: + # => lerna-boostrap + # => tsc + # => tests + # => linter + #------------------------------------------------------------ - working_directory: ~/repo + lerna-bootstrap: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: ~/project + - run: + name: 'Lerna bootstrap' + command: yarn lerna:bootstrap + + run-tsc: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: ~/project + - run: + name: 'Run tsc' + command: yarn tsc + - persist_to_workspace: + root: ~/project + paths: + - packages/@vuepress/shared-utils/lib + + run-tests: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: ~/project + - run: + name: 'Run tests' + command: yarn test + run-linter-check: + <<: *defaults steps: - - checkout + - checkout + - attach_workspace: + at: ~/project + - run: + name: 'Run linter' + command: yarn lint:check - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- + #------------------------------------------------------------ + # 3. Build VuePress + #------------------------------------------------------------ - - run: yarn bootstrap + build: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: ~/project + - run: + name: 'Run tests' + command: yarn build - - save_cache: - paths: - - node_modules - key: v1-dependencies-{{ checksum "package.json" }} +#------------------------------------------------------------ +# Workflows +#------------------------------------------------------------ - # run tests! - - run: yarn build && yarn lint && yarn test +workflows: + version: 2 + build: + jobs: + - install-dependencies + - lerna-bootstrap: { requires: [install-dependencies] } + - run-linter-check: { requires: [install-dependencies] } + - run-tsc: { requires: [install-dependencies] } + - run-tests: { requires: [run-tsc] } + - build: { requires: [run-tests, run-linter-check, lerna-bootstrap] } diff --git a/package.json b/package.json index c744682496..66d9895452 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "description": "Minimalistic doc generator with Vue component based layout system", "scripts": { "precommit": "lint-staged", - "bootstrap": "yarn && lerna bootstrap && yarn tsc", + "bootstrap": "yarn && yarn lerna:bootstrap && yarn tsc", + "lerna:bootstrap": "lerna bootstrap", "clean": "lerna clean && rm -rf node_modules", "boot": "node scripts/bootstrap.js", "remote-version": "node scripts/remote-version.js", @@ -20,6 +21,7 @@ "show-help": "yarn workspace docs show-help", "register-vuepress": "lerna exec --scope vuepress -- yarn link", "lint": "eslint packages --fix --ext .js,.vue", + "lint:check": "eslint packages --ext .js,.vue", "release": "yarn --pure-lockfile && yarn tsc && node scripts/release.js", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2", "test": "node scripts/test.js", diff --git a/packages/@vuepress/theme-default/components/SidebarLink.vue b/packages/@vuepress/theme-default/components/SidebarLink.vue index bc5de287d8..5183aa6f2e 100644 --- a/packages/@vuepress/theme-default/components/SidebarLink.vue +++ b/packages/@vuepress/theme-default/components/SidebarLink.vue @@ -38,7 +38,7 @@ export default { $themeLocaleConfig.sidebarDepth, $themeConfig.sidebarDepth, 1 - ].find(depth => depth !== undefined); + ].find(depth => depth !== undefined) const displayAllHeaders = $themeLocaleConfig.displayAllHeaders || $themeConfig.displayAllHeaders From 123839b9c419231cdbb4d64e3e28918620e87687 Mon Sep 17 00:00:00 2001 From: Franck Abgrall Date: Sun, 11 Aug 2019 19:36:46 +0200 Subject: [PATCH 2/6] Update package.json Co-Authored-By: Sarah Dayan --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66d9895452..fcc3061ee9 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "view-info": "yarn tsc && yarn workspace docs view-info", "show-help": "yarn workspace docs show-help", "register-vuepress": "lerna exec --scope vuepress -- yarn link", - "lint": "eslint packages --fix --ext .js,.vue", + "lint": "yarn lint:check --fix", "lint:check": "eslint packages --ext .js,.vue", "release": "yarn --pure-lockfile && yarn tsc && node scripts/release.js", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2", From 919d490f4955078640aee7f019c9e9c59eb180f9 Mon Sep 17 00:00:00 2001 From: Franck Date: Sun, 11 Aug 2019 19:45:42 +0200 Subject: [PATCH 3/6] Add md linter check to CI workflow --- .circleci/config.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b848bbce5e..8f53ea0579 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,6 +47,7 @@ jobs: # => tsc # => tests # => linter + # => docs linter #------------------------------------------------------------ lerna-bootstrap: @@ -92,6 +93,16 @@ jobs: - run: name: 'Run linter' command: yarn lint:check + + run-docs-linter-check: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: ~/project + - run: + name: 'Run md linter' + command: yarn workspace docs lint-md #------------------------------------------------------------ # 3. Build VuePress @@ -118,6 +129,7 @@ workflows: - install-dependencies - lerna-bootstrap: { requires: [install-dependencies] } - run-linter-check: { requires: [install-dependencies] } + - run-docs-linter-check: { requires: [install-dependencies] } - run-tsc: { requires: [install-dependencies] } - run-tests: { requires: [run-tsc] } - - build: { requires: [run-tests, run-linter-check, lerna-bootstrap] } + - build: { requires: [run-tests, run-linter-check, run-docs-linter-check, lerna-bootstrap] } From 9b16c68366efb7f14149d3dde7db051ca382bbad Mon Sep 17 00:00:00 2001 From: Franck Date: Sun, 11 Aug 2019 19:58:36 +0200 Subject: [PATCH 4/6] Fix yaml indentation --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f53ea0579..284ae01871 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,9 +101,9 @@ jobs: - attach_workspace: at: ~/project - run: - name: 'Run md linter' - command: yarn workspace docs lint-md - + name: 'Run md linter' + command: yarn workspace docs lint-md + #------------------------------------------------------------ # 3. Build VuePress #------------------------------------------------------------ From c828ac249aeea678c9a9f84c07f707d80fbba638 Mon Sep 17 00:00:00 2001 From: Franck Date: Sat, 7 Sep 2019 13:44:33 +0200 Subject: [PATCH 5/6] fix(): Fix md linter errors on local-development.md --- .../docs/miscellaneous/local-development.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/docs/docs/miscellaneous/local-development.md b/packages/docs/docs/miscellaneous/local-development.md index 2b3d01ca3d..61579ed54a 100644 --- a/packages/docs/docs/miscellaneous/local-development.md +++ b/packages/docs/docs/miscellaneous/local-development.md @@ -6,9 +6,9 @@ sidebar: auto ## Informations -If you here youh may be intereset of improve core vuepress. +If you here youh may be intereset of improve core VuePress. -Vuepress is using a combo with [Yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) and [Lerna](https://github.com/lerna/lerna). +VuePress is using a combo with [Yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) and [Lerna](https://github.com/lerna/lerna). ## Init packages @@ -16,11 +16,11 @@ Vuepress is using a combo with [Yarn workspaces](https://yarnpkg.com/lang/en/doc yarn bootstrap // it will run and install into the root all packages subfolders ``` -yarn bootstrap will use hoisting. What it mean for you ? +`yarn bootstrap` will use hoisting. What does it mean for you ? It will regroup all dependencies in the workspace root and link all packages. -to check the link you can run +Check the link by running the following command: ```bash ls -la node_modules/@vuepress @@ -45,7 +45,7 @@ run `yarn tsc` all the time or run in separate shell `yarn run tsc -w`. This wil ## Link -Good from here you have everything ready. You need to link vuepress to your project. +Good from here you have everything ready. You need to link VuePress to your project. ```bash yarn register-vuepress @@ -53,9 +53,9 @@ yarn register-vuepress You will have something like this: `success Registered "vuepress".` -It will link the package vuepress from packages/vuepress. So you will have access to vuepress cli and vuepress packages. +It will link the package VuePress from `packages/vuepress`. You will have access to VuePress cli and packages. -they are decalre in the `packages/vuepress/package.json` +They are declared in the `packages/vuepress/package.json` ```js { @@ -87,10 +87,10 @@ If everything work properly you should have an error telling you there is no pac ## BUGS / QA You will maybe find some difficulty with link. If you encounter something like `There's already a package called "vuepress" registered`. -You have already vuepress registered. so: +You already have VuePress registered: -- 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 -- 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. +- 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 +- If you didn't do anything. You already have VuePress linked somewhere. What you have to do is deleting folder where you ran `yarn link` or `yarn unlink`. ## More From abd0d6c6d390c3203784672061ff0aaa229f9f53 Mon Sep 17 00:00:00 2001 From: Franck Date: Sat, 7 Sep 2019 13:50:50 +0200 Subject: [PATCH 6/6] fix(): Fix md linter errors on local-development.md --- packages/docs/docs/miscellaneous/local-development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/docs/miscellaneous/local-development.md b/packages/docs/docs/miscellaneous/local-development.md index 61579ed54a..2c97350aae 100644 --- a/packages/docs/docs/miscellaneous/local-development.md +++ b/packages/docs/docs/miscellaneous/local-development.md @@ -90,7 +90,7 @@ You will maybe find some difficulty with link. If you encounter something like ` You already have VuePress registered: - 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 -- If you didn't do anything. You already have VuePress linked somewhere. What you have to do is deleting folder where you ran `yarn link` or `yarn unlink`. +- If you didn’t do anything. You already have VuePress linked somewhere. What you have to do is deleting folder where you ran `yarn link` or `yarn unlink`. ## More