@zap./zap 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 +23 -0
- package/bin/zap +55 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/elbywan/zap/main/assets/zap.png" width="128" height="128" />
|
|
3
|
+
<h6><i><a href="https://www.flaticon.com/free-icons/comic" title="logo">Logo created by Freepik - Flaticon</a></i></h6>
|
|
4
|
+
<h3>Another [insert blazing fast synonyms] JavaScript package manager</h3>
|
|
5
|
+
<a href="https://github.com/elbywan/zap/actions/workflows/build.yml?query=branch%3Amain+workflow%3ABuild"><img alt="Build Status" src="https://github.com/elbywan/zap/actions/workflows/build.yml/badge.svg"></a>
|
|
6
|
+
<a href="https://www.npmjs.com/package/@zap./zap"><img alt="GitHub tag (latest SemVer)" src="https://img.shields.io/npm/v/@zap./zap"></a>
|
|
7
|
+
<a href="https://github.com/elbywan/zap/blob/main/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/elbywan/zap"></a>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
### ⚡️ Install this package globally to use the `zap` package manager.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Pick your flavour
|
|
16
|
+
npm add -g @zap./zap
|
|
17
|
+
yarn add -g @zap./zap
|
|
18
|
+
pnpm add -g @zap./zap
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
> __Note:__ this package is shallow and the zap binary is provided by one of its optional dependencies - depending on the architecture.
|
|
22
|
+
|
|
23
|
+
#### For more information please visit the [repository](https://github.com/elbywan/zap).
|
package/bin/zap
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const childProcess = require("child_process");
|
|
6
|
+
|
|
7
|
+
const packageName = `@zap./${process.platform}-${process.arch}`;
|
|
8
|
+
|
|
9
|
+
BIN_NAME = process.platform === "win32" ? "zap.exe" : "zap";
|
|
10
|
+
|
|
11
|
+
let modulePath = "";
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
modulePath = require.resolve(packageName + "/package.json");
|
|
15
|
+
} catch (err) {
|
|
16
|
+
if (err.code !== "MODULE_NOT_FOUND") {
|
|
17
|
+
console.error(err.message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!modulePath) {
|
|
22
|
+
console.error(
|
|
23
|
+
`Error: Could not locate ${packageName}.\n` +
|
|
24
|
+
"\n" +
|
|
25
|
+
`Either your current architecture (${process.platform}-${process.arch}) is not supported, or the package is not installed.\n` +
|
|
26
|
+
"Make sure that your package manager is not ignoring optional dependencies.\n"
|
|
27
|
+
);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// The actual binary is located in the [platform]-[arch] package's bin directory.
|
|
32
|
+
const binaryPath = path.join(path.dirname(modulePath), "bin", BIN_NAME);
|
|
33
|
+
|
|
34
|
+
// Attempt to replace this node.js script with the binary.
|
|
35
|
+
try {
|
|
36
|
+
const targetPath = path.join(__dirname, BIN_NAME);
|
|
37
|
+
const intermediatePath = path.join(__dirname, "zap.bin");
|
|
38
|
+
|
|
39
|
+
// Make the binary executable.
|
|
40
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
41
|
+
// Remove any existing intermediate file.
|
|
42
|
+
fs.rmSync(intermediatePath, { force: true });
|
|
43
|
+
// Create a hard link to the binary.
|
|
44
|
+
fs.linkSync(binaryPath, intermediatePath);
|
|
45
|
+
// Atomically replace this script with the binary.
|
|
46
|
+
fs.renameSync(intermediatePath, targetPath);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
/* silently swallow errors */
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const args = process.argv.slice(2);
|
|
52
|
+
|
|
53
|
+
childProcess.execFileSync(binaryPath, args, {
|
|
54
|
+
stdio: "inherit",
|
|
55
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zap./zap",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Zap is a package manager for the Javascript language",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/elbywan/zap.git"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"package manager",
|
|
12
|
+
"npm",
|
|
13
|
+
"pnpm",
|
|
14
|
+
"yarn"
|
|
15
|
+
],
|
|
16
|
+
"author": "Julien Elbaz",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/elbywan/zap/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/elbywan/zap#readme",
|
|
22
|
+
"bin": {
|
|
23
|
+
"zap": "bin/zap"
|
|
24
|
+
},
|
|
25
|
+
"optionalDependencies": {
|
|
26
|
+
"@zap./darwin-arm64": "0.1.1",
|
|
27
|
+
"@zap./darwin-x64": "0.1.1",
|
|
28
|
+
"@zap./linux-x64": "0.1.1",
|
|
29
|
+
"@zap./win32-x64": "0.1.1"
|
|
30
|
+
}
|
|
31
|
+
}
|