jsdoc-scribe 1.0.0 → 1.0.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/README.md +8 -29
- package/lib/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ dotfolder are skipped automatically.
|
|
|
43
43
|
gen-comments src/utils.ts # preview only -> utils.commented.ts
|
|
44
44
|
gen-comments . # scan whole project, preview only
|
|
45
45
|
gen-comments . --write # scan whole project, edit in place
|
|
46
|
-
gen-comments src --write --force
|
|
46
|
+
gen-comments src --write --force # also re-document already-commented files
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
If you run `--write` outside a git repo, the CLI prints a one-line warning
|
|
@@ -62,9 +62,9 @@ or revert against.
|
|
|
62
62
|
- `VariableStatement` (`const`/`let`/`var`, including arrow/function inits)
|
|
63
63
|
- `PropertyAssignment` with a function/arrow value inside an object literal
|
|
64
64
|
- `InterfaceDeclaration`, `TypeAliasDeclaration`, `EnumDeclaration`
|
|
65
|
-
3. **Skip** any node that already has a leading `/** ... */` block
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
3. **Skip** any node that already has a leading `/** ... */` block — unless
|
|
66
|
+
`--force` is passed. This keeps the tool idempotent: running it twice
|
|
67
|
+
never duplicates comments.
|
|
68
68
|
4. **Build** the comment block from pure syntax only:
|
|
69
69
|
- An explicit type annotation is always used as-is.
|
|
70
70
|
- With no annotation, it falls back to a syntactic guess: literal kind for
|
|
@@ -75,10 +75,9 @@ or revert against.
|
|
|
75
75
|
- Modifiers (`async`, `static`, `private`, `readonly`, `abstract`,
|
|
76
76
|
`export`, generator `*`) are read directly off the AST node.
|
|
77
77
|
5. **Insert** the comment as plain text at the exact byte offset where the
|
|
78
|
-
node's own line indentation begins. All edits
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
happen.
|
|
78
|
+
node's own line indentation begins. All edits are collected first, then
|
|
79
|
+
applied bottom-to-top so earlier offsets never shift — the rest of the
|
|
80
|
+
file is never re-printed or reformatted, only insertions happen.
|
|
82
81
|
6. **Write** the result — to `<file>.commented.<ext>` by default, or back to
|
|
83
82
|
the original file with `--write`.
|
|
84
83
|
|
|
@@ -101,31 +100,11 @@ const files = collectFiles('src');
|
|
|
101
100
|
there would mangle the call expression. Anything with its own declaration
|
|
102
101
|
(function decl, class member, variable, named object property) is covered.
|
|
103
102
|
- Type/return inference is 100% syntactic. It is never "smart" about what
|
|
104
|
-
your code *means* — only what it *looks like* structurally.
|
|
105
|
-
whole point: deterministic, reproducible output, every time.
|
|
103
|
+
your code *means* — only what it *looks like* structurally.
|
|
106
104
|
- Multi-declarator statements (`const a = 1, b = 2;`) get one combined block
|
|
107
105
|
rather than a per-declarator function-style doc.
|
|
108
106
|
- `.d.ts` files are skipped (no implementation to document).
|
|
109
107
|
|
|
110
|
-
## Development
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
git clone <your-repo-url>
|
|
114
|
-
cd jsdoc-scribe
|
|
115
|
-
npm install
|
|
116
|
-
npm test # runs the self-test suite (test/run.js)
|
|
117
|
-
npm run demo # runs the CLI against the bundled example/ files
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Publishing new versions
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
npm version patch # or minor / major
|
|
124
|
-
npm publish
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
`prepublishOnly` runs the test suite automatically before every publish.
|
|
128
|
-
|
|
129
108
|
## License
|
|
130
109
|
|
|
131
110
|
MIT
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* comment-block-generator — lib/index.js
|
|
5
5
|
* ----------------------------------------
|
|
6
6
|
* A PURE, deterministic, AST-based JSDoc comment generator.
|
|
7
7
|
* No AI / LLM / external API is used anywhere — every comment line is
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsdoc-scribe",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Pure AST-based JSDoc comment generator for
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Pure, deterministic, AST-based JSDoc comment generator for JavaScript & TypeScript. No AI involved — every comment line comes straight from the syntax tree.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"gen-comments": "./bin/cli.js"
|