sb-mig 4.0.3 → 4.0.6

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
@@ -7,6 +7,12 @@ If you've found an issue or you have feature request - <a href="https://github.c
7
7
  [![npm](https://img.shields.io/npm/dt/sb-mig.svg)](ttps://img.shields.io/npm/dt/sb-mig.svg)
8
8
  [![GitHub issues](https://img.shields.io/github/issues/sb-mig/sb-mig.svg?style=flat-square&v=1)](https://github.com/sb-mig/sb-mig/issues?q=is%3Aopen+is%3Aissue)
9
9
 
10
+ # 4.x.x version released!
11
+
12
+ - Whole deployment now, is handled by [semantic-release](https://github.com/semantic-release/semantic-release). And is just normal repository, instead of Lerna monorepo which is not needed anymore, and it was recently unmaintained (now it was passed to `nrwl` to maintain (https://github.com/lerna/lerna/issues/3121) will see what will happen in future with it :)
13
+ - Fromt the code perspective, there are no **breaking changes** between **3.x.x** and **4.x.x** but i'm going to fix some stuff now and add some more functionalities to it. So stay tuned!
14
+ - This Readme, which is also kinda documentation, will also be updated. Cause in some places there is misleading information. The best documentation though is just `sb-mig --help` command.
15
+
10
16
  # 3.x.x version released!
11
17
 
12
18
  - completely rewritten to simple [Meow](https://github.com/sindresorhus/meow) lib with help of Typescript. Check [migration guide](https://github.com/sb-mig/sb-mig/blob/oclif-research/MIGRATION-GUIDE-v3.md)
@@ -37,11 +43,19 @@ If you've found an issue or you have feature request - <a href="https://github.c
37
43
  npm install --global sb-mig
38
44
  ```
39
45
 
40
- You have to create a `.env` file with your variables:
46
+ In your working directory (usually root of your repo where u have your app/webpage using Storyblok), you have to create a `.env` file with your variables:
41
47
 
42
48
  ```
43
49
  STORYBLOK_OAUTH_TOKEN=1234567890qwertyuiop
44
50
  STORYBLOK_SPACE_ID=12345
51
+
52
+ # For nextjs
53
+ # NEXT_PUBLIC_STORYBLOK_ACCESS_TOKEN=zxcvbnmasdfghjkl
54
+
55
+ # For gatsby
56
+ # GATSBY_STORYBLOK_ACCESS_TOKEN=zxcvbnmasdfghjkl
57
+
58
+ # any other (you have to handle '.env' access in frontend yourself (for example with dotenv package)
45
59
  STORYBLOK_ACCESS_TOKEN=zxcvbnmasdfghjkl
46
60
  ```
47
61
 
@@ -88,13 +102,13 @@ $ sb-mig --help
88
102
  help This screen
89
103
 
90
104
  Examples
91
- $ sb-migv sync components --all
105
+ $ sb-mig sync components --all
92
106
  $ sb-mig debug
93
107
  ```
94
108
 
95
109
  # Commands
96
110
 
97
- * [`sb-mig version`](#sb-mig-version)
111
+ * [`sb-mig --version`](#sb-mig-version)
98
112
  * [`sb-mig backup`](#sb-mig-backup)
99
113
  * [`sb-mig debug`](#sb-mig-debug)
100
114
  * [`sb-mig sync`](#sb-mig-sync)
@@ -103,7 +117,7 @@ $ sb-mig --help
103
117
  ```
104
118
  $ sb-mig --version
105
119
 
106
- 3.1.7
120
+ 4.0.4
107
121
  ```
108
122
 
109
123
  ## `sb-mig backup`
@@ -118,7 +132,7 @@ $ sb-mig backup --help
118
132
  CLI to rule the world. (and handle stuff related to Storyblok CMS)
119
133
 
120
134
  Usage
121
- $ sb-mig-v3 backup [components|component-groups|roles|datasources|presets|component-presets] [space separated file names] or --all
135
+ $ sb-mig backup [components|component-groups|roles|datasources|presets|component-presets] component-name --one or --all
122
136
  Description
123
137
  Command for backing up anything related to Storyblok
124
138
 
@@ -148,6 +162,7 @@ Output extra debugging.
148
162
  ```
149
163
  $ sb-mig debug
150
164
 
165
+ ✓ Found storyblok.config.js!
151
166
  storyblok.config.js: {
152
167
  componentsMatchFile: 'src/components/components.js',
153
168
  storyblokComponentsListfile: 'src/components/storyblok-components.componentList.js',
@@ -197,8 +212,14 @@ CLI to rule the world. (and handle stuff related to Storyblok CMS)
197
212
 
198
213
  EXAMPLES
199
214
  $ sb-mig sync components --all
215
+ $ sb-mig sync components --all --presets
200
216
  $ sb-mig sync components accordion accordion-item
217
+ $ sb-mig sync components accordion accordion-item --presets
201
218
  $ sb-mig sync components @storyblok-components/accordion --packageName
219
+ $ sb-mig sync components @storyblok-components/accordion --packageName --presets
220
+ $ sb-mig sync roles --all
221
+ $ sb-mig sync datasources --all
222
+
202
223
  ```
203
224
 
204
225
  # Schema documentation:
@@ -267,7 +288,7 @@ There is also support for `sections` inside components:
267
288
 
268
289
  The main purpose of `sb-mig` is to sync your `.sb.js` component schema files with your `Storyblok` space.
269
290
 
270
- In v3.x.x There is 1 way to sync your schemas, which is to name all your schemas with `.sb.js` extension. You can have them in any place of your repositories, as long as this place is pointed in `storyblok.config.js` `componentDirectories` field, which is set to `componentsDirectories: ["src", "storyblok"],` by default:
291
+ In v4.x.x There is 1 way to sync your schemas, which is to name all your schemas with `.sb.js` extension. You can have them in any place of your repositories, as long as this place is pointed in `storyblok.config.js` `componentDirectories` field, which is set to `componentsDirectories: ["src", "storyblok"],` by default:
271
292
 
272
293
  ```
273
294
  sb-mig sync components row column
@@ -398,7 +419,7 @@ export default {
398
419
  Now, sync your component
399
420
 
400
421
  ```
401
- sb-mig sync components --presets text-block
422
+ sb-mig sync components text-block --presets
402
423
  ```
403
424
 
404
425
  output:
@@ -431,12 +452,29 @@ Install packages
431
452
  yarn
432
453
  ```
433
454
 
434
- Link package to easy test it with `sb-mig` command
455
+ Run development command
456
+ ```bash
457
+ yarn build:dev
458
+ ```
459
+
460
+ It will watch a file change, and on every change, will rebuild typescript and build the whole lib/cli.
461
+
462
+ The you can use
463
+ ```
464
+ node dist/index.js debug
465
+ ```
466
+ to access `sb-mig`
435
467
 
468
+ For your conveniece, you can also, link it to proper `sb-mi` name:
436
469
  ```
437
470
  yarn link
438
471
  ```
439
472
 
473
+ And then you can use it like that:
474
+ ```
475
+ sb-mig debug
476
+ ```
477
+
440
478
  ## Roadmap
441
479
 
442
480
  - [ ] Sync / Migrate content (stories)
@@ -1,4 +1,4 @@
1
- export declare const mainDescription = "\n CLI to rule the world. (and handle stuff related to Storyblok CMS)\n \n USAGE\n $ sb-mig [command]\n \n COMMANDS\n sync Synchronize components, datasources or roles with Storyblok space.\n backup Command for backing up anything related to Storyblok\n debug Output extra debugging information\n help This screen\n \n Examples\n $ sb-migv-3 sync\n $ sb-mig-v3 debug \n";
2
- export declare const syncDescription = "\n Usage\n $ sb-mig-v3 sync [components|roles|datasources] [space separated file names] or --all --packageName\n \n Description\n Synchronize components or roles with Storyblok space.\n \n COMMANDS\n components - sync components\n roles - sync roles\n datasources - sync datasources\n \n FLAGS\n --all - Sync all components\n --packageName - Sync based on package name, instead of file name (package can have multiple schema files to sync)\n --presets - Pass it, if u want to sync also with presets (will take longer) \n \n EXAMPLES\n $ sb-mig sync components --all\n $ sb-mig sync components accordion accordion-item\n $ sb-mig sync components @storyblok-components/accordion --packageName\n \n";
3
- export declare const backupDescription = "\n Usage\n $ sb-mig-v3 backup [components|component-groups|roles|datasources|presets|component-presets] [space separated file names ] or --all\n Description\n Command for backing up anything related to Storyblok\n \n COMMANDS\n components - backup components\n component-groups - backuo component-groups\n roles - backup components\n datasources - backup components\n presets - backup presets\n component-presets - backup component presets\n \n FLAGS\n --all - Backup all \n --one - Backup one \n \n EXAMPLES\n $ sb-mig backup components --all\n $ sb-mig backup components accordion accordion-item carousel text-block\n $ sb-mig backup datasources --all\n $ sb-mig backup roles admin normal-user\n";
4
- export declare const debugDescription = "\n Usage\n $ sb-mig-v3 debug\n Description\n Output extra debugging information\n";
1
+ export declare const mainDescription = "\n USAGE\n $ sb-mig [command]\n \n COMMANDS\n sync Synchronize components, datasources or roles with Storyblok space.\n backup Command for backing up anything related to Storyblok\n debug Output extra debugging information\n help This screen\n \n Examples\n $ sb-mig sync components --all\n $ sb-mig debug \n";
2
+ export declare const syncDescription = "\n Usage\n $ sb-mig sync [components|roles|datasources] [space separated file names] or --all --packageName\n \n Description\n Synchronize components or roles with Storyblok space.\n \n COMMANDS\n components - sync components\n roles - sync roles\n datasources - sync datasources\n \n FLAGS\n --all - Sync all components\n --packageName - Sync based on package name, instead of file name (package can have multiple schema files to sync)\n --presets - Pass it, if u want to sync also with presets (will take longer) \n \n EXAMPLES\n $ sb-mig sync components --all\n $ sb-mig sync components --all --presets\n $ sb-mig sync components accordion accordion-item\n $ sb-mig sync components accordion accordion-item --presets\n $ sb-mig sync components @storyblok-components/accordion --packageName\n $ sb-mig sync components @storyblok-components/accordion --packageName --presets\n $ sb-mig sync roles --all\n $ sb-mig sync datasources --all\n";
3
+ export declare const backupDescription = "\n Usage\n $ sb-mig backup [components|component-groups|roles|datasources|presets|component-presets] component-name --one or --all\n Description\n Command for backing up anything related to Storyblok\n \n COMMANDS\n components - backup components\n component-groups - backup component-groups\n roles - backup components\n datasources - backup components\n presets - backup presets\n component-presets - backup component presets\n \n FLAGS\n --all - Backup all \n --one - Backup one \n \n EXAMPLES\n $ sb-mig backup components --all\n $ sb-mig backup components accordion --one \n $ sb-mig backup datasources --all\n $ sb-mig backup roles admin --one\n";
4
+ export declare const debugDescription = "\n Usage\n $ sb-mig debug\n Description\n Output extra debugging information\n";
@@ -1,22 +1,20 @@
1
1
  export const mainDescription = `
2
- CLI to rule the world. (and handle stuff related to Storyblok CMS)
3
-
4
2
  USAGE
5
3
  $ sb-mig [command]
6
4
 
7
5
  COMMANDS
8
- sync Synchronize components, datasources or roles with Storyblok space.
6
+ sync Synchronize components, datasources or roles with Storyblok space.
9
7
  backup Command for backing up anything related to Storyblok
10
8
  debug Output extra debugging information
11
9
  help This screen
12
10
 
13
11
  Examples
14
- $ sb-migv-3 sync
15
- $ sb-mig-v3 debug
12
+ $ sb-mig sync components --all
13
+ $ sb-mig debug
16
14
  `;
17
15
  export const syncDescription = `
18
16
  Usage
19
- $ sb-mig-v3 sync [components|roles|datasources] [space separated file names] or --all --packageName
17
+ $ sb-mig sync [components|roles|datasources] [space separated file names] or --all --packageName
20
18
 
21
19
  Description
22
20
  Synchronize components or roles with Storyblok space.
@@ -33,19 +31,23 @@ export const syncDescription = `
33
31
 
34
32
  EXAMPLES
35
33
  $ sb-mig sync components --all
34
+ $ sb-mig sync components --all --presets
36
35
  $ sb-mig sync components accordion accordion-item
36
+ $ sb-mig sync components accordion accordion-item --presets
37
37
  $ sb-mig sync components @storyblok-components/accordion --packageName
38
-
38
+ $ sb-mig sync components @storyblok-components/accordion --packageName --presets
39
+ $ sb-mig sync roles --all
40
+ $ sb-mig sync datasources --all
39
41
  `;
40
42
  export const backupDescription = `
41
43
  Usage
42
- $ sb-mig-v3 backup [components|component-groups|roles|datasources|presets|component-presets] [space separated file names ] or --all
44
+ $ sb-mig backup [components|component-groups|roles|datasources|presets|component-presets] component-name --one or --all
43
45
  Description
44
46
  Command for backing up anything related to Storyblok
45
47
 
46
48
  COMMANDS
47
49
  components - backup components
48
- component-groups - backuo component-groups
50
+ component-groups - backup component-groups
49
51
  roles - backup components
50
52
  datasources - backup components
51
53
  presets - backup presets
@@ -57,13 +59,13 @@ export const backupDescription = `
57
59
 
58
60
  EXAMPLES
59
61
  $ sb-mig backup components --all
60
- $ sb-mig backup components accordion accordion-item carousel text-block
62
+ $ sb-mig backup components accordion --one
61
63
  $ sb-mig backup datasources --all
62
- $ sb-mig backup roles admin normal-user
64
+ $ sb-mig backup roles admin --one
63
65
  `;
64
66
  export const debugDescription = `
65
67
  Usage
66
- $ sb-mig-v3 debug
68
+ $ sb-mig debug
67
69
  Description
68
70
  Output extra debugging information
69
71
  `;
@@ -38,6 +38,9 @@ export const backup = (props) => {
38
38
  const componentToBackup = unpackOne(input);
39
39
  getComponent(componentToBackup)
40
40
  .then(async (res) => {
41
+ console.log("############");
42
+ console.log(res);
43
+ console.log("############");
41
44
  await createAndSaveToFile({
42
45
  prefix: "component-",
43
46
  folder: "components",
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sb-mig",
3
- "version": "4.0.3",
3
+ "version": "4.0.6",
4
4
  "description": "CLI to rule the world. (and handle stuff related to Storyblok CMS)",
5
5
  "author": "Marcin Krawczyk <marckraw@icloud.com>",
6
6
  "license": "MIT",
@@ -35,8 +35,8 @@
35
35
  ],
36
36
  "scripts": {
37
37
  "lint-staged": "lint-staged",
38
- "build": "rm -rf dist && tsc",
39
- "build:dev": "rm -rf dist && tsc && chmod +x ./dist/index.js",
38
+ "build": "rm -rf dist && tsc && chmod +x ./dist/index.js",
39
+ "build:dev": "chokidar 'src/**/*.{js,ts,cjs,mjs}' -c 'yarn build'",
40
40
  "test": "echo \"Error: no test specified\" && exit 1",
41
41
  "start": "yarn build && ./dist/index.js",
42
42
  "debug": "yarn build && ./dist/index.js sync components accordion accordion-item",
@@ -62,6 +62,7 @@
62
62
  "@types/glob": "^7.2.0",
63
63
  "@types/ncp": "^2.0.5",
64
64
  "@types/node": "^17.0.35",
65
+ "chokidar-cli": "^3.0.0",
65
66
  "commitizen": "^4.0.4",
66
67
  "conventional-changelog-cli": "^2.0.31",
67
68
  "eslint": "^8.16.0",