@gurulu/cli 1.0.1 → 1.0.5
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/bin.js +32 -24
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -24
- package/dist/lib/detect.d.ts.map +1 -1
- package/dist/lib/exec-install.d.ts.map +1 -1
- package/dist/lib/install-plan.d.ts.map +1 -1
- package/dist/lib/install-plan.js +31 -23
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -25241,36 +25241,43 @@ function sdkFor(framework) {
|
|
|
25241
25241
|
}
|
|
25242
25242
|
}
|
|
25243
25243
|
function snippetWeb(workspaceKey) {
|
|
25244
|
-
return `import
|
|
25244
|
+
return `import gurulu from '@gurulu/web';
|
|
25245
25245
|
|
|
25246
|
-
|
|
25247
|
-
|
|
25246
|
+
gurulu.init({
|
|
25247
|
+
workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
25248
|
+
endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
|
|
25249
|
+
});`;
|
|
25248
25250
|
}
|
|
25249
25251
|
function snippetNext(workspaceKey) {
|
|
25250
|
-
return `// app/
|
|
25252
|
+
return `// src/app/gurulu-provider.tsx
|
|
25251
25253
|
'use client';
|
|
25252
25254
|
import { useEffect } from 'react';
|
|
25253
|
-
import
|
|
25254
|
-
|
|
25255
|
-
const gurulu = createGurulu();
|
|
25255
|
+
import gurulu from '@gurulu/web';
|
|
25256
25256
|
|
|
25257
25257
|
export function GuruluProvider({ children }: { children: React.ReactNode }) {
|
|
25258
25258
|
useEffect(() => {
|
|
25259
|
-
gurulu.init({
|
|
25259
|
+
gurulu.init({
|
|
25260
|
+
workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
25261
|
+
endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT,
|
|
25262
|
+
});
|
|
25260
25263
|
}, []);
|
|
25261
25264
|
return <>{children}</>;
|
|
25262
|
-
}
|
|
25265
|
+
}
|
|
25266
|
+
|
|
25267
|
+
// Then wrap your root in app/layout.tsx:
|
|
25268
|
+
// <GuruluProvider>{children}</GuruluProvider>`;
|
|
25263
25269
|
}
|
|
25264
25270
|
function snippetNode(workspaceKey) {
|
|
25265
25271
|
return `import { createGurulu } from '@gurulu/node';
|
|
25266
25272
|
|
|
25267
25273
|
const gurulu = createGurulu({
|
|
25268
|
-
|
|
25274
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
25269
25275
|
apiKey: process.env.GURULU_API_KEY,
|
|
25276
|
+
endpoint: process.env.GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
|
|
25270
25277
|
});
|
|
25271
25278
|
|
|
25272
25279
|
// In your handler:
|
|
25273
|
-
await gurulu.track('
|
|
25280
|
+
await gurulu.track('purchase_completed', {
|
|
25274
25281
|
user_id: 'u_42',
|
|
25275
25282
|
order_id: 'o_123',
|
|
25276
25283
|
total: 49.99,
|
|
@@ -25282,8 +25289,9 @@ import { guruluMiddleware } from '@gurulu/node/middleware/express';
|
|
|
25282
25289
|
|
|
25283
25290
|
const app = express();
|
|
25284
25291
|
app.use(guruluMiddleware({
|
|
25285
|
-
|
|
25292
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
25286
25293
|
apiKey: process.env.GURULU_API_KEY,
|
|
25294
|
+
endpoint: process.env.GURULU_ENDPOINT,
|
|
25287
25295
|
}));`;
|
|
25288
25296
|
}
|
|
25289
25297
|
function snippetHono(workspaceKey) {
|
|
@@ -25291,13 +25299,14 @@ function snippetHono(workspaceKey) {
|
|
|
25291
25299
|
import { createGurulu } from '@gurulu/node';
|
|
25292
25300
|
|
|
25293
25301
|
const gurulu = createGurulu({
|
|
25294
|
-
|
|
25302
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
25295
25303
|
apiKey: process.env.GURULU_API_KEY,
|
|
25304
|
+
endpoint: process.env.GURULU_ENDPOINT,
|
|
25296
25305
|
});
|
|
25297
25306
|
|
|
25298
25307
|
const app = new Hono();
|
|
25299
25308
|
app.post('/checkout/complete', async (c) => {
|
|
25300
|
-
await gurulu.track('
|
|
25309
|
+
await gurulu.track('purchase_completed', await c.req.json());
|
|
25301
25310
|
return c.json({ ok: true });
|
|
25302
25311
|
});`;
|
|
25303
25312
|
}
|
|
@@ -25344,20 +25353,19 @@ function initSnippetFor(framework, sdk, workspaceKey) {
|
|
|
25344
25353
|
function envKeysFor(sdk, framework) {
|
|
25345
25354
|
if (sdk === "@gurulu/node") {
|
|
25346
25355
|
return [
|
|
25356
|
+
{ key: "GURULU_WORKSPACE", example: "pk_live_xxxxxxxxxxxx", required: true },
|
|
25357
|
+
{ key: "GURULU_API_KEY", example: "sk_live_xxxxxxxxxxxx", required: true },
|
|
25347
25358
|
{
|
|
25348
|
-
key: "
|
|
25349
|
-
example: "
|
|
25350
|
-
required:
|
|
25359
|
+
key: "GURULU_ENDPOINT",
|
|
25360
|
+
example: "https://ingest.gurulu.io",
|
|
25361
|
+
required: false
|
|
25351
25362
|
}
|
|
25352
25363
|
];
|
|
25353
25364
|
}
|
|
25354
|
-
const
|
|
25365
|
+
const prefix = framework === "next" ? "NEXT_PUBLIC_GURULU" : "VITE_GURULU";
|
|
25355
25366
|
return [
|
|
25356
|
-
{
|
|
25357
|
-
|
|
25358
|
-
example: "pk_live_xxxxxxxxxxxx",
|
|
25359
|
-
required: false
|
|
25360
|
-
}
|
|
25367
|
+
{ key: `${prefix}_WORKSPACE`, example: "pk_live_xxxxxxxxxxxx", required: false },
|
|
25368
|
+
{ key: `${prefix}_ENDPOINT`, example: "https://ingest.gurulu.io", required: false }
|
|
25361
25369
|
];
|
|
25362
25370
|
}
|
|
25363
25371
|
function buildInstallPlan(detected, ctx = {}) {
|
|
@@ -25706,7 +25714,7 @@ var pushCmd = defineCommand({
|
|
|
25706
25714
|
});
|
|
25707
25715
|
|
|
25708
25716
|
// src/index.ts
|
|
25709
|
-
var VERSION = "1.0.
|
|
25717
|
+
var VERSION = "1.0.4";
|
|
25710
25718
|
var mcpCmd = defineCommand({
|
|
25711
25719
|
meta: {
|
|
25712
25720
|
name: "mcp",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4IlB,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -24818,36 +24818,43 @@ function sdkFor(framework) {
|
|
|
24818
24818
|
}
|
|
24819
24819
|
}
|
|
24820
24820
|
function snippetWeb(workspaceKey) {
|
|
24821
|
-
return `import
|
|
24821
|
+
return `import gurulu from '@gurulu/web';
|
|
24822
24822
|
|
|
24823
|
-
|
|
24824
|
-
|
|
24823
|
+
gurulu.init({
|
|
24824
|
+
workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
24825
|
+
endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
|
|
24826
|
+
});`;
|
|
24825
24827
|
}
|
|
24826
24828
|
function snippetNext(workspaceKey) {
|
|
24827
|
-
return `// app/
|
|
24829
|
+
return `// src/app/gurulu-provider.tsx
|
|
24828
24830
|
'use client';
|
|
24829
24831
|
import { useEffect } from 'react';
|
|
24830
|
-
import
|
|
24831
|
-
|
|
24832
|
-
const gurulu = createGurulu();
|
|
24832
|
+
import gurulu from '@gurulu/web';
|
|
24833
24833
|
|
|
24834
24834
|
export function GuruluProvider({ children }: { children: React.ReactNode }) {
|
|
24835
24835
|
useEffect(() => {
|
|
24836
|
-
gurulu.init({
|
|
24836
|
+
gurulu.init({
|
|
24837
|
+
workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
24838
|
+
endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT,
|
|
24839
|
+
});
|
|
24837
24840
|
}, []);
|
|
24838
24841
|
return <>{children}</>;
|
|
24839
|
-
}
|
|
24842
|
+
}
|
|
24843
|
+
|
|
24844
|
+
// Then wrap your root in app/layout.tsx:
|
|
24845
|
+
// <GuruluProvider>{children}</GuruluProvider>`;
|
|
24840
24846
|
}
|
|
24841
24847
|
function snippetNode(workspaceKey) {
|
|
24842
24848
|
return `import { createGurulu } from '@gurulu/node';
|
|
24843
24849
|
|
|
24844
24850
|
const gurulu = createGurulu({
|
|
24845
|
-
|
|
24851
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
24846
24852
|
apiKey: process.env.GURULU_API_KEY,
|
|
24853
|
+
endpoint: process.env.GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
|
|
24847
24854
|
});
|
|
24848
24855
|
|
|
24849
24856
|
// In your handler:
|
|
24850
|
-
await gurulu.track('
|
|
24857
|
+
await gurulu.track('purchase_completed', {
|
|
24851
24858
|
user_id: 'u_42',
|
|
24852
24859
|
order_id: 'o_123',
|
|
24853
24860
|
total: 49.99,
|
|
@@ -24859,8 +24866,9 @@ import { guruluMiddleware } from '@gurulu/node/middleware/express';
|
|
|
24859
24866
|
|
|
24860
24867
|
const app = express();
|
|
24861
24868
|
app.use(guruluMiddleware({
|
|
24862
|
-
|
|
24869
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
24863
24870
|
apiKey: process.env.GURULU_API_KEY,
|
|
24871
|
+
endpoint: process.env.GURULU_ENDPOINT,
|
|
24864
24872
|
}));`;
|
|
24865
24873
|
}
|
|
24866
24874
|
function snippetHono(workspaceKey) {
|
|
@@ -24868,13 +24876,14 @@ function snippetHono(workspaceKey) {
|
|
|
24868
24876
|
import { createGurulu } from '@gurulu/node';
|
|
24869
24877
|
|
|
24870
24878
|
const gurulu = createGurulu({
|
|
24871
|
-
|
|
24879
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
24872
24880
|
apiKey: process.env.GURULU_API_KEY,
|
|
24881
|
+
endpoint: process.env.GURULU_ENDPOINT,
|
|
24873
24882
|
});
|
|
24874
24883
|
|
|
24875
24884
|
const app = new Hono();
|
|
24876
24885
|
app.post('/checkout/complete', async (c) => {
|
|
24877
|
-
await gurulu.track('
|
|
24886
|
+
await gurulu.track('purchase_completed', await c.req.json());
|
|
24878
24887
|
return c.json({ ok: true });
|
|
24879
24888
|
});`;
|
|
24880
24889
|
}
|
|
@@ -24921,20 +24930,19 @@ function initSnippetFor(framework, sdk, workspaceKey) {
|
|
|
24921
24930
|
function envKeysFor(sdk, framework) {
|
|
24922
24931
|
if (sdk === "@gurulu/node") {
|
|
24923
24932
|
return [
|
|
24933
|
+
{ key: "GURULU_WORKSPACE", example: "pk_live_xxxxxxxxxxxx", required: true },
|
|
24934
|
+
{ key: "GURULU_API_KEY", example: "sk_live_xxxxxxxxxxxx", required: true },
|
|
24924
24935
|
{
|
|
24925
|
-
key: "
|
|
24926
|
-
example: "
|
|
24927
|
-
required:
|
|
24936
|
+
key: "GURULU_ENDPOINT",
|
|
24937
|
+
example: "https://ingest.gurulu.io",
|
|
24938
|
+
required: false
|
|
24928
24939
|
}
|
|
24929
24940
|
];
|
|
24930
24941
|
}
|
|
24931
|
-
const
|
|
24942
|
+
const prefix = framework === "next" ? "NEXT_PUBLIC_GURULU" : "VITE_GURULU";
|
|
24932
24943
|
return [
|
|
24933
|
-
{
|
|
24934
|
-
|
|
24935
|
-
example: "pk_live_xxxxxxxxxxxx",
|
|
24936
|
-
required: false
|
|
24937
|
-
}
|
|
24944
|
+
{ key: `${prefix}_WORKSPACE`, example: "pk_live_xxxxxxxxxxxx", required: false },
|
|
24945
|
+
{ key: `${prefix}_ENDPOINT`, example: "https://ingest.gurulu.io", required: false }
|
|
24938
24946
|
];
|
|
24939
24947
|
}
|
|
24940
24948
|
function buildInstallPlan(detected, ctx = {}) {
|
|
@@ -25283,7 +25291,7 @@ var pushCmd = defineCommand({
|
|
|
25283
25291
|
});
|
|
25284
25292
|
|
|
25285
25293
|
// src/index.ts
|
|
25286
|
-
var VERSION = "1.0.
|
|
25294
|
+
var VERSION = "1.0.4";
|
|
25287
25295
|
var mcpCmd = defineCommand({
|
|
25288
25296
|
meta: {
|
|
25289
25297
|
name: "mcp",
|
package/dist/lib/detect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/lib/detect.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,OAAO,GACP,KAAK,GACL,MAAM,GACN,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,GACT,SAAS,GACT,MAAM,GACN,KAAK,GACL,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAiBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAchE;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/lib/detect.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,OAAO,GACP,KAAK,GACL,MAAM,GACN,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,GACT,SAAS,GACT,MAAM,GACN,KAAK,GACL,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAiBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAchE;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAmBpF;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAmBvD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAW1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-install.d.ts","sourceRoot":"","sources":["../../src/lib/exec-install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"exec-install.d.ts","sourceRoot":"","sources":["../../src/lib/exec-install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,iBAAiB,CAAC,CA0D5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-plan.d.ts","sourceRoot":"","sources":["../../src/lib/install-plan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"install-plan.d.ts","sourceRoot":"","sources":["../../src/lib/install-plan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;CACtB;AAwKD,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,EACzB,GAAG,GAAE,kBAAuB,GAC3B,WAAW,CAYb"}
|
package/dist/lib/install-plan.js
CHANGED
|
@@ -24,36 +24,43 @@ function sdkFor(framework) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function snippetWeb(workspaceKey) {
|
|
27
|
-
return `import
|
|
27
|
+
return `import gurulu from '@gurulu/web';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
gurulu.init({
|
|
30
|
+
workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
31
|
+
endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
|
|
32
|
+
});`;
|
|
31
33
|
}
|
|
32
34
|
function snippetNext(workspaceKey) {
|
|
33
|
-
return `// app/
|
|
35
|
+
return `// src/app/gurulu-provider.tsx
|
|
34
36
|
'use client';
|
|
35
37
|
import { useEffect } from 'react';
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
const gurulu = createGurulu();
|
|
38
|
+
import gurulu from '@gurulu/web';
|
|
39
39
|
|
|
40
40
|
export function GuruluProvider({ children }: { children: React.ReactNode }) {
|
|
41
41
|
useEffect(() => {
|
|
42
|
-
gurulu.init({
|
|
42
|
+
gurulu.init({
|
|
43
|
+
workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
44
|
+
endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT,
|
|
45
|
+
});
|
|
43
46
|
}, []);
|
|
44
47
|
return <>{children}</>;
|
|
45
|
-
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Then wrap your root in app/layout.tsx:
|
|
51
|
+
// <GuruluProvider>{children}</GuruluProvider>`;
|
|
46
52
|
}
|
|
47
53
|
function snippetNode(workspaceKey) {
|
|
48
54
|
return `import { createGurulu } from '@gurulu/node';
|
|
49
55
|
|
|
50
56
|
const gurulu = createGurulu({
|
|
51
|
-
|
|
57
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
52
58
|
apiKey: process.env.GURULU_API_KEY,
|
|
59
|
+
endpoint: process.env.GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
|
|
53
60
|
});
|
|
54
61
|
|
|
55
62
|
// In your handler:
|
|
56
|
-
await gurulu.track('
|
|
63
|
+
await gurulu.track('purchase_completed', {
|
|
57
64
|
user_id: 'u_42',
|
|
58
65
|
order_id: 'o_123',
|
|
59
66
|
total: 49.99,
|
|
@@ -65,8 +72,9 @@ import { guruluMiddleware } from '@gurulu/node/middleware/express';
|
|
|
65
72
|
|
|
66
73
|
const app = express();
|
|
67
74
|
app.use(guruluMiddleware({
|
|
68
|
-
|
|
75
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
69
76
|
apiKey: process.env.GURULU_API_KEY,
|
|
77
|
+
endpoint: process.env.GURULU_ENDPOINT,
|
|
70
78
|
}));`;
|
|
71
79
|
}
|
|
72
80
|
function snippetHono(workspaceKey) {
|
|
@@ -74,13 +82,14 @@ function snippetHono(workspaceKey) {
|
|
|
74
82
|
import { createGurulu } from '@gurulu/node';
|
|
75
83
|
|
|
76
84
|
const gurulu = createGurulu({
|
|
77
|
-
|
|
85
|
+
workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
|
|
78
86
|
apiKey: process.env.GURULU_API_KEY,
|
|
87
|
+
endpoint: process.env.GURULU_ENDPOINT,
|
|
79
88
|
});
|
|
80
89
|
|
|
81
90
|
const app = new Hono();
|
|
82
91
|
app.post('/checkout/complete', async (c) => {
|
|
83
|
-
await gurulu.track('
|
|
92
|
+
await gurulu.track('purchase_completed', await c.req.json());
|
|
84
93
|
return c.json({ ok: true });
|
|
85
94
|
});`;
|
|
86
95
|
}
|
|
@@ -127,20 +136,19 @@ function initSnippetFor(framework, sdk, workspaceKey) {
|
|
|
127
136
|
function envKeysFor(sdk, framework) {
|
|
128
137
|
if (sdk === "@gurulu/node") {
|
|
129
138
|
return [
|
|
139
|
+
{ key: "GURULU_WORKSPACE", example: "pk_live_xxxxxxxxxxxx", required: true },
|
|
140
|
+
{ key: "GURULU_API_KEY", example: "sk_live_xxxxxxxxxxxx", required: true },
|
|
130
141
|
{
|
|
131
|
-
key: "
|
|
132
|
-
example: "
|
|
133
|
-
required:
|
|
142
|
+
key: "GURULU_ENDPOINT",
|
|
143
|
+
example: "https://ingest.gurulu.io",
|
|
144
|
+
required: false
|
|
134
145
|
}
|
|
135
146
|
];
|
|
136
147
|
}
|
|
137
|
-
const
|
|
148
|
+
const prefix = framework === "next" ? "NEXT_PUBLIC_GURULU" : "VITE_GURULU";
|
|
138
149
|
return [
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
example: "pk_live_xxxxxxxxxxxx",
|
|
142
|
-
required: false
|
|
143
|
-
}
|
|
150
|
+
{ key: `${prefix}_WORKSPACE`, example: "pk_live_xxxxxxxxxxxx", required: false },
|
|
151
|
+
{ key: `${prefix}_ENDPOINT`, example: "https://ingest.gurulu.io", required: false }
|
|
144
152
|
];
|
|
145
153
|
}
|
|
146
154
|
function buildInstallPlan(detected, ctx = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gurulu/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"publishConfig": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"build:bin": "bun build ./src/bin.ts --outdir ./dist --target node --format=esm && chmod +x dist/bin.js",
|
|
51
51
|
"build:types": "tsc -p tsconfig.build.json",
|
|
52
52
|
"typecheck": "tsc --noEmit",
|
|
53
|
-
"test": "
|
|
53
|
+
"test": "bun test",
|
|
54
54
|
"prepublishOnly": "bun run build",
|
|
55
55
|
"clean": "rm -rf dist .turbo"
|
|
56
56
|
},
|