diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 1fd28145b6..ed7ed8f386 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -24,6 +24,7 @@ jobs: - '@adeira/abacus-tools' - '@adeira/sx-design' - '@adeira/typescript-test' + - '@adeira/mrtnzlml.com' - 'mrtnzlml-meta' include: - repository: '@adeira/abacus-backoffice' @@ -46,6 +47,10 @@ jobs: source: 'src/typescript-test/**' playwrightReportName: 'playwright-report-typescript-test' playwrightReportPath: 'src/typescript-test/playwright/test-results/' + - repository: '@adeira/mrtnzlml.com' + source: 'src/mrtnzlml.com/**' + playwrightReportName: 'playwright-report-mrtnzlml-com' + playwrightReportPath: 'src/mrtnzlml.com/playwright/test-results/' - repository: 'mrtnzlml-meta' source: 'src/mrtnzlml-meta/**' playwrightReportName: 'playwright-report-mrtnzlml-meta' diff --git a/src/mrtnzlml.com/.babelrc.js b/src/mrtnzlml.com/.babelrc.js new file mode 100644 index 0000000000..f3a27426f7 --- /dev/null +++ b/src/mrtnzlml.com/.babelrc.js @@ -0,0 +1,34 @@ +// @flow strict + +const styleXPlugin = require('@stylexjs/babel-plugin'); + +module.exports = { + presets: [ + [ + '@adeira/babel-preset-adeira', + { + target: + process.env.NODE_ENV === 'test' + ? 'js' // Jest doesn't support ES6 modules by default. + : 'js-esm', // To support dynamic `import(…)` for `@adeira/icons`. + }, + ], + ], + plugins: [ + [ + styleXPlugin, + { + // https://stylexjs.com/docs/api/configuration/babel-plugin/ + dev: process.env.NODE_ENV === 'development', + test: false, + treeshakeCompensation: true, + + // Required for CSS variable support + unstable_moduleResolution: { + type: 'commonJS', + rootDir: __dirname, // The absolute path to the root directory of the project + }, + }, + ], + ], +}; diff --git a/src/mrtnzlml.com/.eslintrc.js b/src/mrtnzlml.com/.eslintrc.js new file mode 100644 index 0000000000..b5929133f6 --- /dev/null +++ b/src/mrtnzlml.com/.eslintrc.js @@ -0,0 +1,24 @@ +// @flow strict + +/* eslint-disable no-unused-vars */ +const OFF = 0; +const WARN = 1; +const ERROR = 2; +/* eslint-enable no-unused-vars */ + +module.exports = { + env: { + browser: true, + }, + extends: [ + '@adeira/eslint-config/strict', // preset with almost everything + '@adeira/eslint-config/fbt', // additional FBT rules + '@adeira/eslint-config/next', // additional Next.js rules + '@adeira/eslint-config/react', + ], + settings: { + next: { + rootDir: __dirname, // https://nextjs.org/docs/basic-features/eslint#rootdir + }, + }, +}; diff --git a/src/mrtnzlml.com/.gitignore b/src/mrtnzlml.com/.gitignore new file mode 100644 index 0000000000..d385e2044c --- /dev/null +++ b/src/mrtnzlml.com/.gitignore @@ -0,0 +1,37 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local + +# vercel +.vercel + +# Sentry +.sentryclirc diff --git a/src/mrtnzlml.com/Dockerfile b/src/mrtnzlml.com/Dockerfile new file mode 100644 index 0000000000..f717822e75 --- /dev/null +++ b/src/mrtnzlml.com/Dockerfile @@ -0,0 +1,34 @@ +# Install dependencies only when needed +FROM node:21.7.3-alpine AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat +WORKDIR /app +COPY package.json ./ +RUN yarn install # --immutable + +# Rebuild the source code only when needed +FROM node:21.7.3-alpine AS builder +WORKDIR /app +COPY . . +COPY --from=deps /app/node_modules ./node_modules +RUN yarn build && yarn install # --immutable + +# Production image, copy all the files and run next +FROM node:21.7.3-alpine AS runner +WORKDIR /app + +ENV NODE_ENV production + +COPY --from=builder /app/next.config.js ./ +COPY --from=builder /app/.next ./.next +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json + +EXPOSE 3000 + +# Next.js collects completely anonymous telemetry data about general usage. +# Learn more here: https://nextjs.org/telemetry +# Uncomment the following line in case you want to disable telemetry. +# ENV NEXT_TELEMETRY_DISABLED 1 + +CMD ["yarn", "start"] diff --git a/src/mrtnzlml.com/README.md b/src/mrtnzlml.com/README.md new file mode 100644 index 0000000000..25df6f3e75 --- /dev/null +++ b/src/mrtnzlml.com/README.md @@ -0,0 +1,13 @@ +New version of https://mrtnzlml.com/ + +Development: + +```bash +yarn workspace @adeira/mrtnzlml.com dev +``` + +Playwright: + +```bash +yarn workspace @adeira/mrtnzlml.com playwright test +``` diff --git a/src/mrtnzlml.com/next.config.js b/src/mrtnzlml.com/next.config.js new file mode 100644 index 0000000000..84501fc44e --- /dev/null +++ b/src/mrtnzlml.com/next.config.js @@ -0,0 +1,44 @@ +// @flow + +/* eslint-disable import/order */ + +const path = require('path'); +const withPlugins = require('next-compose-plugins'); + +const withCustomBabelConfigFile = require('next-plugin-custom-babel-config')({ + babelConfigFile: path.join(__dirname, '.babelrc.js'), +}); + +const withStylex = require('@stylexjs/nextjs-plugin')({ + rootDir: __dirname, +}); + +module.exports = (withPlugins( + [ + [withCustomBabelConfigFile], + [withStylex], + // other plugins here + ], + { + poweredByHeader: false, + reactStrictMode: true, + devIndicators: { + buildActivity: true, + }, + eslint: { + ignoreDuringBuilds: true, + }, + webpack: (nextConfig) => { + nextConfig.module.rules.push({ + type: 'javascript/auto', + test: /\.mjs$/, + }); + return nextConfig; + }, + experimental: { + // https://github.com/vercel/next.js/issues/23725 + // https://github.com/vercel/next.js/pull/27069 + esmExternals: 'loose', + }, + }, +) /*: $FlowFixMe */); diff --git a/src/mrtnzlml.com/package.json b/src/mrtnzlml.com/package.json new file mode 100644 index 0000000000..55d084c14c --- /dev/null +++ b/src/mrtnzlml.com/package.json @@ -0,0 +1,26 @@ +{ + "name": "@adeira/mrtnzlml.com", + "version": "0.0.0", + "private": true, + "license": "UNLICENSED", + "scripts": { + "dev": "next dev --port=3000", + "build": "next build", + "start": "next start --port=3000" + }, + "dependencies": { + "@stylexjs/nextjs-plugin": "^0.6.1", + "@stylexjs/stylex": "^0.6.1", + "next": "^14.2.3", + "next-compose-plugins": "^2.2.1", + "next-plugin-custom-babel-config": "^1.0.5", + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@adeira/babel-preset-adeira": "^4.0.0", + "@babel/core": "^7.24.7", + "@playwright/test": "^1.44.1", + "@stylexjs/babel-plugin": "^0.6.1" + } +} diff --git a/src/mrtnzlml.com/playwright.config.js b/src/mrtnzlml.com/playwright.config.js new file mode 100644 index 0000000000..21777e768f --- /dev/null +++ b/src/mrtnzlml.com/playwright.config.js @@ -0,0 +1,27 @@ +// eslint-disable-next-line ft-flow/require-valid-file-annotation,import/no-extraneous-dependencies +const { devices, defineConfig } = require('@playwright/test'); + +export default defineConfig({ + testDir: 'playwright', + outputDir: 'playwright/test-results', + testMatch: '**.play.js', + forbidOnly: !!process.env.CI, + reporter: process.env.CI ? 'github' : 'list', + retries: process.env.CI ? 2 : 0, + webServer: { + command: 'yarn dev', + port: 3000, + timeout: 120 * 1000, // milliseconds + reuseExistingServer: !process.env.CI, + }, + use: { + trace: 'on-first-retry', + screenshot: 'only-on-failure', + }, + projects: [ + { + name: 'Desktop Chrome', + use: devices['Desktop Chrome'], + }, + ], +}); diff --git a/src/mrtnzlml.com/playwright/.eslintrc.js b/src/mrtnzlml.com/playwright/.eslintrc.js new file mode 100644 index 0000000000..d503ef90e4 --- /dev/null +++ b/src/mrtnzlml.com/playwright/.eslintrc.js @@ -0,0 +1,16 @@ +// @flow strict + +/* eslint-disable no-unused-vars */ +const OFF = 0; +const WARN = 1; +const ERROR = 2; +/* eslint-enable no-unused-vars */ + +module.exports = { + rules: { + // Jest rules incompatible with Playwright: + 'jest/no-disabled-tests': OFF, + 'jest/no-standalone-expect': OFF, + 'jest/valid-title': OFF, + }, +}; diff --git a/src/mrtnzlml.com/playwright/pages/index.play.js b/src/mrtnzlml.com/playwright/pages/index.play.js new file mode 100644 index 0000000000..d1277ac850 --- /dev/null +++ b/src/mrtnzlml.com/playwright/pages/index.play.js @@ -0,0 +1,7 @@ +// eslint-disable-next-line ft-flow/require-valid-file-annotation,import/no-extraneous-dependencies +const { test, expect } = require('@playwright/test'); + +test('that the index page works', async ({ page }) => { + await page.goto('/'); + await expect(page).toHaveTitle(/^mrtnzlml\.com$/); +}); diff --git a/src/mrtnzlml.com/src/app/_global.css b/src/mrtnzlml.com/src/app/_global.css new file mode 100644 index 0000000000..904bb8744e --- /dev/null +++ b/src/mrtnzlml.com/src/app/_global.css @@ -0,0 +1,6 @@ +/* https://github.com/rsms/inter */ +@import url('https://rsms.me/inter/inter.css'); + +:root { + font-family: 'Inter', sans-serif; +} diff --git a/src/mrtnzlml.com/src/app/layout.js b/src/mrtnzlml.com/src/app/layout.js new file mode 100644 index 0000000000..de511d131b --- /dev/null +++ b/src/mrtnzlml.com/src/app/layout.js @@ -0,0 +1,22 @@ +// @flow + +import React, { type Node } from 'react'; + +import './_global.css'; // This must exist even if empty for StyleX to work! + +export const metadata = { + title: 'mrtnzlml.com', + description: 'Martin Zlámal', +}; + +type Props = { + +children: Node, +}; + +export default function RootLayout({ children }: Props): Node { + return ( + +
{children} + + ); +} diff --git a/src/mrtnzlml.com/src/app/page.js b/src/mrtnzlml.com/src/app/page.js new file mode 100644 index 0000000000..ec53f2b92d --- /dev/null +++ b/src/mrtnzlml.com/src/app/page.js @@ -0,0 +1,15 @@ +// @flow + +import React, { type Node } from 'react'; +import * as sx from '@stylexjs/stylex'; + +export default function Homepage(): Node { + return TODO: mrtnzlml.com; +} + +const styles = sx.create({ + todo: { + color: 'green', + fontSize: 20, + }, +}); diff --git a/yarn.lock b/yarn.lock index d7a5f74c7c..d23a6bf521 100644 --- a/yarn.lock +++ b/yarn.lock @@ -326,6 +326,24 @@ __metadata: languageName: unknown linkType: soft +"@adeira/mrtnzlml.com@workspace:src/mrtnzlml.com": + version: 0.0.0-use.local + resolution: "@adeira/mrtnzlml.com@workspace:src/mrtnzlml.com" + dependencies: + "@adeira/babel-preset-adeira": "npm:^4.0.0" + "@babel/core": "npm:^7.24.7" + "@playwright/test": "npm:^1.44.1" + "@stylexjs/babel-plugin": "npm:^0.6.1" + "@stylexjs/nextjs-plugin": "npm:^0.6.1" + "@stylexjs/stylex": "npm:^0.6.1" + next: "npm:^14.2.3" + next-compose-plugins: "npm:^2.2.1" + next-plugin-custom-babel-config: "npm:^1.0.5" + react: "npm:^18.3.1" + react-dom: "npm:^18.3.1" + languageName: unknown + linkType: soft + "@adeira/murmur-hash@npm:^2.0.1, @adeira/murmur-hash@workspace:src/murmur-hash": version: 0.0.0-use.local resolution: "@adeira/murmur-hash@workspace:src/murmur-hash"