Skip to content

Commit

Permalink
fix: update draft env var (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlnf authored Jun 3, 2024
1 parent ffc3768 commit 332809c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
pnpm install --frozen-lockfile --ignore-scripts
pnpm run ds:build
env:
SHOW_DRAFTS: true
NEXT_PUBLIC_SHOW_DRAFTS: true
NEXT_EXPORT: true
GITHUB_PAGES: true
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
8 changes: 5 additions & 3 deletions apps/docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { withContentlayer } from "next-contentlayer";
import { withContentlayer } from 'next-contentlayer';

const isGitHubPages = Boolean(process.env.GITHUB_PAGES);
const prefix = isGitHubPages ? "/govie-ds" : undefined;
const isNextExport = Boolean(process.env.NEXT_EXPORT);

const prefix = isGitHubPages ? '/govie-ds' : undefined;

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
trailingSlash: true,
basePath: prefix,
assetPrefix: prefix,
output: isGitHubPages ? "export" : "standalone",
output: isNextExport ? 'export' : 'standalone',
images: {
unoptimized: true, // TODO: review image optimisation
},
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"format:check": "prettier 'src/**/*.{ts,tsx}' --check",
"dev": "next dev",
"build": "next build",
"build:prod": "cross-env CI=true next build",
"start": "next start",
"build:export": "cross-env NEXT_EXPORT=true next build",
"start": "pnpm dlx serve@latest out",
"lint": "next lint",
"test": "vitest run",
"test:watch": "vitest",
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const config = {
isProduction: () => isProduction(),
showDrafts: () => {
// Show drafts setting takes precedence
if (process.env.SHOW_DRAFTS) {
return process.env.SHOW_DRAFTS === 'true';
if (process.env.NEXT_PUBLIC_SHOW_DRAFTS) {
return process.env.NEXT_PUBLIC_SHOW_DRAFTS === 'true';
}

return !isProduction();
Expand Down

0 comments on commit 332809c

Please sign in to comment.