@symbiosis-lab/moss 0.14.1 → 0.15.9
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 +9 -40
- package/bin/moss.js +1 -16
- package/lib/fetch.js +19 -10
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
# @symbiosis-lab/moss
|
|
2
2
|
|
|
3
|
-
moss on your PATH. This package downloads the
|
|
4
|
-
CLI binary from [moss-releases](https://github.com/Symbiosis-Lab/moss-releases)
|
|
5
|
-
and exposes it as the `moss` command.
|
|
6
|
-
|
|
7
|
-
> **Publishing note:** the package is currently marked `"private": true` in
|
|
8
|
-
> `package.json` so it cannot ship by accident. Flip that (remove the field)
|
|
9
|
-
> at publish time — `publishConfig` is already set up.
|
|
3
|
+
moss on your PATH. This package downloads the open [moss-cli](https://github.com/Symbiosis-Lab/moss/tree/develop/crates/moss-cli) binary and exposes it as the `moss` command.
|
|
10
4
|
|
|
11
5
|
## Install
|
|
12
6
|
|
|
@@ -15,12 +9,9 @@ npm install -g @symbiosis-lab/moss
|
|
|
15
9
|
moss --version
|
|
16
10
|
```
|
|
17
11
|
|
|
18
|
-
The binary is fetched at install time (postinstall). With `--ignore-scripts`,
|
|
19
|
-
or if the download failed (e.g. offline), the first `moss` invocation fetches
|
|
20
|
-
it lazily instead.
|
|
12
|
+
The binary is fetched at install time (postinstall). With `--ignore-scripts`, or if the download failed (e.g. offline), the first `moss` invocation fetches it lazily instead.
|
|
21
13
|
|
|
22
|
-
Supported platforms: macOS (Intel and Apple Silicon, one universal binary)
|
|
23
|
-
and Linux x86_64.
|
|
14
|
+
Supported platforms: macOS (Intel and Apple Silicon, one universal binary) and Linux x86_64. The binary has no window system in its dependency graph, so it starts on a headless Linux server or inside a container with no desktop libraries to install first.
|
|
24
15
|
|
|
25
16
|
## Use
|
|
26
17
|
|
|
@@ -30,29 +21,15 @@ moss build ~/Sites/my-site
|
|
|
30
21
|
|
|
31
22
|
All arguments pass straight through to the moss binary; see `moss --help`.
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
The current Linux binary links against WebKitGTK even for headless CLI verbs.
|
|
36
|
-
If `moss` fails with `error while loading shared libraries`, install:
|
|
37
|
-
|
|
38
|
-
```sh
|
|
39
|
-
sudo apt install libwebkit2gtk-4.1-0
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
This requirement is temporary — a moss CLI build without the WebKitGTK
|
|
43
|
-
linkage is planned.
|
|
24
|
+
`moss preview` and `moss edit` need a window, which this binary doesn't have: they hand off to [moss desktop](https://mosspub.com) if it's installed, or print a one-line hint if it isn't. On macOS, `moss desktop install` fetches and installs it for you (see `moss desktop install --help`); it always asks before downloading and never runs unattended (no terminal attached, as in CI, is treated as declining). moss desktop isn't packaged for Linux or Windows yet, so `moss desktop install` there just prints where to get it.
|
|
44
25
|
|
|
45
26
|
## Checksums
|
|
46
27
|
|
|
47
|
-
Downloads are verified against the `SHA256SUMS` file published with each
|
|
48
|
-
release. Releases that predate checksum publishing install with a warning
|
|
49
|
-
instead of verification.
|
|
28
|
+
Downloads are verified against the `SHA256SUMS` file published with each release. Releases that predate checksum publishing install with a warning instead of verification.
|
|
50
29
|
|
|
51
30
|
## Versioning and overrides
|
|
52
31
|
|
|
53
|
-
The wrapper downloads the moss version matching its own package version;
|
|
54
|
-
they are released in lockstep. `MOSS_VERSION_OVERRIDE=v0.11.1` forces a
|
|
55
|
-
specific release (ops/testing escape hatch).
|
|
32
|
+
The wrapper downloads the moss version matching its own package version; they are released in lockstep. `MOSS_VERSION_OVERRIDE=v0.11.1` forces a specific release (ops/testing escape hatch).
|
|
56
33
|
|
|
57
34
|
## Controlling the download
|
|
58
35
|
|
|
@@ -62,18 +39,10 @@ specific release (ops/testing escape hatch).
|
|
|
62
39
|
| `MOSS_BINARY_PATH=/path/to/moss` | Run that binary instead of the vendored one, and skip the download entirely. |
|
|
63
40
|
| `MOSS_FORCE_BINARY_DOWNLOAD=1` | Download even where the wrapper would otherwise skip. |
|
|
64
41
|
|
|
65
|
-
Each also reads from `.npmrc` under its lowercased name (`moss_skip_binary_download=true`),
|
|
66
|
-
because npm passes config keys to lifecycle scripts as `npm_config_*`.
|
|
42
|
+
Each also reads from `.npmrc` under its lowercased name (`moss_skip_binary_download=true`), because npm passes config keys to lifecycle scripts as `npm_config_*`.
|
|
67
43
|
|
|
68
|
-
**Inside the moss repo the download is skipped automatically.** A checkout is
|
|
69
|
-
not an install: `packages/moss` sits in the workspace rather than under
|
|
70
|
-
`node_modules`, so `pnpm install` at the repo root would otherwise pull a
|
|
71
|
-
release binary that no moss developer wants — they build from source. Point
|
|
72
|
-
`MOSS_BINARY_PATH` at `src-tauri/target/release/moss` to exercise the wrapper
|
|
73
|
-
against your own build.
|
|
44
|
+
**Inside the moss repo the download is skipped automatically.** A checkout is not an install: `packages/moss` sits in the workspace rather than under `node_modules`, so `pnpm install` at the repo root would otherwise pull a release binary that no moss developer wants — they build from source. Point `MOSS_BINARY_PATH` at `target/release/moss-cli` (`cargo build --release -p moss-cli`) to exercise the wrapper against your own build.
|
|
74
45
|
|
|
75
46
|
## License
|
|
76
47
|
|
|
77
|
-
The wrapper code in this package is MIT (see LICENSE). The moss binary it
|
|
78
|
-
downloads is a separate work, distributed under its own terms via
|
|
79
|
-
[moss-releases](https://github.com/Symbiosis-Lab/moss-releases).
|
|
48
|
+
The wrapper code in this package is MIT (see LICENSE). The moss binary it downloads is a separate work, distributed under its own terms via [moss](https://github.com/Symbiosis-Lab/moss).
|
package/bin/moss.js
CHANGED
|
@@ -24,25 +24,10 @@ async function main() {
|
|
|
24
24
|
await fetchBinary();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
// verbatim. stdin/stdout stay inherited for interactive use.
|
|
29
|
-
const result = spawnSync(binary, process.argv.slice(2), {
|
|
30
|
-
stdio: ['inherit', 'inherit', 'pipe'],
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const stderr = result.stderr ? result.stderr.toString() : '';
|
|
34
|
-
if (stderr) process.stderr.write(stderr);
|
|
27
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
35
28
|
|
|
36
29
|
if (result.error) throw result.error;
|
|
37
30
|
|
|
38
|
-
if (stderr.includes('error while loading shared libraries')) {
|
|
39
|
-
console.error(
|
|
40
|
-
'\nmoss-npm: the moss binary currently needs the WebKitGTK runtime libraries:\n' +
|
|
41
|
-
' sudo apt install libwebkit2gtk-4.1-0\n' +
|
|
42
|
-
'This is temporary — a moss CLI build without that linkage is planned.'
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
31
|
process.exit(result.status === null ? 1 : result.status);
|
|
47
32
|
}
|
|
48
33
|
|
package/lib/fetch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Downloads the moss CLI binary for this platform from moss
|
|
1
|
+
// Downloads the moss CLI binary for this platform from moss.
|
|
2
2
|
//
|
|
3
3
|
// No dependencies: uses the global fetch that ships with Node >= 18.
|
|
4
4
|
// The version defaults to this package's own version (the wrapper is
|
|
@@ -11,10 +11,15 @@ const crypto = require('node:crypto');
|
|
|
11
11
|
const fs = require('node:fs');
|
|
12
12
|
const path = require('node:path');
|
|
13
13
|
|
|
14
|
-
const RELEASES = 'https://github.com/Symbiosis-Lab/moss
|
|
14
|
+
const RELEASES = 'https://github.com/Symbiosis-Lab/moss/releases/download';
|
|
15
15
|
|
|
16
16
|
const packageRoot = path.join(__dirname, '..');
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
// Compute the vendored binary path at use time, appending .exe on win32.
|
|
19
|
+
function vendorBinary() {
|
|
20
|
+
const name = process.platform === 'win32' ? 'moss.exe' : 'moss';
|
|
21
|
+
return path.join(packageRoot, 'vendor', name);
|
|
22
|
+
}
|
|
18
23
|
|
|
19
24
|
// npm and pnpm expose every `.npmrc` key to lifecycle scripts as `npm_config_<key>`,
|
|
20
25
|
// so one lookup covers both the environment variable and the config file. This is
|
|
@@ -58,7 +63,7 @@ function skipDownloadReason() {
|
|
|
58
63
|
// Which binary `moss` should execute. `MOSS_BINARY_PATH` wins so a developer can
|
|
59
64
|
// point the wrapper at a locally built moss (esbuild's `ESBUILD_BINARY_PATH`).
|
|
60
65
|
function resolveBinary() {
|
|
61
|
-
return process.env.MOSS_BINARY_PATH || vendorBinary;
|
|
66
|
+
return process.env.MOSS_BINARY_PATH || vendorBinary();
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
function resolveVersion() {
|
|
@@ -77,10 +82,13 @@ function resolveAsset() {
|
|
|
77
82
|
if (platform === 'linux' && arch === 'x64') {
|
|
78
83
|
return 'moss-linux-x86_64';
|
|
79
84
|
}
|
|
85
|
+
if (platform === 'win32' && arch === 'x64') {
|
|
86
|
+
return 'moss-windows-x86_64.exe';
|
|
87
|
+
}
|
|
80
88
|
throw new Error(
|
|
81
89
|
`moss-npm: no moss binary is published for ${platform}-${arch}.\n` +
|
|
82
|
-
'Supported: macOS (x64/arm64) and
|
|
83
|
-
'See https://github.com/Symbiosis-Lab/moss
|
|
90
|
+
'Supported: macOS (x64/arm64), Linux (x64), and Windows (x64). ' +
|
|
91
|
+
'See https://github.com/Symbiosis-Lab/moss for available builds.'
|
|
84
92
|
);
|
|
85
93
|
}
|
|
86
94
|
|
|
@@ -165,10 +173,11 @@ async function fetchBinary() {
|
|
|
165
173
|
const bytes = await download(url);
|
|
166
174
|
await verifyChecksum(bytes, asset, version);
|
|
167
175
|
|
|
168
|
-
|
|
169
|
-
fs.
|
|
170
|
-
|
|
171
|
-
|
|
176
|
+
const binaryPath = vendorBinary();
|
|
177
|
+
fs.mkdirSync(path.dirname(binaryPath), { recursive: true });
|
|
178
|
+
fs.writeFileSync(binaryPath, bytes, { mode: 0o755 });
|
|
179
|
+
console.log(`moss-npm: installed ${binaryPath}`);
|
|
180
|
+
return binaryPath;
|
|
172
181
|
}
|
|
173
182
|
|
|
174
183
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiosis-lab/moss",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "moss on your PATH — npm wrapper that installs the moss CLI binary from moss
|
|
3
|
+
"version": "0.15.9",
|
|
4
|
+
"description": "moss on your PATH — npm wrapper that installs the moss CLI binary from moss",
|
|
5
5
|
"bin": {
|
|
6
6
|
"moss": "bin/moss.js"
|
|
7
7
|
},
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"os": [
|
|
24
24
|
"darwin",
|
|
25
|
-
"linux"
|
|
25
|
+
"linux",
|
|
26
|
+
"win32"
|
|
26
27
|
],
|
|
27
28
|
"cpu": [
|
|
28
29
|
"x64",
|
|
@@ -38,10 +39,10 @@
|
|
|
38
39
|
"license": "MIT",
|
|
39
40
|
"repository": {
|
|
40
41
|
"type": "git",
|
|
41
|
-
"url": "git+https://github.com/Symbiosis-Lab/moss
|
|
42
|
+
"url": "git+https://github.com/Symbiosis-Lab/moss.git"
|
|
42
43
|
},
|
|
43
44
|
"bugs": {
|
|
44
|
-
"url": "https://github.com/Symbiosis-Lab/moss
|
|
45
|
+
"url": "https://github.com/Symbiosis-Lab/moss/issues"
|
|
45
46
|
},
|
|
46
47
|
"homepage": "https://mosspub.com",
|
|
47
48
|
"publishConfig": {
|