fix(cli): refactor

This commit is contained in:
Leifer Mendez
2023-01-16 09:21:26 +01:00
parent 716349a839
commit 6683715ad6
10 changed files with 180 additions and 2 deletions

View File

@@ -40,6 +40,15 @@ jobs:
- name: Check Twilio
run: yarn node ./scripts/checker.js --name=twilio --stable=true
- uses: stefanzweifel/git-auto-commit-action@v4
- name: Add and commit changes to gh-pages branch
run: |
git config --local user.email 'action@github.com'
git config --local user.name 'GitHub Action'
git add .
git commit -m 'major'
- name: Push changes
uses: ad-m/github-push-action@master
with:
commit_message: 'ci(providers): 👍 updated versions stable providers'
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: feature/providers-major

View File

@@ -0,0 +1,4 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "unifiedjs.vscode-mdx"],
"unwantedRecommendations": []
}

View File

@@ -0,0 +1,32 @@
{
"onGet": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:onGet",
"description": "onGet function for a route index",
"body": [
"export const onGet: RequestHandler = (request) => {",
" $0",
"};"
]
},
"onGet (typed)": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:onGet typed",
"description": "onGet function for a route index",
"body": [
"export interface ${1:PageData} {",
" $2",
"};",
"",
"export const onGet: RequestHandler<$1> = (request) => {",
" $4",
"};"
]
},
"useEndpoint": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useEndpoint",
"description": "useEndpoint declaration",
"body": "const $1 = useEndpoint<typeof onGet>();"
}
}

View File

@@ -0,0 +1,84 @@
{
"Qwik component (simple)": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:component",
"description": "Simple Qwik component",
"body": [
"export const ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}} = component$(() => {",
" return <${2:div}>$4</$2>",
"});"
]
},
"Qwik component (props)": {
"scope": "typescriptreact",
"prefix": "q:component w/props",
"description": "Qwik component w/ props",
"body": [
"export interface ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}}Props {",
" $2",
"}",
"",
"export const $1 = component$<$1Props>((props) => {",
" const ${2:count} = useSignal(0);",
" return (",
" <${3:div} on${4:Click}$={(ev) => {$5}}>",
" $6",
" </${3}>",
" );",
"});"
]
},
"Qwik signal": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useSignal",
"description": "useSignal() declaration",
"body": ["const ${1:foo} = useSignal($2);", "$0"]
},
"Qwik store": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useStore",
"description": "useStore() declaration",
"body": ["const ${1:state} = useStore({", " $2", "});", "$0"]
},
"$ hook": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:$",
"description": "$() function hook",
"body": ["$(() => {", " $0", "});", ""]
},
"useClientEffect": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useClientEffect",
"description": "useClientEffect$() function hook",
"body": ["useClientEffect$(({ track }) => {", " $0", "});", ""]
},
"useTask": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useTask",
"description": "useTask$() function hook",
"body": [
"useTask$(({ track }) => {",
" track(() => $1);",
" $0",
"});",
""
]
},
"useResource": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useResource",
"description": "useResource$() declaration",
"body": [
"const $1 = useResource$(({ track, cleanup }) => {",
" $0",
"});",
""
]
},
"useServerMount": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useServerMount",
"description": "useServerMount$() function hook",
"body": ["useServerMount$(() => {", " $0", "});", ""]
}
}

View File

@@ -0,0 +1,15 @@
const notFounds = [
[
'/',
'<!DOCTYPE html>\n<html>\n<head>\n <meta charset="utf-8">\n <meta http-equiv="Status" content="404"/>\n <title>404 Resource Not Found</title>\n <meta name="viewport" content="width=device-width,initial-scale=1">\n <style>\n body { color: #006ce9; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }\n p { max-width: 600px; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px #006ce9; overflow: hidden; }\n strong { display: inline-block; padding: 15px; background: #006ce9; color: white; }\n span { display: inline-block; padding: 15px; }\n pre { max-width: 580px; margin: 0 auto; }\n </style>\n</head>\n<body>\n <p><strong>404</strong> <span>Resource Not Found</span></p>\n</body>\n</html>',
],
]
function getNotFound(p) {
for (const r of notFounds) {
if (p.startsWith(r[0])) {
return r[1]
}
}
return 'Resource Not Found'
}
export { getNotFound }

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
const staticPaths = new Set([
'/',
'/favicon.svg',
'/manifest.json',
'/q-manifest.json',
'/robots.txt',
'/service-worker.js',
'/sitemap.xml',
'/water-mark.png',
])
function isStaticPath(p) {
if (p.startsWith('/build/')) {
return true
}
if (p.startsWith('/assets/')) {
return true
}
if (staticPaths.has(p)) {
return true
}
return false
}
export { isStaticPath }

View File

@@ -0,0 +1 @@
export * from './entry.ssr.mjs'

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
{
"type": "module"
}