@weibaohui/nothing-todo 0.0.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/install.js +43 -0
- package/package.json +25 -0
package/install.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// 跨平台安装脚本(用于主包安装)
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const platform = os.platform();
|
|
9
|
+
const arch = os.arch();
|
|
10
|
+
|
|
11
|
+
// 根据系统和架构确定平台包名
|
|
12
|
+
function getPackageName() {
|
|
13
|
+
const platformMap = {
|
|
14
|
+
'linux': { 'x64': 'nothing-todo-linux-x64', 'arm64': 'nothing-todo-linux-arm64' },
|
|
15
|
+
'darwin': { 'arm64': 'nothing-todo-darwin-arm64' },
|
|
16
|
+
'win32': { 'x64': 'nothing-todo-windows-x64' }
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const p = platformMap[platform];
|
|
20
|
+
if (!p) {
|
|
21
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const a = p[arch] || p[Object.keys(p)[0]];
|
|
26
|
+
if (!a) {
|
|
27
|
+
console.error(`Unsupported architecture: ${arch}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return `@weibaohui/${a}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const pkg = getPackageName();
|
|
35
|
+
console.log(`Installing ${pkg}...`);
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
execSync(`npm install ${pkg}`, { stdio: 'inherit' });
|
|
39
|
+
console.log('Installation complete!');
|
|
40
|
+
} catch (e) {
|
|
41
|
+
console.error('Installation failed');
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@weibaohui/nothing-todo",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "NothingTodo - Rust CLI for managing your daily tasks",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"todo",
|
|
7
|
+
"task",
|
|
8
|
+
"cli",
|
|
9
|
+
"rust"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/weibaohui/nothing-todo"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"postinstall": "node install.js"
|
|
18
|
+
},
|
|
19
|
+
"optionalDependencies": {
|
|
20
|
+
"@weibaohui/nothing-todo-linux-x64": "*",
|
|
21
|
+
"@weibaohui/nothing-todo-linux-arm64": "*",
|
|
22
|
+
"@weibaohui/nothing-todo-darwin-arm64": "*",
|
|
23
|
+
"@weibaohui/nothing-todo-windows-x64": "*"
|
|
24
|
+
}
|
|
25
|
+
}
|