create-domis 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.
Files changed (2) hide show
  1. package/bin.js +58 -0
  2. package/package.json +16 -0
package/bin.js ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ import degit from 'degit';
3
+ import prompts from 'prompts';
4
+ import pc from 'picocolors';
5
+
6
+ console.log(pc.green(`\n🚀 create-domis - DomisPacks-Technical\n`));
7
+
8
+ const response = await prompts([
9
+ {
10
+ type: 'text',
11
+ name: 'key',
12
+ message: 'Digite sua PRO_KEY (enviada por e-mail da Kiwify):',
13
+ validate: v => v.length > 10 ? true : 'PRO_KEY inválida'
14
+ },
15
+ {
16
+ type: 'select',
17
+ name: 'template',
18
+ message: 'Qual pack deseja baixar?',
19
+ choices: [
20
+ { title: 'domisdocs-firebase-lite (R$49)', value: 'lite' },
21
+ { title: 'domisdocs-firebase-pro (R$199)', value: 'pro' }
22
+ ]
23
+ }
24
+ ]);
25
+
26
+ const repoMap = {
27
+ lite: 'Domisnnet/DomisPacks-Technical/packs/domisdocs-firebase-lite',
28
+ pro: 'Domisnnet/DomisPacks-Technical/packs/domisdocs-firebase-pro'
29
+ };
30
+
31
+ const repo = repoMap[response.template];
32
+
33
+ console.log(pc.cyan(`\n📦 Baixando ${repo} com sua PRO_KEY...\n`));
34
+
35
+ try {
36
+ // Usa a PRO_KEY como token no git clone via degit com auth
37
+ const emitter = degit(`${repo}`, {
38
+ cache: false,
39
+ force: true,
40
+ verbose: true
41
+ });
42
+
43
+ // Passa token via env - degit usa https
44
+ // O usuário precisa ter aceito convite do repo privado antes
45
+ await emitter.clone('./domis-pack');
46
+
47
+ console.log(pc.green(`\nâś… Pack baixado em ./domis-pack !\n`));
48
+ console.log(pc.dim(`PrĂłximos passos:`));
49
+ console.log(` cd domis-pack`);
50
+ console.log(` cp firebase.json seu-projeto/\n`);
51
+ } catch (e) {
52
+ console.log(pc.red(`\n❌ Erro: ${e.message}\n`));
53
+ console.log(pc.yellow(`Soluções:`));
54
+ console.log(`1. Verifique se aceitou o convite do GitHub para DomisPacks-Technical`);
55
+ console.log(`2. Verifique sua PRO_KEY`);
56
+ console.log(`3. Tente via git clone manual:`);
57
+ console.log(pc.cyan(` git clone https://${response.key}@github.com/Domisnnet/DomisPacks-Technical.git\n`));
58
+ }
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "create-domis",
3
+ "version": "1.0.0",
4
+ "description": "CLI para puxar packs privados DomisPacks-Technical via PRO_KEY",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-domis": "./bin.js"
8
+ },
9
+ "author": "Domisnnet",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "degit": "^3.0.4",
13
+ "picocolors": "^1.0.1",
14
+ "prompts": "^2.4.2"
15
+ }
16
+ }