mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 22:49:18 +00:00
refactor: rename project
This commit is contained in:
committed by
Carlos Valente
parent
c9ef8d55c1
commit
46195fc043
@@ -59,35 +59,6 @@ export function doesProjectExist(name: string): boolean {
|
||||
return existsSync(projectFilePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Validates the existence of project files.
|
||||
* @param {object} projectFiles
|
||||
* @param {string} projectFiles.projectFilename
|
||||
* @param {string} projectFiles.newFilename
|
||||
*
|
||||
* @returns {Promise<Array<string>>} Array of errors
|
||||
*
|
||||
*/
|
||||
export const validateProjectFiles = (projectFiles: { filename?: string; newFilename?: string }): Array<string> => {
|
||||
const errors: string[] = [];
|
||||
|
||||
// current project must exist
|
||||
if (projectFiles.filename) {
|
||||
if (!doesProjectExist(projectFiles.filename)) {
|
||||
errors.push('Project file does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
// new project must NOT exist
|
||||
if (projectFiles.newFilename) {
|
||||
if (doesProjectExist(projectFiles.newFilename)) {
|
||||
errors.push('New project file already exists');
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the absolute path to a project file
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user