dp-key 0.0.2 → 0.0.3

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 CHANGED
@@ -1,17 +1,37 @@
1
1
  # dp-key
2
2
 
3
+ 一个简单实用的 npm 工具包。
4
+
3
5
  ## 安装
4
6
 
7
+ ### 本地安装
8
+
5
9
  ```bash
6
10
  npm install dp-key
7
11
  ```
8
12
 
9
- ## 使用
13
+ 或使用简写:
10
14
 
11
- ```javascript
12
- const dpKey = require('dp-key');
15
+ ```bash
16
+ npm i dp-key
17
+ ```
18
+
19
+ ### 全局安装
20
+
21
+ ```bash
22
+ npm install -g dp-key
13
23
  ```
14
24
 
15
- ## 许可证
25
+ 或使用简写:
26
+
27
+ ```bash
28
+ npm i -g dp-key
29
+ ```
30
+
31
+ ## npm 包地址
32
+
33
+ https://www.npmjs.com/package/dp-key
34
+
35
+ ## 版本
16
36
 
17
- ISC
37
+ 当前版本:0.0.1
package/bin/dp-key.js ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+ const os = require('os');
6
+
7
+ const platform = os.platform();
8
+ const arch = os.arch();
9
+
10
+ let binaryName;
11
+ if (platform === 'darwin' && arch === 'arm64') {
12
+ binaryName = 'dp-key-darwin-arm64';
13
+ } else if (platform === 'darwin' && arch === 'x64') {
14
+ binaryName = 'dp-key-darwin-amd64';
15
+ } else if (platform === 'linux' && arch === 'x64') {
16
+ binaryName = 'dp-key-linux-amd64';
17
+ } else if (platform === 'win32' && arch === 'x64') {
18
+ binaryName = 'dp-key-windows-amd64.exe';
19
+ } else {
20
+ console.error(`Unsupported platform: ${platform}-${arch}`);
21
+ process.exit(1);
22
+ }
23
+
24
+ const binaryPath = path.join(__dirname, '..', 'binaries', binaryName);
25
+ const child = spawn(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
26
+
27
+ child.on('exit', (code) => {
28
+ process.exit(code || 0);
29
+ });
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,16 +1,21 @@
1
1
  {
2
2
  "name": "dp-key",
3
- "version": "0.0.2",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.0.3",
4
+ "description": "dp-key CLI tool",
5
+ "bin": {
6
+ "dp-key": "./bin/dp-key.js"
8
7
  },
9
- "keywords": [],
10
- "author": "",
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/dp-fan/dp-key.git"
14
- },
15
- "homepage": "https://github.com/dp-fan/dp-key"
8
+ "files": [
9
+ "bin/",
10
+ "binaries/"
11
+ ],
12
+ "os": [
13
+ "darwin",
14
+ "linux",
15
+ "win32"
16
+ ],
17
+ "cpu": [
18
+ "x64",
19
+ "arm64"
20
+ ]
16
21
  }
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- // dp-key 主入口文件
2
- module.exports = {
3
- // 在这里添加你的功能
4
- };