Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insights(feat): qwikInsights Vite Plugin + save symbol details #5011

Merged
merged 11 commits into from
Aug 25, 2023
Merged
13 changes: 5 additions & 8 deletions packages/docs/src/routes/docs/labs/insights/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Insights allow your application to collect real user usage information to optimi
The optimization consists of these parts:
- A `<Insights>` component which collects real user usage data.
- A registered application inside the builder.io database.
- A qwikVite configuration to load real user usage data during the build process.
- A `qwikInsights` Vite Plugin to load and save real user usage data during the build process.

> NOTE:
> To try this new feature please drop a message inside the [Qwik Discord server](https://qwik.builder.io/chat)
Expand Down Expand Up @@ -69,17 +69,14 @@ file: `vite.config.js`
```typescript
//..
import { defineConfig, loadEnv } from 'vite';
import { insightsEntryStrategy } from '@builder.io/qwik-labs/vite';

import { qwikInsights } from '@builder.io/qwik-labs/vite';

export default defineConfig(async () => {
return {
plugins: [
qwikVite({
entryStrategy: await insightsEntryStrategy({
publicApiKey: loadEnv('', '.', '').PUBLIC_QWIK_INSIGHTS_KEY,
}),
}),
qwikInsights({
publicApiKey: loadEnv('', '.', '').PUBLIC_QWIK_INSIGHTS_KEY,
}),
//...
],
// ...
Expand Down
4 changes: 0 additions & 4 deletions packages/docs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { examplesData, playgroundData, tutorialData } from './vite.repl-apps';
import { sourceResolver } from './vite.source-resolver';
import { qwikReact } from '@builder.io/qwik-react/vite';
import Inspect from 'vite-plugin-inspect';
// import { insightsEntryStrategy } from '@builder.io/qwik-labs';

export const PUBLIC_QWIK_INSIGHT_KEY = loadEnv('', '.', 'PUBLIC').PUBLIC_QWIK_INSIGHTS_KEY;

Expand Down Expand Up @@ -97,9 +96,6 @@ export default defineConfig(async () => {
},
}),
qwikVite({
// entryStrategy: await insightsEntryStrategy({
// publicApiKey: PUBLIC_QWIK_INSIGHT_KEY,
// }),
entryStrategy: {
type: 'smart',
manual: {
Expand Down
15 changes: 15 additions & 0 deletions packages/insights/drizzle/0012_omniscient_leader.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE TABLE `symbolDetailTmp` (
`id` integer PRIMARY KEY NOT NULL,
`hash` text NOT NULL,
`public_api_key` text,
`manifest_hash` text,
`full_name` text NOT NULL,
`origin` text NOT NULL,
`lo` integer NOT NULL,
`hi` integer NOT NULL,
FOREIGN KEY (`public_api_key`) REFERENCES `applications`(`public_api_key`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`public_api_key`,`manifest_hash`) REFERENCES `manifests`(`public_api_key`,`hash`) ON UPDATE no action ON DELETE no action
);--> statement-breakpoint
INSERT INTO `symbolDetailTmp` SELECT * FROM `symbolDetail`;--> statement-breakpoint
DROP TABLE `symbolDetail`;--> statement-breakpoint
ALTER TABLE `symbolDetailTmp` RENAME TO `symbolDetail`;
Loading
Loading