File tree Expand file tree Collapse file tree
with-package-with-framework
with-package-without-framework Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
22
3- COPY convert .npmrc /converter/
3+ COPY convert install-function-dependencies .npmrc /converter/
44
55COPY without-package /converter/without-package
66COPY with-package-without-framework /converter/with-package-without-framework
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ if [[ ! -f functions/package.json ]]; then
1818 echo ' Handling functions without package.json'
1919 cp /converter/without-package/package.json .
2020 cp /converter/without-package/package-lock.json .
21+ cp /converter/install-function-dependencies .
2122 ln -s node_modules/.bin/functions-framework start-functions-framework
2223elif ! cat functions/package.json | jq -e " .dependencies.\" @google-cloud/functions-framework\" " ; then
2324 echo ' Handling functions with package.json without dependency on @google-cloud/functions-framework'
2425 cp /converter/with-package-without-framework/package.json .
2526 cp /converter/with-package-without-framework/package-lock.json .
27+ cp /converter/install-function-dependencies .
2628 ln -s node_modules/.bin/functions-framework start-functions-framework
2729else
2830 echo ' Handling functions with package.json with dependency on functions-framework'
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Installs dependencies specified by the function.
4+
5+ set -euo pipefail
6+
7+ echo ' Installing function dependencies'
8+
9+ if [[ -f functions/yarn.lock ]]; then
10+ echo ' Found yarn.lock; using yarn'
11+ yarn install --cwd functions
12+ else
13+ npm install --prefix functions
14+ fi
15+
16+ echo ' Installing function dependencies done'
Original file line number Diff line number Diff line change 11{
22 "scripts" : {
3- "preinstall" : " npm --prefix functions install " ,
3+ "preinstall" : " ./install-function-dependencies " ,
44 "start" : " cd functions && node_modules/.bin/functions-framework"
55 }
66}
Original file line number Diff line number Diff line change 33 "@google-cloud/functions-framework" : " ^1.0.0"
44 },
55 "scripts" : {
6- "preinstall" : " npm --prefix functions install " ,
6+ "preinstall" : " ./install-function-dependencies " ,
77 "start" : " cd functions && functions-framework"
88 }
99}
You can’t perform that action at this time.
0 commit comments