Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Sep 22, 2023
0 parents commit 734956e
Show file tree
Hide file tree
Showing 37 changed files with 5,655 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -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,
},
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
4 changes: 4 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"]
}
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
run_install: true

- name: Build All
run: pnpm build
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

/tmp
4 changes: 4 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm i
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
22 changes: 22 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
printWidth: 100
tabWidth: 4
useTabs: true
trailingComma: all
semi: true
singleQuote: false

overrides:
- files: "*.md"
options:
useTabs: false
- files: "*.svelte"
options:
parser: svelte

plugins:
- prettier-plugin-svelte
- prettier-plugin-organize-imports
- prettier-plugin-tailwindcss

organizeImportsSkipDestructiveCodeActions: true
12 changes: 12 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"GitHub.copilot",
"GitHub.copilot-labs",
"svelte.svelte-vscode",
"bradlc.vscode-tailwindcss",
"antfu.iconify",
"lokalise.i18n-ally"
]
}
31 changes: 31 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"[svelte]": {
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": true
},
"[css]": {
"editor.formatOnSave": true
},
"[json]": {
"editor.formatOnSave": true
},
"i18n-ally.localesPaths": ["locales"],
"i18n-ally.keystyle": "nested",
"i18n-ally.sortKeys": true,
"i18n-ally.keepFulfilled": true,
"i18n-ally.extract.parsers.html": {
"attributes": ["text", "title", "alt", "placeholder", "label", "aria-label"],
"ignoredTags": ["script", "style"],
"inlineText": true
},
"i18n-ally.extract.autoDetect": true,
"i18n-ally.refactor.templates": [
{
"source": "html-attribute",
"templates": ["{$t('{key}'{args})}"],
"include": ["src/**/*.{svelte,ts}", "index.html"]
}
]
}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:lts-alpine as build-stage

WORKDIR /app
RUN npm i -g pnpm
COPY package*.json ./
RUN pnpm install
COPY . .
RUN pnpm run build
RUN pnpm pkg delete scripts.prepare && rm -rf node_modules && pnpm install --production

FROM node:lts-alpine as production-stage

WORKDIR /app
COPY --from=build-stage /app/build ./build
COPY --from=build-stage /app/node_modules ./node_modules
COPY --from=build-stage /app/package.json ./package.json
CMD [ "node", "build" ]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 JacobLinCool

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.9"

services:
app:
image: "jacoblincool/canary-probe-server:latest"
build:
context: .
dockerfile: Dockerfile
ports:
- "48080:48080"
environment:
- PORT=48080
- ORIGIN=http://localhost:48080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./tmp:/app/tmp
5 changes: 5 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$t": "Checking in progress...",
"welcome": "Welcome to SvelteKit+",
"with-tech": "SvelteKit with TailwindCSS, DaisyUI, and I18n!"
}
5 changes: 5 additions & 0 deletions locales/zh-TW.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$t": "正在進行檢查 ...",
"welcome": "歡迎使用 SvelteKit+",
"with-tech": "SvelteKit 加上 TailwindCSS、DaisyUI 以及 I18n!"
}
57 changes: 57 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"private": true,
"name": "sveltekit-plus",
"version": "0.0.0",
"type": "module",
"scripts": {
"prepare": "husky install",
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:unit": "vitest",
"lint": "prettier --ignore-path .gitignore --check **/*.{ts,js,json,yaml,yml,svelte,html,css} && eslint .",
"format": "prettier --ignore-path .gitignore --write **/*.{ts,js,json,yaml,yml,svelte,html,css}"
},
"dependencies": {
"canary-probe": "^0.0.1"
},
"devDependencies": {
"@playwright/test": "^1.38.1",
"@sveltejs/adapter-node": "^1.3.1",
"@sveltejs/kit": "^1.25.0",
"@tailwindcss/typography": "^0.5.10",
"@types/debug": "^4.1.8",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"autoprefixer": "^10.4.16",
"daisyui": "^3.7.7",
"debug": "^4.3.4",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-svelte": "^2.33.2",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"postcss": "^8.4.30",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.3",
"prettier-plugin-svelte": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.4",
"svelte": "^4.2.1",
"svelte-check": "^3.5.2",
"svelte-i18n": "^3.7.4",
"tailwindcss": "^3.3.3",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vitest": "^0.34.5"
},
"lint-staged": {
"*.{ts,js,json,yaml,yml,svelte,html,css}": [
"prettier --write"
]
},
"packageManager": "pnpm@8.7.6"
}
11 changes: 11 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { PlaywrightTestConfig } from "@playwright/test";

const config: PlaywrightTestConfig = {
webServer: {
command: "npm run build && npm run preview",
port: 4173,
},
testDir: "tests",
};

export default config;
Loading

0 comments on commit 734956e

Please sign in to comment.