Skip to content

Commit

Permalink
feat: add optional yarn_install_directory parameter (react-native-com…
Browse files Browse the repository at this point in the history
…munity#124)

* yarn_install - add optional yarn_install_directory parameter

* Fix spelling and add default

* Only use --cwd if yarn_install_directory is not empty string
  • Loading branch information
joshdholtz authored Jan 4, 2022
1 parent 567c336 commit 3c659f9
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/commands/yarn_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ parameters:
description: The path to the yarn cache folder. Defaults to /tmp/yarn
type: string
default: "/tmp/yarn"
yarn_install_directory:
description: The working directory to run install at. Defaults to yarn's current working directory
type: string
default: ""

steps:
- when:
Expand All @@ -23,9 +27,20 @@ steps:
- restore_cache:
keys:
- yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}-{{ .Environment.CACHE_VERSION }}
- run:
name: Yarn Install
command: "yarn install --frozen-lockfile --non-interactive --cache-folder <<parameters.cache_folder>>"
- when:
condition:
equal: ["", <<parameters.yarn_install_directory>>]
steps:
- run:
name: Yarn Install
command: "yarn install --frozen-lockfile --non-interactive --cache-folder <<parameters.cache_folder>>"
- unless:
condition:
equal: ["", <<parameters.yarn_install_directory>>]
steps:
- run:
name: Yarn Install (<<parameters.yarn_install_directory>>)
command: "yarn --cwd <<parameters.yarn_install_directory>> install --frozen-lockfile --non-interactive --cache-folder <<parameters.cache_folder>>"
- when:
condition: <<parameters.cache>>
steps:
Expand Down

0 comments on commit 3c659f9

Please sign in to comment.