Skip to content

Commit 3c659f9

Browse files
authored
feat: add optional yarn_install_directory parameter (#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
1 parent 567c336 commit 3c659f9

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/commands/yarn_install.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ parameters:
99
description: The path to the yarn cache folder. Defaults to /tmp/yarn
1010
type: string
1111
default: "/tmp/yarn"
12+
yarn_install_directory:
13+
description: The working directory to run install at. Defaults to yarn's current working directory
14+
type: string
15+
default: ""
1216

1317
steps:
1418
- when:
@@ -23,9 +27,20 @@ steps:
2327
- restore_cache:
2428
keys:
2529
- yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}-{{ .Environment.CACHE_VERSION }}
26-
- run:
27-
name: Yarn Install
28-
command: "yarn install --frozen-lockfile --non-interactive --cache-folder <<parameters.cache_folder>>"
30+
- when:
31+
condition:
32+
equal: ["", <<parameters.yarn_install_directory>>]
33+
steps:
34+
- run:
35+
name: Yarn Install
36+
command: "yarn install --frozen-lockfile --non-interactive --cache-folder <<parameters.cache_folder>>"
37+
- unless:
38+
condition:
39+
equal: ["", <<parameters.yarn_install_directory>>]
40+
steps:
41+
- run:
42+
name: Yarn Install (<<parameters.yarn_install_directory>>)
43+
command: "yarn --cwd <<parameters.yarn_install_directory>> install --frozen-lockfile --non-interactive --cache-folder <<parameters.cache_folder>>"
2944
- when:
3045
condition: <<parameters.cache>>
3146
steps:

0 commit comments

Comments
 (0)