@ekgf/grapharch 0.0.0-stage → 0.2.21

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2025 Enterprise Knowledge Graph Forum, Object Management Group Inc.
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,23 @@
1
- # Temporary Holding Version
1
+ # GraphArch
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Generate documentation websites, specifications, and PDFs from a documentation
4
+ knowledge graph.
5
+
6
+ After the first package release is published:
7
+
8
+ ```sh
9
+ npm install --save-dev @ekgf/grapharch
10
+ npx grapharch --help
11
+ ```
12
+
13
+ Pin GraphArch in your project's lockfile and invoke it in your normal npm scripts
14
+ or CI pipeline. Install optional dependencies: they contain the executable for
15
+ your operating system. Installation and invocation do not download an executable
16
+ from a separate website.
17
+
18
+ Packages are prepared for Linux with glibc 2.28+, macOS 11+, and Windows, on
19
+ Intel/AMD 64-bit and ARM64. Unsupported platforms and missing or mismatched
20
+ platform packages fail with an explicit error.
21
+
22
+ See the [documentation](https://ekgf.github.io/grapharch/) for source configuration,
23
+ publication commands, and examples.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ try { require('../lib/launcher.cjs').main(); }
4
+ catch (error) {
5
+ console.error(`GraphArch: ${error.message}`);
6
+ process.exit(1);
7
+ }
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+ const fs = require('node:fs');
3
+ const path = require('node:path');
4
+ const {spawn} = require('node:child_process');
5
+ const manifest = require('../package.json');
6
+
7
+ function platformPackage({platform, arch, glibc}) {
8
+ const name = `@ekgf/grapharch-${platform}-${arch}`;
9
+ if (!Object.hasOwn(manifest.optionalDependencies, name)) {
10
+ throw new Error(`unsupported platform ${platform}/${arch}; no GraphArch package is published for it`);
11
+ }
12
+ if (platform === 'linux') {
13
+ const match = /^(\d+)\.(\d+)(?:\.|$)/.exec(glibc || '');
14
+ if (!match || Number(match[1]) < 2 || (Number(match[1]) === 2 && Number(match[2]) < 28)) {
15
+ throw new Error('GraphArch requires Linux with glibc 2.28 or newer; musl-based systems are not supported by this package');
16
+ }
17
+ }
18
+ return name;
19
+ }
20
+
21
+ function resolveBinary(options = {}) {
22
+ const platform = options.platform ?? process.platform;
23
+ const arch = options.arch ?? process.arch;
24
+ const glibc = options.glibc ?? (platform === 'linux' ? process.report.getReport().header.glibcVersionRuntime : undefined);
25
+ const name = platformPackage({platform, arch, glibc});
26
+ let metadata;
27
+ try { metadata = (options.resolve ?? require.resolve)(`${name}/package.json`); }
28
+ catch { throw new Error(`platform package ${name}@${manifest.version} is missing; reinstall grapharch with optional dependencies enabled`); }
29
+ const installed = JSON.parse(fs.readFileSync(metadata, 'utf8'));
30
+ if (installed.name !== name || installed.version !== manifest.version) {
31
+ throw new Error(`platform package version mismatch: expected ${name}@${manifest.version}`);
32
+ }
33
+ const binary = path.join(path.dirname(metadata), 'bin', platform === 'win32' ? 'grapharch.exe' : 'grapharch');
34
+ if (!fs.statSync(binary).isFile()) throw new Error(`platform package ${name} has no executable`);
35
+ fs.accessSync(binary, fs.constants.X_OK);
36
+ return binary;
37
+ }
38
+
39
+ function main(args = process.argv.slice(2)) {
40
+ const child = spawn(resolveBinary(), args, {stdio:'inherit', shell:false});
41
+ const handlers = new Map();
42
+ for (const signal of ['SIGINT', 'SIGTERM']) {
43
+ const handler = () => child.kill(signal);
44
+ handlers.set(signal, handler);
45
+ process.on(signal, handler);
46
+ }
47
+ const cleanup = () => {
48
+ for (const [signal, handler] of handlers) process.removeListener(signal, handler);
49
+ };
50
+ child.once('error', error => {
51
+ cleanup();
52
+ console.error(`GraphArch: cannot start the installed executable: ${error.message}`);
53
+ process.exit(1);
54
+ });
55
+ child.once('exit', (code, signal) => {
56
+ cleanup();
57
+ if (signal) process.kill(process.pid, signal);
58
+ else process.exit(code);
59
+ });
60
+ }
61
+ module.exports = {platformPackage, resolveBinary, main};
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@ekgf/grapharch",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.21",
4
+ "description": "Generate documentation websites, specifications, and PDFs from a documentation knowledge graph",
5
+ "license": "MIT",
6
+ "homepage": "https://ekgf.github.io/grapharch/",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/EKGF/grapharch.git",
10
+ "directory": "npm"
11
+ },
12
+ "bin": {
13
+ "grapharch": "bin/grapharch.cjs"
14
+ },
15
+ "files": [
16
+ "bin/",
17
+ "lib/",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "engines": {
22
+ "node": ">=20"
23
+ },
24
+ "scripts": {
25
+ "test": "node --test tests/*.test.cjs"
26
+ },
27
+ "optionalDependencies": {
28
+ "@ekgf/grapharch-linux-x64": "0.2.21",
29
+ "@ekgf/grapharch-linux-arm64": "0.2.21",
30
+ "@ekgf/grapharch-darwin-x64": "0.2.21",
31
+ "@ekgf/grapharch-darwin-arm64": "0.2.21",
32
+ "@ekgf/grapharch-win32-x64": "0.2.21",
33
+ "@ekgf/grapharch-win32-arm64": "0.2.21"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ }
38
+ }