@egintegrations/telemetry 0.2.2 → 0.3.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/dist/cli.js +122 -8
  2. package/package.json +9 -4
package/dist/cli.js CHANGED
@@ -131,6 +131,120 @@ function buildSku(version, systemType, platform, date) {
131
131
  return `${version}.${systemType}.${platform}.${skuDate}`;
132
132
  }
133
133
 
134
+ // src/cli/banner.ts
135
+ var import_chalk = __toESM(require("chalk"));
136
+ var import_boxen = __toESM(require("boxen"));
137
+ var import_gradient_string = __toESM(require("gradient-string"));
138
+ var ASCII_LOGO = `
139
+ ###########################*#*#**#+
140
+ ########################*******************
141
+ ######%@@%###########**************###%@@@*******
142
+ #%%%%@*+===--===-------::::::::::::::--------=%@*****
143
+ %%%%%+==-%#####################################:::-@****
144
+ %%%%*==+%%%%#######################################:-+@****
145
+ %%%%===%%%%%# ######--@*##*
146
+ %%%%==*%%## #####--%####
147
+ %%%%*==%%%# %+*#### *****+++++++======== ####--%###
148
+ %%%%++%%%% %%%++%### *******++++++++======= %###--%###*
149
+ -%%%%++%%%% %%%%++%### *#********+++++++====== ####-=####
150
+ =%%%%++%%%% %%%%=+%###. ###*******+++++++++==== ####--####
151
+ =%%%%+*%%%% %%%%=+%###: .. ... :. ::
152
+ =%%%%**%%%% %%%%=+%%%%:
153
+ =%%%%**%%%% %%%%=+%%%%%%%%#################*******************#
154
+ =%%%%*#%%%% %%%%++%%%%###%%%%%%#######################*#*******
155
+ =%%%%*#%%%% %%%%+*@%%%###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
156
+ =%%%%*#%%%% %%%%+*@%%%****++ ===================----------
157
+ =%%%%*#%%%% @@%%+*%%%%###%%%%%%%%%%%%%#########################
158
+ =%%%%*#%%%% @@@@*#%%%%%%%%%%%%%%%%%%%%%%%%#####################
159
+ +@%%%*#%%%% @@@@*#%%%%
160
+ +@%@%*#%%%% @@@@##%%%%
161
+ +@%%%*#%%%% @@@@##%%%% ##########**********+++ %%%%+*%%%%
162
+ +@@@%*#%%%% @@@@#%%%%% #############********++ %%%%++%%%%
163
+ @@@@**@%%%= %@@@#%@%%% %%%%%##########******* +%%%%=#%%%%
164
+ @@@@##%%%%% @@#%@@%% %%%%%%##########***** %%%%==@%%%
165
+ %@@@@**@@%%% %%@@@@ %%%%%%###########* @%%%*=+%%%%
166
+ @@@@@**@@@@@@ %%%%%*==%%%%
167
+ @@@@@+**@@@@@@@%+-:::::::::.......... =%%%%%%%%%++#%%%%
168
+ %@@@@@*##@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%%%%%%%%%@#*++%%%%%
169
+ @@@@@@*####%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#***+@%%%%
170
+ @@@@@@@%*###*##############***####********#%%%%%%%%
171
+ @@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%@@@%@%%%%%%%%
172
+ @@@@@@@@@@@@@@@@@@%@@@@@%%%%%@@@%@%%@@%
173
+ `;
174
+ var TAGLINE = "EGI Engine Platform \xB7 Telemetry SDK";
175
+ var VERSION = "v0.3.0";
176
+ function showBanner() {
177
+ console.clear();
178
+ const coloredLogo = (0, import_gradient_string.default)("cyan", "#00ffff", "#0099ff").multiline(ASCII_LOGO);
179
+ console.log(coloredLogo);
180
+ console.log();
181
+ console.log(
182
+ (0, import_boxen.default)(
183
+ import_chalk.default.cyan.bold(TAGLINE) + "\n" + import_chalk.default.gray(VERSION),
184
+ {
185
+ padding: 1,
186
+ margin: 1,
187
+ borderStyle: "round",
188
+ borderColor: "cyan",
189
+ align: "center"
190
+ }
191
+ )
192
+ );
193
+ console.log();
194
+ }
195
+ function showDetectedInfo(framework, version, features) {
196
+ const info = [
197
+ import_chalk.default.cyan("\u{1F50D} Project Detection"),
198
+ "",
199
+ import_chalk.default.white("Framework: ") + import_chalk.default.green.bold(framework)
200
+ ];
201
+ if (version) {
202
+ info.push(import_chalk.default.white("Version: ") + import_chalk.default.yellow(version));
203
+ }
204
+ if (features && features.length > 0) {
205
+ info.push(import_chalk.default.white("Features: ") + import_chalk.default.magenta(features.join(", ")));
206
+ }
207
+ console.log(
208
+ (0, import_boxen.default)(info.join("\n"), {
209
+ padding: 1,
210
+ margin: { top: 0, bottom: 1, left: 2, right: 2 },
211
+ borderStyle: "single",
212
+ borderColor: "cyan"
213
+ })
214
+ );
215
+ }
216
+ function showSuccess(message) {
217
+ console.log();
218
+ console.log(
219
+ (0, import_boxen.default)(
220
+ import_chalk.default.green("\u2713 ") + import_chalk.default.white.bold(message),
221
+ {
222
+ padding: 1,
223
+ margin: 1,
224
+ borderStyle: "round",
225
+ borderColor: "green",
226
+ align: "center"
227
+ }
228
+ )
229
+ );
230
+ }
231
+ function showGeneratedSku(sku) {
232
+ console.log();
233
+ console.log(
234
+ (0, import_boxen.default)(
235
+ import_chalk.default.cyan("\u{1F4E6} Generated SKU\n\n") + import_chalk.default.yellow.bold(sku),
236
+ {
237
+ padding: 1,
238
+ margin: { top: 0, bottom: 1, left: 2, right: 2 },
239
+ borderStyle: "round",
240
+ borderColor: "yellow",
241
+ align: "center"
242
+ }
243
+ )
244
+ );
245
+ console.log();
246
+ }
247
+
134
248
  // src/cli/prompts.ts
135
249
  async function gatherOptions(cliArgs, detected) {
136
250
  const questions = [];
@@ -222,8 +336,7 @@ async function gatherOptions(cliArgs, detected) {
222
336
  let finalSku = cliArgs.sku;
223
337
  if (!finalSku && answers.skuVersion && answers.skuType && answers.skuPlatform) {
224
338
  finalSku = buildSku(answers.skuVersion, answers.skuType, answers.skuPlatform);
225
- console.log(`
226
- \u{1F4E6} Generated SKU: ${finalSku}`);
339
+ showGeneratedSku(finalSku);
227
340
  }
228
341
  return {
229
342
  engine: cliArgs.engine || answers.engine,
@@ -496,15 +609,15 @@ async function runGenerator(ctx) {
496
609
 
497
610
  // src/cli/commands.ts
498
611
  async function initCommand(options) {
499
- console.log("\u{1F680} EGI Telemetry SDK Initialization\n");
612
+ showBanner();
500
613
  try {
501
614
  const cwd = process.cwd();
502
- console.log("\u{1F50D} Detecting framework...");
503
615
  const detected = await detectFramework(cwd);
504
- console.log(` Found: ${detected.type}${detected.version ? ` v${detected.version}` : ""}`);
616
+ const features = [];
505
617
  if (detected.type === "nextjs" && detected.appDir) {
506
- console.log(" Next.js App Router detected");
618
+ features.push("App Router");
507
619
  }
620
+ showDetectedInfo(detected.type, detected.version, features);
508
621
  console.log("");
509
622
  const telemetryOptions = await gatherOptions(options, detected);
510
623
  console.log("");
@@ -517,7 +630,7 @@ async function initCommand(options) {
517
630
  for (const file of files) {
518
631
  await writeFile(file);
519
632
  }
520
- console.log("\n\u2705 Telemetry SDK initialized successfully!\n");
633
+ showSuccess("Telemetry SDK initialized successfully!");
521
634
  if (telemetryOptions.codegen && detected.type !== "generic") {
522
635
  console.log("\u{1F4DD} Next steps:");
523
636
  console.log(" 1. Review the generated files");
@@ -527,7 +640,8 @@ async function initCommand(options) {
527
640
  } else {
528
641
  console.log(" import telemetry from './telemetry';");
529
642
  }
530
- console.log(" 3. Start using telemetry.sendMetrics() in your app");
643
+ console.log(" 3. Deploy your project");
644
+ console.log(" 4. Engine will auto-register in dashboard");
531
645
  console.log("");
532
646
  }
533
647
  } catch (error) {
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@egintegrations/telemetry",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Telemetry SDK for EGIntegrations client engines",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "bin": {
9
- "egi-telemetry": "./dist/cli.js"
9
+ "egi-telemetry": "dist/cli.js"
10
10
  },
11
11
  "exports": {
12
12
  ".": {
13
+ "types": "./dist/index.d.ts",
13
14
  "require": "./dist/index.js",
14
- "import": "./dist/index.mjs",
15
- "types": "./dist/index.d.ts"
15
+ "import": "./dist/index.mjs"
16
16
  }
17
17
  },
18
18
  "scripts": {
@@ -33,7 +33,12 @@
33
33
  "license": "PROPRIETARY",
34
34
  "dependencies": {
35
35
  "axios": "^1.6.0",
36
+ "boxen": "^5.1.2",
37
+ "chalk": "^4.1.2",
38
+ "cli-table3": "^0.6.5",
36
39
  "commander": "^12.0.0",
40
+ "gradient-string": "^2.0.2",
41
+ "ora": "^5.4.1",
37
42
  "prompts": "^2.4.2"
38
43
  },
39
44
  "devDependencies": {