Skip to content

Commit 5bba9cd

Browse files
committed
feat(cli): creating project if not exist
1 parent 930685c commit 5bba9cd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ const initProject = async ({ organizationId, projectId, projectName } = {}) => {
4848
organization: { id: organizationId },
4949
start: 'existing'
5050
}
51+
52+
53+
try {
54+
await projectsGet({ projectId, parseOutput: false });
55+
} catch (e) {
56+
if (e.code === 404) {
57+
answers.start = 'new';
58+
answers.id = answers.project.id;
59+
answers.project = answers.project.name;
60+
} else {
61+
throw e;
62+
}
63+
}
64+
5165
} else {
5266
answers = await inquirer.prompt(questionsInitProject)
5367
if (answers.override === false) {

0 commit comments

Comments
 (0)