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.
- package/README.md +107 -471
- package/dist/api/componentPresets.d.ts +1 -0
- package/dist/api/componentPresets.js +18 -0
- package/{lib → dist}/api/components.d.ts +2 -2
- package/dist/api/components.js +63 -0
- package/dist/api/config.d.ts +2 -0
- package/dist/api/config.js +4 -0
- package/{lib → dist}/api/datasources.d.ts +1 -1
- package/dist/api/datasources.js +181 -0
- package/dist/api/migrate.d.ts +17 -0
- package/dist/api/migrate.js +139 -0
- package/{lib → dist}/api/mutateComponents.d.ts +0 -0
- package/dist/api/mutateComponents.js +45 -0
- package/{lib → dist}/api/presets.d.ts +1 -1
- package/dist/api/presets.js +52 -0
- package/{lib → dist}/api/resolvePresets.d.ts +0 -0
- package/{lib → dist}/api/resolvePresets.js +15 -14
- package/{lib → dist}/api/roles.d.ts +2 -2
- package/dist/api/roles.js +125 -0
- package/dist/cli-descriptions.d.ts +4 -0
- package/dist/cli-descriptions.js +69 -0
- package/dist/commands/backup.d.ts +2 -0
- package/dist/commands/backup.js +201 -0
- package/dist/commands/debug.d.ts +1 -0
- package/dist/commands/debug.js +5 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.js +58 -0
- package/dist/config/config.d.ts +14 -0
- package/dist/config/config.js +49 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +52 -0
- package/{lib/utils/discover2.d.ts → dist/utils/discover.d.ts} +1 -7
- package/{lib/utils/discover2.js → dist/utils/discover.js} +200 -143
- package/{lib → dist}/utils/files.d.ts +7 -1
- package/dist/utils/files.js +54 -0
- package/dist/utils/interfaces.d.ts +4 -0
- package/dist/utils/interfaces.js +1 -0
- package/{lib → dist}/utils/logger.d.ts +0 -3
- package/{lib → dist}/utils/logger.js +2 -12
- package/dist/utils/main.d.ts +13 -0
- package/dist/utils/main.js +28 -0
- package/{lib → dist}/utils/others.d.ts +0 -0
- package/dist/utils/others.js +1 -0
- package/package.json +63 -57
- package/CHANGELOG.md +0 -996
- package/bin/run +0 -5
- package/bin/run.cmd +0 -3
- package/lib/api/apiConfig.d.ts +0 -2
- package/lib/api/apiConfig.js +0 -9
- package/lib/api/componentPresets.d.ts +0 -1
- package/lib/api/componentPresets.js +0 -22
- package/lib/api/components.js +0 -71
- package/lib/api/datasources.js +0 -193
- package/lib/api/migrate.d.ts +0 -19
- package/lib/api/migrate.js +0 -220
- package/lib/api/mutateComponents.js +0 -50
- package/lib/api/presets.js +0 -59
- package/lib/api/roles.js +0 -133
- package/lib/api/spaces.d.ts +0 -2
- package/lib/api/spaces.js +0 -29
- package/lib/commands/backup.d.ts +0 -22
- package/lib/commands/backup.js +0 -217
- package/lib/commands/debug.d.ts +0 -9
- package/lib/commands/debug.js +0 -21
- package/lib/commands/sync.d.ts +0 -26
- package/lib/commands/sync.js +0 -93
- package/lib/config/StoryblokComponentsConfig.d.ts +0 -68
- package/lib/config/StoryblokComponentsConfig.js +0 -220
- package/lib/config/config.d.ts +0 -37
- package/lib/config/config.js +0 -36
- package/lib/core.d.ts +0 -16
- package/lib/core.js +0 -75
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -5
- package/lib/types/storyblokTypes.d.ts +0 -171
- package/lib/types/storyblokTypes.js +0 -3
- package/lib/utils/discover.d.ts +0 -4
- package/lib/utils/discover.js +0 -96
- package/lib/utils/files.js +0 -54
- package/lib/utils/others.js +0 -5
- package/oclif.manifest.json +0 -1
package/lib/utils/files.js
DELETED
|
@@ -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;
|
package/lib/utils/others.js
DELETED
|
@@ -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;
|
package/oclif.manifest.json
DELETED
|
@@ -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"}]}}}
|