File tree 3 files changed +53
-11
lines changed
3 files changed +53
-11
lines changed Original file line number Diff line number Diff line change 60
60
key : js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
61
61
62
62
- name : Install node_modules
63
- run : yarn install
64
- working-directory : site
63
+ run : ./scripts/yarn_install.sh
65
64
66
65
- name : " yarn lint"
67
66
run : yarn lint
@@ -108,8 +107,7 @@ jobs:
108
107
key : js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
109
108
110
109
- name : Install node_modules
111
- run : yarn install
112
- working-directory : site
110
+ run : ./scripts/yarn_install.sh
113
111
114
112
- name : " make fmt"
115
113
run : " make --output-sync -j fmt"
@@ -214,8 +212,8 @@ jobs:
214
212
with :
215
213
node-version : " 14"
216
214
217
- - run : yarn install
218
- working-directory : site
215
+ - name : Install node_modules
216
+ run : ./scripts/yarn_install.sh
219
217
220
218
- uses : actions/setup-go@v2
221
219
with :
@@ -252,13 +250,15 @@ jobs:
252
250
with :
253
251
node-version : " 14"
254
252
255
- - run : yarn install
256
- working-directory : site
253
+ - name : Install node_modules
254
+ run : ./scripts/yarn_install.sh
257
255
258
- - run : yarn build
256
+ - name : Build frontend
257
+ run : yarn build
259
258
working-directory : site
260
259
261
- - run : yarn storybook:build
260
+ - name : Build Storybook
261
+ run : yarn storybook:build
262
262
working-directory : site
263
263
264
264
- run : yarn test:coverage
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ function create_initial_user() {
22
22
}
23
23
24
24
# Run yarn install, to make sure node_modules are ready to go
25
- yarn --cwd=./site install
25
+ " $PROJECT_ROOT /scripts/yarn_install.sh "
26
26
27
27
# Do initial build - a dev build for coderd.
28
28
# It's OK that we don't build the front-end before - because the front-end
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # Run "yarn install" with flags appropriate to the environment
4
+ # (local development vs build system)
5
+ #
6
+ # Usage: yarn_install.sh [optional extra flags]
7
+
8
+ set -euo pipefail
9
+
10
+ PROJECT_ROOT=$( git rev-parse --show-toplevel)
11
+ cd " $PROJECT_ROOT /site"
12
+
13
+ yarn_flags=(
14
+ # Do not execute install scripts
15
+ # TODO: check if build works properly with this enabled
16
+ # --ignore-scripts
17
+
18
+ # Check if existing node_modules are valid
19
+ # TODO: determine if this is necessary
20
+ # --check-files
21
+
22
+ # Do not install optional dependencies
23
+ --ignore-optional
24
+ )
25
+
26
+ if [ -n " ${CI:- } " ]; then
27
+ yarn_flags+=(
28
+ # Install dependencies from lockfile, ensuring builds are fully
29
+ # reproducible
30
+ --frozen-lockfile
31
+ # Suppress progress information
32
+ --silent
33
+ # Disable interactive prompts for build
34
+ --non-interactive
35
+ )
36
+ fi
37
+
38
+ # Append whatever is specified on the command line
39
+ yarn_flags+=(" $@ " )
40
+
41
+ echo " + yarn install ${yarn_flags[*]} "
42
+ yarn install " ${yarn_flags[@]} "
You can’t perform that action at this time.
0 commit comments