@thi.ng/tangle 1.1.38 → 1.1.40
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 +7 -1
- package/cli.js +42 -40
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-09-
|
|
3
|
+
- **Last updated**: 2025-09-25T11:10:32Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -11,6 +11,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
11
11
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
12
|
and/or version bumps of transitive dependencies.
|
|
13
13
|
|
|
14
|
+
### [1.1.39](https://github.com/thi-ng/umbrella/tree/@thi.ng/tangle@1.1.39) (2025-09-25)
|
|
15
|
+
|
|
16
|
+
#### ♻️ Refactoring
|
|
17
|
+
|
|
18
|
+
- simplify CLI impl via cliApp() wrapper ([f6ae3be](https://github.com/thi-ng/umbrella/commit/f6ae3be))
|
|
19
|
+
|
|
14
20
|
### [1.1.34](https://github.com/thi-ng/umbrella/tree/@thi.ng/tangle@1.1.34) (2025-08-06)
|
|
15
21
|
|
|
16
22
|
#### ♻️ Refactoring
|
package/cli.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARG_DRY_RUN,
|
|
3
3
|
ARG_VERBOSE,
|
|
4
|
-
ParseError,
|
|
5
4
|
THING_HEADER,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
cliApp,
|
|
6
|
+
configureLogLevel,
|
|
7
|
+
flag
|
|
9
8
|
} from "@thi.ng/args";
|
|
10
9
|
import { readJSON, writeText } from "@thi.ng/file-io";
|
|
11
|
-
import { ConsoleLogger } from "@thi.ng/logger";
|
|
12
10
|
import { join } from "node:path";
|
|
13
11
|
import { tangleFile } from "./tangle.js";
|
|
14
|
-
const argOpts = {
|
|
15
|
-
...ARG_DRY_RUN,
|
|
16
|
-
...ARG_VERBOSE,
|
|
17
|
-
noComments: flag({ default: false, desc: "don't generate comments" })
|
|
18
|
-
};
|
|
19
12
|
const PKG = readJSON(join(process.argv[2], "package.json"));
|
|
20
13
|
const APP_NAME = PKG.name.split("/")[1];
|
|
21
14
|
const HEADER = THING_HEADER(
|
|
@@ -23,42 +16,51 @@ const HEADER = THING_HEADER(
|
|
|
23
16
|
PKG.version,
|
|
24
17
|
"Literate programming code block tangling"
|
|
25
18
|
);
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
const CMD = {
|
|
20
|
+
desc: "",
|
|
21
|
+
opts: {},
|
|
22
|
+
inputs: [1, Infinity],
|
|
23
|
+
fn: async ({ opts, inputs, logger }) => {
|
|
24
|
+
let ctx = {
|
|
25
|
+
logger,
|
|
26
|
+
opts: {
|
|
27
|
+
comments: opts.noComments !== true
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
for (let file of inputs) {
|
|
31
|
+
ctx = tangleFile(file, ctx);
|
|
32
|
+
}
|
|
33
|
+
for (let out in ctx.outputs) {
|
|
34
|
+
writeText(out, ctx.outputs[out], ctx.logger, opts.dryRun);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
cliApp({
|
|
39
|
+
name: "tangle",
|
|
40
|
+
start: 3,
|
|
41
|
+
opts: {
|
|
42
|
+
...ARG_DRY_RUN,
|
|
43
|
+
...ARG_VERBOSE,
|
|
44
|
+
noComments: flag({ default: false, desc: "don't generate comments" })
|
|
45
|
+
},
|
|
46
|
+
commands: { CMD },
|
|
47
|
+
single: true,
|
|
48
|
+
usage: {
|
|
49
|
+
lineWidth: process.stdout.columns,
|
|
50
|
+
prefix: `${HEADER}
|
|
29
51
|
|
|
30
52
|
usage: ${APP_NAME} [OPTS] SOURCE-FILES(S) ...
|
|
31
53
|
${APP_NAME} --help
|
|
32
54
|
|
|
33
55
|
`,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
try {
|
|
42
|
-
const result = parse(argOpts, process.argv, { start: 3, usageOpts });
|
|
43
|
-
if (!result) process.exit(1);
|
|
44
|
-
const { result: opts, rest } = result;
|
|
45
|
-
if (!rest.length) showUsage();
|
|
46
|
-
let ctx = {
|
|
47
|
-
logger: new ConsoleLogger("tangle", opts.verbose ? "DEBUG" : "INFO"),
|
|
48
|
-
opts: {
|
|
49
|
-
comments: opts.noComments !== true
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
for (let file of rest) {
|
|
53
|
-
ctx = tangleFile(file, ctx);
|
|
54
|
-
}
|
|
55
|
-
for (let out in ctx.outputs) {
|
|
56
|
-
writeText(out, ctx.outputs[out], ctx.logger, opts.dryRun);
|
|
56
|
+
showGroupNames: true,
|
|
57
|
+
paramWidth: 20
|
|
58
|
+
},
|
|
59
|
+
ctx: async (ctx) => {
|
|
60
|
+
configureLogLevel(ctx.logger, ctx.opts.verbose);
|
|
61
|
+
return ctx;
|
|
57
62
|
}
|
|
58
|
-
}
|
|
59
|
-
if (!(e instanceof ParseError)) process.stderr.write(e.message);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
63
|
+
});
|
|
62
64
|
export {
|
|
63
65
|
APP_NAME,
|
|
64
66
|
HEADER,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/tangle",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.40",
|
|
4
4
|
"description": "Literate programming code block tangling / codegen utility, inspired by org-mode & noweb",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@thi.ng/api": "^8.12.2",
|
|
44
|
-
"@thi.ng/args": "^2.10.
|
|
44
|
+
"@thi.ng/args": "^2.10.2",
|
|
45
45
|
"@thi.ng/checks": "^3.7.18",
|
|
46
46
|
"@thi.ng/compare": "^2.4.28",
|
|
47
47
|
"@thi.ng/date": "^2.7.64",
|
|
48
48
|
"@thi.ng/errors": "^2.5.42",
|
|
49
|
-
"@thi.ng/file-io": "^2.2.
|
|
50
|
-
"@thi.ng/logger": "^3.
|
|
49
|
+
"@thi.ng/file-io": "^2.2.10",
|
|
50
|
+
"@thi.ng/logger": "^3.2.0",
|
|
51
51
|
"@thi.ng/strings": "^3.9.22",
|
|
52
|
-
"@thi.ng/transducers": "^9.6.
|
|
52
|
+
"@thi.ng/transducers": "^9.6.10"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^24.3.0",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"thi.ng": {
|
|
104
104
|
"year": 2022
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "3c3531350eec56011982583c694aeb1a2e0d0ff4\n"
|
|
107
107
|
}
|