create-domis 1.0.28 → 1.0.30

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 +1 -1
  2. package/dist/index.js +56 -78
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  ![Status](https://img.shields.io/badge/Status-Online-brightgreen?style=flat-square)
10
10
  ![CLI](https://img.shields.io/badge/CLI-Oficial-26FF00?style=flat-square)
11
11
  ![Firebase](https://img.shields.io/badge/Firebase-Ready-FFCA28?style=flat-square&logo=firebase&logoColor=black)
12
- [![License](https://img.shields.io/badge/License-Private_Commercial_v1.2-red?style=flat-square)](https://github.com/Domisnnet/DomisPacks-Technical/blob/main/LICENSE)
12
+ [![License](https://img.shields.io/badge/License-Private_Commercial_v1.3-red?style=flat-square)](https://github.com/Domisnnet/DomisPacks-Technical/blob/main/LICENSE)
13
13
  ![Imagem DomisPacks](./src/assets/domispacks.png)
14
14
 
15
15
  Bem-vindo ao **CLI Oficial Domis**. O  `npm create domis@latest` é um acelerador de projetos que elimina 3 horas de configuração de `firebase.json`,  `firestore.rules` e  `GitHub Actions` com 1 comando. Resolvemos o bug de Hosting que quebra 90% dos deploys Next.js 15 no Firebase.
package/dist/index.js CHANGED
@@ -7,112 +7,90 @@ import ora from "ora";
7
7
  import { execSync } from "child_process";
8
8
  import fs from "fs";
9
9
  import path from "path";
10
+ import os from "os";
10
11
  var API_VERIFY = "https://verifyprokey-rk2ogbbeja-uc.a.run.app";
11
- console.log(chalk.green.bold("\n\u{1F525} DomisPacks Technical v1.0.28\n"));
12
+ console.log(chalk.green.bold("\n\u{1F525} DomisPacks Technical v1.0.30 - MONOREPO PRIVADO\n"));
13
+ function copyRecursive(src, dest) {
14
+ const stat = fs.lstatSync(src);
15
+ if (stat.isDirectory()) {
16
+ fs.mkdirSync(dest, { recursive: true });
17
+ for (const file of fs.readdirSync(src)) {
18
+ if (["node_modules", ".next", ".git", ".firebase"].includes(file)) continue;
19
+ copyRecursive(path.join(src, file), path.join(dest, file));
20
+ }
21
+ } else {
22
+ fs.copyFileSync(src, dest);
23
+ }
24
+ }
12
25
  async function main() {
13
26
  const answers = await inquirer.prompt([
14
- {
15
- type: "list",
16
- name: "pack",
17
- message: "Qual pack voc\xEA quer acelerar hoje?",
18
- choices: [
19
- { name: "\u{1F525} DomisDocs Free - firebase.json + firebaserc + package.json + README.md", value: "demo" },
20
- { name: "\u{1F525} DomisDocs Lite \u2014 Next.js 15 + Tailwind v4 + Firebase Killer", value: "lite" },
21
- { name: "\u{1F525} DomisDocs PRO \u2014 Next.js 15 + Stripe + Rules + SSR + CI/CD", value: "pro" }
22
- ]
23
- },
24
- {
25
- type: "password",
26
- name: "proKey",
27
- message: "Digite sua PRO_KEY (recebida por e-mail):",
28
- mask: "*",
29
- when: (a) => a.pack !== "demo",
30
- validate: (v) => v.startsWith("DOMIS-") ? true : "Formato: DOMIS-XXXX-XXXX-XXXX"
31
- },
32
- {
33
- type: "input",
34
- name: "projectName",
35
- message: "Nome do seu projeto:",
36
- default: "meu-app",
37
- validate: (v) => v.trim().length > 0 ? true : "Digite um nome"
38
- }
27
+ { type: "list", name: "pack", message: "Qual pack voc\xEA quer acelerar hoje?", choices: [
28
+ { name: "\u{1F525} DomisDocs Free - demo", value: "demo" },
29
+ { name: "\u{1F525} DomisDocs Lite \u2014 Next.js 15 + Tailwind v4 + Firebase", value: "lite" },
30
+ { name: "\u{1F525} DomisDocs PRO \u2014 Next.js 15 + Stripe + Rules + SSR", value: "pro" }
31
+ ] },
32
+ { type: "password", name: "proKey", message: "Digite sua PRO_KEY:", mask: "*", when: (a) => a.pack !== "demo", validate: (v) => v.startsWith("DOMIS-") ? true : "Formato: DOMIS-XXXX-XXXX-XXXX" },
33
+ { type: "input", name: "projectName", message: "Nome do projeto:", default: "meu-app", validate: (v) => v.trim().length > 0 ? true : "Digite um nome" }
39
34
  ]);
40
35
  const target = answers.projectName.trim();
36
+ if (fs.existsSync(target)) {
37
+ console.log(chalk.red(`\u274C Pasta "${target}" J\xC1 EXISTE!`));
38
+ process.exit(1);
39
+ }
41
40
  if (answers.pack === "demo") {
42
- const spinner2 = ora("Criando DomisDocs Gr\xE1tis...").start();
41
+ const spinner2 = ora("Criando Free...").start();
43
42
  try {
44
- if (fs.existsSync(target)) throw new Error(`Pasta "${target}" J\xC1 EXISTE!`);
45
43
  fs.mkdirSync(target, { recursive: true });
46
- const legacyDemoPath = "C:/Users/dell/Documents/GitHub/DomisDoc-Legacy-Thecnical/templates/domisdocs-free";
47
- if (fs.existsSync(legacyDemoPath)) {
48
- const files = fs.readdirSync(legacyDemoPath);
49
- for (const file of files) {
50
- if (file === "node_modules" || file === ".next") continue;
51
- fs.copyFileSync(path.join(legacyDemoPath, file), path.join(target, file));
52
- }
53
- spinner2.text = "Copiado do template local atualizado";
54
- } else {
55
- fs.writeFileSync(path.join(target, "firebase.json"), JSON.stringify({
56
- hosting: {
57
- public: "dist",
58
- ignore: ["firebase.json", "**/.*", "**/node_modules/**"],
59
- rewrites: [{ source: "**", destination: "/index.html" }]
60
- }
61
- }, null, 2));
62
- fs.writeFileSync(path.join(target, ".firebaserc"), JSON.stringify({
63
- projects: { default: "free" }
64
- }, null, 2));
65
- fs.writeFileSync(path.join(target, "package.json"), JSON.stringify({
66
- name: target,
67
- version: "1.0.0",
68
- private: true,
69
- scripts: { dev: "vite", build: "vite build" }
70
- }, null, 2));
71
- fs.writeFileSync(path.join(target, "README.md"), `DomisDocs Free`);
72
- }
73
- spinner2.succeed(chalk.green.bold(`
74
- \u2705 ${target} DomisDocs Free criada!`));
75
- console.log(chalk.cyan(`
76
- DomisDocs: https://domisdocs-6a896.web.app`));
77
- console.log(chalk.gray("Esse pack \xE9 gr\xE1tis e p\xFAblico, sem necessidade de PRO_KEY."));
78
- console.log(chalk.cyan(`
79
- \u{1F449} cd ${target}`));
80
- const created = fs.readdirSync(target);
81
- console.log(chalk.gray(`\u{1F449} Arquivos: ${created.join(" + ")}`));
44
+ fs.writeFileSync(path.join(target, "firebase.json"), JSON.stringify({ hosting: { public: "dist", rewrites: [{ source: "**", destination: "/index.html" }] } }, null, 2));
45
+ spinner2.succeed(chalk.green(`\u2705 ${target} Free criado!`));
82
46
  } catch (e) {
83
- const msg = e instanceof Error ? e.message : String(e);
84
- spinner2.fail(chalk.red(`\u274C Erro DEMO: ${msg}`));
85
- process.exit(1);
47
+ spinner2.fail(chalk.red(e.message));
86
48
  }
87
49
  return;
88
50
  }
89
- const spinner = ora("Verificando PRO_KEY no cofre Legacy...").start();
51
+ const spinner = ora("Verificando PRO_KEY...").start();
90
52
  try {
91
53
  const url = `${API_VERIFY}?key=${encodeURIComponent(answers.proKey)}&pack=${answers.pack}`;
92
54
  const res = await fetch(url);
93
55
  const data = await res.json();
94
- if (!data.valid || !data.downloadUrl) {
95
- spinner.fail(chalk.red(`\u274C ${data.error || "PRO_KEY inv\xE1lida"}`));
96
- console.log(chalk.yellow(`Verifique em https://domisdocs-6a896.web.app/verificar.html`));
56
+ if (!data.valid) {
57
+ spinner.fail(chalk.red(`\u274C ${data.reason || "KEY inv\xE1lida"}`));
58
+ process.exit(1);
59
+ }
60
+ if (!data.downloadUrl) {
61
+ spinner.fail(chalk.red("\u274C API sem downloadUrl"));
97
62
  process.exit(1);
98
63
  }
99
- spinner.text = `Baixando ${answers.pack.toUpperCase()} do cofre...`;
100
- if (fs.existsSync(target)) throw new Error(`Pasta "${target}" J\xC1 EXISTE!`);
101
- const zipTmp = `C:/Users/dell/AppData/Local/Temp/domis-${Date.now()}.zip`;
64
+ spinner.text = `Baixando ${answers.pack.toUpperCase()} (2.5MB) do cofre privado...`;
65
+ const localPath = `C:\\Users\\dell\\Documents\\GitHub\\DomisDoc-Legacy-Thecnical\\templates\\domisdocs-${answers.pack}`;
66
+ if (fs.existsSync(localPath)) {
67
+ fs.mkdirSync(target, { recursive: true });
68
+ copyRecursive(localPath, target);
69
+ spinner.succeed(chalk.green.bold(`
70
+ \u2705 ${target} criado! (local)`));
71
+ return;
72
+ }
73
+ const zipTmp = path.join(os.tmpdir(), `domis-${Date.now()}.zip`);
74
+ const extractTmp = path.join(os.tmpdir(), `domis-extract-${Date.now()}`);
102
75
  execSync(`curl -L -o "${zipTmp}" "${data.downloadUrl}"`, { stdio: "inherit" });
76
+ fs.mkdirSync(extractTmp, { recursive: true });
77
+ execSync(`powershell -Command "Expand-Archive -Path '${zipTmp}' -DestinationPath '${extractTmp}' -Force"`, { stdio: "inherit" });
78
+ const subfolders = fs.readdirSync(extractTmp).filter((f) => fs.lstatSync(path.join(extractTmp, f)).isDirectory());
79
+ const repoRoot = subfolders.length === 1 ? path.join(extractTmp, subfolders[0]) : extractTmp;
80
+ const packSource = path.join(repoRoot, "templates", `domisdocs-${answers.pack}`);
81
+ if (!fs.existsSync(packSource)) throw new Error(`templates/domisdocs-${answers.pack} n\xE3o encontrado. Tem: ${fs.readdirSync(path.join(repoRoot, "templates")).join(", ")}`);
103
82
  fs.mkdirSync(target, { recursive: true });
104
- execSync(`powershell -Command "Expand-Archive -Path '${zipTmp}' -DestinationPath '${target}' -Force"`, { stdio: "inherit" });
83
+ copyRecursive(packSource, target);
105
84
  fs.rmSync(zipTmp, { force: true });
85
+ fs.rmSync(extractTmp, { recursive: true, force: true });
106
86
  spinner.succeed(chalk.green.bold(`
107
87
  \u2705 ${target} criado com SUCESSO!`));
108
- console.log(chalk.gray(`Origem: DomisDocs-Legacy-Technical/templates/domisdocs-firebase-${answers.pack}`));
109
88
  console.log(chalk.cyan(`
110
89
  \u{1F449} cd ${target}
111
90
  npm install
112
91
  npm run dev`));
113
92
  } catch (e) {
114
- const msg = e instanceof Error ? e.message : String(e);
115
- spinner.fail(chalk.red(`\u274C Erro: ${msg}`));
93
+ spinner.fail(chalk.red(`\u274C Erro: ${e.message}`));
116
94
  process.exit(1);
117
95
  }
118
96
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-domis",
3
- "version": "1.0.28",
4
- "description": "CLI Oficial DomisPacks - Acelerador Next.js 15 + Tailwind v4 + Firebase Killer + Stripe",
3
+ "version": "1.0.30",
4
+ "description": "CLI Oficial DomisPacks - Acelerador Next.js 15 + Tailwind v4 + SaaS Boilerplate",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "create-domis": "./dist/index.js"