Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const initBackup = (rootPath, localSiteFiles) =>
dirAsJson.writeJsonToDir(
path.join(rootPath, ".corvid", "backup"),
localSiteFiles
);
const initTempDir = async files => {
const tempLocalSitePath = await makeTempDir("test-site");
if (files) {
await dirAsJson.writeJsonToDir(tempLocalSitePath, files);
}
return tempLocalSitePath;
};
const initLocalSite = async (localSiteFiles, createdRoodDir) => {
const rootDir = createdRoodDir || (await initTempDir());
const corvidRcPath = path.join(rootDir, ".corvid", "corvidrc.json");
await fs.ensureFile(corvidRcPath);
await fs.writeFile(corvidRcPath, JSON.stringify({ metasiteId: 12345 }));
await dirAsJson.writeJsonToDir(siteSrcPath(rootDir), localSiteFiles);
return rootDir;
};
const listFilesRecursive = async siteRootPath =>
Object.keys(
await readDirToJson(siteRootPath, {
delimiter: "/",
readFiles: false,
onlyFiles: true
})
);