Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,39 @@ This also allows us to pick up the bill on behalf of our customers.

When we make improvements to this process, these are available instantly to all users of the wizard, no training delays or other ambiguity.

## Testing locally
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💖

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use pnpm try if you don't want to rebuild each time :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh get this: doesn't work if we need to detect a version as in instrumentation-client. Gotta actually build and run it from the directory

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm holding it wrong?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry that was very poorly documented, you can do pnpm try --install-dir=e2e-tests/test-applications/nextjs-app-router-test-app for running in an app and that should work without a build :)

Copy link
Collaborator Author

@daniloc daniloc Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay that works!

if I drag and drop a folder into the CLI, as in

pnpm try --install-dir='/Users/daniloc/Documents/Dev/wizard/e2e-tests/test-applications/nextjs-app-router-test-app'

I get an error. an issue escaping the quotes that are auto populated maybe?

daniloc@DAir wizard % pnpm try --install-dir='/Users/daniloc/Documents/Dev/wizard/e2e-tests/test-applications/nextjs-app-router-test-app'

> @posthog/wizard@1.2.2 try /Users/daniloc/Documents/Dev/wizard
> ts-node bin.ts --install-dir\=/Users/daniloc/Documents/Dev/wizard/e2e-tests/test-applications/nextjs-app-router-test-app

┌  Welcome to the PostHog setup wizard ✨
│
■  Could not find package.json. Make sure to run the wizard in the root of your app!
│
└  Wizard setup cancelled.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm does it work without the quotes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path resolution bug; will patch


To test your local changes to the wizard in a different project:

1. **Build the wizard:**
Navigate to the root directory of this wizard project and build it:
```bash
pnpm build
```
This compiles the TypeScript code and prepares the `dist` directory. Run this command any time you make changes to the wizard's source code.

2. **Make the wizard available to other projects:**
In the wizard's project directory, run:
```bash
pnpm link --global
```
This command makes your local version of the wizard available system-wide. You generally only need to do this once, or if you've unlinked it or made changes to `package.json` that affect the package's global registration.

4. **Run the wizard:**
Now, from the root directory of your test project, you can run the wizard using its command:
```bash
wizard [options]
```
For example:
```bash
wizard --integration nextjs
```
or simply:
```bash
wizard
```
The wizard will execute using your local code. Changes made in the wizard's source directory (and rebuilt with `pnpm build`) will be reflected immediately.

## Publishing your tool

To make your version of a tool usable with a one-line `npx` command:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
];

export default eslintConfig;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */

// Add PostHog rewrites
async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: "https://us-assets.i.posthog.com/static/:path*",
},
{
source: "/ingest/:path*",
destination: "https://us.i.posthog.com/:path*",
},
{
source: "/ingest/decide",
destination: "https://us.i.posthog.com/decide",
},
];
},

// Required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
};

export default nextConfig;
Loading
Loading