Skip to content

Commit 897a4c2

Browse files
committed
Use ID instead of name for folder name in CLI init function
1 parent 3ade92c commit 897a4c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

templates/cli/lib/commands/init.js.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ const initFunction = async () => {
6363
});
6464
}
6565

66-
const functionDir = path.join(functionFolder, answers.name);
66+
const functionDir = path.join(functionFolder, answers.id);
6767

6868
if (fs.existsSync(functionDir)) {
69-
throw new Error(`( ${answers.name} ) already exists in the current directory. Please choose another name.`);
69+
throw new Error(`( ${answers.id} ) already exists in the current directory. Please choose another name.`);
7070
}
7171

7272
if (!answers.runtime.entrypoint) {
@@ -134,7 +134,7 @@ const initFunction = async () => {
134134

135135
fs.rmSync(`${functionDir}/${answers.runtime.id}`, { recursive: true, force: true });
136136

137-
const readmePath = path.join(process.cwd(), 'functions', answers.name, 'README.md');
137+
const readmePath = path.join(process.cwd(), 'functions', answers.id, 'README.md');
138138
const readmeFile = fs.readFileSync(readmePath).toString();
139139
const newReadmeFile = readmeFile.split('\n');
140140
newReadmeFile[0] = `# ${answers.name}`;
@@ -154,7 +154,7 @@ const initFunction = async () => {
154154
entrypoint: response.entrypoint,
155155
commands: response.commands,
156156
ignore: answers.runtime.ignore || null,
157-
path: `functions/${answers.name}`,
157+
path: `functions/${answers.id}`,
158158
};
159159

160160
localConfig.addFunction(data);

0 commit comments

Comments
 (0)