@holdyapp/install 0.3.0 → 0.4.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 +24 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -235,7 +235,7 @@ function injectNextPages(file, opts) {
|
|
|
235
235
|
if (typeof window !== 'undefined' && !window.__holdyInit) { initHoldy({ apiKey: '${opts.apiKey}', ${opts.accountId ? `accountKey: '${opts.accountId}', ` : ""}autoCapture: ${opts.autoCapture} }); (window as unknown as { __holdyInit?: boolean }).__holdyInit = true }`
|
|
236
236
|
);
|
|
237
237
|
(0, import_node_fs2.writeFileSync)(file, patched);
|
|
238
|
-
return { ok: true, modified: true, file, message: `Patched ${displayPath(file)} \xB7 rode npm install
|
|
238
|
+
return { ok: true, modified: true, file, message: `Patched ${displayPath(file)} \xB7 rode npm install https://holdy.chat/sdk/holdyapp-sdk-1.5.0.tgz` };
|
|
239
239
|
}
|
|
240
240
|
function injectViteReact(file, opts) {
|
|
241
241
|
if (!file || !(0, import_node_fs2.existsSync)(file)) {
|
|
@@ -256,7 +256,7 @@ initHoldy({ apiKey: '${opts.apiKey}', ${opts.accountId ? `accountKey: '${opts.ac
|
|
|
256
256
|
|
|
257
257
|
${original}`;
|
|
258
258
|
(0, import_node_fs2.writeFileSync)(file, patched);
|
|
259
|
-
return { ok: true, modified: true, file, message: `Patched ${displayPath(file)} \xB7 rode npm install
|
|
259
|
+
return { ok: true, modified: true, file, message: `Patched ${displayPath(file)} \xB7 rode npm install https://holdy.chat/sdk/holdyapp-sdk-1.5.0.tgz` };
|
|
260
260
|
}
|
|
261
261
|
function injectViteVue(file, opts) {
|
|
262
262
|
return injectViteReact(file, opts);
|
|
@@ -278,7 +278,7 @@ export default defineNuxtPlugin(() => {
|
|
|
278
278
|
})
|
|
279
279
|
`;
|
|
280
280
|
(0, import_node_fs2.writeFileSync)(file, content);
|
|
281
|
-
return { ok: true, modified: true, file, message: `Criado ${displayPath(file)} \xB7 rode npm install
|
|
281
|
+
return { ok: true, modified: true, file, message: `Criado ${displayPath(file)} \xB7 rode npm install https://holdy.chat/sdk/holdyapp-sdk-1.5.0.tgz` };
|
|
282
282
|
}
|
|
283
283
|
function injectRemix(file, opts) {
|
|
284
284
|
if (!file || !(0, import_node_fs2.existsSync)(file)) {
|
|
@@ -592,11 +592,27 @@ async function runInstrument(opts) {
|
|
|
592
592
|
`${patches.length} ${patches.length === 1 ? "evento inserido" : "eventos inseridos"} em ${written.length} ${written.length === 1 ? "arquivo" : "arquivos"}`
|
|
593
593
|
);
|
|
594
594
|
for (const file of written) ui.info(file);
|
|
595
|
+
printMetrics(plan.metrics, ui);
|
|
595
596
|
console.log();
|
|
596
597
|
ui.info("Os eventos se registram sozinhos na taxonomia no primeiro emit \u2014 n\xE3o precisa declarar nada na Holdy.");
|
|
597
|
-
ui.info("Rode o app, use o produto e acompanhe em /
|
|
598
|
+
ui.info("Rode o app, use o produto e acompanhe em holdy.chat/onboarding.");
|
|
598
599
|
return 0;
|
|
599
600
|
}
|
|
601
|
+
function printMetrics(metrics, ui) {
|
|
602
|
+
if (!metrics || metrics.length === 0) return;
|
|
603
|
+
const prontas = metrics.filter((m) => m.ready);
|
|
604
|
+
const faltando = metrics.filter((m) => !m.ready);
|
|
605
|
+
console.log();
|
|
606
|
+
console.log(` ${ui.bold("O que voc\xEA passa a medir")}`);
|
|
607
|
+
console.log();
|
|
608
|
+
for (const m of prontas) {
|
|
609
|
+
const extra = m.needs_choice ? ui.dim(` \xB7 ${m.needs_choice}`) : "";
|
|
610
|
+
console.log(` ${ui.green("\u2713")} ${m.label}${extra}`);
|
|
611
|
+
}
|
|
612
|
+
for (const m of faltando) {
|
|
613
|
+
console.log(` ${ui.dim("\xB7")} ${ui.dim(`${m.label} \u2014 falta evento de fase ${m.missing.join(" e ")}`)}`);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
600
616
|
async function requestPlan(opts, files) {
|
|
601
617
|
const url = `${opts.baseUrl.replace(/\/$/, "")}/instrumentation/plan`;
|
|
602
618
|
const response = await fetch(url, {
|
|
@@ -719,7 +735,7 @@ function confirm(question) {
|
|
|
719
735
|
}
|
|
720
736
|
|
|
721
737
|
// src/cli.ts
|
|
722
|
-
var VERSION = "0.
|
|
738
|
+
var VERSION = "0.4.0";
|
|
723
739
|
var DEFAULT_API_URL = "https://holdy.chat/api/v1";
|
|
724
740
|
async function main() {
|
|
725
741
|
const argv = process.argv.slice(2);
|
|
@@ -769,10 +785,10 @@ async function main() {
|
|
|
769
785
|
}
|
|
770
786
|
process.exit(2);
|
|
771
787
|
}
|
|
772
|
-
if (detection.usePackage) {
|
|
788
|
+
if (detection.usePackage && detection.framework !== "next-app") {
|
|
773
789
|
log.step("3", "Falta instalar o pacote npm:");
|
|
774
790
|
console.log();
|
|
775
|
-
console.log(" npm install
|
|
791
|
+
console.log(" npm install https://holdy.chat/sdk/holdyapp-sdk-1.5.0.tgz");
|
|
776
792
|
console.log();
|
|
777
793
|
} else {
|
|
778
794
|
log.step("3", "Sem npm install necess\xE1rio \xB7 script tag via CDN.");
|
|
@@ -796,7 +812,7 @@ async function main() {
|
|
|
796
812
|
log.step("5", "Pronto! Suba o app, use o produto e veja os eventos chegando em holdy.chat.");
|
|
797
813
|
process.exit(0);
|
|
798
814
|
}
|
|
799
|
-
log.step("4",
|
|
815
|
+
log.step("4", "Pronto! Inicie o app e abra holdy.chat/onboarding \xB7 o primeiro evento aparece em segundos.");
|
|
800
816
|
process.exit(0);
|
|
801
817
|
}
|
|
802
818
|
function parseArgs(argv) {
|
package/package.json
CHANGED