initx 0.0.27 → 0.0.28
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 +1 -1
- package/dist/cli.mjs +1 -54
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Use [initx-plugin-starter](https://github.com/initx-collective/initx-plugin-star
|
|
|
18
18
|
|
|
19
19
|
- [cac](https://github.com/cacjs/cac)
|
|
20
20
|
- [defu](https://github.com/unjs/defu)
|
|
21
|
-
- [
|
|
21
|
+
- [tinyexec](https://github.com/tinylibs/tinyexec)
|
|
22
22
|
- [importx](https://github.com/antfu-collective/importx)
|
|
23
23
|
- [inquirer](https://github.com/SBoudrias/Inquirer.js)
|
|
24
24
|
- [picocolors](https://github.com/alexeyraspopov/picocolors)
|
package/dist/cli.mjs
CHANGED
|
@@ -1,54 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { loadPlugins, matchPlugins } from '@initx-plugin/core';
|
|
3
|
-
import { log, loadingFunction, inquirer } from '@initx-plugin/utils';
|
|
4
|
-
import cac from 'cac';
|
|
5
|
-
|
|
6
|
-
const pkgJson = {name:"initx",type:"module",version:"0.0.27",packageManager:"pnpm@9.14.2",description:"A more convenient scripting engine",license:"MIT",homepage:"https://github.com/initx-collective/initx#readme",repository:{type:"git",url:"git@github.com:initx-collective/initx.git"},bugs:{url:"https://github.com/initx-collective/initx/issues"},keywords:["initx"],main:"dist/index.mjs",module:"dist/index.mjs",types:"dist/index.d.ts",bin:"bin/initx.mjs",files:["dist"],scripts:{stub:"unbuild --stub",build:"unbuild"},dependencies:{"@initx-plugin/core":"workspace:*","@initx-plugin/utils":"workspace:*",cac:"^6.7.14"}};
|
|
7
|
-
|
|
8
|
-
const cli = cac("initx");
|
|
9
|
-
cli.help().command("<something>", "see https://github.com/initx-collective/initx").usage("").option("-v, --version", "Display version number");
|
|
10
|
-
const { args, options: cliOptions } = cli.parse();
|
|
11
|
-
if (cliOptions.h || cliOptions.help) {
|
|
12
|
-
process.exit(0);
|
|
13
|
-
}
|
|
14
|
-
if (cliOptions.v || cliOptions.version) {
|
|
15
|
-
console.log(pkgJson.version);
|
|
16
|
-
process.exit(0);
|
|
17
|
-
}
|
|
18
|
-
const [key, ...others] = args;
|
|
19
|
-
if (!key || typeof key !== "string") {
|
|
20
|
-
log.error("Please enter something");
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
(async function() {
|
|
24
|
-
const plugins = await loadingFunction("Loading plugins", loadPlugins);
|
|
25
|
-
if (plugins.length === 0) {
|
|
26
|
-
log.error("No plugin installed");
|
|
27
|
-
process.exit(0);
|
|
28
|
-
}
|
|
29
|
-
const ctx = {
|
|
30
|
-
key,
|
|
31
|
-
cliOptions,
|
|
32
|
-
optionsList: Object.keys(cliOptions).filter((key2) => cliOptions[key2] === true).map((key2) => `--${key2}`)
|
|
33
|
-
};
|
|
34
|
-
const matchedHandlers = matchPlugins(plugins, ctx, ...others);
|
|
35
|
-
if (matchedHandlers.length === 0) {
|
|
36
|
-
process.exit(0);
|
|
37
|
-
}
|
|
38
|
-
if (matchedHandlers.length === 1) {
|
|
39
|
-
const [{ handler }] = matchedHandlers;
|
|
40
|
-
await handler();
|
|
41
|
-
process.exit(0);
|
|
42
|
-
}
|
|
43
|
-
const index = await inquirer.select(
|
|
44
|
-
"Which handler do you want to run?",
|
|
45
|
-
matchedHandlers.map(
|
|
46
|
-
({ description, packageInfo }) => `[${packageInfo.name.replace(/^@?initx-plugin[-/]/, "")}] ${description}`
|
|
47
|
-
)
|
|
48
|
-
);
|
|
49
|
-
if (!matchedHandlers[index] || typeof matchedHandlers[index].handler !== "function") {
|
|
50
|
-
log.error("Handler not found");
|
|
51
|
-
process.exit(0);
|
|
52
|
-
}
|
|
53
|
-
await matchedHandlers[index].handler();
|
|
54
|
-
})();
|
|
1
|
+
import e from"node:process";import{loadPlugins as u,matchPlugins as g}from"@initx-plugin/core";import{log as s,loadingFunction as d,inquirer as m}from"@initx-plugin/utils";import x from"cac";const h={name:"initx",type:"module",version:"0.0.28",packageManager:"pnpm@9.15.3",description:"A more convenient scripting engine",license:"MIT",homepage:"https://github.com/initx-collective/initx#readme",repository:{type:"git",url:"git@github.com:initx-collective/initx.git"},bugs:{url:"https://github.com/initx-collective/initx/issues"},keywords:["initx"],main:"dist/index.mjs",module:"dist/index.mjs",types:"dist/index.d.ts",bin:"bin/initx.mjs",files:["dist"],scripts:{stub:"unbuild --stub",build:"unbuild"},dependencies:{"@initx-plugin/core":"workspace:*","@initx-plugin/utils":"workspace:*",cac:"^6.7.14"}},c=x("initx");c.help().command("<something>","see https://github.com/initx-collective/initx").usage("").option("-v, --version","Display version number");const{args:b,options:n}=c.parse();(n.h||n.help)&&e.exit(0),(n.v||n.version)&&(console.log(h.version),e.exit(0));const[r,...f]=b;(!r||typeof r!="string")&&(s.error("Please enter something"),e.exit(0)),async function(){const l=await d("Loading plugins",u);l.length===0&&(s.error("No plugin installed"),e.exit(0));const a={key:r,cliOptions:n,optionsList:Object.keys(n).filter(t=>n[t]===!0).map(t=>`--${t}`)},i=g(l,a,...f);if(i.length===0&&e.exit(0),i.length===1){const[{handler:t}]=i;await t(),e.exit(0)}const o=await m.select("Which handler do you want to run?",i.map(({description:t,packageInfo:p})=>`[${p.name.replace(/^@?initx-plugin[-/]/,"")}] ${t}`));(!i[o]||typeof i[o].handler!="function")&&(s.error("Handler not found"),e.exit(0)),await i[o].handler()}();
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export*from"@initx-plugin/core";
|
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.0.28",
|
|
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/utils": "0.0.28",
|
|
28
|
+
"@initx-plugin/core": "0.0.28"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"stub": "unbuild --stub",
|