create-domis 1.0.29 → 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 (2) hide show
  1. package/dist/index.js +31 -72
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -9,13 +9,13 @@ import fs from "fs";
9
9
  import path from "path";
10
10
  import os from "os";
11
11
  var API_VERIFY = "https://verifyprokey-rk2ogbbeja-uc.a.run.app";
12
- console.log(chalk.green.bold("\n\u{1F525} DomisPacks Technical v1.0.29\n"));
12
+ console.log(chalk.green.bold("\n\u{1F525} DomisPacks Technical v1.0.30 - MONOREPO PRIVADO\n"));
13
13
  function copyRecursive(src, dest) {
14
14
  const stat = fs.lstatSync(src);
15
15
  if (stat.isDirectory()) {
16
16
  fs.mkdirSync(dest, { recursive: true });
17
17
  for (const file of fs.readdirSync(src)) {
18
- if (file === "node_modules" || file === ".next" || file === ".git") continue;
18
+ if (["node_modules", ".next", ".git", ".firebase"].includes(file)) continue;
19
19
  copyRecursive(path.join(src, file), path.join(dest, file));
20
20
  }
21
21
  } else {
@@ -24,58 +24,27 @@ function copyRecursive(src, dest) {
24
24
  }
25
25
  async function main() {
26
26
  const answers = await inquirer.prompt([
27
- {
28
- type: "list",
29
- name: "pack",
30
- message: "Qual pack voc\xEA quer acelerar hoje?",
31
- choices: [
32
- { name: "\u{1F525} DomisDocs Free - firebase.json + firebaserc + package.json + README.md", value: "demo" },
33
- { name: "\u{1F525} DomisDocs Lite \u2014 Next.js 15 + Tailwind v4 + Firebase Killer", value: "lite" },
34
- { name: "\u{1F525} DomisDocs PRO \u2014 Next.js 15 + Stripe + Rules + SSR + CI/CD", value: "pro" }
35
- ]
36
- },
37
- {
38
- type: "password",
39
- name: "proKey",
40
- message: "Digite sua PRO_KEY (recebida por e-mail):",
41
- mask: "*",
42
- when: (a) => a.pack !== "demo",
43
- validate: (v) => v.startsWith("DOMIS-") ? true : "Formato: DOMIS-XXXX-XXXX-XXXX"
44
- },
45
- {
46
- type: "input",
47
- name: "projectName",
48
- message: "Nome do seu projeto:",
49
- default: "meu-app",
50
- validate: (v) => v.trim().length > 0 ? true : "Digite um nome"
51
- }
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" }
52
34
  ]);
53
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
+ }
54
40
  if (answers.pack === "demo") {
55
- const spinner2 = ora("Criando DomisDocs Gr\xE1tis...").start();
41
+ const spinner2 = ora("Criando Free...").start();
56
42
  try {
57
- if (fs.existsSync(target)) throw new Error(`Pasta "${target}" J\xC1 EXISTE!`);
58
43
  fs.mkdirSync(target, { recursive: true });
59
- const legacyDemoPath = path.join(process.cwd(), "..", "DomisDoc-Legacy-Thecnical", "templates", "domisdocs-free");
60
- const localDemoPath = "C:[STRIPPED 79 bytes]";
61
- const finalDemoPath = fs.existsSync(localDemoPath) ? localDemoPath : fs.existsSync(legacyDemoPath) ? legacyDemoPath : "";
62
- if (finalDemoPath) {
63
- copyRecursive(finalDemoPath, target);
64
- spinner2.text = "Copiado do template local";
65
- } else {
66
- fs.writeFileSync(path.join(target, "firebase.json"), JSON.stringify({ hosting: { public: "dist", ignore: ["firebase.json", "**/.*", "**/node_modules/**"], rewrites: [{ source: "**", destination: "/index.html" }] } }, null, 2));
67
- fs.writeFileSync(path.join(target, ".firebaserc"), JSON.stringify({ projects: { default: "free" } }, null, 2));
68
- fs.writeFileSync(path.join(target, "package.json"), JSON.stringify({ name: target, version: "1.0.0", private: true, scripts: { dev: "vite", build: "vite build" } }, null, 2));
69
- fs.writeFileSync(path.join(target, "README.md"), `DomisDocs Free`);
70
- }
71
- spinner2.succeed(chalk.green.bold(`
72
- \u2705 ${target} DomisDocs Free criada!`));
73
- console.log(chalk.cyan(`
74
- \u{1F449} cd ${target}`));
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!`));
75
46
  } catch (e) {
76
- const msg = e instanceof Error ? e.message : String(e);
77
- ora().fail(chalk.red(`\u274C Erro DEMO: ${msg}`));
78
- process.exit(1);
47
+ spinner2.fail(chalk.red(e.message));
79
48
  }
80
49
  return;
81
50
  }
@@ -85,53 +54,43 @@ async function main() {
85
54
  const res = await fetch(url);
86
55
  const data = await res.json();
87
56
  if (!data.valid) {
88
- const reasonMsg = data.reason === "upgrade_required" ? "Plano LITE n\xE3o pode baixar PRO. Fa\xE7a upgrade." : data.reason === "not_found" ? "PRO_KEY n\xE3o encontrada" : data.error || "PRO_KEY inv\xE1lida";
89
- spinner.fail(chalk.red(`\u274C ${reasonMsg}`));
90
- console.log(chalk.yellow(`Verifique em https://domispacks.web.app/validar.html`));
57
+ spinner.fail(chalk.red(`\u274C ${data.reason || "KEY inv\xE1lida"}`));
91
58
  process.exit(1);
92
59
  }
93
60
  if (!data.downloadUrl) {
94
- spinner.fail(chalk.red(`\u274C API sem downloadUrl - atualize a Function`));
61
+ spinner.fail(chalk.red("\u274C API sem downloadUrl"));
95
62
  process.exit(1);
96
63
  }
97
- spinner.text = `Baixando ${answers.pack.toUpperCase()} do cofre (${data.repo})...`;
98
- if (fs.existsSync(target)) throw new Error(`Pasta "${target}" J\xC1 EXISTE!`);
99
- const localLegacyPath = `C:[STRIPPED 75 bytes]${answers.pack}`;
100
- if (fs.existsSync(localLegacyPath)) {
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)) {
101
67
  fs.mkdirSync(target, { recursive: true });
102
- copyRecursive(localLegacyPath, target);
68
+ copyRecursive(localPath, target);
103
69
  spinner.succeed(chalk.green.bold(`
104
- \u2705 ${target} criado com SUCESSO! (local)`));
105
- console.log(chalk.gray(`Origem: templates/domisdocs-${answers.pack}`));
106
- console.log(chalk.cyan(`
107
- \u{1F449} cd ${target}
108
- npm install
109
- npm run dev`));
70
+ \u2705 ${target} criado! (local)`));
110
71
  return;
111
72
  }
112
73
  const zipTmp = path.join(os.tmpdir(), `domis-${Date.now()}.zip`);
113
- const githubToken = process.env.GITHUB_TOKEN || "";
114
- const curlCmd = githubToken ? `curl -L -H "Authorization: token ${githubToken}" -o "${zipTmp}" "${data.downloadUrl}"` : `curl -L -o "${zipTmp}" "${data.downloadUrl}"`;
115
- execSync(curlCmd, { stdio: "inherit" });
116
- fs.mkdirSync(target, { recursive: true });
117
74
  const extractTmp = path.join(os.tmpdir(), `domis-extract-${Date.now()}`);
75
+ execSync(`curl -L -o "${zipTmp}" "${data.downloadUrl}"`, { stdio: "inherit" });
118
76
  fs.mkdirSync(extractTmp, { recursive: true });
119
77
  execSync(`powershell -Command "Expand-Archive -Path '${zipTmp}' -DestinationPath '${extractTmp}' -Force"`, { stdio: "inherit" });
120
78
  const subfolders = fs.readdirSync(extractTmp).filter((f) => fs.lstatSync(path.join(extractTmp, f)).isDirectory());
121
- const sourceRoot = subfolders.length === 1 ? path.join(extractTmp, subfolders[0]) : extractTmp;
122
- copyRecursive(sourceRoot, target);
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(", ")}`);
82
+ fs.mkdirSync(target, { recursive: true });
83
+ copyRecursive(packSource, target);
123
84
  fs.rmSync(zipTmp, { force: true });
124
85
  fs.rmSync(extractTmp, { recursive: true, force: true });
125
86
  spinner.succeed(chalk.green.bold(`
126
87
  \u2705 ${target} criado com SUCESSO!`));
127
- console.log(chalk.gray(`Origem: ${data.repo}`));
128
88
  console.log(chalk.cyan(`
129
89
  \u{1F449} cd ${target}
130
90
  npm install
131
91
  npm run dev`));
132
92
  } catch (e) {
133
- const msg = e instanceof Error ? e.message : String(e);
134
- spinner.fail(chalk.red(`\u274C Erro: ${msg}`));
93
+ spinner.fail(chalk.red(`\u274C Erro: ${e.message}`));
135
94
  process.exit(1);
136
95
  }
137
96
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-domis",
3
- "version": "1.0.29",
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"