@magland/mochi 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-info.json +2 -2
- package/dist/cli/backup-cmd.js +28 -0
- package/dist/markdown.js +1 -0
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
package/dist/cli/backup-cmd.js
CHANGED
|
@@ -532,6 +532,29 @@ function walkFiles(dir, rel = '', out = []) {
|
|
|
532
532
|
}
|
|
533
533
|
return out;
|
|
534
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Every directory under dir, as paths relative to it, each after its parent.
|
|
537
|
+
* Listed apart from the files because an empty directory can matter: a bare
|
|
538
|
+
* repository whose refs are all packed has an empty refs/, and git does not
|
|
539
|
+
* take a directory without refs/ for a repository.
|
|
540
|
+
*/
|
|
541
|
+
function walkDirs(dir, rel = '', out = []) {
|
|
542
|
+
let entries;
|
|
543
|
+
try {
|
|
544
|
+
entries = fs.readdirSync(path.join(dir, rel), { withFileTypes: true });
|
|
545
|
+
}
|
|
546
|
+
catch {
|
|
547
|
+
return out;
|
|
548
|
+
}
|
|
549
|
+
for (const e of entries) {
|
|
550
|
+
if (!e.isDirectory())
|
|
551
|
+
continue;
|
|
552
|
+
const child = rel ? `${rel}/${e.name}` : e.name;
|
|
553
|
+
out.push(child);
|
|
554
|
+
walkDirs(dir, child, out);
|
|
555
|
+
}
|
|
556
|
+
return out;
|
|
557
|
+
}
|
|
535
558
|
/**
|
|
536
559
|
* A snapshot of current/ as a directory of hardlinks: one inode per file and no
|
|
537
560
|
* data, and still a servable vault.
|
|
@@ -551,11 +574,16 @@ function takeSnapshot(dir, quiet) {
|
|
|
551
574
|
if (fs.existsSync(to)) {
|
|
552
575
|
throw new exit_1.CliError(`A snapshot named ${name} is already there, so this second is left alone.`, exit_1.EXIT_CONFLICT);
|
|
553
576
|
}
|
|
577
|
+
const dirs = walkDirs(from);
|
|
554
578
|
const files = walkFiles(from);
|
|
555
579
|
const maxLinks = before + 1;
|
|
556
580
|
fs.mkdirSync(to, { recursive: true });
|
|
557
581
|
let linked = 0;
|
|
558
582
|
try {
|
|
583
|
+
// Every directory, not only those a file lands in, so that the snapshot has
|
|
584
|
+
// the empty ones too and its repositories are still repositories.
|
|
585
|
+
for (const rel of dirs)
|
|
586
|
+
fs.mkdirSync(path.join(to, rel), { recursive: true });
|
|
559
587
|
for (const rel of files) {
|
|
560
588
|
const src = path.join(from, rel);
|
|
561
589
|
const st = fs.lstatSync(src);
|
package/dist/markdown.js
CHANGED
|
@@ -465,6 +465,7 @@ function buildMarkdownIt() {
|
|
|
465
465
|
block.children = out;
|
|
466
466
|
}
|
|
467
467
|
});
|
|
468
|
+
md.renderer.rules.softbreak = (_tokens, _idx, options, env) => options.breaks || env.opts.breaks ? '<br>\n' : '\n';
|
|
468
469
|
md.renderer.rules.fence = (tokens, idx, _options, env) => {
|
|
469
470
|
const token = tokens[idx];
|
|
470
471
|
const info = token.info.trim().split(/\s+/)[0].toLowerCase();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magland/mochi",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "A self-hosted git forge with the shape of GitHub: browsing, in-browser editing, issues, pull requests, Actions-compatible workflows, static sites, and Git LFS, from one small server.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|