lesgo 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ set -Eeuo pipefail
8
8
  # #
9
9
  ###############################################################################
10
10
 
11
- usage="$(basename "$0") [-f] [-s] [-t] [-h] [-d] [-y] -- script to deploy serverless functions
11
+ usage="$(basename "$0") [-f] [-s] [-t] [-h] [-d] [-c] [-y] -- script to deploy serverless functions
12
12
 
13
13
  where:
14
14
  -t define the type of action to be taken (build, deploy, invoke, logs, destroy)
@@ -17,22 +17,24 @@ where:
17
17
  -h show this help text
18
18
  -l to invoke a local function
19
19
  -d set data parameters for invoke function
20
+ -c set config as per --config path-to-serverless-yml
20
21
  -y no question/prompt for ci/cd"
21
22
 
22
23
  # arg options
23
- BUILD=0; # serverless build without deploy
24
- DEPLOY=0; # serverless deploy
25
- INVOKE=0; # serverless invoke of specific function
26
- LOGS=0; # serverless stream log of specific function
27
- DESTROY=0; # serverless remove entire service
28
- FUNCTION=''; # specify function to involve
29
- STAGE=''; # deploy specific stage/environment
30
- INVOKE_LOCAL=0; # default to non local execution
31
- DATA='' # set the data parameters for invoke function
32
- NO_QUESTION=0; # default to prompt
24
+ BUILD=0; # serverless build without deploy
25
+ DEPLOY=0; # serverless deploy
26
+ INVOKE=0; # serverless invoke of specific function
27
+ LOGS=0; # serverless stream log of specific function
28
+ DESTROY=0; # serverless remove entire service
29
+ FUNCTION=''; # specify function to involve
30
+ STAGE=''; # deploy specific stage/environment
31
+ INVOKE_LOCAL=0; # default to non local execution
32
+ DATA='' # set the data parameters for invoke function
33
+ NO_QUESTION=0; # default to prompt
34
+ CONFIG='./serverless.yml'; # specify serverless config file to deploy, default to root
33
35
 
34
36
  # parse the options
35
- while getopts "lhs:f:t:d:y" OPT ; do
37
+ while getopts "lhs:f:t:d:c:y" OPT ; do
36
38
  case ${OPT} in
37
39
  f) FUNCTION=${OPTARG} ;;
38
40
  s) STAGE=${OPTARG} ;;
@@ -53,6 +55,7 @@ while getopts "lhs:f:t:d:y" OPT ; do
53
55
  fi;;
54
56
  l) INVOKE_LOCAL=1 ;;
55
57
  d) DATA=${OPTARG} ;;
58
+ c) CONFIG=${OPTARG} ;;
56
59
  y) NO_QUESTION=1 ;;
57
60
  h)
58
61
  echo "${usage}"
@@ -102,8 +105,8 @@ function deploy_func_check ()
102
105
 
103
106
  function deploy_func ()
104
107
  {
105
- echo -e "${YELLOW}Deploying ${FUNCTION} to ${STAGE}${NC}"
106
- sls deploy -f ${FUNCTION} --stage ${STAGE} --env ${ENVFILE}
108
+ echo -e "${YELLOW}Deploying ${FUNCTION} to ${STAGE}${NC} using ${CONFIG}"
109
+ sls deploy -f ${FUNCTION} --stage ${STAGE} --env ${ENVFILE} --config ${CONFIG}
107
110
  }
108
111
 
109
112
  function prompt_confirmation_deploy_all ()
@@ -112,7 +115,7 @@ function prompt_confirmation_deploy_all ()
112
115
  deploy_full;
113
116
  else
114
117
  while true; do
115
- read -p "Confirm deploy service to ${STAGE} with .env.${ENVFILE}? [Y|N] " yn
118
+ read -p "Confirm deploy service to ${STAGE} with .env.${ENVFILE} using ${CONFIG}? [Y|N] " yn
116
119
  case ${yn} in
117
120
  [Yy] | yes | Yes | YES ) deploy_full; break;;
118
121
  [Nn] | no | No | NO ) echo -e "${YELLOW}Cancelled deploying service to [${STAGE}]${NC}"; exit;;
@@ -125,7 +128,7 @@ function prompt_confirmation_deploy_all ()
125
128
  function prompt_confirmation_deploy_function ()
126
129
  {
127
130
  while true; do
128
- read -p "Confirm deploy function ${FUNCTION} to ${STAGE} with .env.${ENVFILE}? [Y|N] " yn
131
+ read -p "Confirm deploy function ${FUNCTION} to ${STAGE} with .env.${ENVFILE} using ${CONFIG}? [Y|N] " yn
129
132
  case ${yn} in
130
133
  [Yy] | yes | Yes | YES ) deploy_func; break;;
131
134
  [Nn] | no | No | NO ) echo -e "${YELLOW}Cancelled deploying function ${FUNCTION} to [${STAGE}]${NC}"; exit;;
@@ -137,35 +140,35 @@ function prompt_confirmation_deploy_function ()
137
140
  function deploy_full ()
138
141
  {
139
142
  echo -e "${YELLOW}Deploying service to ${STAGE}${NC}"
140
- sls deploy --stage ${STAGE} --env ${ENVFILE}
143
+ sls deploy --stage ${STAGE} --env ${ENVFILE} --config ${CONFIG}
141
144
  }
142
145
 
143
146
  function invoke_func ()
144
147
  {
145
- echo -e "${YELLOW}Invoking function ${FUNCTION} on ${STAGE}${NC}"
148
+ echo -e "${YELLOW}Invoking function ${FUNCTION} on ${STAGE}${NC} using ${CONFIG}"
146
149
  if [ ${INVOKE_LOCAL} == 1 ]; then
147
- sls invoke local -f ${FUNCTION} --stage ${STAGE} --env ${ENVFILE} -d ${DATA} -l
150
+ sls invoke local -f ${FUNCTION} --stage ${STAGE} --env ${ENVFILE} -d ${DATA} -l --config ${CONFIG}
148
151
  else
149
- sls invoke -f ${FUNCTION} --stage ${STAGE} --env ${ENVFILE} -d ${DATA} -l
152
+ sls invoke -f ${FUNCTION} --stage ${STAGE} --env ${ENVFILE} -d ${DATA} -l --config ${CONFIG}
150
153
  fi
151
154
  }
152
155
 
153
156
  function log_stream_func ()
154
157
  {
155
- echo -e "${YELLOW}Log Streaming function ${FUNCTION} on ${STAGE}${NC}"
156
- sls logs -f ${FUNCTION} --stage ${STAGE} --env ${ENVFILE} -t
158
+ echo -e "${YELLOW}Log Streaming function ${FUNCTION} on ${STAGE}${NC} using ${CONFIG}"
159
+ sls logs -f ${FUNCTION} --stage ${STAGE} --env ${ENVFILE} -t --config ${CONFIG}
157
160
  }
158
161
 
159
162
  function build ()
160
163
  {
161
- echo -e "${YELLOW}Building bundle without deployment${NC}"
162
- sls webpack --stage ${STAGE} --env ${ENVFILE}
164
+ echo -e "${YELLOW}Building bundle without deployment${NC} using ${CONFIG}"
165
+ sls webpack --stage ${STAGE} --env ${ENVFILE} --config ${CONFIG}
163
166
  }
164
167
 
165
168
  function prompt_confirmation_destroy_service ()
166
169
  {
167
170
  while true; do
168
- read -p "Confirm destroy service to ${STAGE} with .env.${ENVFILE}? Note: This action will remove entire service from AWS. Ensure no other applications are using this service. [Y|N] " yn
171
+ read -p "Confirm destroy service to ${STAGE} with .env.${ENVFILE} using ${CONFIG}? Note: This action will remove entire service from AWS. Ensure no other applications are using this service. [Y|N] " yn
169
172
  case ${yn} in
170
173
  [Yy] | yes | Yes | YES ) destroy_service; break;;
171
174
  [Nn] | no | No | NO ) echo -e "${YELLOW}Cancelled destroying service to [${STAGE}]${NC}"; exit;;
@@ -177,7 +180,7 @@ function prompt_confirmation_destroy_service ()
177
180
  function destroy_service ()
178
181
  {
179
182
  echo -e "${YELLOW}Removing service to ${STAGE}${NC}"
180
- sls remove --stage ${STAGE} --env ${ENVFILE}
183
+ sls remove --stage ${STAGE} --env ${ENVFILE} --config ${CONFIG}
181
184
  }
182
185
 
183
186
  ###############################################################################
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lesgo",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Core framework for lesgo node.js serverless framework.",
5
5
  "main": "./src/index.js",
6
6
  "author": "Sufiyan Rahmat",