git-remote-igit 0.1.1

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 ADDED
@@ -0,0 +1,25 @@
1
+ # git-remote-igit
2
+
3
+ Git remote helper for InfiniGit's native `igit://` transport.
4
+
5
+ ```bash
6
+ cargo install git-remote-igit
7
+ # or: npm install --global git-remote-igit
8
+ git clone igit://infinigit.com/username/repository
9
+ ```
10
+
11
+ Git discovers the executable by its `git-remote-igit` name. The helper resolves
12
+ human-readable repository coordinates through the InfiniGit directory and
13
+ uses the external `infinigit-pack` bridge to synchronize canister packfiles.
14
+
15
+ ## Releases
16
+
17
+ See [PUBLISHING.md](PUBLISHING.md) for registry setup, versioning, publishing,
18
+ verification, and partial-release recovery.
19
+
20
+ Tags named `v<version>` publish the crate and npm package and attach native
21
+ Linux, macOS, and Windows binaries to a GitHub Release. Keep the versions in
22
+ `Cargo.toml` and `package.json` identical before tagging. The `release`
23
+ environment needs a `CARGO_REGISTRY_TOKEN` secret. npm trusted publishing should
24
+ authorize `infinigit-labs/git-remote-igit` and `.github/workflows/release.yml`;
25
+ an `NPM_TOKEN` secret can bootstrap the first publication.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ const path = require('node:path');
4
+ const { spawnSync } = require('node:child_process');
5
+ const executable = path.join(__dirname, '..', 'vendor', `git-remote-igit${process.platform === 'win32' ? '.exe' : ''}`);
6
+ const result = spawnSync(executable, process.argv.slice(2), { stdio: 'inherit' });
7
+ if (result.error) { console.error(result.error.message); process.exit(1); }
8
+ process.exit(result.status === null ? 1 : result.status);
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs');
4
+ const https = require('node:https');
5
+ const path = require('node:path');
6
+ const { pipeline } = require('node:stream/promises');
7
+ const { spawnSync } = require('node:child_process');
8
+ const pkg = require('../../package.json');
9
+ const { targetFor } = require('./platform');
10
+
11
+ const binary = 'git-remote-igit';
12
+ const target = targetFor();
13
+ const extension = process.platform === 'win32' ? '.zip' : '.tar.gz';
14
+ const asset = `${pkg.name}-v${pkg.version}-${target}${extension}`;
15
+ const url = `https://github.com/infinigit-labs/${pkg.name}/releases/download/v${pkg.version}/${asset}`;
16
+ const vendor = path.join(__dirname, '..', 'vendor');
17
+
18
+ function request(source, redirects = 5) {
19
+ return new Promise((resolve, reject) => {
20
+ https.get(source, { headers: { 'User-Agent': `${pkg.name}-npm/${pkg.version}` } }, response => {
21
+ if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location && redirects) {
22
+ response.resume(); resolve(request(response.headers.location, redirects - 1));
23
+ } else if (response.statusCode === 200) resolve(response);
24
+ else { response.resume(); reject(new Error(`Download failed with HTTP ${response.statusCode}`)); }
25
+ }).on('error', reject);
26
+ });
27
+ }
28
+
29
+ async function install() {
30
+ fs.mkdirSync(vendor, { recursive: true });
31
+ const archive = path.join(vendor, asset);
32
+ await pipeline(await request(url), fs.createWriteStream(archive));
33
+ const result = spawnSync('tar', ['-xf', archive, '-C', vendor], { stdio: 'inherit' });
34
+ fs.rmSync(archive, { force: true });
35
+ if (result.status !== 0) throw new Error('Could not extract downloaded archive');
36
+ if (process.platform !== 'win32') fs.chmodSync(path.join(vendor, binary), 0o755);
37
+ }
38
+
39
+ install().catch(error => { console.error(`${pkg.name}: ${error.message}`); process.exitCode = 1; });
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ const targets = {
4
+ 'darwin-arm64': 'aarch64-apple-darwin',
5
+ 'darwin-x64': 'x86_64-apple-darwin',
6
+ 'linux-arm64': 'aarch64-unknown-linux-gnu',
7
+ 'linux-x64': 'x86_64-unknown-linux-gnu',
8
+ 'win32-x64': 'x86_64-pc-windows-msvc'
9
+ };
10
+
11
+ function targetFor(platform = process.platform, arch = process.arch) {
12
+ const target = targets[`${platform}-${arch}`];
13
+ if (!target) throw new Error(`Unsupported platform: ${platform}-${arch}`);
14
+ return target;
15
+ }
16
+
17
+ module.exports = { targetFor };
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "git-remote-igit",
3
+ "version": "0.1.1",
4
+ "description": "Git remote helper for the native igit:// InfiniGit transport",
5
+ "license": "Apache-2.0",
6
+ "repository": "github:infinigit-labs/git-remote-igit",
7
+ "homepage": "https://infinigit.com",
8
+ "os": ["darwin", "linux", "win32"],
9
+ "cpu": ["x64", "arm64"],
10
+ "bin": { "git-remote-igit": "npm/bin/git-remote-igit.js" },
11
+ "files": ["npm/bin", "npm/lib"],
12
+ "scripts": {
13
+ "postinstall": "node npm/lib/install.js",
14
+ "test:npm": "node --test npm/test/*.test.js"
15
+ },
16
+ "engines": { "node": ">=18" },
17
+ "publishConfig": { "access": "public", "provenance": true }
18
+ }