hongdown 0.1.0-dev.3

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.
Files changed (2) hide show
  1. package/bin/hongdown.js +34 -0
  2. package/package.json +37 -0
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+ import { createRequire } from "node:module";
4
+
5
+ const require = createRequire(import.meta.url);
6
+
7
+ const PLATFORMS = {
8
+ "darwin-arm64": "@hongdown/darwin-arm64",
9
+ "darwin-x64": "@hongdown/darwin-x64",
10
+ "linux-arm64": "@hongdown/linux-arm64",
11
+ "linux-x64": "@hongdown/linux-x64",
12
+ "win32-arm64": "@hongdown/win32-arm64",
13
+ "win32-x64": "@hongdown/win32-x64",
14
+ };
15
+
16
+ const platformKey = `${process.platform}-${process.arch}`;
17
+ const packageName = PLATFORMS[platformKey];
18
+
19
+ if (!packageName) {
20
+ console.error(`Unsupported platform: ${platformKey}`);
21
+ process.exit(1);
22
+ }
23
+
24
+ try {
25
+ const binName = process.platform === "win32" ? "hongdown.exe" : "hongdown";
26
+ const binPath = require.resolve(`${packageName}/bin/${binName}`);
27
+ const result = spawnSync(binPath, process.argv.slice(2), {
28
+ stdio: "inherit",
29
+ });
30
+ process.exit(result.status ?? 1);
31
+ } catch (e) {
32
+ console.error(`Failed to run hongdown: ${e.message}`);
33
+ process.exit(1);
34
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "hongdown",
3
+ "version": "0.1.0-dev.3",
4
+ "type": "module",
5
+ "description": "A Markdown formatter that enforces Hong Minhee's Markdown style conventions",
6
+ "license": "GPL-3.0-or-later",
7
+ "author": "Hong Minhee <hong@minhee.org>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/dahlia/hongdown"
11
+ },
12
+ "homepage": "https://github.com/dahlia/hongdown",
13
+ "keywords": [
14
+ "markdown",
15
+ "formatter",
16
+ "linter",
17
+ "style"
18
+ ],
19
+ "bin": {
20
+ "hongdown": "bin/hongdown.js"
21
+ },
22
+ "files": [
23
+ "bin/",
24
+ "README.md"
25
+ ],
26
+ "engines": {
27
+ "node": ">=18"
28
+ },
29
+ "optionalDependencies": {
30
+ "@hongdown/darwin-arm64": "0.0.0",
31
+ "@hongdown/darwin-x64": "0.0.0",
32
+ "@hongdown/linux-arm64": "0.0.0",
33
+ "@hongdown/linux-x64": "0.0.0",
34
+ "@hongdown/win32-arm64": "0.0.0",
35
+ "@hongdown/win32-x64": "0.0.0"
36
+ }
37
+ }