Skip to content
Snippets Groups Projects
Commit 8efd6a6a authored by Mike Lynch's avatar Mike Lynch
Browse files

Added a --merge flag to simple-deposit.js for merging changes using the 'additive'

feature on ocfl-js - only add or update files in the incoming version, don't delete
anything, bring forward all unchanged files from the previous version
parent eef21aaa
Branches
No related merge requests found
This diff is collapsed.
......@@ -14,11 +14,11 @@
"license": "GPL-3.0",
"dependencies": {
"fs-extra": "^8.1.0",
"jsonld": "^1.6.2",
"jsonld": "^1.8.1",
"nunjucks": "^3.2.0",
"ocfl": "^1.0.3",
"ro-crate": "^1.2.10",
"uuid": "^3.3.3",
"ocfl": "^1.0.9",
"ro-crate": "^1.2.20",
"uuid": "^3.4.0",
"yargs": "^13.3.0"
}
}
......@@ -30,13 +30,14 @@ async function main() {
const repoPath = argv.repo;
const objectId = argv.oid;
const contentDir = argv.content;
const merge = argv.merge;
if( ! repoPath ) {
console.error("Need an --repo to deposit to");
return;
}
if( ! objectId ) {
console.error("Need an --oid to deposit to");
return;
......@@ -47,6 +48,11 @@ async function main() {
return;
}
if( merge ) {
console.warn("Merging new content over previous version");
}
try {
const stat = await fs.stat(contentDir);
if( stat.isDirectory() ) {
......@@ -54,7 +60,7 @@ async function main() {
console.log("Connected to " + repoPath);
await repo.importNewObjectDir(objectId, contentDir);
await repo.importNewObjectDir(objectId, contentDir, merge);
console.log(`Updated ${objectId}`);
} else {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment