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

Commit b39d30f

Browse files
author
uid10804
committed
fix(cli): add missing directory config before create config files
1 parent 5da8fdf commit b39d30f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

packages/cli/src/actions/helpers.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,15 @@ export class Helpers {
105105
});
106106
});
107107
}
108+
109+
static createDir(dir: string) {
110+
const fs = require("fs")
111+
try {
112+
if (!fs.existsSync(dir)) {
113+
fs.mkdirSync(dir);
114+
}
115+
} catch(e) {
116+
console.log("createDir: An error occurred." + e)
117+
}
118+
}
108119
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export class CreateStackCommand extends Command {
109109
appconfig.readOnly = flags.readonly;
110110
appconfig.enableSwagger = flags.swagger;
111111
appconfig.stackName = stackName;
112+
Helpers.createDir(stackFolder + "/config");
112113
fs.writeFileSync(
113114
path.normalize(stackFolder + '/config/appconfig.json'),
114115
JSON.stringify(appconfig, null, 2),
@@ -122,6 +123,7 @@ export class CreateStackCommand extends Command {
122123
const serverlessConfig = new ServerlessConfig();
123124
serverlessConfig.awsRegion = region;
124125
serverlessConfig.stage = args.stage;
126+
Helpers.createDir(stackFolder + "/config");
125127
fs.writeFileSync(
126128
path.normalize(stackFolder + '/config/serverlessconfig.json'),
127129
JSON.stringify(serverlessConfig, null, 2),

0 commit comments

Comments
 (0)