Skip to content

Commit

Permalink
fix(insights): move default location to root
Browse files Browse the repository at this point in the history
so it doesn't get clobbered by builds
  • Loading branch information
wmertens committed Oct 8, 2024
1 parent 30721d0 commit d937f84
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ node_modules
.vscode
.rollup.cache
tsconfig.tsbuildinfo
q-insights.json

# Logs
logs
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-labs/src-vite/insights/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function qwikInsights(qwikInsightsOpts: {
baseUrl?: string;
outDir?: string;
}): Promise<PluginOption> {
const { publicApiKey, baseUrl = 'https://insights.qwik.dev', outDir = 'dist' } = qwikInsightsOpts;
const { publicApiKey, baseUrl = 'https://insights.qwik.dev', outDir = '' } = qwikInsightsOpts;
let isProd = false;
const vitePlugin: PluginOption = {
name: 'vite-plugin-qwik-insights',
Expand Down
10 changes: 5 additions & 5 deletions packages/qwik/src/optimizer/src/plugins/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
const injections: GlobalInjections[] = [];
const qwikPlugin = createPlugin(qwikViteOpts.optimizerOptions);

async function loadQwikInsights(clientOutDir?: string | null): Promise<InsightManifest | null> {
async function loadQwikInsights(clientOutDir = ''): Promise<InsightManifest | null> {
const sys = qwikPlugin.getSys();
const cwdRelativePath = absolutePathAwareJoin(
sys.path,
rootDir || '.',
clientOutDir ?? 'dist',
clientOutDir,
'q-insights.json'
);
const path = absolutePathAwareJoin(sys.path, process.cwd(), cwdRelativePath);
Expand All @@ -97,7 +97,7 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
getOptimizer: () => qwikPlugin.getOptimizer(),
getOptions: () => qwikPlugin.getOptions(),
getManifest: () => manifestInput,
getInsightsManifest: (clientOutDir?: string | null) => loadQwikInsights(clientOutDir),
getInsightsManifest: (clientOutDir = '') => loadQwikInsights(clientOutDir!),
getRootDir: () => qwikPlugin.getOptions().rootDir,
getClientOutDir: () => clientOutDir,
getClientPublicOutDir: () => clientPublicOutDir,
Expand Down Expand Up @@ -225,7 +225,7 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
} catch (e) {
console.error(e);
}
} catch (e) {
} catch {
// error reading package.json from Node.js fs, ok to ignore
}

Expand Down Expand Up @@ -429,7 +429,7 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
if (entryStrategy) {
qwikViteOpts.entryStrategy = entryStrategy;
}
} catch (e) {
} catch {
// ok to ignore
}
}
Expand Down

0 comments on commit d937f84

Please sign in to comment.