@genepad/app 0.6.2
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 +49 -0
- package/bin/genepad.js +81 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @genepad/app
|
|
2
|
+
|
|
3
|
+
**GenePad** — a DNA sequence viewer and editor for molecular biology research.
|
|
4
|
+
|
|
5
|
+
This npm package is a **launcher**: it installs the prebuilt native GenePad binary for your
|
|
6
|
+
platform (via an `optionalDependencies` sub-package) and exposes the `genepad` command.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @genepad/app
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
npm automatically selects the binary matching your OS and CPU:
|
|
15
|
+
|
|
16
|
+
| Platform | Sub-package |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| Windows x64 | `@genepad/win32-x64` |
|
|
19
|
+
| Linux x64 | `@genepad/linux-x64` |
|
|
20
|
+
| Linux arm64 | `@genepad/linux-arm64` |
|
|
21
|
+
| macOS arm64 | `@genepad/darwin-arm64` |
|
|
22
|
+
|
|
23
|
+
No source code is shipped — only the compiled binary plus this small launcher.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
genepad # launch the GUI
|
|
29
|
+
genepad path/to/file.dna # open a file
|
|
30
|
+
genepad --tool=enzyme-library # open a specific tool window
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
GenePad is a GUI application (Tauri). `genepad` opens a window just like double-clicking the
|
|
34
|
+
native app; it is not a terminal program.
|
|
35
|
+
|
|
36
|
+
## Supported file formats
|
|
37
|
+
|
|
38
|
+
GenBank (`.gb`/`.gbk`), FASTA (`.fa`/`.fasta`), GJSON (`.gjson`), SnapGene (`.dna`), AB1
|
|
39
|
+
chromatograms (`.ab1`).
|
|
40
|
+
|
|
41
|
+
## Notes
|
|
42
|
+
|
|
43
|
+
- Windows: WebView2 is auto-fetched on first launch if missing.
|
|
44
|
+
- Linux: ships a self-contained AppImage (no system libraries required).
|
|
45
|
+
- macOS: ships the `.app` bundle (arm64, currently unsigned). The launcher strips the macOS
|
|
46
|
+
quarantine attribute automatically.
|
|
47
|
+
- Android is not distributed via npm — use the APK/AAB from the official site or app store.
|
|
48
|
+
|
|
49
|
+
Project home: https://github.com/Masterchiefm/GenePad
|
package/bin/genepad.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// GenePad launcher.
|
|
5
|
+
//
|
|
6
|
+
// Resolves the prebuilt native binary for the current platform (installed as an
|
|
7
|
+
// optional dependency) and spawns it, forwarding all command-line arguments so
|
|
8
|
+
// `genepad file.dna` and `genepad --tool=enzyme-library` behave like the native app.
|
|
9
|
+
|
|
10
|
+
const { spawn, spawnSync } = require('node:child_process');
|
|
11
|
+
const fs = require('node:fs');
|
|
12
|
+
const path = require('node:path');
|
|
13
|
+
|
|
14
|
+
// Maps Node's process.platform + process.arch to the platform sub-package and
|
|
15
|
+
// the binary it ships. npm installs only the sub-package matching os/cpu.
|
|
16
|
+
const PLATFORMS = {
|
|
17
|
+
'win32-x64': { pkg: '@genepad/win32-x64', bin: 'GenePad.exe', type: 'exe' },
|
|
18
|
+
'linux-x64': { pkg: '@genepad/linux-x64', bin: 'genepad.AppImage', type: 'appimage' },
|
|
19
|
+
'linux-arm64': { pkg: '@genepad/linux-arm64', bin: 'genepad.AppImage', type: 'appimage' },
|
|
20
|
+
'darwin-arm64': { pkg: '@genepad/darwin-arm64', bin: 'GenePad.app', type: 'app' },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function fail(message) {
|
|
24
|
+
console.error(`genepad: ${message}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
29
|
+
const config = PLATFORMS[platformKey];
|
|
30
|
+
|
|
31
|
+
if (!config) {
|
|
32
|
+
fail(
|
|
33
|
+
`unsupported platform/arch "${platformKey}". ` +
|
|
34
|
+
'Supported: win32-x64, linux-x64, linux-arm64, darwin-arm64.',
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let packageDir;
|
|
39
|
+
try {
|
|
40
|
+
packageDir = path.dirname(require.resolve(`${config.pkg}/package.json`));
|
|
41
|
+
} catch {
|
|
42
|
+
fail(
|
|
43
|
+
`platform package "${config.pkg}" is not installed. ` +
|
|
44
|
+
'Reinstall with: npm install -g @genepad/app',
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const binaryPath = path.join(packageDir, config.bin);
|
|
49
|
+
if (!fs.existsSync(binaryPath)) {
|
|
50
|
+
fail(`binary not found at ${binaryPath}`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const args = process.argv.slice(2);
|
|
54
|
+
|
|
55
|
+
if (config.type === 'app') {
|
|
56
|
+
// macOS: npm-extracted files carry no quarantine xattr, but strip it just in
|
|
57
|
+
// case the package was copied through a quarantined path. Best-effort.
|
|
58
|
+
try {
|
|
59
|
+
spawnSync('xattr', ['-dr', 'com.apple.quarantine', binaryPath], { stdio: 'ignore' });
|
|
60
|
+
} catch {
|
|
61
|
+
// ignore — xattr may be absent on non-macOS or without CLT
|
|
62
|
+
}
|
|
63
|
+
// `open` launches the app as a proper macOS application and returns once it
|
|
64
|
+
// has been started. Forward file paths / flags via --args.
|
|
65
|
+
const child = spawn('open', ['-n', '-a', binaryPath, '--args', ...args], {
|
|
66
|
+
stdio: 'inherit',
|
|
67
|
+
});
|
|
68
|
+
child.on('error', (err) => fail(`failed to launch: ${err.message}`));
|
|
69
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
70
|
+
} else {
|
|
71
|
+
if (config.type === 'appimage') {
|
|
72
|
+
try {
|
|
73
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
74
|
+
} catch {
|
|
75
|
+
// ignore — may already be executable or fs is read-only
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const child = spawn(binaryPath, args, { stdio: 'inherit' });
|
|
79
|
+
child.on('error', (err) => fail(`failed to launch: ${err.message}`));
|
|
80
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
81
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@genepad/app",
|
|
3
|
+
"version": "0.6.2",
|
|
4
|
+
"description": "GenePad — a DNA sequence viewer and editor. This package is a launcher that installs the prebuilt native binary for your platform.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"bin": {
|
|
7
|
+
"genepad": "bin/genepad.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@genepad/win32-x64": "0.6.2",
|
|
15
|
+
"@genepad/linux-x64": "0.6.2",
|
|
16
|
+
"@genepad/linux-arm64": "0.6.2",
|
|
17
|
+
"@genepad/darwin-arm64": "0.6.2"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
}
|
|
22
|
+
}
|