Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Armin Jazi committed Apr 11, 2024
0 parents commit 122509d
Show file tree
Hide file tree
Showing 53 changed files with 10,254 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"prettier"
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"import/no-unresolved": "error"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": ["tsconfig.json"]
}
}
}
}
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore

# Node artifact files
node_modules/
dist/

# Compiled Java class files
*.class

# Compiled Python bytecode
*.py[cod]

# Log files
*.log

# Package files
*.jar

# Maven
target/

# JetBrains IDE
.idea/

# Unit test reports
TEST*.xml

# Generated by MacOS
.DS_Store

# Generated by Windows
Thumbs.db

# Applications
*.app
*.exe
*.war

# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv


# Logs
logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
41 changes: 41 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
stages:
- test
- publish

test-job:
image: node:16.14.2
stage: test
cache:
key: npm
policy: pull-push
paths:
- .npm/
script:
- npm ci
- npm run lint
- npm run test:unit
- npm run build
artifacts:
paths:
- node_modules/
- dist/
expire_in: 1 days
tags:
- infra-cicd

publish-job:
image: node:16.14.2
stage: publish
only:
- /^release\/*/
cache:
key: npm
policy: pull-push
paths:
- .npm/
script:
- echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}">.npmrc
- npm publish
tags:
- infra-cicd

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.14.2
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
coverage
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## TODOS

- [ ] add default cache and use query integration tests
- [ ] add global sync default cache and use query integration tests
- [ ] variables as query keys.
- [ ] optimistic UI queries
- [ ] storage options -> session, cookie, indexdb etc…
- [ ] Performance optimizations like pagination and lazy loading data
- [ ] Deduping multiple requests for the same data into a single request
- [ ] refetchOnReconnect, refetchInterval
- [ ] retry mechanism
- [ ] structural sharing
- [ ] dependent queries
```javascript
let userId = null;
useQuery(['user', email], getUserByEmail, {
onSuccess: (user) => {
userId = user.id;
},
})
useQuery(['projects', userId], getProjectsByUser,
{
// The query will not execute until the userId exists
enabled: !!userId,
}
)
```
- [ ] refetchInterval number | false
- [ ] refetchIntervalInBackground boolean
- [ ] refetchOnMount boolean
- [ ] refetchOnReconnect boolean


## Fetching Indicators

- isLoading: indicates a hard state reload
- isFetching: indicates a background state reload, where initial data is still available through cache
41 changes: 41 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + TS</title>
<style>
.shell {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 4rem;
justify-content: center;
align-items: center;
text-align: center;
min-height: 100vh;
margin: auto;
}
</style>
</head>
<body>
<div class="shell">
<div id="app-1">
<h1>App 1 - sync</h1>
</div>
<div id="app-2">
<h1>App 2 - sync</h1>
</div>
<div id="app-3">
<h1>App 3 - sync</h1>
</div>
<div id="app-4">
<h1>App 4 - non-sync</h1>
</div>
</div>
<script type="module" src="/src/app-1/main.ts"></script>
<script type="module" src="/src/app-2/main.ts"></script>
<script type="module" src="/src/app-3/main.ts"></script>
<script type="module" src="/src/app-4/main.ts"></script>
</body>
</html>
Loading

0 comments on commit 122509d

Please sign in to comment.