sb-mig 2.9.3 → 3.0.0-beta.2

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.
Files changed (81) hide show
  1. package/README.md +107 -471
  2. package/dist/api/componentPresets.d.ts +1 -0
  3. package/dist/api/componentPresets.js +18 -0
  4. package/{lib → dist}/api/components.d.ts +2 -2
  5. package/dist/api/components.js +63 -0
  6. package/dist/api/config.d.ts +2 -0
  7. package/dist/api/config.js +4 -0
  8. package/{lib → dist}/api/datasources.d.ts +1 -1
  9. package/dist/api/datasources.js +181 -0
  10. package/dist/api/migrate.d.ts +17 -0
  11. package/dist/api/migrate.js +139 -0
  12. package/{lib → dist}/api/mutateComponents.d.ts +0 -0
  13. package/dist/api/mutateComponents.js +45 -0
  14. package/{lib → dist}/api/presets.d.ts +1 -1
  15. package/dist/api/presets.js +52 -0
  16. package/{lib → dist}/api/resolvePresets.d.ts +0 -0
  17. package/{lib → dist}/api/resolvePresets.js +15 -14
  18. package/{lib → dist}/api/roles.d.ts +2 -2
  19. package/dist/api/roles.js +125 -0
  20. package/dist/cli-descriptions.d.ts +4 -0
  21. package/dist/cli-descriptions.js +69 -0
  22. package/dist/commands/backup.d.ts +2 -0
  23. package/dist/commands/backup.js +201 -0
  24. package/dist/commands/debug.d.ts +1 -0
  25. package/dist/commands/debug.js +5 -0
  26. package/dist/commands/sync.d.ts +2 -0
  27. package/dist/commands/sync.js +58 -0
  28. package/dist/config/config.d.ts +14 -0
  29. package/dist/config/config.js +49 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +52 -0
  32. package/{lib/utils/discover2.d.ts → dist/utils/discover.d.ts} +1 -7
  33. package/{lib/utils/discover2.js → dist/utils/discover.js} +200 -143
  34. package/{lib → dist}/utils/files.d.ts +7 -1
  35. package/dist/utils/files.js +54 -0
  36. package/dist/utils/interfaces.d.ts +4 -0
  37. package/dist/utils/interfaces.js +1 -0
  38. package/{lib → dist}/utils/logger.d.ts +0 -3
  39. package/{lib → dist}/utils/logger.js +2 -12
  40. package/dist/utils/main.d.ts +13 -0
  41. package/dist/utils/main.js +28 -0
  42. package/{lib → dist}/utils/others.d.ts +0 -0
  43. package/dist/utils/others.js +1 -0
  44. package/package.json +63 -57
  45. package/CHANGELOG.md +0 -996
  46. package/bin/run +0 -5
  47. package/bin/run.cmd +0 -3
  48. package/lib/api/apiConfig.d.ts +0 -2
  49. package/lib/api/apiConfig.js +0 -9
  50. package/lib/api/componentPresets.d.ts +0 -1
  51. package/lib/api/componentPresets.js +0 -22
  52. package/lib/api/components.js +0 -71
  53. package/lib/api/datasources.js +0 -193
  54. package/lib/api/migrate.d.ts +0 -19
  55. package/lib/api/migrate.js +0 -220
  56. package/lib/api/mutateComponents.js +0 -50
  57. package/lib/api/presets.js +0 -59
  58. package/lib/api/roles.js +0 -133
  59. package/lib/api/spaces.d.ts +0 -2
  60. package/lib/api/spaces.js +0 -29
  61. package/lib/commands/backup.d.ts +0 -22
  62. package/lib/commands/backup.js +0 -217
  63. package/lib/commands/debug.d.ts +0 -9
  64. package/lib/commands/debug.js +0 -21
  65. package/lib/commands/sync.d.ts +0 -26
  66. package/lib/commands/sync.js +0 -93
  67. package/lib/config/StoryblokComponentsConfig.d.ts +0 -68
  68. package/lib/config/StoryblokComponentsConfig.js +0 -220
  69. package/lib/config/config.d.ts +0 -37
  70. package/lib/config/config.js +0 -36
  71. package/lib/core.d.ts +0 -16
  72. package/lib/core.js +0 -75
  73. package/lib/index.d.ts +0 -1
  74. package/lib/index.js +0 -5
  75. package/lib/types/storyblokTypes.d.ts +0 -171
  76. package/lib/types/storyblokTypes.js +0 -3
  77. package/lib/utils/discover.d.ts +0 -4
  78. package/lib/utils/discover.js +0 -96
  79. package/lib/utils/files.js +0 -54
  80. package/lib/utils/others.js +0 -5
  81. package/oclif.manifest.json +0 -1
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.copyFile = exports.copyFolder = exports.createJsonFile = exports.createDir = exports.isDirectoryExists = exports.getCurrentDirectoryBase = void 0;
4
- const fs = require("fs");
5
- const ncp_1 = require("ncp");
6
- const path = require("path");
7
- const logger_1 = require("./logger");
8
- const getCurrentDirectoryBase = () => path.basename(process.cwd());
9
- exports.getCurrentDirectoryBase = getCurrentDirectoryBase;
10
- const isDirectoryExists = (path) => fs.existsSync(path);
11
- exports.isDirectoryExists = isDirectoryExists;
12
- const createDir = async (dirPath) => {
13
- await fs.promises.mkdir(`${process.cwd()}/${dirPath}`, {
14
- recursive: true,
15
- });
16
- };
17
- exports.createDir = createDir;
18
- const createJsonFile = async (content, pathWithFilename) => {
19
- await fs.promises.writeFile(pathWithFilename, content, { flag: 'w' });
20
- };
21
- exports.createJsonFile = createJsonFile;
22
- const copyFolder = async (src, dest) => {
23
- return new Promise((resolve, reject) => {
24
- (0, ncp_1.ncp)(src, dest, function (err) {
25
- if (err) {
26
- reject({
27
- failed: true,
28
- message: `${src} copied unsuccessfully.`,
29
- });
30
- }
31
- resolve({
32
- failed: false,
33
- message: `${src} copied successfully.`,
34
- });
35
- });
36
- });
37
- };
38
- exports.copyFolder = copyFolder;
39
- const copyFile = async (src, dest) => {
40
- const directory = dest.split('/').slice(0, dest.split('/').length - 1);
41
- const fileName = src.split('/')[src.split('/').length - 1];
42
- if (!(0, exports.isDirectoryExists)(directory.join('/'))) {
43
- await (0, exports.createDir)(directory.join('/'));
44
- }
45
- fs.copyFile(src, dest, err => {
46
- if (err) {
47
- logger_1.default.error(`There is no file to copy, named ${fileName}`);
48
- console.log(err);
49
- return false;
50
- }
51
- console.log(`${fileName} was copied to ${dest}`);
52
- });
53
- };
54
- exports.copyFile = copyFile;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateDatestamp = void 0;
4
- const generateDatestamp = (datestamp) => `${datestamp.getFullYear()}-${datestamp.getMonth()}-${datestamp.getDay()}_${datestamp.getTime()}`;
5
- exports.generateDatestamp = generateDatestamp;
@@ -1 +0,0 @@
1
- {"version":"2.9.3","commands":{"backup":{"id":"backup","description":"Command for backing up anything related to Storyblok","pluginName":"sb-mig","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"allComponents":{"name":"allComponents","type":"boolean","char":"a","description":"Backup all components.","allowNo":false},"oneComponent":{"name":"oneComponent","type":"option","char":"o","description":"Backup one component by name."},"allComponentsGroups":{"name":"allComponentsGroups","type":"boolean","char":"g","description":"Backup all components groups.","allowNo":false},"oneComponentsGroup":{"name":"oneComponentsGroup","type":"option","char":"f","description":"Backup one components group by name."},"oneComponentPresets":{"name":"oneComponentPresets","type":"option","char":"p","description":"Backup all presets for one component"},"allPresets":{"name":"allPresets","type":"boolean","char":"l","description":"Backup all presets.","allowNo":false},"onePreset":{"name":"onePreset","type":"option","char":"i","description":"Backup one preset by id."},"allDatasources":{"name":"allDatasources","type":"boolean","char":"d","description":"Backup all datasources.","allowNo":false},"oneDatasource":{"name":"oneDatasource","type":"option","char":"x","description":"Backup one datasource by name."},"datasourceEntries":{"name":"datasourceEntries","type":"option","char":"e","description":"Backup one datasource entries by datasource name."},"allRoles":{"name":"allRoles","type":"boolean","char":"R","description":"Backup all roles and permissions.","allowNo":false},"oneRole":{"name":"oneRole","type":"option","char":"r","description":"Backup one role by name."}},"args":[]},"debug":{"id":"debug","description":"Output extra debugging","pluginName":"sb-mig","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"sync":{"id":"sync","description":"Synchronize components, datasources or roles with Storyblok space.","pluginName":"sb-mig","pluginType":"core","aliases":[],"examples":["$ sb-mig sync components --all --ext","$ sb-mig sync components @storyblok-components/text-block --ext --packageName","$ sb-mig sync components @storyblok-components/text-block @storyblok-components/button --ext --packageName","$ sb-mig sync components text-block button --ext","$ sb-mig sync components text-block button","$ sb-mig sync roles"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"all":{"name":"all","type":"boolean","char":"a","description":"Synchronize all components.","allowNo":false},"ext":{"name":"ext","type":"boolean","char":"e","description":"Synchronize with file extension. Default extension: '.sb.js'","allowNo":false},"packageName":{"name":"packageName","type":"boolean","char":"n","description":"Synchronize based on installed package name.","allowNo":false},"presets":{"name":"presets","type":"boolean","char":"p","description":"Synchronize components with presets.","allowNo":false},"lock":{"name":"lock","type":"boolean","char":"l","description":"Synchronize based on storyblok.components.lock.js file","allowNo":false}},"args":[{"name":"type","description":"What to synchronize","required":true,"options":["components","datasources","roles"]},{"name":"list","description":"Space separated list of component names. Example: card product-card row layout"}]}}}