Skip to content

Commit 675508e

Browse files
authored
chore: add env variables for apps (#3293)
* chore: improve deployed env variables for apps * change env vaules to preview and production
1 parent 6de457f commit 675508e

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

apps/storefront/app/layout.tsx

+4-9
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ import { Figma, Github, Header, Slack } from '@repo/components';
88
import { Footer } from '@repo/components';
99
import type { Metadata } from 'next';
1010
import Script from 'next/script';
11+
import { isProduction } from '../utils/is-production';
1112

12-
const isProduction = true;
13+
const subdomain = isProduction() ? '' : 'next.';
1314

1415
export const metadata: Metadata = {
15-
metadataBase: new URL(
16-
isProduction
17-
? 'https://designsystemet.no'
18-
: 'https://next.designsystemet.no',
19-
),
16+
metadataBase: new URL(`https://${subdomain}designsystemet.no`),
2017
title: {
2118
template: '%s - Designsystemet',
2219
default: 'Designsystemet',
@@ -49,9 +46,7 @@ const menu = [
4946
},
5047
{
5148
name: 'Temabygger',
52-
href: isProduction
53-
? 'https://theme.designsystemet.no'
54-
: 'https://next.theme.designsystemet.no',
49+
href: `https://${subdomain}theme.designsystemet.no`,
5550
},
5651
];
5752

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export function isProduction() {
2-
return true;
2+
return process.env.DESIGNSYSTEMET_ENV === 'production';
33
}

apps/theme/components/TokenModal/TokenModal.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ export const TokenModal = () => {
4040
return str;
4141
};
4242

43-
const packageCommand = `@digdir/designsystemet${isProduction() ? '' : '@next'}`;
43+
const packageWithTag = `@digdir/designsystemet${isProduction() ? '' : '@next'}`;
4444

45-
const buildSnippet = `npx ${packageCommand} tokens build`;
45+
const buildSnippet = `npx ${packageWithTag} tokens build`;
4646

4747
const cliSnippet = [
48-
`npx ${packageCommand} tokens create`,
48+
`npx ${packageWithTag} tokens create`,
4949
`--${colorCliOptions.main} ${setCliColors(colors.main).trimEnd()}`,
5050
`--${colorCliOptions.neutral} "${getBaseDefault(colors.neutral[0]?.colors.light)?.hex}"`,
5151
`${colors.support.length > 0 ? `--${colorCliOptions.support} ${setCliColors(colors.support).trimEnd()}` : ''}`,

apps/theme/utils/is-production.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export function isProduction() {
2-
return true;
2+
return process.env.DESIGNSYSTEMET_ENV === 'production';
33
}

0 commit comments

Comments
 (0)