Skip to content

Commit 33e894e

Browse files
committed
refactor(cli): Remove templates when creating function
1 parent 4d036c3 commit 33e894e

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

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

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -223,21 +223,7 @@ const initFunction = async () => {
223223
fs.mkdirSync(templatesDir, "777");
224224
const repo = "https://github.com/{{ sdk.gitUserName }}/templates";
225225
const api = `https://api.github.com/repos/{{ sdk.gitUserName }}/templates/contents/${answers.runtime.name}`
226-
let selected = undefined;
227-
228-
if(answers.template === 'starter') {
229-
selected = { template: 'starter' };
230-
} else {
231-
try {
232-
const res = await fetch(api);
233-
const templates = [];
234-
templates.push(...(await res.json()).map((template) => template.name));
235-
selected = await inquirer.prompt(questionsCreateFunctionSelectTemplate(templates));
236-
} catch {
237-
// Not a problem will go with directory pulling
238-
log('Loading templates...');
239-
}
240-
}
226+
let selected = { template: 'starter' };
241227

242228
const sparse = (selected ? `${answers.runtime.name}/${selected.template}` : answers.runtime.name).toLowerCase();
243229

templates/cli/lib/questions.js.twig

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -301,22 +301,7 @@ const questionsCreateFunction = [
301301
})
302302
return choices;
303303
},
304-
},
305-
{
306-
type: "list",
307-
name: "template",
308-
message: "How would you like to start your function code?",
309-
choices: [
310-
{
311-
name: `Start from scratch ${chalk.blackBright(`(starter)`)}`,
312-
value: "starter"
313-
},
314-
{
315-
name: "Pick a template",
316-
value: "custom"
317-
}
318-
]
319-
},
304+
}
320305
];
321306

322307
const questionsCreateFunctionSelectTemplate = (templates) => {

0 commit comments

Comments
 (0)