From c013c839bb38333ec1527e942e77ca5f99f9b4f0 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 28 Nov 2022 20:01:10 +0100 Subject: [PATCH] Dependencies, README, svelte setup w/ vite, prettier & eslint configs --- .eslintignore | 13 +++++++++++++ .eslintrc.cjs | 20 ++++++++++++++++++++ .gitignore | 12 ++++++++++++ .prettierignore | 13 +++++++++++++ .prettierrc | 10 ++++++++++ README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 37 +++++++++++++++++++++++++++++++++++++ svelte.config.js | 17 +++++++++++++++++ tsconfig.json | 17 +++++++++++++++++ vite.config.ts | 8 ++++++++ 10 files changed, 191 insertions(+) create mode 100644 .eslintignore create mode 100644 .eslintrc.cjs create mode 100644 .gitignore create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 README.md create mode 100644 package.json create mode 100644 svelte.config.js create mode 100644 tsconfig.json create mode 100644 vite.config.ts diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..3897265 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,13 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example + +# Ignore files for PNPM, NPM and YARN +pnpm-lock.yaml +package-lock.json +yarn.lock diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..3ccf435 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,20 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], + plugins: ['svelte3', '@typescript-eslint'], + ignorePatterns: ['*.cjs'], + overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], + settings: { + 'svelte3/typescript': () => require('typescript') + }, + parserOptions: { + sourceType: 'module', + ecmaVersion: 2020 + }, + env: { + browser: true, + es2017: true, + node: true + } +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c81e66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example +.vercel +.output +build +yarn.lock diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..3897265 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example + +# Ignore files for PNPM, NPM and YARN +pnpm-lock.yaml +package-lock.json +yarn.lock diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..7e1df08 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ + "useTabs": false, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "pluginSearchDirs": ["."], + "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], + "svelteStrictMode": true +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..8557385 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# planetposen frontend + +Frontend of planetposen webshop. View backend at: [kevinmidboe/planetposen-backend](https://github.com/kevinmidboe/planetposen-backend) + +## Install + +Download project: + +```bash +git clone https://github.com/kevinmidboe/planetposen-frontend +cd planetposen-frontend +``` + +Install dependencies: +```bash +yarn +``` + +or + +```bash +npm install +``` + +## Developing + +To view project locally and see changes with hot module reloading run: + +```bash +yarn dev +``` + +Visit at: http://localhost:5173 + +## Build +To create a production build of planetposen run: + +```bash +yarn build +``` + +You can preview the production build with `yarn preview`. + +> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. diff --git a/package.json b/package.json new file mode 100644 index 0000000..b5a533e --- /dev/null +++ b/package.json @@ -0,0 +1,37 @@ +{ + "name": "planetposen-webshop", + "license": "MIT", + "version": "1.0.0", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --plugin-search-dir . --check src && eslint src", + "format": "prettier --plugin-search-dir . --write src" + }, + "devDependencies": { + "@sveltejs/adapter-static": "next", + "@sveltejs/kit": "next", + "@types/cookie": "^0.5.1", + "@typescript-eslint/eslint-plugin": "^5.27.0", + "@typescript-eslint/parser": "^5.27.0", + "eslint": "^8.16.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-svelte3": "^4.0.0", + "prettier": "^2.8.0", + "prettier-plugin-svelte": "^2.8.1", + "svelte": "^3.46.0", + "svelte-check": "^2.7.1", + "svelte-preprocess": "^4.10.6", + "tslib": "^2.3.1", + "typescript": "^4.7.4", + "vite": "^3.1.0" + }, + "type": "module", + "dependencies": { + "@stripe/stripe-js": "^1.42.0", + "sass": "^1.55.0" + } +} diff --git a/svelte.config.js b/svelte.config.js new file mode 100644 index 0000000..4ea92e5 --- /dev/null +++ b/svelte.config.js @@ -0,0 +1,17 @@ +import preprocess from 'svelte-preprocess'; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + // Consult https://github.com/sveltejs/svelte-preprocess + // for more information about preprocessors + preprocess: preprocess(), + + kit: { + csrf: { + checkOrigin: false + }, + outDir: 'build' + } +}; + +export default config; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6ae0c8c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "./.svelte-kit/tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true + } + // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias + // + // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes + // from the referenced tsconfig.json - TypeScript does not merge them in +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..1695034 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,8 @@ +import { sveltekit } from '@sveltejs/kit/vite'; +import type { UserConfig } from 'vite'; + +const config: UserConfig = { + plugins: [sveltekit()] +}; + +export default config;