@@ -203,12 +203,13 @@ const initFunction = async () => {
203203 }
204204
205205 const functionId = answers.id === 'unique()' ? ID.unique() : answers.id;
206- const functionDir = path.join(functionFolder, functionId);
206+ const functionName = answers.name;
207+ const functionDir = path.join(functionFolder, functionName);
207208 const templatesDir = path.join(functionFolder, `${functionId}-templates`);
208209 const runtimeDir = path.join(templatesDir, answers.runtime.name);
209210
210211 if (fs.existsSync(functionDir)) {
211- throw new Error(`( ${functionId } ) already exists in the current directory. Please choose another name.`);
212+ throw new Error(`( ${functionName } ) already exists in the current directory. Please choose another name.`);
212213 }
213214
214215 if (!answers.runtime.entrypoint) {
@@ -285,7 +286,7 @@ const initFunction = async () => {
285286
286287 fs.rmSync(templatesDir, { recursive: true, force: true });
287288
288- const readmePath = path.join(process.cwd(), 'functions', functionId , 'README.md');
289+ const readmePath = path.join(process.cwd(), 'functions', functionName , 'README.md');
289290 const readmeFile = fs.readFileSync(readmePath).toString();
290291 const newReadmeFile = readmeFile.split('\n');
291292 newReadmeFile[0] = `# ${answers.name}`;
@@ -306,7 +307,7 @@ const initFunction = async () => {
306307 entrypoint: answers.runtime.entrypoint || '',
307308 commands: answers.runtime.commands || '',
308309 ignore: answers.runtime.ignore || null,
309- path: `functions/${functionId }`,
310+ path: `functions/${functionName }`,
310311 };
311312
312313 localConfig.addFunction(data);
0 commit comments