-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #814 from redwoodjs/pp-integrate-decoupled
Integrate decoupled
- Loading branch information
Showing
157 changed files
with
30,795 additions
and
1,453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist | ||
fixtures | ||
packages/api/importAll.macro.js | ||
packages/core/src/__tests__/__fixtures__/**/* | ||
packages/core/config/storybook/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
node_modules | ||
dist | ||
yarn-error.log | ||
.docz | ||
.env | ||
.DS_Store | ||
.wip | ||
|
||
api/prisma/dev.sqlite | ||
packages/photon/runtime | ||
packages/photon/index.js | ||
packages/photon/index.d.ts | ||
|
9 changes: 9 additions & 0 deletions
9
__fixtures__/example-todo-main-with-errors/.vscode/settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"editor.tabSize": 2, | ||
"files.trimTrailingWhitespace": true, | ||
"eslint.format.enable": true, | ||
|
||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Redwood | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Todo | ||
|
||
This is an example Redwood app, implementing a very minimal todo application. | ||
Features you can see in action here: | ||
|
||
- Redwood Cells (see TodoListCell.js). | ||
- Optimistic GraphQL response with Apollo (see AddTodo.js). | ||
- SVG loader (see Check.js) | ||
- StyledComponents usage (and stylistic approach) | ||
|
||
## Getting Started | ||
|
||
### Setup | ||
|
||
We use Yarn as our package manager. To get the dependencies installed, just do | ||
this in the root directory: | ||
|
||
```terminal | ||
yarn | ||
``` | ||
|
||
Set up the database and generate the database client: | ||
|
||
```terminal | ||
yarn redwood db up | ||
``` | ||
|
||
### Fire it up | ||
|
||
```terminal | ||
yarn redwood dev | ||
``` | ||
|
||
Browse to `http://localhost:8910` (or run `yarn redwood open`) to see the web app. | ||
|
||
Lambda functions run on | ||
`localhost:8911` but are proxied via `localhost:8910/api/functions/*`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = { extends: "../babel.config.js" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"src/*": ["./src/*"] | ||
} | ||
}, | ||
"include": ["generated/**/*", "src/**/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"private": true, | ||
"name": "api", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"@redwoodjs/api": "0.7.0" | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...__/example-todo-main-with-errors/api/prisma/migrations/20200415083240/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Migration `20200415083240` | ||
|
||
This migration has been generated by Peter Pistorius at 4/15/2020, 8:32:40 AM. | ||
You can check out the [state of the schema](./schema.prisma) after the migration. | ||
|
||
## Database Steps | ||
|
||
```sql | ||
CREATE TABLE "quaint"."Todo" ( | ||
"body" TEXT NOT NULL , | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"status" TEXT NOT NULL DEFAULT 'off' | ||
) | ||
|
||
CREATE UNIQUE INDEX "quaint"."Todo.body" ON "Todo"("body") | ||
``` | ||
|
||
## Changes | ||
|
||
```diff | ||
diff --git schema.prisma schema.prisma | ||
migration ..20200415083240 | ||
--- datamodel.dml | ||
+++ datamodel.dml | ||
@@ -1,0 +1,17 @@ | ||
+datasource sqlite { | ||
+ url = "file:./dev.sqlite" | ||
+ provider = "sqlite" | ||
+} | ||
+ | ||
+generator photonjs { | ||
+ provider = "prisma-client-js" | ||
+} | ||
+ | ||
+// Define your own models here and run `yarn rw db save` to create | ||
+// migrations for them. | ||
+ | ||
+model Todo { | ||
+ id Int @id @default(autoincrement()) | ||
+ body String @unique | ||
+ status String @default("off") | ||
+} | ||
``` | ||
|
||
|
17 changes: 17 additions & 0 deletions
17
...xtures__/example-todo-main-with-errors/api/prisma/migrations/20200415083240/schema.prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
datasource sqlite { | ||
url = "***" | ||
provider = "sqlite" | ||
} | ||
|
||
generator photonjs { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
// Define your own models here and run `yarn rw db save` to create | ||
// migrations for them. | ||
|
||
model Todo { | ||
id Int @id @default(autoincrement()) | ||
body String @unique | ||
status String @default("off") | ||
} |
124 changes: 124 additions & 0 deletions
124
__fixtures__/example-todo-main-with-errors/api/prisma/migrations/20200415083240/steps.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
{ | ||
"version": "0.3.14-fixed", | ||
"steps": [ | ||
{ | ||
"tag": "CreateSource", | ||
"source": "sqlite" | ||
}, | ||
{ | ||
"tag": "CreateArgument", | ||
"location": { | ||
"tag": "Source", | ||
"source": "sqlite" | ||
}, | ||
"argument": "url", | ||
"value": "\"file:./dev.sqlite\"" | ||
}, | ||
{ | ||
"tag": "CreateArgument", | ||
"location": { | ||
"tag": "Source", | ||
"source": "sqlite" | ||
}, | ||
"argument": "provider", | ||
"value": "\"sqlite\"" | ||
}, | ||
{ | ||
"tag": "CreateModel", | ||
"model": "Todo" | ||
}, | ||
{ | ||
"tag": "CreateField", | ||
"model": "Todo", | ||
"field": "id", | ||
"type": "Int", | ||
"arity": "Required" | ||
}, | ||
{ | ||
"tag": "CreateDirective", | ||
"location": { | ||
"path": { | ||
"tag": "Field", | ||
"model": "Todo", | ||
"field": "id" | ||
}, | ||
"directive": "id" | ||
} | ||
}, | ||
{ | ||
"tag": "CreateDirective", | ||
"location": { | ||
"path": { | ||
"tag": "Field", | ||
"model": "Todo", | ||
"field": "id" | ||
}, | ||
"directive": "default" | ||
} | ||
}, | ||
{ | ||
"tag": "CreateArgument", | ||
"location": { | ||
"tag": "Directive", | ||
"path": { | ||
"tag": "Field", | ||
"model": "Todo", | ||
"field": "id" | ||
}, | ||
"directive": "default" | ||
}, | ||
"argument": "", | ||
"value": "autoincrement()" | ||
}, | ||
{ | ||
"tag": "CreateField", | ||
"model": "Todo", | ||
"field": "body", | ||
"type": "String", | ||
"arity": "Required" | ||
}, | ||
{ | ||
"tag": "CreateDirective", | ||
"location": { | ||
"path": { | ||
"tag": "Field", | ||
"model": "Todo", | ||
"field": "body" | ||
}, | ||
"directive": "unique" | ||
} | ||
}, | ||
{ | ||
"tag": "CreateField", | ||
"model": "Todo", | ||
"field": "status", | ||
"type": "String", | ||
"arity": "Required" | ||
}, | ||
{ | ||
"tag": "CreateDirective", | ||
"location": { | ||
"path": { | ||
"tag": "Field", | ||
"model": "Todo", | ||
"field": "status" | ||
}, | ||
"directive": "default" | ||
} | ||
}, | ||
{ | ||
"tag": "CreateArgument", | ||
"location": { | ||
"tag": "Directive", | ||
"path": { | ||
"tag": "Field", | ||
"model": "Todo", | ||
"field": "status" | ||
}, | ||
"directive": "default" | ||
}, | ||
"argument": "", | ||
"value": "\"off\"" | ||
} | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
__fixtures__/example-todo-main-with-errors/api/prisma/migrations/migrate.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# IF THERE'S A GIT CONFLICT IN THIS FILE, DON'T SOLVE IT MANUALLY! | ||
# INSTEAD EXECUTE `prisma migrate fix` | ||
# Prisma Migrate lockfile v1 | ||
# Read more about conflict resolution here: TODO | ||
|
||
20200415083240 |
17 changes: 17 additions & 0 deletions
17
__fixtures__/example-todo-main-with-errors/api/prisma/schema.prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
datasource sqlite { | ||
url = "file:./dev.sqlite" | ||
provider = "sqlite" | ||
} | ||
|
||
generator photonjs { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
// Define your own models here and run `yarn rw db save` to create | ||
// migrations for them. | ||
|
||
model Todo { | ||
id Int @id @default(autoincrement()) | ||
body String @unique | ||
status String @default("off") | ||
} |
21 changes: 21 additions & 0 deletions
21
__fixtures__/example-todo-main-with-errors/api/src/functions/graphql.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
createGraphQLHandler, | ||
makeMergedSchema, | ||
makeServices, | ||
} from '@redwoodjs/api' | ||
import importAll from '@redwoodjs/api/importAll.macro' | ||
|
||
import { db } from 'src/lib/db' | ||
|
||
const schemas = importAll('api', 'graphql') | ||
const services = importAll('api', 'services') | ||
|
||
export const handler = createGraphQLHandler( | ||
{ | ||
schema: makeMergedSchema({ | ||
schemas, | ||
services: makeServices({ services }), | ||
}), | ||
}, | ||
db | ||
) |
17 changes: 17 additions & 0 deletions
17
__fixtures__/example-todo-main-with-errors/api/src/graphql/todos.sdl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export const schema = gql` | ||
type Todo { | ||
id: Int! | ||
body: String! | ||
status: String! | ||
} | ||
type Query { | ||
todos: [Todo] | ||
} | ||
type Mutation { | ||
createTodo(body: String!): Todo | ||
updateTodoStatus(id: Int!, status: String!): Todo | ||
renameTodo(id: Int!, body: String!): Todo | ||
} | ||
` |
17 changes: 17 additions & 0 deletions
17
__fixtures__/example-todo-main-with-errors/api/src/services/todos/todos.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { db } from 'src/lib/db' | ||
|
||
export const todos = () => db.todo.findMany() | ||
|
||
export const createTodo = ({ body }) => db.todo.create({ data: { body } }) | ||
|
||
export const updateTodoStatus = ({ id, status }) => | ||
db.todo.update({ | ||
data: { status }, | ||
where: { id }, | ||
}) | ||
|
||
export const renameTodo = ({ id, body }) => | ||
db.todo.update({ | ||
data: { body }, | ||
where: { id }, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ['@redwoodjs/core/config/babel-preset'], | ||
} |
Oops, something went wrong.