mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
Bulk rename across 989 files: - Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc. - Repository URLs: posthog/posthog-js → hanzoai/insights-js - Brand names: PostHog → Insights - File renames: 259 reference JSON files, source files, workflow files - Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
64 lines
2.4 KiB
JavaScript
64 lines
2.4 KiB
JavaScript
const path = require('path');
|
|
const fs = require('fs');
|
|
const { generateApiSpecs } = require('../../../scripts/docs/parser');
|
|
const { HOG_REF } = require('../../../scripts/docs/constants');
|
|
|
|
// Read package.json to get version
|
|
const packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8'));
|
|
const version = packageJson.version;
|
|
|
|
// React Native-specific configuration
|
|
const REACT_NATIVE_SPEC_INFO = {
|
|
id: 'insights-react-native',
|
|
title: 'Insights React Native SDK',
|
|
description: 'Insights React Native SDK allows you to capture events and send them to Insights from your React Native applications.',
|
|
slugPrefix: 'insights-react-native',
|
|
specUrl: 'https://github.com/Insights/@hanzo/insights'
|
|
};
|
|
|
|
// React Native-specific type examples (can be customized as needed)
|
|
const REACT_NATIVE_TYPE_EXAMPLES = {
|
|
InsightsEventProperties: `// Properties for React Native events
|
|
{
|
|
event: 'user_signed_up',
|
|
userId: 'user123',
|
|
timestamp: new Date().toISOString(),
|
|
distinct_id: 'user123',
|
|
$set: {
|
|
email: '[email protected]',
|
|
name: 'John Doe'
|
|
}
|
|
}`,
|
|
InsightsEventProperty: `// Can be a string or an object
|
|
"[email protected]" | { name: "John", age: 25 }`
|
|
};
|
|
|
|
const config = {
|
|
packageDir: path.resolve(__dirname, '..'), // packages/react-native
|
|
apiJsonPath: path.resolve(__dirname, '../docs/insights-react-native.api.json'),
|
|
outputPath: path.resolve(__dirname, `../references/insights-react-native-references-${version}.json`),
|
|
version: version,
|
|
id: REACT_NATIVE_SPEC_INFO.id,
|
|
hogRef: HOG_REF,
|
|
specInfo: REACT_NATIVE_SPEC_INFO,
|
|
typeExamples: REACT_NATIVE_TYPE_EXAMPLES,
|
|
parentClass: 'Insights',
|
|
extraMethods: ['InsightsProvider']
|
|
};
|
|
|
|
// Ensure references directory exists
|
|
const referencesDir = path.resolve(__dirname, '../references');
|
|
if (!fs.existsSync(referencesDir)) {
|
|
fs.mkdirSync(referencesDir, { recursive: true });
|
|
}
|
|
|
|
// Generate versioned file
|
|
const output = generateApiSpecs(config);
|
|
|
|
// Write versioned file
|
|
const versionedPath = path.resolve(__dirname, `../references/insights-react-native-references-${version}.json`);
|
|
fs.writeFileSync(versionedPath, JSON.stringify(output, null, 2));
|
|
|
|
// Copy to latest file
|
|
const latestPath = path.resolve(__dirname, '../references/insights-react-native-references-latest.json');
|
|
fs.writeFileSync(latestPath, JSON.stringify(output, null, 2)); |