@posthog/wizard
Version:
The PostHog wizard helps you to configure your project
100 lines • 5.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.INTEGRATION_ORDER = exports.INTEGRATION_CONFIG = void 0;
const clack_utils_1 = require("../utils/clack-utils");
const package_json_1 = require("../utils/package-json");
const constants_1 = require("./constants");
exports.INTEGRATION_CONFIG = {
[constants_1.Integration.nextjs]: {
name: 'Next.js',
filterPatterns: ['**/*.{tsx,ts,jsx,js,mjs,cjs}'],
ignorePatterns: [
'node_modules',
'dist',
'build',
'public',
'static',
'next-env.d.*',
],
detect: async (options) => {
const packageJson = await (0, clack_utils_1.getPackageDotJson)(options);
return (0, package_json_1.hasPackageInstalled)('next', packageJson);
},
generateFilesRules: '',
filterFilesRules: '',
docsUrl: 'https://posthog.com/docs/libraries/next-js',
defaultChanges: '• Installed posthog-js & posthog-node packages\n• Initialized PostHog and added pageview tracking\n• Created a PostHogClient to use PostHog server-side\n• Setup a reverse proxy to avoid ad blockers blocking analytics requests',
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app',
},
[constants_1.Integration.react]: {
name: 'React',
filterPatterns: ['**/*.{tsx,ts,jsx,js}'],
ignorePatterns: [
'node_modules',
'dist',
'build',
'public',
'static',
'assets',
],
detect: async (options) => {
const packageJson = await (0, clack_utils_1.getPackageDotJson)(options);
return (0, package_json_1.hasPackageInstalled)('react', packageJson);
},
generateFilesRules: '',
filterFilesRules: '',
docsUrl: 'https://posthog.com/docs/libraries/react',
defaultChanges: '• Installed posthog-js package\n• Added PostHogProvider to the root of the app, to initialize PostHog and enable autocapture',
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app',
},
[constants_1.Integration.svelte]: {
name: 'Svelte',
filterPatterns: ['**/*.{svelte,ts,js,jsx,tsx}'],
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
detect: async (options) => {
const packageJson = await (0, clack_utils_1.getPackageDotJson)(options);
return (0, package_json_1.hasPackageInstalled)('@sveltejs/kit', packageJson);
},
generateFilesRules: '',
filterFilesRules: '',
docsUrl: 'https://posthog.com/docs/libraries/svelte',
defaultChanges: '• Installed posthog-js & posthog-node packages\n• Added PostHog initialization to your Svelte app\n• Setup pageview & pageleave tracking\n• Setup event auto - capture to capture events as users interact with your app\n• Added a getPostHogClient() function to use PostHog server-side',
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Use getPostHogClient() to start capturing events server - side',
},
[constants_1.Integration.reactNative]: {
name: 'React Native',
filterPatterns: ['**/*.{ts,js,jsx,tsx}'],
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
detect: async (options) => {
const packageJson = await (0, clack_utils_1.getPackageDotJson)(options);
return (0, package_json_1.hasPackageInstalled)('react-native', packageJson);
},
generateFilesRules: '',
filterFilesRules: '',
docsUrl: 'https://posthog.com/docs/libraries/react-native',
defaultChanges: '• Installed required packages\n• Added PostHogProvider to the root of the app\n• Enabled autocapture and session replay',
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app',
},
[constants_1.Integration.astro]: {
name: 'Astro',
filterPatterns: ['**/*.{astro,ts,js,jsx,tsx}'],
ignorePatterns: ['node_modules', 'dist', 'build', 'public', 'static'],
detect: async (options) => {
const packageJson = await (0, clack_utils_1.getPackageDotJson)(options);
return (0, package_json_1.hasPackageInstalled)('astro', packageJson);
},
generateFilesRules: '',
filterFilesRules: '',
docsUrl: 'https://posthog.com/docs/libraries/js',
defaultChanges: '• Added PostHog component with initialization script\n• Created PostHogLayout for consistent analytics tracking',
nextSteps: '• Call posthog.identify() when a user signs into your app\n• Call posthog.capture() to capture custom events in your app\n• Use posthog.isFeatureEnabled() for feature flags',
},
};
exports.INTEGRATION_ORDER = [
constants_1.Integration.nextjs,
constants_1.Integration.astro,
constants_1.Integration.svelte,
constants_1.Integration.reactNative,
constants_1.Integration.react,
];
//# sourceMappingURL=config.js.map