falak-app-duo 1.1.0 → 1.1.2

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/README.md CHANGED
@@ -14,7 +14,27 @@ integrations on the frontend side: **Ably** (realtime) and **Brevo**
14
14
  | Brevo (email/SMS) | Kept — calls go through Laravel, key never ships to the browser |
15
15
  | Laravel API auth | `X-API-Key` (app) + `Authorization: Bearer <token>` (user) |
16
16
  | AES-256 | Kept — encrypts the cached user token in localStorage |
17
- | Arabic/RTL | Kept — baked in via vue-i18n + postcss-rtlcss |
17
+ | Arabic/RTL | Kept — baked in via vue-i18n + postcss-rtlcss (opt-out: `--no-rtl` or the RTL prompt) |
18
+
19
+ ## Install & run
20
+
21
+ Published on npm under both `falak-app-duo` and the `@ma7moudsalama` org scope.
22
+ No install needed — run it straight with `npx`:
23
+
24
+ ```bash
25
+ npx falak-app-duo my-project # interactive prompts
26
+ npx falak-app-duo my-project --yes # all defaults: Ably + Brevo, localhost API, RTL on
27
+ npx falak-app-duo my-project --no-rtl # default locale becomes English/LTR
28
+ ```
29
+
30
+ Or install the CLI globally once:
31
+
32
+ ```bash
33
+ npm install -g falak-app-duo
34
+ falak-app-duo my-project
35
+ ```
36
+
37
+ The org-scoped equivalent is `npx @ma7moudsalama/falak-app-duo my-project`.
18
38
 
19
39
  ## Auth model
20
40
 
@@ -73,22 +93,20 @@ POST /api/brevo/email | /api/brevo/sms | /api/brevo/contacts
73
93
  plus an `X-API-Key` middleware gating all of the above, and Sanctum (or
74
94
  similar) validating the bearer token for user-scoped routes.
75
95
 
76
- ## Usage
77
-
78
- ```bash
79
- node bin/falak-app-duo my-project # interactive prompts
80
- node bin/falak-app-duo my-project --yes # defaults: Ably + Brevo, localhost API
81
- ```
82
-
83
- Once published to npm you'd run it as `npx falak-app-duo my-project`.
96
+ ## What the CLI does
84
97
 
85
- The CLI:
86
- 1. Copies `templates/default` into `my-project/`.
87
- 2. Strips out `ably.js` and/or `brevo.js` if you didn't select them.
88
- 3. Generates a real `.env` from `.env.example` with a fresh random AES-256
89
- key + IV, and your chosen API base URL.
98
+ 1. Prints a gradient **Falak Duo** banner.
99
+ 2. In interactive mode asks which services to wire up (**Ably** and/or
100
+ **Brevo**), the Laravel API base URL, and whether to enable **Arabic/RTL**
101
+ by default. `--yes` takes all defaults; `--no-rtl` skips the RTL choice and
102
+ defaults to English/LTR.
103
+ 3. Copies `templates/default` into `my-project/`, strips the service files you
104
+ didn't select, and generates a real `.env` from `.env.example` with a fresh
105
+ random AES-256 key + IV and your chosen API base URL.
106
+ 4. Offers to run `npm install` and start the dev server for you (`--yes` runs
107
+ `npm install` automatically).
90
108
 
91
- Then:
109
+ To start a scaffolded project on your own:
92
110
 
93
111
  ```bash
94
112
  cd my-project
package/bin/falak-app-duo CHANGED
@@ -138,19 +138,47 @@ async function main() {
138
138
  }
139
139
  }
140
140
 
141
- // RTL off: flip the hard-coded Arabic/LTR defaults to English/LTR
141
+ // RTL off: strip Arabic/RTL out of the copied app — English/LTR only.
142
+ // The template is RTL by default, so this must also remove the locale
143
+ // toggle and the Arabic bundle or the app would still "support RTL".
142
144
  if (!rtlEnabled) {
143
145
  const htmlPath = path.join(targetDir, "index.html");
144
146
  const html = await fs.readFile(htmlPath, "utf-8");
145
147
  await fs.writeFile(htmlPath, html.replace('<html lang="ar" dir="rtl">', '<html lang="en" dir="ltr">'));
146
148
 
147
149
  const i18nPath = path.join(targetDir, "src", "i18n", "index.js");
148
- const i18n = await fs.readFile(i18nPath, "utf-8");
149
150
  await fs.writeFile(
150
151
  i18nPath,
151
- i18n.replace('getItem(STORAGE_KEY) || "ar"', 'getItem(STORAGE_KEY) || "en"')
152
+ [
153
+ 'import { createI18n } from "vue-i18n";',
154
+ 'import en from "./locales/en.json";',
155
+ "",
156
+ "export default createI18n({",
157
+ ' legacy: false,',
158
+ ' locale: "en",',
159
+ ' fallbackLocale: "en",',
160
+ " messages: { en },",
161
+ "});",
162
+ "",
163
+ ].join("\n")
152
164
  );
153
- console.log(chalk.gray(" RTL disabled \u2014 English (LTR) set as the default locale."));
165
+ await fs.remove(path.join(targetDir, "src", "i18n", "locales", "ar.json"));
166
+
167
+ const appPath = path.join(targetDir, "src", "App.vue");
168
+ let app = await fs.readFile(appPath, "utf-8");
169
+ app = app.replace('import { setLocale } from "@/i18n";\n', "");
170
+ app = app.replace("const { t, locale } = useI18n();", "const { t } = useI18n();");
171
+ app = app.replace(
172
+ 'function toggleLocale() {\n setLocale(locale.value === "ar" ? "en" : "ar");\n}\n',
173
+ ""
174
+ );
175
+ app = app.replace(
176
+ /\n <button @click="toggleLocale" class="text-sm px-2 py-1 border rounded">\n \{\{ locale === "ar" \? "EN" : "AR" \}\}\n <\/button>/,
177
+ ""
178
+ );
179
+ await fs.writeFile(appPath, app);
180
+
181
+ console.log(chalk.gray(" RTL disabled \u2014 English/LTR only, no Arabic or AR/EN toggle."));
154
182
  }
155
183
 
156
184
  // Generate a real .env from .env.example with a fresh encryption key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "falak-app-duo",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Vue 3 boilerplate scaffolder — Ably (realtime), Brevo, AES-256, Arabic/RTL, and a Laravel API client (API key + user token auth). No Firebase, no Groq/Paymob on the frontend (Groq is backend-only; Paymob dropped).",
5
5
  "type": "module",
6
6
  "bin": {