Merged in feat/sw-2880-prepare-booking-flow-package (pull request #2467)
feat(SW-2880) Prepare booking flow package * Init booking-flow package * Add gitignore * Use booking-flow package * Use design-system Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
.page {
|
||||
color: white;
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
padding-left: 200px;
|
||||
padding-top: 200px;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Temp } from "@scandic-hotels/booking-flow/test-entry"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
@@ -10,6 +11,11 @@ export default function Home() {
|
||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||
<p>hello world</p>
|
||||
</Typography>
|
||||
<Typography>
|
||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||
<p>from booking-flow package:</p>
|
||||
</Typography>
|
||||
<Temp />
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -3,7 +3,11 @@ import type { NextConfig } from "next"
|
||||
const nextConfig: NextConfig = {
|
||||
poweredByHeader: false,
|
||||
trailingSlash: false,
|
||||
transpilePackages: ["@scandic-hotels/common", "@scandic-hotels/trpc"],
|
||||
transpilePackages: [
|
||||
"@scandic-hotels/common",
|
||||
"@scandic-hotels/trpc",
|
||||
"@scandic-hotels/booking-flow",
|
||||
],
|
||||
output: "standalone",
|
||||
|
||||
webpack: function (config: any) {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@netlify/plugin-nextjs": "^5.11.2",
|
||||
"@scandic-hotels/booking-flow": "workspace:*",
|
||||
"@scandic-hotels/design-system": "workspace:*",
|
||||
"next": "15.3.4",
|
||||
"react": "^19.0.0",
|
||||
|
||||
@@ -29,7 +29,11 @@ const nextConfig = {
|
||||
poweredByHeader: false,
|
||||
eslint: { ignoreDuringBuilds: true },
|
||||
trailingSlash: false,
|
||||
transpilePackages: ["@scandic-hotels/common", "@scandic-hotels/trpc"],
|
||||
transpilePackages: [
|
||||
"@scandic-hotels/common",
|
||||
"@scandic-hotels/trpc",
|
||||
"@scandic-hotels/booking-flow",
|
||||
],
|
||||
experimental: {
|
||||
serverActions: {
|
||||
allowedOrigins: [
|
||||
|
||||
0
packages/booking-flow/.env.test
Normal file
0
packages/booking-flow/.env.test
Normal file
40
packages/booking-flow/.gitignore
vendored
Normal file
40
packages/booking-flow/.gitignore
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
.yarn/install-state.gz
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
#vscode
|
||||
.vscode/
|
||||
|
||||
#cursor
|
||||
.cursorrules
|
||||
|
||||
# Yarn
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
.yarn/releases
|
||||
92
packages/booking-flow/eslint.config.mjs
Normal file
92
packages/booking-flow/eslint.config.mjs
Normal file
@@ -0,0 +1,92 @@
|
||||
import { FlatCompat } from "@eslint/eslintrc"
|
||||
import js from "@eslint/js"
|
||||
import typescriptEslint from "@typescript-eslint/eslint-plugin"
|
||||
import tsParser from "@typescript-eslint/parser"
|
||||
import { defineConfig } from "eslint/config"
|
||||
import simpleImportSort from "eslint-plugin-simple-import-sort"
|
||||
|
||||
const compat = new FlatCompat({
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
})
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
extends: compat.extends("next/core-web-vitals", "plugin:import/typescript"),
|
||||
plugins: {
|
||||
"simple-import-sort": simpleImportSort,
|
||||
"@typescript-eslint": typescriptEslint,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
},
|
||||
|
||||
rules: {
|
||||
"no-unused-vars": "off",
|
||||
"react/function-component-definition": "error",
|
||||
"import/no-relative-packages": "error",
|
||||
"simple-import-sort/imports": [
|
||||
"error",
|
||||
{
|
||||
groups: [
|
||||
["^\\u0000"],
|
||||
["^node:"],
|
||||
["^@?\\w"],
|
||||
["^@scandic-hotels/(?!.*\u0000$).*$"],
|
||||
[
|
||||
"^@/constants/?(?!.*\u0000$).*$",
|
||||
"^@/env/?(?!.*\u0000$).*$",
|
||||
"^@/lib/?(?!.*\u0000$).*$",
|
||||
"^@/server/?(?!.*\u0000$).*$",
|
||||
"^@/stores/?(?!.*\u0000$).*$",
|
||||
],
|
||||
["^@/(?!(types|.*\u0000$)).*$"],
|
||||
[
|
||||
"^\\.\\.(?!/?$)",
|
||||
"^\\.\\./?$",
|
||||
"^\\./(?=.*/)(?!/?$)",
|
||||
"^\\.(?!/?$)",
|
||||
"^\\./?$",
|
||||
],
|
||||
["^(?!\\u0000).+\\.s?css$"],
|
||||
["^node:.*\\u0000$", "^@?\\w.*\\u0000$"],
|
||||
[
|
||||
"^@scandichotels/.*\\u0000$",
|
||||
"^@/types/.*",
|
||||
"^@/.*\\u0000$",
|
||||
"^[^.].*\\u0000$",
|
||||
"^\\..*\\u0000$",
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
"simple-import-sort/exports": "error",
|
||||
"import/first": "error",
|
||||
"import/newline-after-import": "error",
|
||||
|
||||
"import/no-duplicates": [
|
||||
"error",
|
||||
{
|
||||
"prefer-inline": true,
|
||||
},
|
||||
],
|
||||
|
||||
"@typescript-eslint/consistent-type-imports": "error",
|
||||
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
args: "all",
|
||||
argsIgnorePattern: "^_",
|
||||
caughtErrors: "all",
|
||||
caughtErrorsIgnorePattern: "^_",
|
||||
destructuredArrayIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
ignoreRestSiblings: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
])
|
||||
9
packages/booking-flow/lib/index.tsx
Normal file
9
packages/booking-flow/lib/index.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
export function Temp() {
|
||||
return (
|
||||
<Typography variant="Body/Lead text">
|
||||
<p>Tjena</p>
|
||||
</Typography>
|
||||
)
|
||||
}
|
||||
6
packages/booking-flow/lint-staged.config.mjs
Normal file
6
packages/booking-flow/lint-staged.config.mjs
Normal file
@@ -0,0 +1,6 @@
|
||||
const config = {
|
||||
"*.{ts,tsx}": [() => "tsc -p tsconfig.json --noEmit", "prettier --write"],
|
||||
"*.{js,cjs,mjs}": "prettier --write",
|
||||
}
|
||||
|
||||
export default config
|
||||
39
packages/booking-flow/package.json
Normal file
39
packages/booking-flow/package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@scandic-hotels/booking-flow",
|
||||
"version": "1.0.0",
|
||||
"main": "index.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"check-types": "tsc --noEmit",
|
||||
"lint": "eslint . --max-warnings 0 && tsc --noEmit",
|
||||
"lint:fix": "eslint . --fix && tsc --noEmit",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
},
|
||||
"exports": {
|
||||
"./test-entry": "./lib/index.tsx"
|
||||
},
|
||||
"dependencies": {
|
||||
"@scandic-hotels/common": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"next": "^15",
|
||||
"react": "^19"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.9",
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "^9.26.0",
|
||||
"@scandic-hotels/typescript-config": "workspace:*",
|
||||
"@types/lodash-es": "^4",
|
||||
"@types/react": "19.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.32.0",
|
||||
"@typescript-eslint/parser": "^8.32.0",
|
||||
"dotenv": "^16.5.0",
|
||||
"eslint": "^9",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"typescript": "5.8.3",
|
||||
"vitest": "^3.2.3"
|
||||
}
|
||||
}
|
||||
8
packages/booking-flow/prettier.config.cjs
Normal file
8
packages/booking-flow/prettier.config.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
semi: false,
|
||||
trailingComma: "es5",
|
||||
singleQuote: false,
|
||||
printWidth: 80,
|
||||
tabWidth: 2,
|
||||
endOfLine: "lf",
|
||||
}
|
||||
16
packages/booking-flow/tsconfig.json
Normal file
16
packages/booking-flow/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "@scandic-hotels/typescript-config/nextjs.json",
|
||||
"compilerOptions": {
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
},
|
||||
{ "name": "typescript-plugin-css-modules" }
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["**/node_modules/**"]
|
||||
}
|
||||
3
packages/booking-flow/vitest-setup.ts
Normal file
3
packages/booking-flow/vitest-setup.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { config } from "dotenv"
|
||||
|
||||
config({ path: "./.env.test" })
|
||||
7
packages/booking-flow/vitest.config.js
Normal file
7
packages/booking-flow/vitest.config.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "jsdom",
|
||||
setupFiles: ["./vitest-setup.ts"],
|
||||
},
|
||||
}
|
||||
26
yarn.lock
26
yarn.lock
@@ -7051,6 +7051,31 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@scandic-hotels/booking-flow@workspace:*, @scandic-hotels/booking-flow@workspace:packages/booking-flow":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@scandic-hotels/booking-flow@workspace:packages/booking-flow"
|
||||
dependencies:
|
||||
"@eslint/compat": "npm:^1.2.9"
|
||||
"@eslint/eslintrc": "npm:^3.3.1"
|
||||
"@eslint/js": "npm:^9.26.0"
|
||||
"@scandic-hotels/common": "workspace:*"
|
||||
"@scandic-hotels/typescript-config": "workspace:*"
|
||||
"@types/lodash-es": "npm:^4"
|
||||
"@types/react": "npm:19.1.0"
|
||||
"@typescript-eslint/eslint-plugin": "npm:^8.32.0"
|
||||
"@typescript-eslint/parser": "npm:^8.32.0"
|
||||
dotenv: "npm:^16.5.0"
|
||||
eslint: "npm:^9"
|
||||
eslint-plugin-import: "npm:^2.31.0"
|
||||
eslint-plugin-simple-import-sort: "npm:^12.1.1"
|
||||
typescript: "npm:5.8.3"
|
||||
vitest: "npm:^3.2.3"
|
||||
peerDependencies:
|
||||
next: ^15
|
||||
react: ^19
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@scandic-hotels/common@workspace:*, @scandic-hotels/common@workspace:packages/common":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@scandic-hotels/common@workspace:packages/common"
|
||||
@@ -7139,6 +7164,7 @@ __metadata:
|
||||
"@eslint/eslintrc": "npm:^3.3.1"
|
||||
"@eslint/js": "npm:^9.26.0"
|
||||
"@netlify/plugin-nextjs": "npm:^5.11.2"
|
||||
"@scandic-hotels/booking-flow": "workspace:*"
|
||||
"@scandic-hotels/common": "workspace:*"
|
||||
"@scandic-hotels/design-system": "workspace:*"
|
||||
"@scandic-hotels/typescript-config": "workspace:*"
|
||||
|
||||
Reference in New Issue
Block a user