@simon_he/pi 0.0.7 → 0.0.8
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 +25 -23
- package/dist/index.cjs +10 -10
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
<span ><p align="center"></p></span>
|
|
2
|
+
<p align="center"> English | <a href="./README_zh.md">简体中文</a></p>
|
|
3
|
+
<p align="center"><a href="https://www.npmjs.com/package/@simon_he/pi"><img src="https://img.shields.io/npm/v/@simon_he/pi?color=3fb883&label=" alt="NPM version"></a>
|
|
2
4
|
|
|
3
|
-
## PI
|
|
4
|
-
|
|
5
|
+
## :lollipop: PI
|
|
6
|
+
A smart package manager with a custom loading style, which makes you install dependencies more beautifully :)
|
|
5
7
|
|
|
6
|
-
##
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
8
|
+
## :rocket: Smart package manager
|
|
9
|
+
- Supports dependency installation, uninstallation, execution and packaging of go mod
|
|
10
|
+
- Supports Cargo's dependency installation, uninstallation, execution and packaging
|
|
11
|
+
- Support npm dependency installation, uninstallation and execution
|
|
12
|
+
- Support pnpm dependency installation, uninstallation and execution
|
|
13
|
+
- Support yarn dependency installation, uninstallation and execution
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
https://user-images.githubusercontent.com/57086651/203143603-9e78f686-399e-4c3d-ae53-56638501b276.mov
|
|
15
17
|
|
|
16
18
|
|
|
17
|
-
##
|
|
19
|
+
## :gear: Install
|
|
18
20
|
```
|
|
19
21
|
npm i -g @simon_he/pi
|
|
20
22
|
```
|
|
21
23
|
|
|
22
|
-
##
|
|
24
|
+
## :open_hands: Usage
|
|
23
25
|
```
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
+
# According to the environment of the current directory to analyze which package manager to use,go、rust、pnpm、yarn、npm
|
|
27
|
+
# Install dependencies
|
|
26
28
|
pi xxx
|
|
27
|
-
#
|
|
29
|
+
# Uninstall dependencies
|
|
28
30
|
pui xxx
|
|
29
|
-
#
|
|
31
|
+
# Execute command
|
|
30
32
|
prun
|
|
31
|
-
#
|
|
33
|
+
# Initialization
|
|
32
34
|
pinit
|
|
33
|
-
#
|
|
35
|
+
# build - for cargo, go
|
|
34
36
|
pbuild
|
|
35
37
|
```
|
|
36
38
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
+
## :bulb: Custom configuration
|
|
40
|
+
You can configure the loading style in .zshrc, as follows:
|
|
39
41
|
```
|
|
40
|
-
export PI_COLOR=red #
|
|
41
|
-
export PI_SPINNER=star #
|
|
42
|
+
export PI_COLOR=red # loadingstyle color
|
|
43
|
+
export PI_SPINNER=star # loadingstyle
|
|
42
44
|
```
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
+
- 70+ types of styles, from[cli-spinners](https://jsfiddle.net/sindresorhus/2eLtsbey/embedded/result/),You can choose to fill in the name in PI_SPINNER.
|
|
46
|
+
- Color options: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray', Fill in PI_COLOR.
|
|
45
47
|
|
|
46
|
-
##
|
|
48
|
+
## :battery: Dependency
|
|
47
49
|
- [@antfu/ni](https://github.com/antfu/ni)
|
|
48
50
|
- [ora](https://github.com/sindresorhus/ora)
|
|
49
51
|
- [ccommand](https://github.com/Simon-He95/ccommand)
|
package/dist/index.cjs
CHANGED
|
@@ -14,16 +14,16 @@ const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
|
14
14
|
const process__default = /*#__PURE__*/_interopDefaultLegacy(process);
|
|
15
15
|
const ora__default = /*#__PURE__*/_interopDefaultLegacy(ora);
|
|
16
16
|
|
|
17
|
-
const version = "0.0.
|
|
17
|
+
const version = "0.0.8";
|
|
18
18
|
|
|
19
19
|
const __filename$1 = url$1.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
20
20
|
const __dirname$1 = path__default.dirname(__filename$1);
|
|
21
21
|
const url = path__default.resolve(__dirname$1, "./seprateThread.mjs");
|
|
22
22
|
async function pi(params, pkg) {
|
|
23
23
|
const text = pkg ? `Installing ${pkg} ...
|
|
24
|
-
` : "
|
|
25
|
-
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "
|
|
26
|
-
const failMsg = pkg ? `Failed to install ${pkg}
|
|
24
|
+
` : "Updating dependency ...\n";
|
|
25
|
+
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
|
|
26
|
+
const failMsg = pkg ? `Failed to install ${pkg} \u{1F62D}` : "Failed to update dependency! \u{1F62D}";
|
|
27
27
|
const loading_status = await loading(text);
|
|
28
28
|
const { status } = await simonJsTool.useNodeWorker(url, `ni ${params}`);
|
|
29
29
|
if (status === 0)
|
|
@@ -38,7 +38,7 @@ async function pui(params, pkg) {
|
|
|
38
38
|
const successMsg = `unInstalled ${pkg} successfully! \u{1F60A}`;
|
|
39
39
|
const failMsg = `Failed to uninstall ${pkg} \u{1F62D}`;
|
|
40
40
|
if (!pkg) {
|
|
41
|
-
console.log("
|
|
41
|
+
console.log("Need to specify an uninstall package name");
|
|
42
42
|
process__default.exit(1);
|
|
43
43
|
}
|
|
44
44
|
const loading_status = await loading(text);
|
|
@@ -53,7 +53,7 @@ function prun(params) {
|
|
|
53
53
|
simonJsTool.jsShell(`ccommand ${params}`);
|
|
54
54
|
}
|
|
55
55
|
function pinit() {
|
|
56
|
-
console.log("
|
|
56
|
+
console.log("Initializing project...");
|
|
57
57
|
switch (simonJsTool.getPkgTool()) {
|
|
58
58
|
case "npm":
|
|
59
59
|
simonJsTool.jsShell("npm init -y");
|
|
@@ -89,7 +89,7 @@ async function installDeps() {
|
|
|
89
89
|
function returnVersion(argv) {
|
|
90
90
|
const arg = argv[0];
|
|
91
91
|
if (arg === "-v" || arg === "--version") {
|
|
92
|
-
simonJsTool.jsShell(`gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" 'pi version:${version}' '\
|
|
92
|
+
simonJsTool.jsShell(`gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" 'pi version:${version}' 'Please give me a \u{1F31F} for my efforts'`);
|
|
93
93
|
process__default.exit(0);
|
|
94
94
|
} else if (arg === "-h" || arg === "--help") {
|
|
95
95
|
simonJsTool.jsShell(`gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "1 1" 'PI Commands:' 'pi: install package' 'pui: uninstall package' 'prun: run package script' 'pinit: package init' 'pbuild: go build | cargo build'`);
|
|
@@ -150,7 +150,7 @@ async function runner() {
|
|
|
150
150
|
} else if (exec === "pbuild") {
|
|
151
151
|
simonJsTool.jsShell(`go build ${params}`);
|
|
152
152
|
} else {
|
|
153
|
-
console.log("
|
|
153
|
+
console.log("The commands is not supported");
|
|
154
154
|
}
|
|
155
155
|
process__default.exit();
|
|
156
156
|
}
|
|
@@ -178,12 +178,12 @@ async function runner() {
|
|
|
178
178
|
} else if (exec === "pbuild") {
|
|
179
179
|
simonJsTool.jsShell(`cargo build ${params}`);
|
|
180
180
|
} else {
|
|
181
|
-
console.log("
|
|
181
|
+
console.log("The commands is not supported");
|
|
182
182
|
}
|
|
183
183
|
process__default.exit();
|
|
184
184
|
}
|
|
185
185
|
if (!runMap[exec]) {
|
|
186
|
-
console.log("
|
|
186
|
+
console.log("The command does not exist, please execute pi -h to view the help");
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
189
|
const pkg = argv.filter((v) => !v.startsWith("-")).join(" ");
|
package/dist/index.mjs
CHANGED
|
@@ -4,16 +4,16 @@ import { fileURLToPath } from 'url';
|
|
|
4
4
|
import { useNodeWorker, jsShell, getPkgTool } from 'simon-js-tool';
|
|
5
5
|
import ora from 'ora';
|
|
6
6
|
|
|
7
|
-
const version = "0.0.
|
|
7
|
+
const version = "0.0.8";
|
|
8
8
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
10
|
const __dirname = path.dirname(__filename);
|
|
11
11
|
const url = path.resolve(__dirname, "./seprateThread.mjs");
|
|
12
12
|
async function pi(params, pkg) {
|
|
13
13
|
const text = pkg ? `Installing ${pkg} ...
|
|
14
|
-
` : "
|
|
15
|
-
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "
|
|
16
|
-
const failMsg = pkg ? `Failed to install ${pkg}
|
|
14
|
+
` : "Updating dependency ...\n";
|
|
15
|
+
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
|
|
16
|
+
const failMsg = pkg ? `Failed to install ${pkg} \u{1F62D}` : "Failed to update dependency! \u{1F62D}";
|
|
17
17
|
const loading_status = await loading(text);
|
|
18
18
|
const { status } = await useNodeWorker(url, `ni ${params}`);
|
|
19
19
|
if (status === 0)
|
|
@@ -28,7 +28,7 @@ async function pui(params, pkg) {
|
|
|
28
28
|
const successMsg = `unInstalled ${pkg} successfully! \u{1F60A}`;
|
|
29
29
|
const failMsg = `Failed to uninstall ${pkg} \u{1F62D}`;
|
|
30
30
|
if (!pkg) {
|
|
31
|
-
console.log("
|
|
31
|
+
console.log("Need to specify an uninstall package name");
|
|
32
32
|
process.exit(1);
|
|
33
33
|
}
|
|
34
34
|
const loading_status = await loading(text);
|
|
@@ -43,7 +43,7 @@ function prun(params) {
|
|
|
43
43
|
jsShell(`ccommand ${params}`);
|
|
44
44
|
}
|
|
45
45
|
function pinit() {
|
|
46
|
-
console.log("
|
|
46
|
+
console.log("Initializing project...");
|
|
47
47
|
switch (getPkgTool()) {
|
|
48
48
|
case "npm":
|
|
49
49
|
jsShell("npm init -y");
|
|
@@ -79,7 +79,7 @@ async function installDeps() {
|
|
|
79
79
|
function returnVersion(argv) {
|
|
80
80
|
const arg = argv[0];
|
|
81
81
|
if (arg === "-v" || arg === "--version") {
|
|
82
|
-
jsShell(`gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" 'pi version:${version}' '\
|
|
82
|
+
jsShell(`gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" 'pi version:${version}' 'Please give me a \u{1F31F} for my efforts'`);
|
|
83
83
|
process.exit(0);
|
|
84
84
|
} else if (arg === "-h" || arg === "--help") {
|
|
85
85
|
jsShell(`gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "1 1" 'PI Commands:' 'pi: install package' 'pui: uninstall package' 'prun: run package script' 'pinit: package init' 'pbuild: go build | cargo build'`);
|
|
@@ -140,7 +140,7 @@ async function runner() {
|
|
|
140
140
|
} else if (exec === "pbuild") {
|
|
141
141
|
jsShell(`go build ${params}`);
|
|
142
142
|
} else {
|
|
143
|
-
console.log("
|
|
143
|
+
console.log("The commands is not supported");
|
|
144
144
|
}
|
|
145
145
|
process.exit();
|
|
146
146
|
}
|
|
@@ -168,12 +168,12 @@ async function runner() {
|
|
|
168
168
|
} else if (exec === "pbuild") {
|
|
169
169
|
jsShell(`cargo build ${params}`);
|
|
170
170
|
} else {
|
|
171
|
-
console.log("
|
|
171
|
+
console.log("The commands is not supported");
|
|
172
172
|
}
|
|
173
173
|
process.exit();
|
|
174
174
|
}
|
|
175
175
|
if (!runMap[exec]) {
|
|
176
|
-
console.log("
|
|
176
|
+
console.log("The command does not exist, please execute pi -h to view the help");
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
179
|
const pkg = argv.filter((v) => !v.startsWith("-")).join(" ");
|