Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit 3752a74

Browse files
authored
Merge pull request #236 from pharindoko/fix/222-cors-issue
Fix/222 cors issue
2 parents a608323 + 4fc2269 commit 3752a74

File tree

10 files changed

+861
-421
lines changed

10 files changed

+861
-421
lines changed

package-lock.json

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

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@
2020
"homepage": "https://github.com/pharindoko/json-serverless.git#readme",
2121
"devDependencies": {
2222
"@semantic-release/changelog": "3.0.6",
23-
"@semantic-release/git": "7.0.18",
23+
"@semantic-release/git": "8.0.0",
2424
"@types/aws-lambda": "8.10.39",
2525
"@types/dotenv": "6.1.1",
2626
"@types/express": "4.17.2",
27-
"@types/jest": "24.0.25",
27+
"@types/jest": "24.9.0",
2828
"@types/json-server": "0.14.2",
2929
"@types/lodash": "4.14.149",
3030
"@types/lowdb": "1.0.9",
3131
"@types/node": "10.14.16",
32-
"@types/pino": "5.15.1",
32+
"@types/pino": "5.15.3",
3333
"@types/supertest": "2.0.8",
3434
"@types/swagger-schema-official": "2.0.20",
3535
"@types/swagger-ui-express": "4.1.1",
3636
"copy-webpack-plugin": "5.1.1",
3737
"cz-conventional-changelog": "3.0.2",
3838
"eslint": "6.8.0",
3939
"eslint-config-airbnb-base": "14.0.0",
40-
"eslint-plugin-import": "2.19.1",
41-
"express-swagger-generator": "1.1.15",
40+
"eslint-plugin-import": "2.20.0",
41+
"express-swagger-generator": "1.1.17",
4242
"gts": "1.1.2",
4343
"jest": "24.9.0",
4444
"lerna": "3.20.2",
@@ -48,10 +48,10 @@
4848
"pino-pretty": "3.5.0",
4949
"serverless-offline": "5.12.1",
5050
"serverless-webpack": "5.3.1",
51-
"terser-webpack-plugin": "2.3.1",
52-
"ts-jest": "24.2.0",
51+
"terser-webpack-plugin": "2.3.2",
52+
"ts-jest": "24.3.0",
5353
"ts-loader": "6.2.1",
54-
"typescript": "3.7.4",
54+
"typescript": "3.7.5",
5555
"webpack": "4.41.5",
5656
"webpack-cli": "3.3.10",
5757
"webpack-node-externals": "1.7.2"

packages/cli/package-lock.json

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

packages/cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"copy-webpack-plugin": "^5.1.1",
2121
"express": "^4.17.1",
2222
"figlet": "^1.2.4",
23-
"globby": "^10.0.1",
23+
"globby": "^11.0.0",
2424
"inquirer": "^7.0.1",
2525
"json-serverless-lib": "^1.5.16",
2626
"listr": "^0.14.3",
@@ -31,7 +31,7 @@
3131
"serverless": "^1.60.4",
3232
"serverless-http": "^2.3.0",
3333
"serverless-webpack": "^5.3.1",
34-
"terser-webpack-plugin": "2.3.1",
34+
"terser-webpack-plugin": "2.3.2",
3535
"ts-loader": "^6.2.1",
3636
"tslib": "^1.10.0",
3737
"typescript": "^3.7.4",
@@ -43,7 +43,7 @@
4343
"@oclif/dev-cli": "1.22.2",
4444
"@types/listr": "0.14.2",
4545
"@types/node": "10.17.13",
46-
"ts-node": "8.5.4"
46+
"ts-node": "8.6.2"
4747
},
4848
"engines": {
4949
"node": ">=8.0.0"

packages/cli/src/commands/create-stack.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import cli from 'cli-ux';
88
import { Helpers } from '../actions/helpers';
99
import { AWSActions } from '../actions/aws-actions';
1010
import { ServerlessConfig } from '../classes/serverlessconfig';
11-
import chalk from 'chalk'
11+
import chalk from 'chalk';
1212
export class CreateStackCommand extends Command {
1313
static description = 'describe the command here';
1414

@@ -58,26 +58,33 @@ export class CreateStackCommand extends Command {
5858
await Helpers.generateLogo('json-serverless');
5959
this.log();
6060
const { args, flags } = this.parse(CreateStackCommand);
61-
cli.action.start(`${chalk.blueBright('Check AWS Identity')}`, `${chalk.blueBright('initializing')}`, { stdout: true });
61+
cli.action.start(
62+
`${chalk.blueBright('Check AWS Identity')}`,
63+
`${chalk.blueBright('initializing')}`,
64+
{ stdout: true }
65+
);
6266
try {
6367
const identity = await AWSActions.checkValidAWSIdentity();
6468
this.log(`${chalk.green('AWS Account: ' + identity.Account)}`);
6569
} catch (error) {
66-
6770
this.error(`${chalk.red(error.message)}`);
6871
}
6972
cli.action.stop();
7073
this.log();
71-
7274

73-
const stackName = await cli.prompt(`${chalk.magenta('What is the name of the api ?')}`);
75+
const stackName = await cli.prompt(
76+
`${chalk.magenta('What is the name of the api ?')}`
77+
);
7478
this.log();
7579
const region = await this.getRegion();
7680
let filePath = path.normalize(args.file);
7781
const templateFolder = path.normalize(this.config.root + '/template');
7882
const stackFolder = path.normalize(process.cwd() + '/' + stackName);
7983
this.log();
80-
this.log('New stack template folder will be created under path: ' + `${chalk.blueBright.bold.underline(stackFolder)}`);
84+
this.log(
85+
'New stack template folder will be created under path: ' +
86+
`${chalk.blueBright.bold.underline(stackFolder)}`
87+
);
8188
this.log();
8289
await cli.confirm(`${chalk.magenta('Continue ? y/n')}`);
8390
this.log();
@@ -109,7 +116,7 @@ export class CreateStackCommand extends Command {
109116
appconfig.readOnly = flags.readonly;
110117
appconfig.enableSwagger = flags.swagger;
111118
appconfig.stackName = stackName;
112-
Helpers.createDir(stackFolder + "/config");
119+
Helpers.createDir(stackFolder + '/config');
113120
fs.writeFileSync(
114121
path.normalize(stackFolder + '/config/appconfig.json'),
115122
JSON.stringify(appconfig, null, 2),
@@ -123,7 +130,7 @@ export class CreateStackCommand extends Command {
123130
const serverlessConfig = new ServerlessConfig();
124131
serverlessConfig.awsRegion = region;
125132
serverlessConfig.stage = args.stage;
126-
Helpers.createDir(stackFolder + "/config");
133+
Helpers.createDir(stackFolder + '/config');
127134
fs.writeFileSync(
128135
path.normalize(stackFolder + '/config/serverlessconfig.json'),
129136
JSON.stringify(serverlessConfig, null, 2),
@@ -133,7 +140,7 @@ export class CreateStackCommand extends Command {
133140
},
134141
{
135142
title: 'Install Dependencies',
136-
task: async (task) => {
143+
task: async task => {
137144
task.output = 'INSTALL DEPENDENCIES';
138145
await Helpers.executeChildProcess(
139146
'npm i',
@@ -148,7 +155,7 @@ export class CreateStackCommand extends Command {
148155
title: 'Deploy Stack on AWS',
149156
task: async () => {
150157
await Helpers.executeChildProcess(
151-
'sls deploy',
158+
'node_modules/serverless/bin/serverless deploy',
152159
{
153160
cwd: stackFolder,
154161
},
@@ -159,7 +166,10 @@ export class CreateStackCommand extends Command {
159166
]);
160167
try {
161168
await tasks.run();
162-
await Helpers.executeChildProcess('sls info', { cwd: stackFolder });
169+
await Helpers.executeChildProcess(
170+
'node_modules/serverless/bin/serverless info',
171+
{ cwd: stackFolder }
172+
);
163173
} catch (error) {
164174
this.error(`${chalk.red(error.message)}`);
165175
}
@@ -176,7 +186,7 @@ export class CreateStackCommand extends Command {
176186
name: 'region',
177187
message: 'select a region',
178188
type: 'list',
179-
choices: regions
189+
choices: regions,
180190
},
181191
]);
182192
region = responses.region;

0 commit comments

Comments
 (0)