Skip to content

Commit 6d2b426

Browse files
committed
Major update
1 parent 8ededf3 commit 6d2b426

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2656
-3227
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
module.exports = {
2-
root: true,
3-
env: {
4-
node: true,
5-
},
62
parser: "vue-eslint-parser",
73
parserOptions: {
84
parser: "@typescript-eslint/parser",
@@ -11,12 +7,17 @@ module.exports = {
117
},
128
extends: [
139
"plugin:@typescript-eslint/recommended",
14-
"eslint:recommended",
1510
"prettier/@typescript-eslint",
1611
"plugin:prettier/recommended",
1712
"plugin:vue/vue3-recommended",
1813
"prettier/vue",
1914
],
20-
plugins: ["prettier", "@typescript-eslint"],
21-
rules: {},
15+
rules: {
16+
"no-unused-vars": "off",
17+
"@typescript-eslint/ban-types": "off",
18+
"@typescript-eslint/explicit-module-boundary-types": "off",
19+
"@typescript-eslint/no-empty-interface": "off",
20+
"@typescript-eslint/no-explicit-any": "off",
21+
"@typescript-eslint/no-unused-vars": "off",
22+
},
2223
};

.gitignore

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
9-
# Diagnostic reports (https://nodejs.org/api/report.html)
10-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
*.pid.lock
17-
18-
# Dependency directories
19-
node_modules/
20-
jspm_packages/
21-
22-
# dotenv environment variables file
231
.env
24-
.env.*
25-
26-
# Production build output
272
dist
3+
node_modules
4+
*.lock
5+
*.log

.graphqlrc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
schema: ["./server/schema/generated/schema.graphql"],
3+
documents: "./client/web/src/graphql/**/*.gql",
4+
extensions: {
5+
codegen: {
6+
generates: {
7+
"./server/schema/generated/types.ts": {
8+
plugins: ["typescript"],
9+
},
10+
"./client/web/src/generated/graphql-operations.ts": {
11+
plugins: ["typescript","typescript-operations","typed-document-node"],
12+
}
13+
},
14+
hooks: {
15+
afterAllFileWrite: ["yarn lint"],
16+
},
17+
},
18+
},
19+
};

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ module.exports = {
22
printWidth: 120,
33
semi: true,
44
tabWidth: 2,
5-
trailingComma: "all"
5+
trailingComma: "all",
66
};

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.2.0",
2+
"version": "0.3.0",
33
"configurations": [
44
{
55
"type": "node-terminal",

client/web/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
43
<head>
54
<meta charset="UTF-8">
65
<link rel="icon" href="/favicon.ico" />
76
<meta name="viewport" content="width=device-width, initial-scale=1.0">
87
<title>Vite App</title>
98
</head>
10-
119
<body>
1210
<div id="app"></div>
1311
<script type="module" src="/src/main.ts"></script>
1412
</body>
15-
16-
</html>
13+
</html>

client/web/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "@client/web",
3+
"version": "0.3.0",
4+
"license": "MIT",
5+
"private": true,
6+
"scripts": {
7+
"dev": "vite -l warn",
8+
"build": "vite build --emptyOutDir"
9+
},
10+
"dependencies": {
11+
"@villus/batch": "^1.0.0-rc.8",
12+
"@villus/multipart": "^1.0.0-rc.7",
13+
"subscriptions-transport-ws": "^0.9.18",
14+
"villus": "^1.0.0-rc.11",
15+
"vue": "^3.0.5",
16+
"vue-router": "^4.0.3"
17+
},
18+
"devDependencies": {
19+
"@graphql-codegen/typed-document-node": "^1.18.2",
20+
"@graphql-typed-document-node/core": "^3.1.0",
21+
"@vitejs/plugin-vue": "^1.1.2",
22+
"@vue/compiler-sfc": "^3.0.5",
23+
"autoprefixer": "^10.2.3",
24+
"postcss": "^8.2.4",
25+
"tailwindcss": "^2.0.2",
26+
"vite": "^2.0.0-beta.47",
27+
"vite-plugin-components": "^0.6.6",
28+
"vite-plugin-voie": "^0.7.3"
29+
}
30+
}

client/web/postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
};
File renamed without changes.
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<template>
2-
<HelloWorld />
2+
<div class="container">
3+
<router-view />
4+
</div>
35
</template>
46

57
<script lang="ts">
68
import { defineComponent } from "vue";
7-
import HelloWorld from "/@/components/ui/HelloWorld.vue";
89
910
export default defineComponent({
10-
name: "Home",
11-
components: {
12-
HelloWorld,
13-
},
11+
name: "App",
1412
});
1513
</script>

client/web/src/assets/index.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<template>
2+
<h1 class="text-4xl">{{ msg }}</h1>
3+
<div v-if="isFetching">Loading...</div>
4+
<div v-else-if="error">{{ error.message }}</div>
5+
<div v-else-if="data && data.hello">
6+
{{ data.hello }}
7+
</div>
8+
</template>
9+
10+
<script lang="ts">
11+
import { ref, defineComponent } from "vue";
12+
import { useQuery } from "villus";
13+
import { HelloDocument as query } from "../generated/graphql-operations";
14+
15+
export default defineComponent({
16+
name: "HelloWorld",
17+
props: {
18+
msg: {
19+
type: String,
20+
required: true,
21+
},
22+
},
23+
setup: () => {
24+
const count = ref(0);
25+
const { data, isFetching, error } = useQuery({ query });
26+
return { count, data, isFetching, error };
27+
},
28+
});
29+
</script>
30+
31+
<style scoped>
32+
a {
33+
color: #42b983;
34+
}
35+
</style>
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import { TypedDocumentNode as DocumentNode } from "@graphql-typed-document-node/core";
2+
export type Maybe<T> = T | null;
3+
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
4+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
5+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
6+
/** All built-in and custom scalars, mapped to their actual values */
7+
export type Scalars = {
8+
ID: string;
9+
String: string;
10+
Boolean: boolean;
11+
Int: number;
12+
Float: number;
13+
/** The `Upload` scalar type represents a file upload. */
14+
Upload: any;
15+
};
16+
17+
export type EnumRoleFieldUpdateOperationsInput = {
18+
set?: Maybe<Role>;
19+
};
20+
21+
export type Mutation = {
22+
__typename?: "Mutation";
23+
createOneUser?: Maybe<User>;
24+
deleteOneUser?: Maybe<User>;
25+
ping?: Maybe<Scalars["String"]>;
26+
updateOneUser?: Maybe<User>;
27+
};
28+
29+
export type MutationCreateOneUserArgs = {
30+
data: UserCreateInput;
31+
};
32+
33+
export type MutationDeleteOneUserArgs = {
34+
where: UserWhereUniqueInput;
35+
};
36+
37+
export type MutationUpdateOneUserArgs = {
38+
data: UserUpdateInput;
39+
where: UserWhereUniqueInput;
40+
};
41+
42+
export type Query = {
43+
__typename?: "Query";
44+
hello: Scalars["String"];
45+
user?: Maybe<User>;
46+
users: Array<User>;
47+
};
48+
49+
export type QueryUserArgs = {
50+
where: UserWhereUniqueInput;
51+
};
52+
53+
export type QueryUsersArgs = {
54+
after?: Maybe<UserWhereUniqueInput>;
55+
before?: Maybe<UserWhereUniqueInput>;
56+
first?: Maybe<Scalars["Int"]>;
57+
last?: Maybe<Scalars["Int"]>;
58+
};
59+
60+
export enum Role {
61+
Admin = "ADMIN",
62+
Editor = "EDITOR",
63+
User = "USER",
64+
}
65+
66+
export type StringFieldUpdateOperationsInput = {
67+
set?: Maybe<Scalars["String"]>;
68+
};
69+
70+
export type Subscription = {
71+
__typename?: "Subscription";
72+
ping?: Maybe<Scalars["String"]>;
73+
};
74+
75+
export type User = {
76+
__typename?: "User";
77+
email?: Maybe<Scalars["String"]>;
78+
id?: Maybe<Scalars["Int"]>;
79+
role?: Maybe<Role>;
80+
};
81+
82+
export type UserCreateInput = {
83+
email: Scalars["String"];
84+
password: Scalars["String"];
85+
role?: Maybe<Role>;
86+
};
87+
88+
export type UserUpdateInput = {
89+
email?: Maybe<StringFieldUpdateOperationsInput>;
90+
password?: Maybe<StringFieldUpdateOperationsInput>;
91+
role?: Maybe<EnumRoleFieldUpdateOperationsInput>;
92+
};
93+
94+
export type UserWhereUniqueInput = {
95+
email?: Maybe<Scalars["String"]>;
96+
id?: Maybe<Scalars["Int"]>;
97+
};
98+
99+
export type HelloQueryVariables = Exact<{ [key: string]: never }>;
100+
101+
export type HelloQuery = { __typename?: "Query" } & Pick<Query, "hello">;
102+
103+
export const HelloDocument: DocumentNode<HelloQuery, HelloQueryVariables> = {
104+
kind: "Document",
105+
definitions: [
106+
{
107+
kind: "OperationDefinition",
108+
operation: "query",
109+
name: { kind: "Name", value: "Hello" },
110+
selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "hello" } }] },
111+
},
112+
],
113+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
query Hello {
2+
hello
3+
}

client/web/src/main.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createApp } from "vue";
2+
import App from "./App.vue";
3+
import { router } from "./router";
4+
import { villus } from "./villus";
5+
import "./assets/index.css";
6+
7+
const app = createApp(App);
8+
app.use(router);
9+
app.use(villus);
10+
app.mount("#app");

client/web/src/pages/[...all].vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<template>
2+
<div class="text-center">
3+
<h1 class="text-4xl">Page not found</h1>
4+
<router-link to="/">Return home</router-link>
5+
</div>
6+
</template>

client/web/src/pages/index.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<template>
2+
<div class="text-center">
3+
<img src="../assets/logo.png" alt="Vue logo" class="inline-block" />
4+
<HelloWorld msg="Hello Vue 3 + Vite" />
5+
</div>
6+
</template>

client/web/src/router.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createRouter, createWebHistory } from "vue-router";
2+
import routes from "voie-pages";
3+
4+
export const router = createRouter({
5+
history: createWebHistory(),
6+
routes,
7+
});

client/web/src/villus.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { createClient, handleSubscriptions, cache, dedup } from "villus";
2+
import { multipart } from "@villus/multipart";
3+
import { batch } from "@villus/batch";
4+
import { SubscriptionClient } from "subscriptions-transport-ws";
5+
6+
const subscriptionClient = new SubscriptionClient(`ws://${window.location.host}/api/graphql`, {
7+
reconnect: true,
8+
});
9+
10+
export const villus = createClient({
11+
url: "/api/graphql",
12+
use: [
13+
handleSubscriptions((operation) => subscriptionClient.request(operation)),
14+
multipart(),
15+
cache(),
16+
dedup(),
17+
batch(),
18+
],
19+
});

0 commit comments

Comments
 (0)