@vulcantech/analytics 0.1.0 → 0.1.1

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/README.md +5 -32
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -14,40 +14,13 @@ Exports:
14
14
 
15
15
  Wire analytics into a consumer site (Next.js App Router):
16
16
 
17
- **1. Add the dependency** (`package.json`):
18
- ```json
19
- "@vulcantech/analytics": "*"
17
+ **1. Add the dependency**:
18
+ ```bash
19
+ npm install @vulcantech/analytics
20
20
  ```
21
+ (Inside the VulcanTech monorepo, use the workspace wiring in `MONOREPO.md` instead.)
21
22
 
22
- **2. Transpile + alias it to SOURCE** (`next.config.js`), same shape as the other CMS packages. Alias directly to the source files — the root `.gcloudignore` strips `**/dist/` from the Cloud Build upload, so resolving via `package.json` (→ `dist/…`) 404s the build. Note the two-key pattern: the `/tags` subpath first, then the `$`-anchored bare specifier so it doesn't shadow the subpath:
23
- ```js
24
- transpilePackages: ["@vulcantech/analytics", /* ... */],
25
- webpack: (config) => {
26
- // subpath must come before the "$"-anchored bare specifier
27
- config.resolve.alias["@vulcantech/analytics/tags"] = path.join(__dirname, "../../packages/analytics/src/tags.tsx");
28
- config.resolve.alias["@vulcantech/analytics$"] = path.join(__dirname, "../../packages/analytics/src/index.tsx");
29
- return config;
30
- },
31
- turbopack: {
32
- resolveAlias: {
33
- "@vulcantech/analytics/tags": "./../../packages/analytics/src/tags.tsx",
34
- "@vulcantech/analytics": "./../../packages/analytics/src/index.tsx",
35
- },
36
- },
37
- ```
38
-
39
- **2a. Add tsconfig paths** (`tsconfig.json`) so TypeScript resolves the source (no built `dist`):
40
- ```json
41
- "paths": {
42
- "@vulcantech/analytics": ["../../packages/analytics/src"],
43
- "@vulcantech/analytics/tags": ["../../packages/analytics/src/tags.tsx"]
44
- }
45
- ```
46
-
47
- **2b. COPY it in the Dockerfile** deps stage (alongside the other `packages/*/package.json` copies) — a frozen-lockfile `yarn install` needs the workspace member present or the build fails:
48
- ```dockerfile
49
- COPY packages/analytics/package.json ./packages/analytics/
50
- ```
23
+ **2. Set the env** — see [Required env](#required-env) below.
51
24
 
52
25
  **3. Mount `AnalyticsTracker`** in the root layout (`src/app/layout.tsx`) — tracks page views on every route change:
53
26
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulcantech/analytics",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Lightweight first-party analytics tracker for Next.js — page views, custom events, form conversions. No cookies, no fingerprinting, <1KB gzipped.",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",