@gurulu/cli 0.3.1 → 0.3.3
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/commands/install.js
CHANGED
|
@@ -103,10 +103,10 @@ function detectPackageManager(repoRoot) {
|
|
|
103
103
|
}
|
|
104
104
|
function packageInstallArgs(pm) {
|
|
105
105
|
if (pm === 'pnpm')
|
|
106
|
-
return ['add', '@gurulu/
|
|
106
|
+
return ['add', '@gurulu/web'];
|
|
107
107
|
if (pm === 'yarn')
|
|
108
|
-
return ['add', '@gurulu/
|
|
109
|
-
return ['install', '@gurulu/
|
|
108
|
+
return ['add', '@gurulu/web'];
|
|
109
|
+
return ['install', '@gurulu/web'];
|
|
110
110
|
}
|
|
111
111
|
function mergeEnvFile(repoRoot, framework, vars) {
|
|
112
112
|
const isNext = framework.startsWith('nextjs') || framework === 'nextjs';
|
|
@@ -412,10 +412,10 @@ async function runInstallFlow(args, deps, scriptsDir) {
|
|
|
412
412
|
const pm = detectPackageManager(repoRoot);
|
|
413
413
|
summary.packageManager = pm;
|
|
414
414
|
if (args.skipNpm || args.dryRun) {
|
|
415
|
-
log(deps, 'info', `Skipping package install (${pm} add @gurulu/
|
|
415
|
+
log(deps, 'info', `Skipping package install (${pm} add @gurulu/web)`);
|
|
416
416
|
}
|
|
417
417
|
else {
|
|
418
|
-
log(deps, 'step', `Installing @gurulu/
|
|
418
|
+
log(deps, 'step', `Installing @gurulu/web with ${(0, ui_1.bold)(pm)}...`);
|
|
419
419
|
const pmRes = await deps.runCmd(pm, packageInstallArgs(pm), { cwd: repoRoot });
|
|
420
420
|
if (pmRes.code !== 0) {
|
|
421
421
|
const msg = `${pm} install failed (exit ${pmRes.code}): ${pmRes.stderr.trim()}`;
|
|
@@ -424,7 +424,7 @@ async function runInstallFlow(args, deps, scriptsDir) {
|
|
|
424
424
|
}
|
|
425
425
|
else {
|
|
426
426
|
summary.packageInstalled = true;
|
|
427
|
-
log(deps, 'success', '@gurulu/
|
|
427
|
+
log(deps, 'success', '@gurulu/web installed.');
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
// ---- 6. .env merge ---------------------------------------------------
|
package/package.json
CHANGED
|
@@ -88,7 +88,7 @@ function buildInjection(opts) {
|
|
|
88
88
|
const siteId = opts.siteId || '';
|
|
89
89
|
const tenantId = opts.tenantId || '';
|
|
90
90
|
const publishableKey = opts.publishableKey || '';
|
|
91
|
-
const src = opts.scriptSrc || '
|
|
91
|
+
const src = opts.scriptSrc || 'https://gurulu.io/t.js';
|
|
92
92
|
return { siteId, tenantId, publishableKey, scriptSrc: src };
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -61,6 +61,8 @@ function ensureScriptImport(source) {
|
|
|
61
61
|
|
|
62
62
|
function injectScriptTag(source, injection) {
|
|
63
63
|
if (source.includes(MARKER)) return source; // idempotent
|
|
64
|
+
// Also detect existing tracker tags (manual or from other install methods)
|
|
65
|
+
if (source.includes('data-site-id=') || source.includes('data-gurulu-site-id=') || source.includes('/t.js')) return source;
|
|
64
66
|
const tag = buildScriptTag(injection);
|
|
65
67
|
// Prefer to insert just before </body>. Fall back to before the closing
|
|
66
68
|
// top-level fragment/element.
|