sb-mig 5.0.7-beta.1 → 5.0.7-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.
|
@@ -209,11 +209,11 @@ export const doTheMigration = async ({ itemType = "story", from, itemsToMigrate,
|
|
|
209
209
|
}, config);
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
|
-
const
|
|
212
|
+
const saveBackupToFile = async ({ itemType, res, folder, filename, }) => {
|
|
213
213
|
await createAndSaveToFile({
|
|
214
214
|
ext: "json",
|
|
215
215
|
datestamp: true,
|
|
216
|
-
suffix: ".sb.stories",
|
|
216
|
+
suffix: itemType === "story" ? ".sb.stories" : ".sb.presets",
|
|
217
217
|
filename,
|
|
218
218
|
folder,
|
|
219
219
|
res: res,
|
|
@@ -249,9 +249,10 @@ export const migrateProvidedComponentsDataInStories = async ({ itemType, migrati
|
|
|
249
249
|
spaceId: from,
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
|
-
const backupFolder = path.join("backup",
|
|
252
|
+
const backupFolder = path.join("backup", itemType);
|
|
253
253
|
// save stories to file as backup
|
|
254
|
-
await
|
|
254
|
+
await saveBackupToFile({
|
|
255
|
+
itemType,
|
|
255
256
|
filename: `before__${migrationConfig}__${from}`,
|
|
256
257
|
folder: backupFolder,
|
|
257
258
|
res: itemsToMigrate,
|
|
@@ -59,11 +59,6 @@ export const migrate = async (props) => {
|
|
|
59
59
|
const dryRun = flags["dryRun"];
|
|
60
60
|
await askForConfirmation("Are you sure you want to MIGRATE content (stories) in your space ? (it will overwrite stories)", async () => {
|
|
61
61
|
Logger.warning("Preparing to migrate...");
|
|
62
|
-
// await backupStories({
|
|
63
|
-
// filename: `${from}--backup-before-migration___${migrationConfig}`,
|
|
64
|
-
// suffix: ".sb.stories",
|
|
65
|
-
// spaceId: from,
|
|
66
|
-
// }, apiConfig);
|
|
67
62
|
await migrateAllComponentsDataInStories({
|
|
68
63
|
itemType: "story",
|
|
69
64
|
from,
|
|
@@ -93,11 +88,6 @@ export const migrate = async (props) => {
|
|
|
93
88
|
const dryRun = flags["dryRun"];
|
|
94
89
|
await askForConfirmation("Are you sure you want to MIGRATE presets in your space ? (it will overwrite them)", async () => {
|
|
95
90
|
Logger.warning("Preparing to migrate...");
|
|
96
|
-
// backupPresets({
|
|
97
|
-
// filename: `${from}--backup-before-migration___${migrationConfig}`,
|
|
98
|
-
// suffix: ".sb.presets",
|
|
99
|
-
// spaceId: from,
|
|
100
|
-
// }, apiConfig)
|
|
101
91
|
const response = await managementApi.presets.getAllPresets(apiConfig);
|
|
102
92
|
await createAndSaveToFile({
|
|
103
93
|
filename: "presets-backup",
|
package/package.json
CHANGED