storyblok 3.20.0 → 3.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,10 @@ $ storyblok login
37
37
  * `password`: your user's password
38
38
 
39
39
  ##### Options for Login with token (Recomended to SSO user's but works with all user accounts)
40
- * `token`: your access token
40
+ * `token`: your personal access token
41
+
42
+ **Get your personal access token**
43
+ * Go to [https://app.storyblok.com/#/me/account?tab=token](https://app.storyblok.com/#/me/account?tab=token) and click on Generate new token.
41
44
 
42
45
  **For Both login options you nedd to pass the region**
43
46
 
@@ -47,7 +50,7 @@ $ storyblok login
47
50
  You can also add the token directly from the login’s command, like the example below:
48
51
 
49
52
  ```sh
50
- $ storyblok login --token <YOUR_OUTH_TOKEN> --region eu
53
+ $ storyblok login --token <PERSONAL_ACCESS_TOKEN> --region eu
51
54
  ```
52
55
 
53
56
  ### logout
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyblok",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "A simple CLI to start Storyblok from your command line.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/cli.js CHANGED
@@ -273,6 +273,7 @@ program
273
273
  .option('--keys <KEYS>', 'Field names in your story object which should be used for filtering. Multiple keys should separated by comma.')
274
274
  .option('--operations <OPERATIONS>', 'Operations to be used for filtering. Can be: is, in, not_in, like, not_like, any_in_array, all_in_array, gt_date, lt_date, gt_int, lt_int, gt_float, lt_float. Multiple operations should be separated by comma.')
275
275
  .option('--values <VALUES>', 'Values to be used for filtering. Any string or number. If you want to use multiple values, separate them with a comma. Multiple values should be separated by comma.')
276
+ .option('--components-groups <UUIDs>', 'Synchronize components based on their group UUIDs separated by commas')
276
277
  .action(async (options) => {
277
278
  console.log(`${chalk.blue('-')} Sync data between spaces\n`)
278
279
 
@@ -289,9 +290,12 @@ program
289
290
  filter,
290
291
  keys,
291
292
  operations,
292
- values
293
+ values,
294
+ componentsGroups
293
295
  } = options
294
296
 
297
+ const _componentsGroups = componentsGroups ? componentsGroups.split(',') : null
298
+
295
299
  const _types = type.split(',') || []
296
300
  _types.forEach(_type => {
297
301
  if (!SYNC_TYPES.includes(_type)) {
@@ -308,7 +312,8 @@ program
308
312
  source,
309
313
  target,
310
314
  startsWith,
311
- filterQuery
315
+ filterQuery,
316
+ _componentsGroups
312
317
  })
313
318
 
314
319
  console.log('\n' + chalk.green('✓') + ' Sync data between spaces successfully completed')
@@ -18,6 +18,7 @@ class SyncComponents {
18
18
  this.oauthToken = options.oauthToken
19
19
  this.client = api.getClient()
20
20
  this.presetsLib = new PresetsLib({ oauthToken: options.oauthToken, targetSpaceId: this.targetSpaceId })
21
+ this.componentsGroups = options.componentsGroups
21
22
  }
22
23
 
23
24
  async sync () {
@@ -70,6 +71,14 @@ class SyncComponents {
70
71
 
71
72
  const sourceGroupUuid = component.component_group_uuid
72
73
 
74
+ if (this.componentsGroups && !this.componentsGroups.includes(sourceGroupUuid)) {
75
+ console.log(
76
+ chalk.yellow("-") +
77
+ ` Component ${component.name} does not belong to the ${this.componentsGroups} group(s).`
78
+ );
79
+ continue;
80
+ }
81
+
73
82
  // if the component belongs to a group
74
83
  if (sourceGroupUuid) {
75
84
  const sourceGroup = findByProperty(
package/src/tasks/sync.js CHANGED
@@ -18,6 +18,7 @@ const SyncSpaces = {
18
18
  this.startsWith = options.startsWith
19
19
  this.filterQuery = options.filterQuery
20
20
  this.client = api.getClient()
21
+ this.componentsGroups = options._componentsGroups
21
22
  },
22
23
 
23
24
  async getStoryWithTranslatedSlugs (sourceStory, targetStory) {
@@ -231,7 +232,8 @@ const SyncSpaces = {
231
232
  const syncComponentsInstance = new SyncComponents({
232
233
  sourceSpaceId: this.sourceSpaceId,
233
234
  targetSpaceId: this.targetSpaceId,
234
- oauthToken: this.oauthToken
235
+ oauthToken: this.oauthToken,
236
+ componentsGroups: this.componentsGroups
235
237
  })
236
238
 
237
239
  try {