Skip to content

Commit

Permalink
chore: create @builder.io/qwik-labs
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Jun 20, 2023
1 parent 6a01cb9 commit 77b9265
Show file tree
Hide file tree
Showing 21 changed files with 5,076 additions and 137 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@ jobs:
path: packages/qwik/dist/*
if-no-files-found: error

- name: Build QwikCity
- name: Build QwikCity / QwikLabs
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm tsm scripts/index.ts --tsc --qwikcity --api
run: pnpm tsm scripts/index.ts --tsc --qwikcity --qwiklabs --api

- name: Print QwikCity Lib Build
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
Expand Down
2 changes: 2 additions & 0 deletions packages/insights/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PRIVATE_LIBSQL_DB_URL=libsql://qwik-bundalyzer-mhevery.turso.io
PRIVATE_LIBSQL_DB_API_TOKEN=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODcyMTQxNTAsImlkIjoiMGU3NDI3ZjYtMGVlMy0xMWVlLThkYTctYmViOGE0ZTk3MTE3In0.Q2aMD5rP4TpLBTSPxp2eVPgd-CLFiVIzz81bOEk0h4go0KgyIpa38WHJhvg5Dn_978VeE3bthwv1BrHvYNg7Dg
17 changes: 17 additions & 0 deletions packages/insights/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "dev.debug",
"request": "launch",
"skipFiles": ["<node_internals>/**"],
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/node_modules/vite/bin/vite.js",
"args": ["--mode", "ssr", "--force"],
},
]
}
44 changes: 44 additions & 0 deletions packages/insights/.vscode/qwik-city.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"onRequest": {
"scope": "javascriptreact,typescriptreact",
"prefix": "qonRequest",
"description": "onRequest function for a route index",
"body": [
"export const onRequest: RequestHandler = (request) => {",
" $0",
"};"
]
},
"loader$": {
"scope": "javascriptreact,typescriptreact",
"prefix": "qloader$",
"description": "loader$()",
"body": [
"export const $1 = routeLoader$(() => {",
" $0",
"});"
]
},
"action$": {
"scope": "javascriptreact,typescriptreact",
"prefix": "qaction$",
"description": "action$()",
"body": [
"export const $1 = routeAction$((data) => {",
" $0",
"});"
]
},
"Full Page": {
"scope": "javascriptreact,typescriptreact",
"prefix": "qpage",
"description": "Simple page component",
"body": [
"import { component$ } from '@builder.io/qwik';",
"",
"export default component$(() => {",
" $0",
"});"
]
}
}
96 changes: 96 additions & 0 deletions packages/insights/.vscode/qwik.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"Qwik component (simple)": {
"scope": "javascriptreact,typescriptreact",
"prefix": "qcomponent$",
"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": "qcomponent$ + 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": "quseSignal",
"description": "useSignal() declaration",
"body": [
"const ${1:foo} = useSignal($2);",
"$0"
]
},
"Qwik store": {
"scope": "javascriptreact,typescriptreact",
"prefix": "quseStore",
"description": "useStore() declaration",
"body": [
"const ${1:state} = useStore({",
" $2",
"});",
"$0"
]
},
"$ hook": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q$",
"description": "$() function hook",
"body": [
"$(() => {",
" $0",
"});",
""
]
},
"useVisibleTask": {
"scope": "javascriptreact,typescriptreact",
"prefix": "quseVisibleTask",
"description": "useVisibleTask$() function hook",
"body": [
"useVisibleTask$(({ track }) => {",
" $0",
"});",
""
]
},
"useTask": {
"scope": "javascriptreact,typescriptreact",
"prefix": "quseTask$",
"description": "useTask$() function hook",
"body": [
"useTask$(({ track }) => {",
" track(() => $1);",
" $0",
"});",
""
]
},
"useResource": {
"scope": "javascriptreact,typescriptreact",
"prefix": "quseResource$",
"description": "useResource$() declaration",
"body": [
"const $1 = useResource$(({ track, cleanup }) => {",
" $0",
"});",
""
]
}
}
31 changes: 31 additions & 0 deletions packages/qwik-labs/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
**/*.log
**/.DS_Store
*.
.vscode/settings.json
.history
.yarn
bazel-*
bazel-bin
bazel-out
bazel-qwik
bazel-testlogs
dist
dist-dev
lib
lib-types
etc
external
node_modules
temp
tsc-out
tsdoc-metadata.json
target
output
rollup.config.js
build
.cache
.vscode
.rollup.cache
dist
tsconfig.tsbuildinfo
vite.config.ts
40 changes: 40 additions & 0 deletions packages/qwik-labs/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:qwik/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'prefer-spread': 'off',
'no-case-declarations': 'off',
'no-console': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
},
};
38 changes: 38 additions & 0 deletions packages/qwik-labs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Build
/dist
/lib
/lib-types
/server

# Development
node_modules

# Cache
.cache
.mf
.vscode
.rollup.cache
tsconfig.tsbuildinfo

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

# Editor
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Yarn
.yarn/*
!.yarn/releases
6 changes: 6 additions & 0 deletions packages/qwik-labs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Files Prettier should not format
**/*.log
**/.DS_Store
*.
dist
node_modules
47 changes: 47 additions & 0 deletions packages/qwik-labs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Qwik Library ⚡️

- [Qwik Docs](https://qwik.builder.io/)
- [Discord](https://qwik.builder.io/chat)
- [Qwik on GitHub](https://github.com/BuilderIO/qwik)
- [@QwikDev](https://twitter.com/QwikDev)
- [Vite](https://vitejs.dev/)
- [Partytown](https://partytown.builder.io/)
- [Mitosis](https://github.com/BuilderIO/mitosis)
- [Builder.io](https://www.builder.io/)

---

## Project Structure

Inside your project, you'll see the following directories and files:

```
├── public/
│ └── ...
└── src/
├── components/
│ └── ...
└── index.ts
```

- `src/components`: Recommended directory for components.

- `index.ts`: The entry point of your component library, make sure all the public components are exported from this file.

## Development

Development mode uses [Vite's development server](https://vitejs.dev/). For Qwik during development, the `dev` command will also server-side render (SSR) the output. The client-side development modules are loaded by the browser.

```
pnpm dev
```

> Note: during dev mode, Vite will request many JS files, which does not represent a Qwik production build.
## Production

The production build should generate the production build of your component library in (./lib) and the typescript type definitions in (./lib-types).

```
pnpm build
```
51 changes: 51 additions & 0 deletions packages/qwik-labs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@builder.io/qwik-labs",
"version": "0.0.1",
"description": "Qwik Labs - Where you can try the latest ideas",
"main": "./lib/index.qwik.mjs",
"qwik": "./lib/index.qwik.mjs",
"types": "./lib-types/index.d.ts",
"exports": {
".": {
"import": "./lib/index.qwik.mjs",
"require": "./lib/index.qwik.cjs",
"types": "./lib-types/index.d.ts"
}
},
"files": [
"lib",
"lib-types"
],
"engines": {
"node": ">=16"
},
"private": false,
"type": "module",
"scripts": {
"build": "qwik build",
"build.lib": "vite build --mode lib",
"build.types": "tsc --emitDeclarationOnly",
"dev": "vite --mode ssr",
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
"fmt": "prettier --write .",
"fmt.check": "prettier --check .",
"lint": "eslint \"src/**/*.ts*\"",
"release": "np",
"start": "vite --open --mode ssr",
"qwik": "qwik"
},
"devDependencies": {
"@builder.io/qwik": "1.1.5",
"@types/eslint": "8.40.2",
"@types/node": "^20.2.5",
"@typescript-eslint/eslint-plugin": "5.59.11",
"@typescript-eslint/parser": "5.59.11",
"eslint": "8.42.0",
"eslint-plugin-qwik": "latest",
"np": "7.6.1",
"prettier": "2.8.8",
"typescript": "5.1.3",
"undici": "5.22.1",
"vite": "4.3.9"
}
}

0 comments on commit 77b9265

Please sign in to comment.