Skip to content

Commit 8ff4c19

Browse files
committed
initial commit
0 parents  commit 8ff4c19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+15017
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish Preview Package
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
env:
8+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
9+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Enable Corepack
16+
run: npm i -g corepack@latest && corepack enable
17+
18+
- name: Setup Node.js v22 LTS
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
cache: "pnpm"
23+
24+
- name: Cache Turborepo build setup
25+
uses: actions/cache@v4
26+
with:
27+
path: .turbo
28+
key: ${{ runner.os }}-turbo-${{ github.sha }}
29+
restore-keys: |
30+
${{ runner.os }}-turbo-
31+
32+
- name: Install dependencies
33+
run: pnpm install
34+
35+
- name: Build package
36+
run: pnpm build --filter=@simpleanalytics/next
37+
38+
- name: Publish package
39+
run: pnpx pkg-pr-new publish './packages/analytics'

.github/workflows/publish.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
env:
15+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
16+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Enable Corepack
23+
run: npm i -g corepack@latest && corepack enable
24+
25+
- name: Setup Node.js v22 LTS
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 22
29+
cache: "pnpm"
30+
registry-url: https://registry.npmjs.org
31+
32+
- name: Cache Turborepo build setup
33+
uses: actions/cache@v4
34+
with:
35+
path: .turbo
36+
key: ${{ runner.os }}-turbo-${{ github.sha }}
37+
restore-keys: |
38+
${{ runner.os }}-turbo-
39+
40+
- name: Install dependencies
41+
run: pnpm install
42+
43+
- name: Build package
44+
run: pnpm build --filter=@simpleanalytics/next
45+
46+
- name: Publish package
47+
shell: bash
48+
run: pnpm publish --filter=@simpleanalytics/next --access public --no-git-checks
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.idea
2+
.vscode
3+
node_modules
4+
.turbo
5+
dist/
6+
7+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
8+
9+
# dependencies
10+
/.pnp
11+
.pnp.*
12+
.yarn/*
13+
!.yarn/patches
14+
!.yarn/plugins
15+
!.yarn/releases
16+
!.yarn/versions
17+
18+
# testing
19+
/coverage
20+
21+
# next.js
22+
.next/
23+
/out/
24+
25+
# production
26+
/build
27+
28+
# misc
29+
.DS_Store
30+
*.pem
31+
32+
# debug
33+
npm-debug.log*
34+
yarn-debug.log*
35+
yarn-error.log*
36+
.pnpm-debug.log*
37+
38+
# env files (can opt-in for committing if needed)
39+
.env*
40+
41+
# vercel
42+
.vercel
43+
44+
# typescript
45+
*.tsbuildinfo
46+
next-env.d.ts
47+
/.nuxt/**

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright 2025 Simple Analytics
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

examples/nuxt-v3/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example

examples/nuxt-v3/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Nuxt Minimal Starter
2+
3+
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
4+
5+
## Setup
6+
7+
Make sure to install dependencies:
8+
9+
```bash
10+
# npm
11+
npm install
12+
13+
# pnpm
14+
pnpm install
15+
16+
# yarn
17+
yarn install
18+
19+
# bun
20+
bun install
21+
```
22+
23+
## Development Server
24+
25+
Start the development server on `http://localhost:3000`:
26+
27+
```bash
28+
# npm
29+
npm run dev
30+
31+
# pnpm
32+
pnpm dev
33+
34+
# yarn
35+
yarn dev
36+
37+
# bun
38+
bun run dev
39+
```
40+
41+
## Production
42+
43+
Build the application for production:
44+
45+
```bash
46+
# npm
47+
npm run build
48+
49+
# pnpm
50+
pnpm build
51+
52+
# yarn
53+
yarn build
54+
55+
# bun
56+
bun run build
57+
```
58+
59+
Locally preview production build:
60+
61+
```bash
62+
# npm
63+
npm run preview
64+
65+
# pnpm
66+
pnpm preview
67+
68+
# yarn
69+
yarn preview
70+
71+
# bun
72+
bun run preview
73+
```
74+
75+
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

examples/nuxt-v3/app.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script setup lang="ts">
2+
if (import.meta.server) {
3+
console.log('app.vue');
4+
await trackPageview();
5+
}
6+
</script>
7+
8+
<template>
9+
<div>
10+
<NuxtRouteAnnouncer />
11+
<NuxtPage />
12+
</div>
13+
</template>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default defineNuxtRouteMiddleware(async (to) => {
2+
console.log('tracking-middleware', to);
3+
// We track pageviews on the server only
4+
if (import.meta.client) {
5+
return;
6+
}
7+
8+
if (to.path.startsWith('/api/')) {
9+
return;
10+
}
11+
12+
await trackPageview();
13+
})

examples/nuxt-v3/nuxt.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// https://nuxt.com/docs/api/configuration/nuxt-config
2+
export default defineNuxtConfig({
3+
compatibilityDate: '2025-05-15',
4+
devtools: { enabled: true },
5+
modules: ['@simpleanalytics/nuxt'],
6+
simpleAnalytics: {
7+
hostname: 'test.example.com' // Replace with your actual domain
8+
}
9+
})

examples/nuxt-v3/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "nuxt-v3",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "nuxt build",
7+
"dev": "nuxt dev",
8+
"generate": "nuxt generate",
9+
"preview": "nuxt preview",
10+
"postinstall": "nuxt prepare"
11+
},
12+
"dependencies": {
13+
"@simpleanalytics/nuxt": "workspace:*",
14+
"nuxt": "^3.17.5",
15+
"vue": "^3.5.17",
16+
"vue-router": "^4.5.1"
17+
}
18+
}

0 commit comments

Comments
 (0)