Skip to content

Commit

Permalink
ci: enable caching of node_modules in builds (#177)
Browse files Browse the repository at this point in the history
* ci: enable caching of node_modules in builds

* chore: upgrade dependencies
  • Loading branch information
ifiokjr committed Nov 21, 2019
1 parent b633ede commit 9c262e1
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 79 deletions.
20 changes: 10 additions & 10 deletions @remirror/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
"jsesc": "^2.5.2",
"parcel-bundler": "^1.12.4",
"react": "^16.8.0",
"react-use": "13.8.0",
"react-use": "^13.8.0",
"rimraf": "^3.0.0",
"yargs": "^15.0.1"
},
"devDependencies": {
"@testing-library/react-hooks": "3.2.1",
"@types/ink-testing-library": "1.0.1",
"@types/jsesc": "0.4.29",
"@types/parcel-bundler": "1.12.1",
"@types/rimraf": "2.0.3",
"@types/yargs": "13.0.3",
"delay": "4.3.0",
"ink-testing-library": "1.0.2",
"lolex": "5.1.1"
"@testing-library/react-hooks": "^3.2.1",
"@types/ink-testing-library": "^1.0.1",
"@types/jsesc": "^0.4.29",
"@types/parcel-bundler": "^1.12.1",
"@types/rimraf": "^2.0.3",
"@types/yargs": "^13.0.3",
"delay": "^4.3.0",
"ink-testing-library": "^1.0.2",
"lolex": "^5.1.1"
},
"engines": {
"node": ">=8"
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"checks:publish": "run-s checks build test:e2e:ssr",
"ci": "yarn clean:all && yarn",
"clean": "yarn if-clean git clean -fdx --exclude=.config.json --exclude=node_modules --exclude=**/node_modules",
"clean:all": "git clean -fdX --exclude=.config.json",
"clean:all": "git clean -fdX --exclude=.config.json --exclude=.yarn",
"clean:modules": "git clean -fdX @remirror support docs e2e packages",
"dev": "run-p dev:ts dev:rollup",
"dev:rollup": "yarn build:rollup --watch",
Expand Down Expand Up @@ -50,6 +50,7 @@
"lint": "run-s lint:*",
"lint:es": "eslint -f friendly --ext=.tsx,.ts,.js .",
"lint:prettier": "prettier --check \"**/*.{json,yml,yaml,md,mdx}\" \"!docs/api/**\" \"!support/api/**\" \"!**/temp/**\" \"!docs/pages/index.mdx\"",
"md": "node support/scripts/md.js",
"patch": "patch-package --patch-dir support/patches",
"publish:canary": "yarn if-clean run-s is-logged-in checks:publish lerna:publish:canary",
"publish:minor": "yarn if-clean run-s is-logged-in checks:publish lerna:publish:minor",
Expand Down Expand Up @@ -142,7 +143,7 @@
"jest-enzyme": "7.1.2",
"jest-extended": "0.11.2",
"jest-watch-typeahead": "0.4.2",
"lerna": "3.18.5",
"lerna": "3.19.0",
"lint-staged": "9.4.3",
"npm-run-all": "4.1.5",
"patch-package": "^6.2.0",
Expand All @@ -155,7 +156,7 @@
"react-test-renderer": "16.12.0",
"release": "6.1.0",
"rimraf": "3.0.0",
"rollup": "1.27.0",
"rollup": "1.27.3",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-babel": "4.3.3",
"rollup-plugin-commonjs": "10.1.0",
Expand Down
2 changes: 2 additions & 0 deletions support/azure/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
variables:
ci: 'true'
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn

jobs:
- template: pipeline-jobs.yml
Expand All @@ -26,6 +27,7 @@ schedules:
trigger:
- master
- canary
- ci/*

# The branches which cause a PR to trigger a new build
pr:
Expand Down
15 changes: 9 additions & 6 deletions support/azure/pipeline-yarn-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ steps:
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
# - task: CacheBeta@1
# inputs:
# key: yarn | $(Agent.OS) | yarn.lock
# path: $(Pipeline.Workspace)/.yarn
# displayName: Cache Yarn packages
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: $(YARN_CACHE_FOLDER)
displayName: Cache Yarn packages
- bash: yarn audit
displayName: 'Check for vulnerabilities'
- bash: yarn ci
- bash: yarn --pure-lockfile
displayName: 'Install dependencies'
23 changes: 23 additions & 0 deletions support/scripts/md.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { mkdirSync, statSync } = require('fs');

const [, , arg] = process.argv;

if (!arg) {
console.error('Please provide a directory name to create.');
process.exit(1);
}

const directory = arg;

const directoryExists = path => {
try {
return statSync(path).isDirectory;
} catch {
return false;
}
};

if (!directoryExists(directory)) {
console.log(`Creating directory for caching: ${directory}`);
mkdirSync(directory);
}

0 comments on commit 9c262e1

Please sign in to comment.