@kenjura/ursa 0.6.0 → 0.8.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # 0.8.0
2
+
3
+ 2023-12-31
4
+
5
+ - Fixed recursive-readdir to actually return directories, not just files
6
+
7
+ # 0.7.0
8
+
9
+ 2023-08-01
10
+
11
+ - removed all non-public modules
12
+
13
+ # 0.6.0
14
+
15
+ 2023-08-01
16
+
17
+ - removed some dependencies that required private auth for npm install
18
+
1
19
  # 0.5.0
2
20
 
3
21
  2023-05-08
package/package.json CHANGED
@@ -2,14 +2,14 @@
2
2
  "name": "@kenjura/ursa",
3
3
  "author": "Andrew London <andrew@kenjura.com>",
4
4
  "type": "module",
5
- "version": "0.6.0",
5
+ "version": "0.8.0",
6
6
  "description": "static site generator from MD/wikitext/YML",
7
7
  "main": "lib/index.js",
8
8
  "scripts": {
9
9
  "serve": "nodemon --config nodemon.json src/serve.js",
10
10
  "serve:debug": "nodemon --config nodemon.json --inspect-brk src/serve.js",
11
11
  "start": "node src/index.js",
12
- "test": "echo \"Error: no test specified\" && exit 1"
12
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
13
13
  },
14
14
  "license": "ISC",
15
15
  "repository": {
@@ -27,10 +27,10 @@
27
27
  "markdown-it-sup": "^1.0.0",
28
28
  "node-watch": "^0.7.3",
29
29
  "object-to-xml": "^2.0.0",
30
- "recursive-readdir": "github:kenjura/recursive-readdir",
31
30
  "yaml": "^2.1.3"
32
31
  },
33
32
  "devDependencies": {
33
+ "jest": "^29.6.2",
34
34
  "node-static": "^0.7.11",
35
35
  "nodemon": "^2.0.15"
36
36
  },
@@ -1,38 +1,38 @@
1
1
  import { hasExt } from "../pathExtReader.js";
2
- import { expect } from "chai";
2
+ // import { expect } from "chai";
3
3
 
4
4
  describe("hasExt", () => {
5
5
  it("returns true for /foo/bar.html", () => {
6
- expect(hasExt("/foo/bar.html")).to.eq(true);
6
+ expect(hasExt("/foo/bar.html")).toEqual(true);
7
7
  });
8
8
  it("returns true for /foo/bar.md", () => {
9
- expect(hasExt("/foo/bar.md")).to.eq(true);
9
+ expect(hasExt("/foo/bar.md")).toEqual(true);
10
10
  });
11
11
  it("returns true for /foo/bar.json", () => {
12
- expect(hasExt("/foo/bar.json")).to.eq(true);
12
+ expect(hasExt("/foo/bar.json")).toEqual(true);
13
13
  });
14
14
  it("returns true for /bar.html", () => {
15
- expect(hasExt("/bar.html")).to.eq(true);
15
+ expect(hasExt("/bar.html")).toEqual(true);
16
16
  });
17
17
  it("returns true for /bar.html?query=string#anchor", () => {
18
- expect(hasExt("/bar.html?query=string#anchor")).to.eq(true);
18
+ expect(hasExt("/bar.html?query=string#anchor")).toEqual(true);
19
19
  });
20
20
  it("returns false for /foo/bar", () => {
21
- expect(hasExt("/foo/bar")).to.eq(false);
21
+ expect(hasExt("/foo/bar")).toEqual(false);
22
22
  });
23
23
  it("returns false for /foo", () => {
24
- expect(hasExt("/foo")).to.eq(false);
24
+ expect(hasExt("/foo")).toEqual(false);
25
25
  });
26
26
  it("returns false for /foo/bar.", () => {
27
- expect(hasExt("/foo/bar.")).to.eq(false);
27
+ expect(hasExt("/foo/bar.")).toEqual(false);
28
28
  });
29
29
  it("returns false for /foo/bar?query=string#anchor", () => {
30
- expect(hasExt("/foo/bar?query=string#anchor")).to.eq(false);
30
+ expect(hasExt("/foo/bar?query=string#anchor")).toEqual(false);
31
31
  });
32
32
  it("returns false for /", () => {
33
- expect(hasExt("/")).to.eq(false);
33
+ expect(hasExt("/")).toEqual(false);
34
34
  });
35
35
  it('returns false for ""', () => {
36
- expect(hasExt("")).to.eq(false);
36
+ expect(hasExt("")).toEqual(false);
37
37
  });
38
38
  });
@@ -0,0 +1,13 @@
1
+ import { resolve } from "path";
2
+ import { readdir } from "fs/promises";
3
+
4
+ export async function recurse(dir) {
5
+ const dirents = await readdir(dir, { withFileTypes: true });
6
+ const files = await Promise.all(
7
+ dirents.map(async (dirent) => {
8
+ const res = resolve(dir, dirent.name);
9
+ return dirent.isDirectory() ? [res, ...(await recurse(res))] : res;
10
+ })
11
+ );
12
+ return Array.prototype.concat(...files);
13
+ }
@@ -1,4 +1,4 @@
1
- import recurse from "recursive-readdir";
1
+ import { recurse } from "../helper/recursive-readdir.js";
2
2
 
3
3
  import { copyFile, mkdir, readdir, readFile } from "fs/promises";
4
4
  import { getAutomenu } from "../helper/automenu.js";