@egintegrations/telemetry 0.2.1 → 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.
- package/dist/cli.js +126 -9
- package/package.json +9 -4
package/dist/cli.js
CHANGED
|
@@ -112,7 +112,10 @@ async function appendEnvFile(envPath, content) {
|
|
|
112
112
|
console.log(`\u2713 Updated: ${envPath}`);
|
|
113
113
|
}
|
|
114
114
|
function loadSkuStandards() {
|
|
115
|
-
|
|
115
|
+
let standardsDir = path2.join(__dirname, "standards");
|
|
116
|
+
if (!fs2.existsSync(standardsDir)) {
|
|
117
|
+
standardsDir = path2.join(__dirname, "..", "src", "cli", "standards");
|
|
118
|
+
}
|
|
116
119
|
const systemTypesPath = path2.join(standardsDir, "system_types.json");
|
|
117
120
|
const platformsPath = path2.join(standardsDir, "platforms.json");
|
|
118
121
|
const systemTypes = JSON.parse(
|
|
@@ -128,6 +131,120 @@ function buildSku(version, systemType, platform, date) {
|
|
|
128
131
|
return `${version}.${systemType}.${platform}.${skuDate}`;
|
|
129
132
|
}
|
|
130
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
|
+
|
|
131
248
|
// src/cli/prompts.ts
|
|
132
249
|
async function gatherOptions(cliArgs, detected) {
|
|
133
250
|
const questions = [];
|
|
@@ -219,8 +336,7 @@ async function gatherOptions(cliArgs, detected) {
|
|
|
219
336
|
let finalSku = cliArgs.sku;
|
|
220
337
|
if (!finalSku && answers.skuVersion && answers.skuType && answers.skuPlatform) {
|
|
221
338
|
finalSku = buildSku(answers.skuVersion, answers.skuType, answers.skuPlatform);
|
|
222
|
-
|
|
223
|
-
\u{1F4E6} Generated SKU: ${finalSku}`);
|
|
339
|
+
showGeneratedSku(finalSku);
|
|
224
340
|
}
|
|
225
341
|
return {
|
|
226
342
|
engine: cliArgs.engine || answers.engine,
|
|
@@ -493,15 +609,15 @@ async function runGenerator(ctx) {
|
|
|
493
609
|
|
|
494
610
|
// src/cli/commands.ts
|
|
495
611
|
async function initCommand(options) {
|
|
496
|
-
|
|
612
|
+
showBanner();
|
|
497
613
|
try {
|
|
498
614
|
const cwd = process.cwd();
|
|
499
|
-
console.log("\u{1F50D} Detecting framework...");
|
|
500
615
|
const detected = await detectFramework(cwd);
|
|
501
|
-
|
|
616
|
+
const features = [];
|
|
502
617
|
if (detected.type === "nextjs" && detected.appDir) {
|
|
503
|
-
|
|
618
|
+
features.push("App Router");
|
|
504
619
|
}
|
|
620
|
+
showDetectedInfo(detected.type, detected.version, features);
|
|
505
621
|
console.log("");
|
|
506
622
|
const telemetryOptions = await gatherOptions(options, detected);
|
|
507
623
|
console.log("");
|
|
@@ -514,7 +630,7 @@ async function initCommand(options) {
|
|
|
514
630
|
for (const file of files) {
|
|
515
631
|
await writeFile(file);
|
|
516
632
|
}
|
|
517
|
-
|
|
633
|
+
showSuccess("Telemetry SDK initialized successfully!");
|
|
518
634
|
if (telemetryOptions.codegen && detected.type !== "generic") {
|
|
519
635
|
console.log("\u{1F4DD} Next steps:");
|
|
520
636
|
console.log(" 1. Review the generated files");
|
|
@@ -524,7 +640,8 @@ async function initCommand(options) {
|
|
|
524
640
|
} else {
|
|
525
641
|
console.log(" import telemetry from './telemetry';");
|
|
526
642
|
}
|
|
527
|
-
console.log(" 3.
|
|
643
|
+
console.log(" 3. Deploy your project");
|
|
644
|
+
console.log(" 4. Engine will auto-register in dashboard");
|
|
528
645
|
console.log("");
|
|
529
646
|
}
|
|
530
647
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egintegrations/telemetry",
|
|
3
|
-
"version": "0.
|
|
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": "
|
|
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": {
|