initx 0.0.18 → 0.0.20

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +8 -16
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import cac from 'cac';
2
2
  import { log, inquirer } from '@initx-plugin/utils';
3
- import { loadPlugins } from '@initx-plugin/core';
3
+ import { loadPlugins, matchPlugins } from '@initx-plugin/core';
4
4
 
5
- const pkgJson = {name:"initx",type:"module",version:"0.0.18",packageManager:"pnpm@9.12.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"}};
5
+ const pkgJson = {name:"initx",type:"module",version:"0.0.20",packageManager:"pnpm@9.12.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"}};
6
6
 
7
7
  const cli = cac("initx");
8
8
  cli.help().command("<something>", "see https://github.com/initx-collective/initx").usage("").option("-v, --version", "Display version number");
@@ -25,20 +25,12 @@ if (!key || typeof key !== "string") {
25
25
  log.error("No plugin installed");
26
26
  process.exit(0);
27
27
  }
28
- const matchedHandlers = [];
29
- for (const plugin of plugins) {
30
- const { handler, packageInfo } = plugin;
31
- const matched = handler.run({
32
- key,
33
- cliOptions,
34
- optionsList: Object.keys(cliOptions).filter((key2) => cliOptions[key2] === true).map((key2) => `--${key2}`)
35
- }, ...others);
36
- matchedHandlers.push(...matched.map((item) => ({
37
- handler: item.handler,
38
- description: item.description,
39
- packageInfo
40
- })));
41
- }
28
+ const ctx = {
29
+ key,
30
+ cliOptions,
31
+ optionsList: Object.keys(cliOptions).filter((key2) => cliOptions[key2] === true).map((key2) => `--${key2}`)
32
+ };
33
+ const matchedHandlers = matchPlugins(plugins, ctx, ...others);
42
34
  if (matchedHandlers.length === 0) {
43
35
  process.exit(0);
44
36
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "initx",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.20",
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/utils": "0.0.18",
28
- "@initx-plugin/core": "0.0.18"
27
+ "@initx-plugin/core": "0.0.20",
28
+ "@initx-plugin/utils": "0.0.20"
29
29
  },
30
30
  "scripts": {
31
31
  "stub": "unbuild --stub",