initx 0.1.4 → 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 CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <pre align="center">npx <b>initx &lt;something&gt;</b></pre>
6
6
 
7
- # What is it?
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
- # Usage
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
- # Plugins
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
- # Acknowledgement
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 i from"node:process";import{detectManager as h,installManager as u,loadPlugins as d,matchPlugins as f}from"@initx-plugin/core";import{log as o,loadingFunction as r,inquirer as x}from"@initx-plugin/utils";import w from"cac";const v={version:"0.1.4"},g=w("initx");g.help().command("<something>","see https://github.com/initx-collective/initx").usage("").option("-v, --version","Display version number");const{args:y,options:e}=g.parse();(e.h||e.help)&&i.exit(0),(e.v||e.version)&&(console.log(v.version),i.exit(0));const[s,...b]=y;(!s||typeof s!="string")&&(o.error("Please enter something"),i.exit(0)),(async function(){let l;await r("initx",async()=>{l=await h()}),l||await r("Installing manager plugin",u);const c=await r("Loading plugins",d);c.length===0&&(o.error("No plugin installed"),i.exit(0));const p={key:s,cliOptions:e,optionsList:Object.keys(e).filter(t=>e[t]===!0).map(t=>`--${t}`)},n=await f(c,p,...b);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 x.select("Which handler do you want to run?",n.map(({description:t,packageInfo:m})=>`[${m.name.replace(/^@?initx-plugin[-/]/,"")}] ${t}`));(!n[a]||typeof n[a].handler!="function")&&(o.error("Handler not found"),i.exit(0)),await n[a].handler()})();
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.1.4",
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",
@@ -27,9 +27,9 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "cac": "^6.7.14",
31
- "@initx-plugin/core": "0.1.4",
32
- "@initx-plugin/utils": "0.1.4"
30
+ "cac": "^7.0.0",
31
+ "@initx-plugin/core": "0.2.0",
32
+ "@initx-plugin/utils": "0.2.0"
33
33
  },
34
34
  "scripts": {
35
35
  "stub": "unbuild --stub",