Browse Source

fix: delete .gitkeep files after copying data folder

Nicolas Meienberger 1 year ago
parent
commit
93282a051e
1 changed files with 7 additions and 0 deletions
  1. 7 0
      packages/cli/src/executors/app/app.helpers.ts

+ 7 - 0
packages/cli/src/executors/app/app.helpers.ts

@@ -2,10 +2,14 @@ import crypto from 'crypto';
 import fs from 'fs';
 import fs from 'fs';
 import path from 'path';
 import path from 'path';
 import { appInfoSchema, envMapToString, envStringToMap } from '@runtipi/shared';
 import { appInfoSchema, envMapToString, envStringToMap } from '@runtipi/shared';
+import { exec } from 'child_process';
+import { promisify } from 'util';
 import { getEnv } from '@/utils/environment/environment';
 import { getEnv } from '@/utils/environment/environment';
 import { generateVapidKeys, getAppEnvMap } from './env.helpers';
 import { generateVapidKeys, getAppEnvMap } from './env.helpers';
 import { pathExists } from '@/utils/fs-helpers';
 import { pathExists } from '@/utils/fs-helpers';
 
 
+const execAsync = promisify(exec);
+
 /**
 /**
  *  This function generates a random string of the provided length by using the SHA-256 hash algorithm.
  *  This function generates a random string of the provided length by using the SHA-256 hash algorithm.
  *  It takes the provided name and a seed value, concatenates them, and uses them as input for the hash algorithm.
  *  It takes the provided name and a seed value, concatenates them, and uses them as input for the hash algorithm.
@@ -186,4 +190,7 @@ export const copyDataDir = async (id: string) => {
       }
       }
     }),
     }),
   );
   );
+
+  // Remove any .gitkeep files from the app-data folder at any level
+  await execAsync(`find ${storagePath}/app-data/${id}/data -name .gitkeep -delete`);
 };
 };