Use yarn instead of npm on CircleCI

This commit is contained in:
Acid Chicken (硫酸鶏) 2019-01-27 20:13:06 +09:00 committed by GitHub
parent 1c37ed589b
commit 75c95225eb

View File

@ -29,18 +29,14 @@ jobs:
executor: default executor: default
steps: steps:
- checkout - checkout
- run:
name: Ensure package-lock.json
command: |
[ ! -e package-lock.json ] && echo '{}' > package-lock.json
- restore_cache: - restore_cache:
name: Restore npm package caches name: Restore npm package caches
keys: keys:
- npm-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "package-lock.json" }}- - yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
- npm-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}- - yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-
- npm-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}- - yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-
- npm-v1-arch-{{ arch }}- - yarn-v1-arch-{{ arch }}-
- npm-v1- - yarn-v1-
- run: - run:
name: Install Dependencies name: Install Dependencies
command: | command: |
@ -54,13 +50,13 @@ jobs:
- run: - run:
name: Build name: Build
command: | command: |
node-gyp configure yarn install
node-gyp build yarn autoclean
npm run build || (echo -e '\033[0;34mRebuild modules\033[0;39m' && ls -1A node_modules | grep '^[^@]' | xargs npm rebuild && ls -1A node_modules | grep '^@' | xargs -I%1 sh -c 'ls -1A node_modules/'%1' | xargs -P0 -I%2 npm rebuild node_modules/'%1'/%2' && npm run build) yarn build
ls -1ARl node_modules > ls [ ! -e yarn.lock ] && touch yarn.lock
- save_cache: - save_cache:
name: Cache npm packages name: Cache npm packages
key: npm-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "package-lock.json" }}-ls-{{ checksum "ls" }} key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
paths: paths:
- node_modules - node_modules
# - store_artifacts: # - store_artifacts:
@ -90,11 +86,11 @@ jobs:
- run: - run:
name: Test name: Test
command: | command: |
npm run test yarn test
ls -1ARl node_modules > ls [ ! -e yarn.lock ] && touch yarn.lock
- save_cache: - save_cache:
name: Cache npm packages name: Cache npm packages
key: npm-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "package-lock.json" }}-ls-{{ checksum "ls" }} key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
paths: paths:
- node_modules - node_modules