initx 0.0.37 → 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 +90 -2
- package/dist/cli.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,13 +4,101 @@
|
|
|
4
4
|
|
|
5
5
|
<pre align="center">npx <b>initx <something></b></pre>
|
|
6
6
|
|
|
7
|
+
# What is it?
|
|
8
|
+
|
|
9
|
+
`initx` can quickly execute some scripts through plug-ins to simplify complex functions
|
|
10
|
+
|
|
11
|
+
like ...
|
|
12
|
+
|
|
13
|
+
<details>
|
|
14
|
+
<summary>
|
|
15
|
+
Set the git username and email address via <code>@initx-plugin/git</code> plugin
|
|
16
|
+
</summary>
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# before
|
|
20
|
+
git config --global user.name "foo"
|
|
21
|
+
git config --global user.email "foo@example.com"
|
|
22
|
+
|
|
23
|
+
# after
|
|
24
|
+
initx user foo foo@example.com
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
</details>
|
|
28
|
+
|
|
29
|
+
<details>
|
|
30
|
+
<summary>
|
|
31
|
+
Copy SSH or GPG public key via <code>@initx-plugin/cp</code> plugin
|
|
32
|
+
</summary>
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# before
|
|
36
|
+
gpg -k # get the key id
|
|
37
|
+
gpg --armor --export <key-id> # export the key
|
|
38
|
+
|
|
39
|
+
# after
|
|
40
|
+
initx cp gpg
|
|
41
|
+
|
|
42
|
+
# before
|
|
43
|
+
# open ~/.ssh/id_rsa.pub or C:/Users/<username>/.ssh/id_rsa.pub and copy it
|
|
44
|
+
|
|
45
|
+
# after
|
|
46
|
+
initx cp ssh
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
</details>
|
|
50
|
+
|
|
51
|
+
<details>
|
|
52
|
+
<summary>
|
|
53
|
+
Manage code projects using <code>@initx-plugin/pm</code>
|
|
54
|
+
</summary>
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# before
|
|
58
|
+
# open github, copy clone url
|
|
59
|
+
# use terminal cd to ~/projects, git clone <url>
|
|
60
|
+
# maybe more steps
|
|
61
|
+
|
|
62
|
+
# after
|
|
63
|
+
initx pm add ~/projects # add projects directory, only need to do it once
|
|
64
|
+
initx create user/repo
|
|
65
|
+
# or initx create user/repo project-name
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
</details>
|
|
69
|
+
|
|
70
|
+
# Usage
|
|
71
|
+
|
|
72
|
+
Install it globally
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm i -g initx
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Then you can ignore `npx`
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
initx <command> [options]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Use various functions by installing plugins
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
initx plugin add <plugin-name>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This will install the `@initx-plugin/git` plugin
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
initx plugin add git
|
|
94
|
+
```
|
|
95
|
+
|
|
7
96
|
# Plugins
|
|
8
97
|
|
|
9
98
|
- [@initx-plugin/git](https://github.com/initx-collective/initx-plugin-git)
|
|
10
99
|
- [@initx-plugin/gpg](https://github.com/initx-collective/initx-plugin-gpg)
|
|
11
100
|
- [@initx-plugin/cp](https://github.com/initx-collective/initx-plugin-cp)
|
|
12
|
-
|
|
13
|
-
You can use [@initx-plugin/manager](https://github.com/initx-collective/initx-plugin-manager) to manage plugins
|
|
101
|
+
- [@initx-plugin/pm](https://github.com/initx-collective/initx-plugin-pm)
|
|
14
102
|
|
|
15
103
|
Use [initx-plugin-starter](https://github.com/initx-collective/initx-plugin-starter) to get started
|
|
16
104
|
|
package/dist/cli.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import i from"node:process";import{detectManager as m,installManager as h,loadPlugins as u,matchPlugins as d}from"@initx-plugin/core";import{log as o,loadingFunction as l,inquirer as f}from"@initx-plugin/utils";import x from"cac";const v={version:"0.0
|
|
1
|
+
import i from"node:process";import{detectManager as m,installManager as h,loadPlugins as u,matchPlugins as d}from"@initx-plugin/core";import{log as o,loadingFunction as l,inquirer as f}from"@initx-plugin/utils";import x from"cac";const v={version:"0.1.0"},c=x("initx");c.help().command("<something>","see https://github.com/initx-collective/initx").usage("").option("-v, --version","Display version number");const{args:w,options:e}=c.parse();(e.h||e.help)&&i.exit(0),(e.v||e.version)&&(console.log(v.version),i.exit(0));const[r,...y]=w;(!r||typeof r!="string")&&(o.error("Please enter something"),i.exit(0)),async function(){m()||await l("Installing manager plugin",h);const s=await l("Loading plugins",u);s.length===0&&(o.error("No plugin installed"),i.exit(0));const p={key:r,cliOptions:e,optionsList:Object.keys(e).filter(t=>e[t]===!0).map(t=>`--${t}`)},n=await d(s,p,...y);if(n.length===0&&(o.warn("No handler found"),i.exit(0)),n.length===1){const[{handler:t}]=n;await t(),i.exit(0)}const a=await f.select("Which handler do you want to run?",n.map(({description:t,packageInfo:g})=>`[${g.name.replace(/^@?initx-plugin[-/]/,"")}] ${t}`));(!n[a]||typeof n[a].handler!="function")&&(o.error("Handler not found"),i.exit(0)),await n[a].handler()}();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "initx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"description": "A more convenient scripting engine",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/initx-collective/initx#readme",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"cac": "^6.7.14",
|
|
27
|
-
"@initx-plugin/
|
|
28
|
-
"@initx-plugin/
|
|
27
|
+
"@initx-plugin/core": "0.1.0",
|
|
28
|
+
"@initx-plugin/utils": "0.1.0"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"stub": "unbuild --stub",
|