mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-27 14:54:55 +00:00
Tidy up shouldSkipAcquire, skip manifest check on --force
This commit is contained in:
parent
410db7da3c
commit
a5eed7297b
@ -205,24 +205,30 @@ function readManifest(target) {
|
|||||||
try {
|
try {
|
||||||
return ini.parse(fs.readFileSync(path.resolve(target, MANIFEST_FILENAME), 'utf8'));
|
return ini.parse(fs.readFileSync(path.resolve(target, MANIFEST_FILENAME), 'utf8'));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldSkipAcquire(target, desiredManifest, force) {
|
function shouldSkipAcquire(target, desiredManifest, force) {
|
||||||
|
if (force) {
|
||||||
|
console.log('Skipping manifest check as --force is enabled');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const existingManifest = readManifest(target);
|
const existingManifest = readManifest(target);
|
||||||
|
|
||||||
if (!existingManifest) {
|
if (!existingManifest) {
|
||||||
console.log('No manifest at the target, proceeding.');
|
console.log('No manifest at the target, proceeding.');
|
||||||
} else if (!Object.keys(desiredManifest).every(key => existingManifest[key] === desiredManifest[key])) {
|
return false;
|
||||||
console.log('Target has is non-empty but has a different manifest, overwriting.');
|
|
||||||
} else if (force) {
|
|
||||||
console.log('Target has a matching manifest but download forced.');
|
|
||||||
} else {
|
|
||||||
console.log('Matching manifest already exists at target - nothing to do (use --force to override)');
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
if (!Object.keys(desiredManifest).every(key => existingManifest[key] === desiredManifest[key])) {
|
||||||
|
console.log('Target directory has a differing manifest, overwriting.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Matching manifest already exists at target - nothing to do (use --force to override)');
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const optionDefinitions = [
|
const optionDefinitions = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user