initx 0.0.6 → 0.0.7

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/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@ import cac from 'cac';
2
2
  import { GitHandler } from '@initx-plugin/git';
3
3
  import { CpHandler } from '@initx-plugin/cp';
4
4
 
5
- const pkgJson = {name:"initx",type:"module",version:"0.0.6",packageManager:"pnpm@9.12.2",description:"More convenient initialization tool",author:"imba97",license:"MIT",homepage:"https://github.com/imba97/initx#readme",repository:{type:"git",url:"git+ssh://git@github.com/imba97/initx"},bugs:{url:"https://github.com/imba97/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/cp":"workspace:*","@initx-plugin/git":"workspace:*",cac:"^6.7.14"},devDependencies:{"@initx-plugin/core":"workspace:*"}};
5
+ const pkgJson = {name:"initx",type:"module",version:"0.0.7",packageManager:"pnpm@9.12.2",description:"More convenient initialization tool",author:"imba97",license:"MIT",homepage:"https://github.com/imba97/initx#readme",repository:{type:"git",url:"git+ssh://git@github.com/imba97/initx"},bugs:{url:"https://github.com/imba97/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/cp":"workspace:*","@initx-plugin/git":"workspace:*",cac:"^6.7.14"}};
6
6
 
7
7
  function getDefaultExportFromCjs (x) {
8
8
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -103,21 +103,25 @@ const handlers = [
103
103
 
104
104
  const cli = cac("initx");
105
105
  cli.help().command("<something>", "see https://github.com/imba97/initx").usage("").option("-v, --version", "Display version number");
106
- const { args, options } = cli.parse();
107
- if (options.h || options.help) {
106
+ const { args, options: cliOptions } = cli.parse();
107
+ if (cliOptions.h || cliOptions.help) {
108
108
  process.exit(0);
109
109
  }
110
- if (options.v || options.version) {
110
+ if (cliOptions.v || cliOptions.version) {
111
111
  console.log(pkgJson.version);
112
112
  process.exit(0);
113
113
  }
114
- const [something, ...rest] = args;
115
- if (!something || typeof something !== "string") {
114
+ const [key, ...others] = args;
115
+ if (!key || typeof key !== "string") {
116
116
  log.error("Please enter something");
117
117
  process.exit(0);
118
118
  }
119
119
  (async function() {
120
120
  for (const handler of handlers) {
121
- await handler.run(something, ...rest);
121
+ await handler.run({
122
+ key,
123
+ cliOptions,
124
+ optionsList: Object.keys(cliOptions).filter((key2) => cliOptions[key2] === true).map((key2) => `--${key2}`)
125
+ }, ...others);
122
126
  }
123
127
  })();
package/dist/index.mjs CHANGED
@@ -1,38 +1,3 @@
1
1
  export { GitHandler } from '@initx-plugin/git';
2
2
  export { CpHandler } from '@initx-plugin/cp';
3
-
4
- class InitxHandler {
5
- async run(value, ...others) {
6
- if (this.isObject(this.matchers)) {
7
- const keys = Object.keys(this.matchers);
8
- for (let i = 0; i < keys.length; i++) {
9
- const matcher = this.matchers[keys[i]];
10
- const isPassed2 = this.isPassed(matcher, value);
11
- if (isPassed2) {
12
- this.handle(value, keys[i], ...others);
13
- break;
14
- }
15
- }
16
- return;
17
- }
18
- const isPassed = this.isPassed(this.matchers, value);
19
- if (!isPassed) {
20
- return;
21
- }
22
- await this.handle(value, ...others);
23
- }
24
- isObject(value) {
25
- return typeof value === "object" && value !== null && !Array.isArray(value);
26
- }
27
- isPassed(matchers, value) {
28
- const tests = Array.isArray(matchers) ? matchers : [matchers];
29
- return tests.some((test) => {
30
- if (typeof test === "string") {
31
- return test === value;
32
- }
33
- return test.test(value);
34
- });
35
- }
36
- }
37
-
38
- export { InitxHandler };
3
+ 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.6",
4
+ "version": "0.0.7",
5
5
  "description": "More convenient initialization tool",
6
6
  "author": "imba97",
7
7
  "license": "MIT",
@@ -25,11 +25,9 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "cac": "^6.7.14",
28
- "@initx-plugin/cp": "0.0.6",
29
- "@initx-plugin/git": "0.0.6"
30
- },
31
- "devDependencies": {
32
- "@initx-plugin/core": "0.0.6"
28
+ "@initx-plugin/core": "0.0.7",
29
+ "@initx-plugin/git": "0.0.7",
30
+ "@initx-plugin/cp": "0.0.7"
33
31
  },
34
32
  "scripts": {
35
33
  "stub": "unbuild --stub",