Skip to content

Commit

Permalink
feat:#1218 tweak serverless.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuong Vu committed May 20, 2020
1 parent 5f3ef2e commit 5d9ddbe
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"build:serverless": "serverless webpack --out dist --stage dev",
"release:server:dev": "serverless deploy --stage dev",
"release:server:prod": "node ../../scripts/release/release-serverless.js web-components",
"release:npm:prod": "node ../../scripts/release/release-npm.js elements --skip-edit-release-note",
"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",
"release:client:prod": "node ../../scripts/release/release-prod.js web-components reapit-web-components",
"release:dev": "yarn release:server:dev && yarn release:client:dev",
Expand Down
8 changes: 8 additions & 0 deletions packages/web-components/scripts/release-serverless.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const path = require('path')
const yargs = require('yargs')

const stage = yargs.argv.stage

const listServerlessYmlFiles = [path.resolve(__dirname, '../src/search-widget/server/serverless.yml')]

const deployServerless = async () => {}
7 changes: 1 addition & 6 deletions packages/web-components/scripts/rollup.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ export default {
babel({
extensions: ['.js', '.ts', '.mjs', '.html', '.svelte'],
runtimeHelpers: true,
exclude: [
'node_modules/@babel/**',
'../node_modules/@babel/**',
'node_modules/core-js/**',
'../node_modules/core-js/**',
],
include: ['src/**', 'node_modules/svelte/**'],
presets: [
[
'@babel/preset-env',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AppointmentBooking from '../planner-step2.svelte'
import AppointmentBooking from '../appointment-planner.svelte'
import '@testing-library/jest-dom/extend-expect'
import { render } from '@testing-library/svelte'
import MockDate from 'mockdate'
Expand Down
105 changes: 105 additions & 0 deletions packages/web-components/src/search-widget/server/serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
service: web-components
plugins:
- serverless-webpack
- serverless-offline
- serverless-plugin-ifelse

custom:
env: ${file(../../../config.json)}
webpack:
webpackConfig: 'webpack.config.js'
includeModules: true
packager: 'yarn'
packagerOptions:
noFrozenLockFile: false
excludeFiles: src/**/*.test.ts
keepOutputDirectory: true
allowedHeaders:
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
- X-Amz-User-Agent
- reapit-customer

provider:
name: aws
runtime: nodejs10.x
stage: ${opt:stage, 'dev'}
region: eu-west-2
apiGateway:
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}
blockPublicAccess: false
environment:
NODE_ENV: ${self:custom.env.NODE_ENV}
APP_ENV: ${self:custom.env.APP_ENV}
PLATFORM_API_BASE_URL: ${self:custom.env.PLATFORM_API_BASE_URL}
COGNITO_CLIENT_SECRET_SEARCH_WIDGET: ${self:custom.env.COGNITO_CLIENT_SECRET_SEARCH_WIDGET}
COGNITO_CLIENT_ID_SEARCH_WIDGET: ${self:custom.env.COGNITO_CLIENT_ID_SEARCH_WIDGET}
COGNITO_OAUTH_URL: ${self:custom.env.COGNITO_OAUTH_URL}
package:
individually: true
include:
- dist/**
exclude:
- package.json
- node_modules/**
- error.log
- info.log
- jest.config.js
- serverless.yml
- src/**
- tsconfig.json
- yml-helpers.js
- public/**

functions:
searchWidgetHandler:
handler: src/search-widget/server/core/index.searchWidgetHandler
events:
- http:
path: properties
method: get
cors:
origin: '*'
headers: ${self:custom.allowedHeaders}
allowCredentials: false
private: true
request:
parameters:
headers:
api-version: false
Authorization: false
reapit-customer: false
- http:
path: properties/{id}
method: get
cors:
origin: '*'
headers: ${self:custom.allowedHeaders}
allowCredentials: false
private: true
request:
parameters:
headers:
api-version: false
Authorization: false
reapit-customer: false
- http:
path: propertyImages
method: get
cors:
origin: '*'
headers: ${self:custom.allowedHeaders}
allowCredentials: false
private: true
request:
parameters:
headers:
api-version: false
Authorization: false
reapit-customer: false

0 comments on commit 5d9ddbe

Please sign in to comment.