You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`type`: describe the command type to execute. Can be: `folders`, `components`, `stories`, `datasources` or `roles`. It's possible pass multiple types separated by comma (`,`).
171
172
*`source`: the source space to use to sync
172
173
*`target`: the target space to use to sync
173
-
*`region`: your space region (default: `eu`). If your space was created under US region, you should use `us` instead.
174
174
175
175
#### Examples
176
176
@@ -205,6 +205,11 @@ Login to the Storyblok cli
205
205
```sh
206
206
$ storyblok login
207
207
```
208
+
#### Options
209
+
210
+
*`email`: your user's email address
211
+
*`password`: your user's password
212
+
*`region`: your user's region (default: `eu`). You can use `us`, `cn` or `eu`. This region will be used for the other cli's commands.
208
213
209
214
### user
210
215
@@ -228,7 +233,6 @@ It's important to note that the `component` and `field` parameters are required
228
233
*`space`: space where the component is
229
234
*`component`: component name. It needs to be a valid component
230
235
*`field`: name of field
231
-
*`region`: your space region (default: `eu`). If your space was created under US region, you should use `us` instead.
.requiredOption('--type <TYPE>','Define what will be sync. Can be components, folders, stories, datasources or roles')
269
262
.requiredOption('--source <SPACE_ID>','Source space id')
270
263
.requiredOption('--target <SPACE_ID>','Target space id')
271
-
.option('-r, --region [value]','region','eu')
272
264
.action(async(options)=>{
273
265
console.log(`${chalk.blue('-')} Sync data between spaces\n`)
274
266
@@ -280,12 +272,9 @@ program
280
272
const{
281
273
type,
282
274
source,
283
-
target,
284
-
region
275
+
target
285
276
}=options
286
277
287
-
api.setRegion(region)
288
-
289
278
const_types=type.split(',')||[]
290
279
_types.forEach(_type=>{
291
280
if(!SYNC_TYPES.includes(_type)){
@@ -314,6 +303,10 @@ program
314
303
.description('Start a project quickly')
315
304
.action(async()=>{
316
305
try{
306
+
if(!api.isAuthorized()){
307
+
awaitapi.processLogin()
308
+
}
309
+
317
310
constspace=program.space
318
311
constquestions=getQuestions('quickstart',{ space },api)
319
312
constanswers=awaitinquirer.prompt(questions)
@@ -327,7 +320,6 @@ program
327
320
program
328
321
.command(COMMANDS.GENERATE_MIGRATION)
329
322
.description('Generate a content migration file')
330
-
.option('-r, --region [value]','region','eu')
331
323
.requiredOption('-c, --component <COMPONENT_NAME>','Name of the component')
332
324
.requiredOption('-f, --field <FIELD_NAME>','Name of the component field')
333
325
.action(async(options)=>{
@@ -347,9 +339,6 @@ program
347
339
awaitapi.processLogin()
348
340
}
349
341
350
-
const{ region }=options
351
-
api.setRegion(region)
352
-
353
342
api.setSpaceId(space)
354
343
awaittasks.generateMigration(api,component,field)
355
344
}catch(e){
@@ -363,7 +352,6 @@ program
363
352
.description('Run a migration file')
364
353
.requiredOption('-c, --component <COMPONENT_NAME>','Name of the component')
365
354
.requiredOption('-f, --field <FIELD_NAME>','Name of the component field')
366
-
.option('-r, --region [value]','region','eu')
367
355
.option('--dryrun','Do not update the story content')
368
356
.option('--publish <PUBLISH_OPTION>','Publish the content. It can be: all, published or published-with-changes')
369
357
.option('--publish-languages <LANGUAGES>','Publish specific languages')
@@ -450,7 +438,7 @@ program
450
438
451
439
awaittasks.listSpaces(api)
452
440
}catch(e){
453
-
console.log(chalk.red('X')+' An error ocurred to listing sapces : '+e.message)
441
+
console.log(chalk.red('X')+' An error ocurred to listing spaces: '+e.message)
454
442
process.exit(1)
455
443
}
456
444
})
@@ -496,7 +484,7 @@ if (program.rawArgs.length <= 2) {
496
484
497
485
functionerrorHandler(e,command){
498
486
if(/404/.test(e.message)){
499
-
console.log(chalk.yellow('/!\\')+' If your space was created under US region, you must provide the region as argument --region us. Otherwise, you can use the default --region eu or omit this flag.')
487
+
console.log(chalk.yellow('/!\\')+' If your space was created under US or CN region, you must provide the region us or cn upon login.')
500
488
}else{
501
489
console.log(chalk.red('X')+' An error occurred when executing the '+command+' task: '+e||e.message)
0 commit comments