Skip to content

Commit eac2793

Browse files
authored
Merge pull request #350 from pharindoko/fix/#349_no_exported_member
Fix/#349 no exported member
2 parents 6b1c8b5 + 1e6ecd2 commit eac2793

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

packages/cli/src/actions/helpers.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ export class Helpers {
3434
}
3535
}
3636

37+
static changeDirectory(directoryPath: string): void {
38+
try {
39+
if (!fs.existsSync(path.resolve(__dirname, directoryPath))) {
40+
throw new Error(
41+
'Cannot find path' +
42+
path.resolve(__dirname, directoryPath) +
43+
'- please verify that this path exists.'
44+
);
45+
} else {
46+
process.chdir(path.resolve(__dirname, directoryPath));
47+
}
48+
} catch (err) {
49+
throw new Error(err);
50+
}
51+
}
52+
3753
static isJSONServerlessDirectory(directoryPath: string): void {
3854
try {
3955
const serverlessFile = path.normalize(directoryPath + '/serverless.yml');

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

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,25 @@ export class UpdateStackCommand extends Command {
2727
default: false, // default value if flag not passed (can be a function that returns a string or undefined)
2828
required: false, // make flag required (this is not common and you should probably use an argument instead)
2929
}),
30+
currentdirectory: flags.string({
31+
char: 'p', // shorter flag version
32+
description: 'current working directory that will be used for execution', // help description for flag
33+
hidden: false, // hide from help
34+
default: '', // default value if flag not passed (can be a function that returns a string or undefined)
35+
required: false, // make flag required (this is not common and you should probably use an argument instead)
36+
}),
3037
};
3138

3239
async run() {
3340
const logo = await Helpers.generateLogo('json-serverless');
3441
this.log(`${chalk.blueBright(logo)}`);
3542
this.log();
3643
const { args, flags } = this.parse(UpdateStackCommand);
44+
45+
if (flags.currentdirectory) {
46+
Helpers.changeDirectory(flags.currentdirectory);
47+
}
48+
3749
cli.action.start(
3850
`${chalk.blueBright('Check AWS Identity')}`,
3951
`${chalk.blueBright('initializing')}`,
@@ -47,7 +59,10 @@ export class UpdateStackCommand extends Command {
4759
}
4860
cli.action.stop();
4961
this.log();
50-
const templateFolder = path.normalize(this.config.root + '/template');
62+
63+
const templateFolder = path.normalize(
64+
this.config.root + '/node_modules/json-serverless-template/'
65+
);
5166
const stackFolder = process.cwd();
5267
const tasks = new Listr([
5368
{
@@ -77,8 +92,8 @@ export class UpdateStackCommand extends Command {
7792
stackFolder + '/tsconfig.json'
7893
);
7994
await fs.copy(
80-
templateFolder + '/webpack.config.prod.js',
81-
stackFolder + '/webpack.config.prod.js'
95+
templateFolder + '/webpack.config.js',
96+
stackFolder + '/webpack.config.js'
8297
);
8398
},
8499
},
@@ -111,6 +126,18 @@ export class UpdateStackCommand extends Command {
111126
);
112127
},
113128
},
129+
{
130+
title: 'Build Code',
131+
task: async () => {
132+
await Helpers.executeChildProcess(
133+
'npm run build',
134+
{
135+
cwd: stackFolder,
136+
},
137+
false
138+
);
139+
},
140+
},
114141
{
115142
title: 'Deploy Stack on AWS',
116143
task: async () => {

0 commit comments

Comments
 (0)