initx 0.1.3 → 0.2.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 +7 -6
- package/dist/cli.mjs +1 -1
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<pre align="center">npx <b>initx <something></b></pre>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## What is it?
|
|
8
8
|
|
|
9
9
|
`initx` can quickly execute some scripts through plug-ins to simplify complex functions
|
|
10
10
|
|
|
@@ -67,7 +67,7 @@ initx create user/repo
|
|
|
67
67
|
|
|
68
68
|
</details>
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
## Usage
|
|
71
71
|
|
|
72
72
|
Install it globally
|
|
73
73
|
|
|
@@ -75,10 +75,12 @@ Install it globally
|
|
|
75
75
|
npm i -g initx
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Then you can ignore `npx`
|
|
78
|
+
Then you can ignore `npx`. You can also use `ix` as a short command alias
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
81
|
initx <command> [options]
|
|
82
|
+
# or
|
|
83
|
+
ix <command> [options]
|
|
82
84
|
```
|
|
83
85
|
|
|
84
86
|
Use various functions by installing plugins
|
|
@@ -93,7 +95,7 @@ This will install the `@initx-plugin/git` plugin
|
|
|
93
95
|
initx plugin add git
|
|
94
96
|
```
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
## Plugins
|
|
97
99
|
|
|
98
100
|
- [@initx-plugin/git](https://github.com/initx-collective/initx-plugin-git)
|
|
99
101
|
- [@initx-plugin/gpg](https://github.com/initx-collective/initx-plugin-gpg)
|
|
@@ -102,7 +104,7 @@ initx plugin add git
|
|
|
102
104
|
|
|
103
105
|
Use [initx-plugin-starter](https://github.com/initx-collective/initx-plugin-starter) to get started
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
## Acknowledgement
|
|
106
108
|
|
|
107
109
|
- [cac](https://github.com/cacjs/cac)
|
|
108
110
|
- [ora](https://github.com/sindresorhus/ora)
|
|
@@ -111,5 +113,4 @@ Use [initx-plugin-starter](https://github.com/initx-collective/initx-plugin-star
|
|
|
111
113
|
- [tinyexec](https://github.com/tinylibs/tinyexec)
|
|
112
114
|
- [importx](https://github.com/antfu-collective/importx)
|
|
113
115
|
- [inquirer](https://github.com/SBoudrias/Inquirer.js)
|
|
114
|
-
- [picocolors](https://github.com/alexeyraspopov/picocolors)
|
|
115
116
|
- [which](https://github.com/npm/node-which)
|
package/dist/cli.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"node:process";import{detectManager as m,installManager as b,loadPlugins as f,matchPlugins as x}from"@initx-plugin/core";import{logger as n,loadingFunction as d,inquirer as v}from"@initx-plugin/utils";import w from"cac";const $={version:"0.2.0"},y=/^@?initx-plugin[-/]/,u=w("initx");u.help().command("<something>","see https://github.com/initx-collective/initx").usage("").option("-v, --version","Display version number").option("-d, --debug","Debug mode");const{args:M,options:e}=u.parse();(e.h||e.help)&&o.exit(0),(e.v||e.version)&&(console.log($.version),o.exit(0)),(e.d||e.debug)&&(n.setLevel("debug"),n.debug("Debug mode enabled"));const[a,...I]=M;(!a||typeof a!="string")&&(n.error("Please enter something"),o.exit(0)),n.debug(`Input: ${a}`),(async function(){let r;await d("initx",async()=>{r=await m()}),n.debug(`Manager: ${r?"installed":"not found"}`),r||await d("Installing manager plugin",b);const s=await d("Loading plugins",f);s.length===0&&(n.error("No plugin installed"),o.exit(0)),n.debug(`Loaded ${s.length} plugins`);const c={key:a,cliOptions:e,optionsList:Object.keys(e).filter(i=>e[i]===!0).map(i=>`--${i}`)},t=await x(s,c,...I);if(n.debug(`Matched ${t.length} handlers`),t.length===0&&(n.warn("No handler found"),o.exit(0)),t.length===1){const[{handler:i,description:g}]=t;n.debug(`Running: ${g}`),await i(),o.exit(0)}const l=await v.select("Which handler do you want to run?",t.map(({description:i,packageInfo:g})=>`[${g.name.replace(y,"")}] ${i}`));(!t[l]||typeof t[l].handler!="function")&&(n.error("Handler not found"),o.exit(0));const{handler:p,description:h}=t[l];n.debug(`Running: ${h}`),await p()})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "initx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "A more convenient scripting engine",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/initx-collective/initx#readme",
|
|
@@ -18,14 +18,18 @@
|
|
|
18
18
|
"main": "dist/index.mjs",
|
|
19
19
|
"module": "dist/index.mjs",
|
|
20
20
|
"types": "dist/index.d.ts",
|
|
21
|
-
"bin":
|
|
21
|
+
"bin": {
|
|
22
|
+
"initx": "bin/initx.mjs",
|
|
23
|
+
"ix": "bin/initx.mjs"
|
|
24
|
+
},
|
|
22
25
|
"files": [
|
|
26
|
+
"bin",
|
|
23
27
|
"dist"
|
|
24
28
|
],
|
|
25
29
|
"dependencies": {
|
|
26
|
-
"cac": "^
|
|
27
|
-
"@initx-plugin/core": "0.
|
|
28
|
-
"@initx-plugin/utils": "0.
|
|
30
|
+
"cac": "^7.0.0",
|
|
31
|
+
"@initx-plugin/core": "0.2.0",
|
|
32
|
+
"@initx-plugin/utils": "0.2.0"
|
|
29
33
|
},
|
|
30
34
|
"scripts": {
|
|
31
35
|
"stub": "unbuild --stub",
|