Skip to content

Commit

Permalink
fix: #1218 fix service name not valid (#1307)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuong Vu authored May 22, 2020
1 parent a7122b9 commit 51c4ccd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"typescript": "~3.7.2"
},
"scripts": {
"build:prod": "node ./scripts/build-prod.js",
"build:prod": "node ./scripts/build-prod.js --stage dev",
"start:server": "serverless offline --out public/dist --stage local",
"start:dev": "node ./scripts/start-dev.js",
"test:dev": "cross-env TZ=UTC jest --watch --color",
Expand All @@ -62,7 +62,7 @@
"lint:fix": "eslint --cache --ext=ts,tsx,js,svelte src --fix",
"fetch-config": "yarn config-manager fetchConfig web-components",
"build:serverless": "node ./scripts/build-serverless.js",
"release:server:dev": "node ./scripts/release-serverless.js",
"release:server:dev": "node ./scripts/release-serverless.js --stage dev",
"release:server:prod": "node ../../scripts/release/release-serverless.js web-components",
"release:npm:prod": "node ../../scripts/release/release-npm.js web-components --skip-edit-release-note",
"release:client:dev": "node ../../scripts/release/release-dev.js web-components reapit-web-components",
Expand Down
10 changes: 8 additions & 2 deletions packages/web-components/scripts/start-dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')

const getMoveHtmlScript = packageName => {
switch (packageName) {
Expand Down Expand Up @@ -43,9 +44,14 @@ return (() => {
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
// need to pass the apiKey into serverless offline for it to work locally
const { WEB_COMPONENT_API_KEY_SEARCH_WIDGET } = require(path.resolve(__dirname, '../config.json'))
const apiKeys = {
'search-widget': WEB_COMPONENT_API_KEY_SEARCH_WIDGET,
}
const serverScript = hasServer
? `serverless offline --config ${serverConfigFile} --out public/dist --stage local`
? // eslint-disable-next-line max-len
`serverless offline --config ${serverConfigFile} --out public/dist --stage local --apiKey ${apiKeys[packageName]}`
: null
const startClientServer = getStartClientServer(packageName)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service: web-components.search-widget
service: web-components-search-widget
plugins:
- serverless-webpack
- serverless-offline
Expand Down Expand Up @@ -33,7 +33,7 @@ provider:
restApiId: ${self:custom.env.GATEWAY_REST_API_ID}
restApiRootResourceId: ${self:custom.env.GATEWAY_REST_API_ROOT_RESOURCE_ID}
deploymentBucket:
name: web-components.search-widget.${self:provider.stage}
name: web-components-search-widget-${self:provider.stage}
blockPublicAccess: false
environment:
NODE_ENV: ${self:custom.env.NODE_ENV}
Expand Down

0 comments on commit 51c4ccd

Please sign in to comment.