@what256/packager 0.1.0
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 +21 -0
- package/README.md +12 -0
- package/bin/packager.js +47 -0
- package/package.json +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Packager contributors
|
|
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
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Packager CLI
|
|
2
|
+
|
|
3
|
+
Install the native Packager command-line interface for macOS or Windows:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install --global @what256/packager
|
|
7
|
+
packager --help
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
This launcher selects the matching optional native package for the current operating system and architecture. Packager currently supports macOS and Windows on ARM64 and x64.
|
|
11
|
+
|
|
12
|
+
Project documentation and source code: https://github.com/what256/packager
|
package/bin/packager.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
const { existsSync } = require("node:fs");
|
|
5
|
+
const { dirname, join } = require("node:path");
|
|
6
|
+
|
|
7
|
+
const key = `${process.platform}-${process.arch}`;
|
|
8
|
+
const packages = {
|
|
9
|
+
"darwin-arm64": "@what256/packager-darwin-arm64",
|
|
10
|
+
"darwin-x64": "@what256/packager-darwin-x64",
|
|
11
|
+
"win32-arm64": "@what256/packager-win32-arm64",
|
|
12
|
+
"win32-x64": "@what256/packager-win32-x64"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const packageName = packages[key];
|
|
16
|
+
if (!packageName) {
|
|
17
|
+
console.error(`Packager does not publish a native CLI for ${key} yet.`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let packageJson;
|
|
22
|
+
try {
|
|
23
|
+
packageJson = require.resolve(`${packageName}/package.json`);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error(
|
|
26
|
+
`The optional native package ${packageName} is missing. ` +
|
|
27
|
+
"Reinstall without --no-optional, or download a standalone binary from the GitHub release."
|
|
28
|
+
);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const executable = join(
|
|
33
|
+
dirname(packageJson),
|
|
34
|
+
"bin",
|
|
35
|
+
process.platform === "win32" ? "packager.exe" : "packager"
|
|
36
|
+
);
|
|
37
|
+
if (!existsSync(executable)) {
|
|
38
|
+
console.error(`${packageName} is installed but its native executable is missing.`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const result = spawnSync(executable, process.argv.slice(2), { stdio: "inherit" });
|
|
43
|
+
if (result.error) {
|
|
44
|
+
console.error(`Could not start Packager: ${result.error.message}`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@what256/packager",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Install the native Packager CLI for macOS and Windows",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/what256/packager.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"packager": "bin/packager.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"optionalDependencies": {
|
|
20
|
+
"@what256/packager-darwin-arm64": "0.1.0",
|
|
21
|
+
"@what256/packager-darwin-x64": "0.1.0",
|
|
22
|
+
"@what256/packager-win32-arm64": "0.1.0",
|
|
23
|
+
"@what256/packager-win32-x64": "0.1.0"
|
|
24
|
+
}
|
|
25
|
+
}
|