Skip to content

Commit

Permalink
feat: #1218 check server exist before start
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuong Vu committed May 21, 2020
1 parent c3d6114 commit 23835f5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/web-components/scripts/start-dev.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env node
const fs = require('fs')

const getMoveHtmlScript = packageName => {
switch (packageName) {
case 'property-detail':
Expand Down Expand Up @@ -38,8 +40,12 @@ return (() => {
}
// eslint-disable-next-line max-len
const clientScript = `rollup -w -c './scripts/rollup.config.${packageName}.js' --environment APP_ENV:local`
const serverConfigFile = `src/${packageName}/server/serverless.yml`
const hasServer = fs.existsSync(serverConfigFile)
// eslint-disable-next-line max-len
const serverScript = `serverless offline --config src/${packageName}/server/serverless.yml --out public/dist --stage local`
const serverScript = hasServer
? `serverless offline --config ${serverConfigFile} --out public/dist --stage local`
: null
const startClientServer = getStartClientServer(packageName)

const startDev = `
Expand Down

0 comments on commit 23835f5

Please sign in to comment.