nerdgram1337 0.0.0-stage → 1.1.5
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/LICENSE +21 -0
- package/README.md +47 -2
- package/bin/nerdgram.js +35 -0
- package/dist/chunk-EGA2UGTF.js +1966 -0
- package/dist/chunk-KO565WWM.js +471 -0
- package/dist/chunk-ZH7YZLR3.js +322 -0
- package/dist/cli.js +536 -0
- package/package.json +48 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ryan Thomas Huff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# nerdgram1337
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`nerdgram` is the command-line client for [NerdGram1337](https://github.com/NetworkNerd1337/NerdGram1337), a local app for [Mermaid](https://mermaid.js.org/) diagrams. The npm package name is `nerdgram1337`. The command it installs is `nerdgram`.
|
|
4
|
+
|
|
5
|
+
List, search, and edit diagrams on a NerdGram server that is already running. `lint` and `render` of a `.mmd` file that is already on disk do not need the server.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Node.js 20 or newer, and npm 10 or newer.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g nerdgram1337
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx nerdgram1337 --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`npm install -g` puts `nerdgram` on your `PATH`. `npx` runs that command without a global install. The package is public.
|
|
20
|
+
|
|
21
|
+
The install also downloads Mermaid and Puppeteer's chrome-headless-shell. Offline `lint` uses Mermaid's parser. Offline `render` uses that shell, which is the large part of the download. Commands that only call the API do not launch it.
|
|
22
|
+
|
|
23
|
+
## Use
|
|
24
|
+
|
|
25
|
+
`NERDGRAM_URL` defaults to `http://127.0.0.1:8787`. `NERDGRAM_TOKEN` is an automation token from Settings in the app. `--url` and `--token` override those. `--json` prints one JSON object. The process exits `1` when the command fails.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export NERDGRAM_URL=http://127.0.0.1:8787
|
|
29
|
+
export NERDGRAM_TOKEN=ng_your_token
|
|
30
|
+
|
|
31
|
+
nerdgram --help
|
|
32
|
+
nerdgram list
|
|
33
|
+
nerdgram search Atlanta
|
|
34
|
+
nerdgram get Welcome.mmd -o Welcome.mmd
|
|
35
|
+
nerdgram put Notes.mmd ./Notes.mmd
|
|
36
|
+
nerdgram lint Welcome.mmd
|
|
37
|
+
nerdgram render Welcome.mmd -o Welcome.svg
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`render` of a local `.mmd` file does not need a server. `--server` sends it to the API instead. `lint` of a local file does not need a server either. `lint` exits `1` when a diagnostic is an error.
|
|
41
|
+
|
|
42
|
+
The app still has to be reachable for every other command. A token does not make it safe to publish port 8787. The server is a single-user app with no login. Keep it on loopback.
|
|
43
|
+
|
|
44
|
+
The full command list and the release notes are in the [repository README](https://github.com/NetworkNerd1337/NerdGram1337#command-line-tool).
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT © Ryan Thomas Huff
|
package/bin/nerdgram.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
// A checkout uses the server build so local edits apply without a pack.
|
|
10
|
+
// A registry install has only the bundled program under dist/.
|
|
11
|
+
const checkout = [
|
|
12
|
+
process.env.NERDGRAM_CLI,
|
|
13
|
+
path.resolve(here, "../../server/dist/cli.js"),
|
|
14
|
+
path.resolve(here, "../server/dist/cli.js"),
|
|
15
|
+
].filter((file) => typeof file === "string" && file.length > 0);
|
|
16
|
+
|
|
17
|
+
const bundled = path.resolve(here, "../dist/cli.js");
|
|
18
|
+
const imageCli = "/app/server/dist/cli.js";
|
|
19
|
+
const target =
|
|
20
|
+
checkout.find((file) => existsSync(file)) ??
|
|
21
|
+
(existsSync(bundled) ? bundled : existsSync(imageCli) ? imageCli : undefined);
|
|
22
|
+
|
|
23
|
+
if (!target) {
|
|
24
|
+
console.error(
|
|
25
|
+
"nerdgram could not find its program. From a checkout, run npm run build, then node server/dist/cli.js. From npm, reinstall nerdgram1337.",
|
|
26
|
+
);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const result = spawnSync(process.execPath, [target, ...process.argv.slice(2)], { stdio: "inherit" });
|
|
31
|
+
if (result.error) {
|
|
32
|
+
console.error(result.error.message);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
process.exit(result.status ?? 1);
|