klei-cli 1.0.3 → 1.0.5

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 (3) hide show
  1. package/README.md +13 -7
  2. package/bin/cli.js +41 -17
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -16,7 +16,19 @@ pnpm install -g klei-cli
16
16
 
17
17
  Para usar la CLI, puedes ejecutar los siguientes comandos:
18
18
 
19
- ### Mostrar Ayuda
19
+ ### create
20
+
21
+ Este comando crea un nuevo proyecto.
22
+
23
+ ```bash
24
+ # klei create <nombre> [opciones]
25
+ # klei create mi-proyecto
26
+ # klei create --t npmjs
27
+ # klei create --type npmjs
28
+ klei create mi-proyecto --type npmjs
29
+ ```
30
+
31
+ ### help
20
32
 
21
33
  Este comando muestra la ayuda y los comandos disponibles.
22
34
 
@@ -30,12 +42,6 @@ klei help
30
42
  - `--t, --type <type>`: Especifica el tipo de proyecto.
31
43
  - `help`: Muestra la ayuda y los comandos disponibles.
32
44
 
33
- ## Ejemplos
34
-
35
- ```bash
36
- klei create mi-proyecto --type npmjs
37
- ```
38
-
39
45
  ## Contribuir
40
46
 
41
47
  Si deseas contribuir a este proyecto, por favor sigue los siguientes pasos:
package/bin/cli.js CHANGED
@@ -4,6 +4,7 @@
4
4
  // src/index.ts
5
5
  import chalk4 from "chalk";
6
6
  import { program } from "commander";
7
+ import fs3 from "fs";
7
8
 
8
9
  // src/utils/banner.ts
9
10
  import chalk from "chalk";
@@ -47,10 +48,10 @@ var npmjs = [
47
48
  scripts: {
48
49
  start: "tsx src/index.ts",
49
50
  xtart: "npx -y tsx src/index.ts",
50
- watch: 'tsup --entry.index src/index.ts --watch --onSuccess "node dist/index.js"',
51
- build: "tsup --entry.index src/index.ts --format esm,cjs --dts",
52
- "test:esm": 'tsup --entry.test src/index.ts --format esm --watch --onSuccess "node dist/test.js"',
53
- "test:spec": 'tsup test/test.spec.ts --format esm --onSuccess "cross-env NODE_ENV=test node --test dist/test.spec.js"'
51
+ watch: 'tsup --entry.index src/index.ts --format esm --clean --watch --onSuccess "node dist/index.js"',
52
+ build: "tsup --entry.index src/index.ts --format esm,cjs --dts --clean",
53
+ "test:esm": 'tsup --entry.test src/index.ts --format esm --clean --onSuccess "node dist/test.js"',
54
+ "test:spec": 'tsup test/test.spec.ts --format esm --clean --onSuccess "cross-env NODE_ENV=test node --test dist/test.spec.js"'
54
55
  },
55
56
  keywords: [],
56
57
  author: "",
@@ -60,7 +61,7 @@ var npmjs = [
60
61
  "@eslint/js": "latest",
61
62
  // "@types/assert": 'latest',
62
63
  "@types/node": "latest",
63
- // 'cross-env': 'latest',
64
+ "cross-env": "latest",
64
65
  eslint: "latest",
65
66
  nodemon: "latest",
66
67
  "ts-node": "latest",
@@ -89,15 +90,16 @@ export default defineConfig(${JSON.stringify({
89
90
  $schema: "https://json.schemastore.org/tsconfig",
90
91
  display: "Default",
91
92
  compilerOptions: {
92
- target: "ES2016",
93
- module: "CommonJS",
94
- outDir: "./dist",
95
- rootDir: "./src",
93
+ target: "ES2024",
94
+ module: "ES2022",
95
+ // outDir: './dist',
96
+ // rootDir: './src',
96
97
  strict: true,
97
98
  esModuleInterop: true,
98
99
  skipLibCheck: true,
99
100
  forceConsistentCasingInFileNames: true,
100
101
  declaration: true,
102
+ moduleResolution: "node",
101
103
  resolveJsonModule: true,
102
104
  noUnusedLocals: false,
103
105
  noImplicitThis: false,
@@ -109,8 +111,8 @@ export default defineConfig(${JSON.stringify({
109
111
  ]
110
112
  }
111
113
  },
112
- include: ["src/**/*"],
113
- exclude: ["node_modules", "**.spec.ts", "dist", "build", "docs"]
114
+ include: ["."],
115
+ exclude: ["node_modules", "dist", "build", "docs"]
114
116
  }, null, 2),
115
117
  pathFileName: "tsconfig.json"
116
118
  },
@@ -129,12 +131,12 @@ interface User {
129
131
  type GreetUser = (user: User) => string;
130
132
 
131
133
  // Example implementation of the GreetUser function
132
- const greetUser: GreetUser = (user) => {
134
+ export const greetUser: GreetUser = (user) => {
133
135
  return \`Hello, \${user.name}! Your email is \${user.email}.\`;
134
136
  };
135
137
 
136
138
  // Example usage
137
- const exampleUser: User = {
139
+ export const exampleUser: User = {
138
140
  id: 1,
139
141
  name: 'John Doe',
140
142
  email: 'john.doe@example.com',
@@ -174,6 +176,27 @@ export default tseslint.config(
174
176
  }
175
177
  )`,
176
178
  pathFileName: "eslint.config.mjs"
179
+ },
180
+ {
181
+ content: `// \u2501\u2501 IMPORT MODULES \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
182
+ // \xBB IMPORT NATIVE NODE MODULES
183
+
184
+ import { describe, it } from 'node:test'
185
+
186
+ import assert from 'node:assert'
187
+
188
+ // \xBB IMPORT MODULES
189
+ import { greetUser, exampleUser } from '@/index'
190
+
191
+ // \u2501\u2501 TEST \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
192
+
193
+ describe('greetUser', () => {
194
+ it('should return a greeting message with the provided name', () => {
195
+ const result = greetUser(exampleUser)
196
+ assert.strictEqual(result, 'Hello, John Doe! Your email is john.doe@example.com.')
197
+ })
198
+ })`,
199
+ pathFileName: "test/test.spec.ts"
177
200
  }
178
201
  ];
179
202
 
@@ -182,6 +205,7 @@ import fs from "node:fs";
182
205
  import spawn from "cross-spawn";
183
206
  import path from "node:path";
184
207
  import process2 from "node:process";
208
+ import console2 from "node:console";
185
209
  function findPackageJson(startDir) {
186
210
  let dir = path.resolve(startDir || process2.cwd());
187
211
  do {
@@ -201,7 +225,7 @@ function installSyncSaveDev(packages, packageManager = "npm", cwd, installFlags
201
225
  const error = installProcess.error;
202
226
  if (error && error.code === "ENOENT") {
203
227
  const pluralS = packageList.length > 1 ? "s" : "";
204
- console.error(`Could not execute ${packageManager}. Please install the following package${pluralS} with a package manager of your choice: ${packageList.join(", ")}`);
228
+ console2.error(`Could not execute ${packageManager}. Please install the following package${pluralS} with a package manager of your choice: ${packageList.join(", ")}`);
205
229
  }
206
230
  }
207
231
  function parsePackageName(packageName) {
@@ -289,8 +313,8 @@ var questionsMain = [
289
313
  name: "projectInstall",
290
314
  message: " \xBFQuieres instalar dependencias?",
291
315
  choices: [
292
- { name: "S\xED", value: true },
293
- { name: "No", value: false }
316
+ { name: "No", value: false },
317
+ { name: "S\xED", value: true }
294
318
  ]
295
319
  },
296
320
  {
@@ -352,7 +376,7 @@ function showError(error) {
352
376
 
353
377
  // src/index.ts
354
378
  var { version } = JSON.parse(
355
- await import("fs").then((fs3) => fs3.readFileSync(new URL("../package.json", import.meta.url), "utf-8"))
379
+ fs3.readFileSync(new URL("../package.json", import.meta.url), "utf-8")
356
380
  );
357
381
  printBanner();
358
382
  program.name("klei").version(version, "-v, --version", "Muestra la versi\xF3n actual").description("CLI con m\xFAltiples caracter\xEDsticas");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "klei-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "cli for creating and managing packages",
5
5
  "type": "module",
6
6
  "funding": {