qtflow 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/README.md +7 -0
- package/bin/qtflow.js +104 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# qtflow npm wrapper
|
|
2
|
+
|
|
3
|
+
This package provides the `qtflow` command by selecting a prebuilt binary from a platform-specific optional dependency.
|
|
4
|
+
|
|
5
|
+
No Rust toolchain is required when the matching optional package is installed. If the optional package is unavailable, use a GitHub release archive or build from source with `cargo install qtflow`.
|
|
6
|
+
|
|
7
|
+
The package name is `qtflow`; install it with `npm i -g qtflow`. Platform-specific optional packages are published under the `@xehxx/qtflow-cli-<os>-<arch>` names.
|
package/bin/qtflow.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require("child_process");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const PACKAGES = {
|
|
8
|
+
"win32:x64": {
|
|
9
|
+
packageName: "@xehxx/qtflow-cli-win32-x64",
|
|
10
|
+
binary: "qtflow.exe",
|
|
11
|
+
},
|
|
12
|
+
"linux:x64": {
|
|
13
|
+
packageName: "@xehxx/qtflow-cli-linux-x64",
|
|
14
|
+
binary: "qtflow",
|
|
15
|
+
},
|
|
16
|
+
"darwin:x64": {
|
|
17
|
+
packageName: "@xehxx/qtflow-cli-darwin-x64",
|
|
18
|
+
binary: "qtflow",
|
|
19
|
+
},
|
|
20
|
+
"darwin:arm64": {
|
|
21
|
+
packageName: "@xehxx/qtflow-cli-darwin-arm64",
|
|
22
|
+
binary: "qtflow",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function installHelp(platform, arch) {
|
|
27
|
+
return [
|
|
28
|
+
`qtflow: no prebuilt npm package is installed for ${platform}-${arch}.`,
|
|
29
|
+
"",
|
|
30
|
+
"Install from a GitHub release archive, or build from source with:",
|
|
31
|
+
" cargo install qtflow",
|
|
32
|
+
"",
|
|
33
|
+
"GitHub releases: https://github.com/OWNER/qtflow/releases",
|
|
34
|
+
].join("\n");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function resolveBinary(platform = process.platform, arch = process.arch, requireResolve = require.resolve) {
|
|
38
|
+
const entry = PACKAGES[`${platform}:${arch}`];
|
|
39
|
+
if (!entry) {
|
|
40
|
+
return {
|
|
41
|
+
ok: false,
|
|
42
|
+
message: installHelp(platform, arch),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const packageJson = requireResolve(`${entry.packageName}/package.json`);
|
|
48
|
+
const packageRoot = path.dirname(packageJson);
|
|
49
|
+
return {
|
|
50
|
+
ok: true,
|
|
51
|
+
packageName: entry.packageName,
|
|
52
|
+
binaryPath: path.join(packageRoot, "bin", entry.binary),
|
|
53
|
+
};
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return {
|
|
56
|
+
ok: false,
|
|
57
|
+
packageName: entry.packageName,
|
|
58
|
+
message: [
|
|
59
|
+
`qtflow: optional package ${entry.packageName} is not installed or cannot be resolved.`,
|
|
60
|
+
"",
|
|
61
|
+
"This can happen when optional dependencies are disabled or this platform is unsupported.",
|
|
62
|
+
"Install from a GitHub release archive, or build from source with:",
|
|
63
|
+
" cargo install qtflow",
|
|
64
|
+
"",
|
|
65
|
+
"GitHub releases: https://github.com/OWNER/qtflow/releases",
|
|
66
|
+
].join("\n"),
|
|
67
|
+
cause: error,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function run(argv = process.argv.slice(2)) {
|
|
73
|
+
const resolved = resolveBinary();
|
|
74
|
+
if (!resolved.ok) {
|
|
75
|
+
console.error(resolved.message);
|
|
76
|
+
return 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const child = spawnSync(resolved.binaryPath, argv, {
|
|
80
|
+
stdio: "inherit",
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
if (child.error) {
|
|
84
|
+
console.error(`qtflow: failed to launch ${resolved.binaryPath}: ${child.error.message}`);
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (child.signal) {
|
|
89
|
+
console.error(`qtflow: process terminated by signal ${child.signal}`);
|
|
90
|
+
return 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return child.status === null ? 1 : child.status;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (require.main === module) {
|
|
97
|
+
process.exit(run());
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
module.exports = {
|
|
101
|
+
PACKAGES,
|
|
102
|
+
resolveBinary,
|
|
103
|
+
run,
|
|
104
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qtflow",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A Qt/CMake workflow CLI for configure, build, test, and check commands.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/OWNER/qtflow.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"qtflow": "bin/qtflow.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/qtflow.js",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@xehxx/qtflow-cli-win32-x64": "0.1.0",
|
|
19
|
+
"@xehxx/qtflow-cli-linux-x64": "0.1.0",
|
|
20
|
+
"@xehxx/qtflow-cli-darwin-x64": "0.1.0",
|
|
21
|
+
"@xehxx/qtflow-cli-darwin-arm64": "0.1.0"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=14"
|
|
25
|
+
}
|
|
26
|
+
}
|