Skip to content

Commit

Permalink
feat: apollo element starter
Browse files Browse the repository at this point in the history
  • Loading branch information
linbudu599 committed Mar 17, 2022
1 parent b936d16 commit 3201df6
Show file tree
Hide file tree
Showing 21 changed files with 10,670 additions and 150 deletions.
1 change: 0 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
- MidwayJS + GraphQL
- GCG
- GenQL
- Apollo Server + Nexus / TypeGraphQL
- Mobx -> React
- MobxStateTree + GraphQL
- Workflow: GitHub Actions
Expand Down
9 changes: 9 additions & 0 deletions packages/apollo-element-starter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules

src/**/*.js
src/**/*.js.map
src/**/*.d.ts
!src/declaration.d.ts
src/**/*.graphql.ts
# src/schema.ts
src/introspection.json
41 changes: 41 additions & 0 deletions packages/apollo-element-starter/.graphqlrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# schema: schema.graphql
schema: http://localhost:1337/graphql

extensions:
codegen:
config:
constEnums: true # use `const enum` to define unions
declarationKind: interface # use `interface` keyword to define types
dedupeOperationSuffix: true # prevent `MyQueryQuery`
documentVariableSuffix: "" # export `MyQuery` instead of `MyQueryDocument`
immutableTypes: true # add `readonly` keyword to frozen objects
namingConvention: keep # don't rename types
operationResultSuffix: Data # add `Data` suffix to result types
optionalResolveType: true # make `__resolveType` field optional
useIndexSignature: true # required for compatibility with apollo server

generates:
# src/schema.ts:
# schema: src/client.schema.graphql
# plugins:
# - typescript-operations
src/introspection.json:
plugins:
- introspection
src/schema.ts:
plugins:
- typescript
src/:
# schema: src/client.schema.graphql
preset: near-operation-file
presetConfig:
baseTypesPath: schema.ts
extension: .graphql.ts
plugins:
- typescript-operations
- typed-document-node
documents:
- src/**/*.fragment.graphql
- src/**/*.mutation.graphql
- src/**/*.query.graphql
- src/**/*.subscription.graphql
18 changes: 18 additions & 0 deletions packages/apollo-element-starter/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Apollo Elements App</title>
<link rel="stylesheet" href="style.css" />
<script type="module" src="/src/main.ts"></script>
</head>
<body>
<main>
<h1>Apollo Elements App!</h1>
<apollo-client id="client">
<apollo-element-app></apollo-element-app>
</apollo-client>
</main>
</body>
</html>
52 changes: 52 additions & 0 deletions packages/apollo-element-starter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"main": "index.html",
"private": true,
"name": "apollo-elements-app",
"version": "1.0.0",
"type": "module",
"author": "",
"license": "ISC",
"description": "Apollo Elements App",
"scripts": {
"start": "run-p start:*",
"start:codegen": "graphql-codegen --watch",
"start:serve": "wds --watch --open --port 8001",
"lint": "eslint",
"build": "run-s build:*",
"build:codegen": "graphql-codegen",
"build:rollup": "rollup -c",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@apollo-elements/components": "^2.0.0",
"@apollo-elements/core": "^1.0.0",
"@apollo/client": "^3.5.4",
"graphql": "^15.0.0",
"lit": "^2.1.1",
"lit-element": "^3.1.1",
"pwa-helpers": "^0.9.1",
"tslib": "^2.3.1"
},
"devDependencies": {
"@apollo-elements/create": "^3.0.3",
"@graphql-codegen/cli": "^2.3.0",
"@graphql-codegen/introspection": "^2.1.1",
"@graphql-codegen/near-operation-file-preset": "^2.2.2",
"@graphql-codegen/typed-document-node": "^2.2.1",
"@graphql-codegen/typescript": "^2.4.1",
"@graphql-codegen/typescript-operations": "^2.2.1",
"@open-wc/rollup-plugin-html": "^1.x",
"@pwrs/eslint-config": "^0.x",
"@rollup/plugin-commonjs": "^17.x",
"@rollup/plugin-node-resolve": "^11.x",
"@web/dev-server": "^0.1.x",
"@web/dev-server-esbuild": "^0.2.x",
"@web/dev-server-rollup": "^0.3.x",
"npm-run-all": "^4.x",
"rollup": "^2.x",
"rollup-plugin-esbuild": "^2.x",
"rollup-plugin-lit-css": "^2.x",
"typescript": "^4.x"
},
"keywords": []
}
Loading

0 comments on commit 3201df6

Please sign in to comment.