mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Added confirmation before overwriting your LDB with the tool command (#482)
This commit is contained in:
parent
bb9036ee7a
commit
243630878b
3 changed files with 51 additions and 20 deletions
6
package-lock.json
generated
6
package-lock.json
generated
|
|
@ -9,6 +9,7 @@
|
||||||
"autocompleter": "^9.3.2",
|
"autocompleter": "^9.3.2",
|
||||||
"gulp": "^5.0.0",
|
"gulp": "^5.0.0",
|
||||||
"gulp-less": "^5.0.0",
|
"gulp-less": "^5.0.0",
|
||||||
|
"readline": "^1.3.0",
|
||||||
"rollup": "^4.40.0"
|
"rollup": "^4.40.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
@ -4263,6 +4264,11 @@
|
||||||
"url": "https://github.com/sponsors/jonschlinkert"
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/readline": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/readline/-/readline-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-k2d6ACCkiNYz222Fs/iNze30rRJ1iIicW7JuX/7/cozvih6YCkFZH+J6mAFDVgv0dRBaAyr4jDqC95R2y4IADg=="
|
||||||
|
},
|
||||||
"node_modules/rechoir": {
|
"node_modules/rechoir": {
|
||||||
"version": "0.8.0",
|
"version": "0.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
"build": "npm run rollup && npm run gulp",
|
"build": "npm run rollup && npm run gulp",
|
||||||
"rollup": "rollup -c",
|
"rollup": "rollup -c",
|
||||||
"gulp": "gulp less",
|
"gulp": "gulp less",
|
||||||
|
"readline": "^1.3.0",
|
||||||
"pushLDBtoYML": "node ./tools/pushLDBtoYML.mjs",
|
"pushLDBtoYML": "node ./tools/pushLDBtoYML.mjs",
|
||||||
"pullYMLtoLDB": "node ./tools/pullYMLtoLDB.mjs",
|
"pullYMLtoLDB": "node ./tools/pullYMLtoLDB.mjs",
|
||||||
"createSymlink": "node ./tools/create-symlink.mjs"
|
"createSymlink": "node ./tools/create-symlink.mjs"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,32 @@
|
||||||
import { compilePack } from '@foundryvtt/foundryvtt-cli';
|
import { compilePack } from '@foundryvtt/foundryvtt-cli';
|
||||||
|
import readline from 'node:readline/promises';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
|
||||||
const MODULE_ID = process.cwd();
|
const MODULE_ID = process.cwd();
|
||||||
const yaml = false;
|
const yaml = false;
|
||||||
|
|
||||||
|
const rl = readline.createInterface({
|
||||||
|
input: process.stdin,
|
||||||
|
output: process.stdout
|
||||||
|
});
|
||||||
|
|
||||||
|
const answer = await rl.question(
|
||||||
|
'You are about to overwrite your current database with the saved packs/json. Write "Overwrite" if you are sure. ',
|
||||||
|
function (answer) {
|
||||||
|
rl.close();
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (answer.toLowerCase() === 'overwrite') {
|
||||||
|
await pullToLDB();
|
||||||
|
} else {
|
||||||
|
console.log('Canceled');
|
||||||
|
}
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
|
||||||
|
async function pullToLDB() {
|
||||||
const packs = await deepGetDirectories('./packs');
|
const packs = await deepGetDirectories('./packs');
|
||||||
console.log(packs);
|
console.log(packs);
|
||||||
for (const pack of packs) {
|
for (const pack of packs) {
|
||||||
|
|
@ -29,3 +52,4 @@ async function deepGetDirectories(distPath) {
|
||||||
|
|
||||||
return dirrsWithSub;
|
return dirrsWithSub;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue