create-willem 1.0.0
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/index.js +41 -0
- package/package.json +21 -0
package/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import degit from "degit";
|
|
5
|
+
import prompts from "prompts";
|
|
6
|
+
import { execSync } from "child_process";
|
|
7
|
+
|
|
8
|
+
const program = new Command();
|
|
9
|
+
|
|
10
|
+
program
|
|
11
|
+
.argument("[project-name]", "Nome do projeto")
|
|
12
|
+
.action(async (projectName) => {
|
|
13
|
+
// 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
|
+
});
|
|
20
|
+
|
|
21
|
+
const targetDir = response.name;
|
|
22
|
+
|
|
23
|
+
// 2. Clona o seu repositório template
|
|
24
|
+
// Substitua pelo seu repositório: 'usuario/repositorio'
|
|
25
|
+
const emitter = degit("guisilva10/create-willem", {
|
|
26
|
+
cache: false,
|
|
27
|
+
force: true,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log(`🚀 Criando o projeto em ${targetDir}...`);
|
|
31
|
+
|
|
32
|
+
await emitter.clone(targetDir);
|
|
33
|
+
|
|
34
|
+
// 3. Opcional: Instala as dependências automaticamente
|
|
35
|
+
console.log("📦 Instalando dependências...");
|
|
36
|
+
execSync(`cd ${targetDir} && pnpm install`, { stdio: "inherit" });
|
|
37
|
+
|
|
38
|
+
console.log("✅ Tudo pronto! Agora é só codar.");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
program.parse(process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-willem",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"packageManager": "pnpm@10.28.0",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"commander": "^14.0.2",
|
|
15
|
+
"degit": "^2.8.4",
|
|
16
|
+
"prompts": "^2.4.2"
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"create-willem": "index.js"
|
|
20
|
+
}
|
|
21
|
+
}
|