(token: string, team: number)
| 69 | } |
| 70 | |
| 71 | async function createProject(token: string, team: number) { |
| 72 | const res = await prompts({ |
| 73 | type: 'text', |
| 74 | name: 'name', |
| 75 | message: 'Please enter a new project name:', |
| 76 | initial: 'My new project', |
| 77 | }) |
| 78 | const response = await fetch(`${APP_URL}/api/teams/${team}/projects`, { |
| 79 | method: 'POST', |
| 80 | headers: { |
| 81 | Authorization: `Bearer ${token}`, |
| 82 | 'Content-Type': 'application/json', |
| 83 | Accept: 'application/json', |
| 84 | }, |
| 85 | body: JSON.stringify({ |
| 86 | name: res.name, |
| 87 | license: 'development', |
| 88 | }), |
| 89 | }) |
| 90 | if (!response.ok) { |
| 91 | error('Failed to create project.') |
| 92 | } |
| 93 | const data = await response.json() |
| 94 | if (data.data) { |
| 95 | info( |
| 96 | `Your project was created successfully with a development license — to upgrade to a production license visit ${APP_URL}` |
| 97 | ) |
| 98 | } |
| 99 | return data.data |
| 100 | } |
| 101 | |
| 102 | async function selectProProject() { |
| 103 | try { |
no test coverage detected