Skip to content

Commit

Permalink
fix: skip API if api config is not available
Browse files Browse the repository at this point in the history
Fixes  #1
  • Loading branch information
manekinekko committed Jul 6, 2020
1 parent 5c42f8d commit 39c6dc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const startCommand = [
// Note: the --proxy options allows http-server to work with SPA routing.
`"${httpServerBin} ${app_artifact_location} -p ${appUriPort} -c-1"`,

// serve the api
`"(cd ${api_location}; func start --cors *)"`,
// serve the api, if it's available
`"[ -d '${api_location}' ] && (cd ${api_location}; func start --cors *) || echo 'No API found. Skipping.'"`,
`--color=always`,
];

Expand Down
3 changes: 1 addition & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ module.exports.readConfigFile = () => {
const swaYaml = YAML.parse(githubActionContent);
const swaBuildConfig = swaYaml.jobs.build_and_deploy_job.steps.find((step) => step.uses && step.uses.includes("static-web-apps-deploy"));

// extract the user config and set defaults
// extract the user's config and set defaults
const {
app_build_command = "npm run build --if-present",
api_build_command = "npm run build --if-present",

app_location = "/",
app_artifact_location = "/",
api_location = "api",
Expand Down

0 comments on commit 39c6dc1

Please sign in to comment.