create-willem 1.0.0 → 1.0.1

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/index.js +15 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,6 +4,7 @@ import { Command } from "commander";
4
4
  import degit from "degit";
5
5
  import prompts from "prompts";
6
6
  import { execSync } from "child_process";
7
+ import path from "path";
7
8
 
8
9
  const program = new Command();
9
10
 
@@ -11,14 +12,21 @@ program
11
12
  .argument("[project-name]", "Nome do projeto")
12
13
  .action(async (projectName) => {
13
14
  // 1. Se o nome não for passado, pergunta ao usuário
14
- const response = await prompts({
15
- type: "text",
16
- name: "name",
17
- message: "Qual o nome do seu projeto?",
18
- initial: projectName || "my-awesome-app",
19
- });
15
+ let targetDir = projectName;
20
16
 
21
- const targetDir = response.name;
17
+ // 1. Se o nome não for passado, pergunta ao usuário
18
+ if (!targetDir) {
19
+ const response = await prompts({
20
+ type: "text",
21
+ name: "name",
22
+ message: 'Qual o nome do seu projeto? (use "." para a pasta atual)',
23
+ initial: "my-app",
24
+ });
25
+ targetDir = response.name;
26
+ }
27
+
28
+ // 2. Resolve o caminho (se for ".", vira a pasta atual)
29
+ const projectPath = path.resolve(targetDir);
22
30
 
23
31
  // 2. Clona o seu repositório template
24
32
  // Substitua pelo seu repositório: 'usuario/repositorio'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-willem",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {