smoonb 0.0.67 → 0.0.68
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/package.json
CHANGED
|
@@ -147,8 +147,8 @@ module.exports = async ({ backupPath, targetProject }) => {
|
|
|
147
147
|
// Após a substituição do Project ID, a estrutura 2 fica: project-id-novo/bucket-name/file1.jpg
|
|
148
148
|
const extractedContents = await fs.readdir(extractDir);
|
|
149
149
|
const bucketDirs = [];
|
|
150
|
-
|
|
151
|
-
// Verificar se a pasta raiz é o Project ID
|
|
150
|
+
|
|
151
|
+
// Verificar se a pasta raiz é o Project ID (antigo ou novo)
|
|
152
152
|
// Se for, as subpastas são os buckets reais
|
|
153
153
|
let rootDir = null;
|
|
154
154
|
if (extractedContents.length === 1) {
|
|
@@ -157,10 +157,14 @@ module.exports = async ({ backupPath, targetProject }) => {
|
|
|
157
157
|
const firstItemStats = await fs.stat(firstItemPath);
|
|
158
158
|
|
|
159
159
|
if (firstItemStats.isDirectory()) {
|
|
160
|
-
// Verificar se o nome da pasta raiz corresponde ao Project ID
|
|
160
|
+
// Verificar se o nome da pasta raiz corresponde ao Project ID antigo OU novo
|
|
161
161
|
// Isso pode acontecer se a pasta raiz original era o Project ID antigo
|
|
162
|
-
// e
|
|
163
|
-
|
|
162
|
+
// e pode ou não ter sido renomeada para o Project ID novo pela função replaceProjectIdInExtractedFiles
|
|
163
|
+
const isProjectId =
|
|
164
|
+
(sourceProjectId && firstItem === sourceProjectId) ||
|
|
165
|
+
(firstItem === targetProject.targetProjectId);
|
|
166
|
+
|
|
167
|
+
if (isProjectId) {
|
|
164
168
|
// Verificar se contém subpastas (buckets reais)
|
|
165
169
|
const subContents = await fs.readdir(firstItemPath);
|
|
166
170
|
const hasSubDirs = subContents.some(item => {
|
|
@@ -176,7 +180,7 @@ module.exports = async ({ backupPath, targetProject }) => {
|
|
|
176
180
|
if (hasSubDirs) {
|
|
177
181
|
// A pasta raiz é um wrapper do Project ID - buscar buckets nas subpastas
|
|
178
182
|
rootDir = firstItem;
|
|
179
|
-
console.log(chalk.white(` - Detectada pasta raiz com Project ID
|
|
183
|
+
console.log(chalk.white(` - Detectada pasta raiz com Project ID: ${firstItem}`));
|
|
180
184
|
console.log(chalk.white(` - Buscando buckets nas subpastas...`));
|
|
181
185
|
}
|
|
182
186
|
}
|