Skip to content

Commit 37fd907

Browse files
author
uid10804
committed
fix(template): update template dependencies and config settings to have a working sls setup
1 parent c9a9007 commit 37fd907

File tree

7 files changed

+11694
-15338
lines changed

7 files changed

+11694
-15338
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"s3File": "db.json",
33
"s3Bucket": "jsonsls-${self:service}-${self:provider.stage}",
4-
"basePath": "/dev"
5-
}
4+
"stage": "local"
5+
}

packages/template/package-lock.json

Lines changed: 11666 additions & 15257 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/template/package.json

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,23 @@
55
"author": "pharindoko",
66
"bugs": "https://github.com/pharindoko/json-serverless/issues",
77
"scripts": {
8-
"start": "npm run build && sls offline",
9-
"build": "webpack --mode=production",
8+
"start": "sls offline",
9+
"build": "tsc -b .",
1010
"deploy": "npm run build && sls deploy"
1111
},
1212
"dependencies": {
13-
"express": "4.17.1",
13+
"express": "4.17",
1414
"json-serverless-lib": "^1.6.16",
1515
"serverless-http": "^2.6.0"
1616
},
1717
"devDependencies": {
18-
"@types/express": "4.17.8",
19-
"@types/express-serve-static-core": "4.17.13",
20-
"@types/node": "16.11.6",
21-
"aws-sdk": "2.814.0",
22-
"copy-webpack-plugin": "9.0.0",
23-
"lerna": "4.0.0",
24-
"serverless": "2.16.0",
25-
"serverless-offline": "8.0.0",
18+
"@types/node": "^20.5.1",
19+
"aws-sdk": "^2.1440.0",
20+
"lerna": "^7.1.5",
21+
"serverless": "^2.72.4",
22+
"serverless-offline": "^8.8.1",
2623
"ts-loader": "9.1.2",
27-
"typescript": "4.1.2",
28-
"webpack": "5.11.0",
29-
"webpack-cli": "4.2.0",
30-
"webpack-node-externals": "3.0.0"
24+
"typescript": "^4.9.5"
3125
},
3226
"homepage": "https://github.com/pharindoko/json-serverless",
3327
"license": "MIT",
@@ -43,4 +37,4 @@
4337
"package.json",
4438
"package-lock.json"
4539
]
46-
}
40+
}

packages/template/serverless.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# Welcome to serverless. Read the docs
2-
# https://serverless.com/framework/docs/
3-
4-
# Serverless.yml is the configuration the CLI
5-
# uses to deploy your code to your provider of choice
6-
7-
# The `service` block is the name of the service
81
service: ${self:custom.appconfig.stackName}
92
plugins:
103
- serverless-offline
@@ -24,9 +17,6 @@ custom:
2417
serverless-offline:
2518
resourceRoutes: true
2619
useChildProcesses: true
27-
webpack:
28-
includeModules: true
29-
packager: 'npm'
3020
region: ${self:custom.file.awsRegion, 'eu-central-1'}
3121
provider:
3222
stage: ${self:custom.file.stage, 'dev'}
@@ -39,7 +29,7 @@ provider:
3929
environment:
4030
s3Bucket: ${self:custom.file.s3Bucket}
4131
s3File: ${self:custom.file.s3File}
42-
basePath: ${self:custom.file.basePath}
32+
basePath: /${self:custom.file.stage}
4333
authPath: /jsonsls/${self:service}-${self:provider.stage}
4434
region: ${self:custom.region}
4535
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1

packages/template/src/handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ AWS.config.update({ region: process.env.region });
2020
const server = express();
2121
const sls = serverlessHttp(server);
2222
const defaultConfig = new AppConfig();
23-
const config = JSON.parse(fs.readFileSync('./config/appconfig.json', 'UTF-8'));
23+
const config = JSON.parse(fs.readFileSync('./config/appconfig.json', 'utf8'));
2424
const appConfig = AppConfig.merge(defaultConfig, config);
2525
const environment = new CloudEnvironment();
2626
const swagger = new Swagger(
2727
server,
2828
new SwaggerConfig(appConfig.readOnly, appConfig.enableApiKeyAuth),
29-
environment.basePath,
29+
`/${config.stage}`,
3030
appConfig.routes.apiRoutePath,
3131
'./package.json',
3232
appConfig.routes.swaggerSpecRoutePath

packages/template/tsconfig.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
{
22
"compilerOptions": {
3-
"esModuleInterop": true,
4-
"declaration": false,
5-
"importHelpers": true,
3+
"incremental": false,
64
"moduleResolution": "node",
7-
"rootDir": "src",
8-
"strict": true,
9-
"target": "es2017",
10-
"lib": ["es2017"]
5+
"target": "es5",
6+
"declaration": true,
7+
"esModuleInterop": true,
8+
"declarationMap": true,
9+
"outDir": "dist",
10+
"rootDir": "./src",
11+
"composite": false,
12+
"strictPropertyInitialization": false,
13+
"noImplicitAny": false,
14+
"lib": ["es2015"],
15+
"sourceMap": false,
16+
"resolveJsonModule": true
1117
},
1218
"include": ["src/**/*"]
1319
}

packages/template/webpack.config.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)