@@ -11,7 +11,7 @@ const { databasesList } = require('./commands/databases');
11
11
const { checkDeployConditions } = require('./utils');
12
12
const JSONbig = require("json-bigint")({ storeAsString: false });
13
13
14
- const whenOverride = (answers)=> answers.override === undefined ? true : answers.override;
14
+ const whenOverride = (answers) => answers.override === undefined ? true : answers.override;
15
15
16
16
const getIgnores = (runtime) => {
17
17
const languge = runtime.split('-')[0];
@@ -123,6 +123,22 @@ const questionsInitProject = [
123
123
return Object.keys(localConfig.getProject()).length !== 0;
124
124
}
125
125
},
126
+ {
127
+ type: "list",
128
+ name: "start",
129
+ when: whenOverride,
130
+ message: "How would you like to start?",
131
+ choices: [
132
+ {
133
+ name: "Create a new {{ spec .title | caseUcfirst }} project",
134
+ value: "new"
135
+ },
136
+ {
137
+ name: "Link this directory to an existing {{ spec .title | caseUcfirst }} project",
138
+ value: "existing"
139
+ }
140
+ ]
141
+ },
126
142
{
127
143
type: "list",
128
144
name: "organization",
@@ -149,27 +165,6 @@ const questionsInitProject = [
149
165
},
150
166
when: whenOverride
151
167
},
152
- {
153
- type: "list",
154
- name: "start",
155
- when(answers) {
156
- if (answers.override == undefined) {
157
- return true
158
- }
159
- return answers.override;
160
- },
161
- message: "How would you like to start?",
162
- choices: [
163
- {
164
- name: "Create a new {{ spec .title | caseUcfirst }} project",
165
- value: "new"
166
- },
167
- {
168
- name: "Link this directory to an existing {{ spec .title | caseUcfirst }} project",
169
- value: "existing"
170
- }
171
- ]
172
- },
173
168
{
174
169
type: "input",
175
170
name: "project",
@@ -189,12 +184,14 @@ const questionsInitProject = [
189
184
name: "project",
190
185
message: "Choose your {{ spec .title | caseUcfirst }} project.",
191
186
choices: async (answers) => {
192
- let response = await projectsList({
193
- parseOutput: false,
194
- queries: [JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization.id] })],
195
- })
196
- let projects = response["projects"]
197
- let choices = projects.map((project, idx) => {
187
+ const queries = [
188
+ JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization.id] }),
189
+ JSON.stringify({ method: 'orderDesc', attribute: 'Id' })
190
+ ]
191
+
192
+ const { projects } = await paginate(projectsList, { parseOutput: false, queries, }, 100, 'projects');
193
+
194
+ let choices = projects.map((project) => {
198
195
return {
199
196
name: `${project.name} (${project['$id']})`,
200
197
value: {
@@ -238,7 +235,7 @@ const questionsPullFunctions = [
238
235
choices: async () => {
239
236
const { functions } = await paginate(functionsList, { parseOutput: false }, 100, 'functions');
240
237
241
- if(functions.length === 0){
238
+ if (functions.length === 0) {
242
239
throw "We couldn't find any functions in your {{ spec .title | caseUcfirst }} project";
243
240
}
244
241
@@ -298,7 +295,7 @@ const questionsCreateFunctionSelectTemplate = (templates) => {
298
295
name: "template",
299
296
message: "What template would you like to use?",
300
297
choices: templates.map((template) => {
301
- const name =`${template[0].toUpperCase()}${template.split('').slice(1).join('')}`.replace(/[-_]/g,' ');
298
+ const name = `${template[0].toUpperCase()}${template.split('').slice(1).join('')}`.replace(/[-_]/g, ' ');
302
299
303
300
return { value: template, name }
304
301
})
0 commit comments