@tasksai/install 0.1.18 → 0.1.19
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/package.json +1 -1
- package/src/index.js +11 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -85,13 +85,23 @@ const CLIENTS = {
|
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
if (
|
|
88
|
+
if (isMainModule()) {
|
|
89
89
|
main().catch((error) => {
|
|
90
90
|
console.error(formatError(error));
|
|
91
91
|
process.exit(1);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
function isMainModule() {
|
|
96
|
+
if (!process.argv[1]) return false;
|
|
97
|
+
const modulePath = fileURLToPath(import.meta.url);
|
|
98
|
+
try {
|
|
99
|
+
return fs.realpathSync(process.argv[1]) === fs.realpathSync(modulePath);
|
|
100
|
+
} catch {
|
|
101
|
+
return path.resolve(process.argv[1]) === modulePath;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
95
105
|
async function main() {
|
|
96
106
|
const options = parseArgs(process.argv.slice(2));
|
|
97
107
|
|