Skip to content

Commit

Permalink
Merge pull request #104 from Informasjonsforvaltning/develop
Browse files Browse the repository at this point in the history
Prodsetting
  • Loading branch information
pooriamehregan authored Jun 18, 2024
2 parents 0b9032d + 41c37b1 commit d978f42
Show file tree
Hide file tree
Showing 76 changed files with 2,405 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["node_modules", "**/*"],
"ignorePatterns": ["node_modules", "**/*", "libs/storybook-app"],
"plugins": ["@nx"],
"overrides": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.form {
display:flex;
flex-direction:column;
gap:2rem;
display: flex;
flex-direction: column;
gap: 2rem;
}

.textField {
Expand Down Expand Up @@ -33,3 +33,9 @@
.submitButton {
align-self: flex-start;
}

@media (max-width: 576px) {
.textFieldHalfWidth {
width: 100%;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ const DataHunterForm = ({ dictionary }: DataHunterFormProps) => {

return (
<>
<SubmitStatusAlert
dictionary={dictionary}
formStatus={state?.status}
/>
<form
id='data-hunter-form'
name='data-hunter-form'
Expand Down Expand Up @@ -112,6 +108,10 @@ const DataHunterForm = ({ dictionary }: DataHunterFormProps) => {
{dictionary.submitRequest}
</Button>
</form>
<SubmitStatusAlert
dictionary={dictionary}
formStatus={state?.status}
/>
</>
);
};
Expand Down
20 changes: 5 additions & 15 deletions apps/forms/app/[lang]/data-hunter/page.module.css
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
.contentContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
max-width: 843px;
max-width: var(--breakpoint-x-large);
margin: 5rem auto;
padding: 1rem;
box-sizing: border-box;
min-width: var(--breakpoint-x-small);
}

.contentContainer .paragraph {
.contentContainer {
margin-bottom: 3rem;
}

.paragraph {
text-align: center;
}

@media screen and (max-width: 1200px) {
.contentContainer {
composes: contentContainer;
margin: 5rem 1rem;
}
}
6 changes: 2 additions & 4 deletions apps/forms/app/[lang]/data-hunter/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const DataHunterPage = async ({ params: { lang } }: Props) => {

const dictionary = await getDictionary(lang);

const {
FDK_BASE_URI
} = process.env;
const { FDK_BASE_URI } = process.env;

const baseUri = FDK_BASE_URI ?? '/';

Expand Down Expand Up @@ -54,7 +52,7 @@ const DataHunterPage = async ({ params: { lang } }: Props) => {
</Heading>
<Paragraph
size='large'
className={styles.paragraph}
spacing
>
{dictionary.dataHunterForm.description}
</Paragraph>
Expand Down
22 changes: 22 additions & 0 deletions apps/frontpage-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": ["plugin:playwright/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "playwright.config.ts"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["src/**/*.{ts,js,tsx,jsx}"],
"rules": {}
}
]
}
69 changes: 69 additions & 0 deletions apps/frontpage-e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { defineConfig, devices } from '@playwright/test';
import { nxE2EPreset } from '@nx/playwright/preset';

import { workspaceRoot } from '@nx/devkit';

// For CI, you may want to set BASE_URL to the deployed application.
const baseURL = process.env['BASE_URL'] || 'http://127.0.0.1:3000';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
...nxE2EPreset(__filename, { testDir: './src' }),
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Run your local dev server before starting the tests */
webServer: {
command: 'yarn nx dev frontpage',
url: 'http://127.0.0.1:3000',
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

// Uncomment for mobile browsers support
/* {
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
}, */

// Uncomment for branded browsers
/* {
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
} */
],
});
8 changes: 8 additions & 0 deletions apps/frontpage-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "frontpage-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/frontpage-e2e/src",
"implicitDependencies": ["frontpage"],
"// targets": "to see all targets run: nx show project frontpage-e2e --web",
"targets": {}
}
9 changes: 9 additions & 0 deletions apps/frontpage-e2e/src/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('/');

// Expect h1 to contain a substring.
// expect(await page.locator('h1').innerText()).toContain('Welcome');
expect(true).toBe(true);
});
19 changes: 19 additions & 0 deletions apps/frontpage-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"sourceMap": false
},
"include": [
"**/*.ts",
"**/*.js",
"playwright.config.ts",
"src/**/*.spec.ts",
"src/**/*.spec.js",
"src/**/*.test.ts",
"src/**/*.test.js",
"src/**/*.d.ts"
]
}
8 changes: 8 additions & 0 deletions apps/frontpage/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:20-alpine3.18
WORKDIR /app
COPY yarn.lock dist/apps/frontpage ./
ENV NODE_ENV=$NODE_ENV
RUN corepack enable
RUN yarn set version stable
RUN yarn install
CMD yarn next start -p 8080
26 changes: 26 additions & 0 deletions apps/frontpage/_.eslintrc.json-disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": ["plugin:@nx/react-typescript", "next", "next/core-web-vitals", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", ".next/**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@next/next/no-html-link-for-pages": ["error", "apps/frontpage/pages"]
}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
}
}
]
}
6 changes: 6 additions & 0 deletions apps/frontpage/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '*.svg' {
const content: any;
export const ReactComponent: any;
export default content;
}
11 changes: 11 additions & 0 deletions apps/frontpage/jest.config.ts-disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'frontpage',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/frontpage',
};
5 changes: 5 additions & 0 deletions apps/frontpage/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
25 changes: 25 additions & 0 deletions apps/frontpage/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//@ts-check

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { composePlugins, withNx } = require('@nx/next');

/**
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
// Set this to true if you would like to use SVGR
// See: https://github.com/gregberge/svgr
svgr: false,
},
typescript: {
ignoreBuildErrors: true
}
};

const plugins = [
// Add more Next.js plugins to this list if needed.
withNx,
];

module.exports = composePlugins(...plugins)(nextConfig);
19 changes: 19 additions & 0 deletions apps/frontpage/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
plugins:
[
'postcss-import',
'postcss-flexbugs-fixes',
[
'postcss-preset-env',
{
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
features: {
'custom-properties': false,
},
},
],
]
}
18 changes: 18 additions & 0 deletions apps/frontpage/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "frontpage",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/frontpage",
"projectType": "application",
"tags": [],
"// targets": "to see all targets run: nx show project frontpage --web",
"targets": {
"build": {
"executor": "@nx/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/apps/frontpage"
}
}
}
}
Empty file added apps/frontpage/public/.gitkeep
Empty file.
Binary file added apps/frontpage/public/favicon.ico
Binary file not shown.
11 changes: 11 additions & 0 deletions apps/frontpage/specs/index.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { render } from '@testing-library/react';

import Page from '../src/app/page';

describe('Page', () => {
it('should render successfully', () => {
const { baseElement } = render(<Page />);
expect(baseElement).toBeTruthy();
});
});
1 change: 1 addition & 0 deletions apps/frontpage/src/app/api/ping/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const GET = async () => new Response('Pong', { status: 200 });
1 change: 1 addition & 0 deletions apps/frontpage/src/app/api/ready/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const GET = async () => new Response('Ready', { status: 200 });
Loading

0 comments on commit d978f42

Please sign in to comment.