Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
maoosi committed Apr 3, 2021
2 parents 64818d5 + 428ffa5 commit 5d6f395
Show file tree
Hide file tree
Showing 22 changed files with 95,704 additions and 17,383 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## Version 1.0.0-beta.51

- Fix: Support for prisma ^2.20 added (output for generators can now be env vars).
- Feat: Ability to exclude fields and models from the generated GraphQL schema and API using `/// @PrismaAppSync.ignore` ([more details in the docs](https://prisma-appsync.vercel.app/guides/ignore.html)).
- Feat: Simpler boilerplate usage with `yarn create prisma-appsync-app <target-folder>`.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 2-Clause License

Copyright (c) 2020, Sylvain Simao <hello@sylvainsimao.fr>
Copyright (c) 2021, Sylvain Simao <hello@sylvainsimao.fr>
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

## ⚓ Compatibility

- Prisma 2.18.0
- Prisma 2.10.1

## 📓 Documentation

Expand Down
4 changes: 2 additions & 2 deletions boilerplate/cdk/.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# prefix for all deployed services
SERVICES_PREFIX="PrismaAppSync"
SERVICES_PREFIX="<%= name %>"

# https://www.prisma.io/docs/reference/database-reference/connection-urls
PRISMA_CONNECTION_URL="postgresql://janedoe:mypassword@localhost:5432/mydb"
PRISMA_CONNECTION_URL="<%= connectionUrl %>"

# schema definition path (generated by prisma-appsync generator)
APPSYNC_SCHEMA_PATH="../prisma/generated/prisma-appsync/schema.gql"
Expand Down
8 changes: 6 additions & 2 deletions boilerplate/cdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class AppSyncCdkStack extends cdk.Stack {
const apiKey = new CfnApiKey(this, `${process.env.SERVICES_PREFIX}ApiKey`, {
apiId: graphqlApi.apiId,
description: `${process.env.SERVICES_PREFIX}_api-key`,
expires: Math.floor( today.setDate(today.getDate() + 365) / 1000.0 )
expires: Math.floor( today.setDate(today.getDate() + 364) / 1000.0 )
})
new cdk.CfnOutput(this, `${process.env.SERVICES_PREFIX}CfnApiKey`, {
value: apiKey.attrApiKey,
Expand Down Expand Up @@ -109,7 +109,11 @@ export class AppSyncCdkStack extends cdk.Stack {
return []
},
afterBundling() {
return [`npx prisma generate`]
return [
'npx prisma generate',
'rm -rf node_modules/prisma/query-engine-darwin',
'rm -rf node_modules/prisma/query-engine-rhel-openssl-1.0.x'
]
}
},
nodeModules: ['prisma', '@prisma/client', 'prisma-appsync'],
Expand Down
22 changes: 11 additions & 11 deletions boilerplate/cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
},
"license": "BSD-2-Clause",
"devDependencies": {
"@aws-cdk/aws-appsync": "^1.77.0",
"@aws-cdk/aws-iam": "^1.77.0",
"@aws-cdk/aws-lambda": "^1.77.0",
"@aws-cdk/aws-lambda-nodejs": "^1.77.0",
"@aws-cdk/core": "^1.77.0",
"@types/js-yaml": "^3.12.5",
"@types/node": "^14.14.7",
"dotenv": "^8.2.0",
"@aws-cdk/aws-appsync": "1.77.0",
"@aws-cdk/aws-iam": "1.77.0",
"@aws-cdk/aws-lambda": "1.77.0",
"@aws-cdk/aws-lambda-nodejs": "1.77.0",
"@aws-cdk/core": "1.77.0",
"@types/js-yaml": "3.12.5",
"@types/node": "14.14.7",
"dotenv": "8.2.0",
"esbuild": "0",
"js-yaml": "^3.14.1",
"ts-node": "^9.0.0",
"typescript": "^4.0.5"
"js-yaml": "3.14.1",
"ts-node": "9.0.0",
"typescript": "4.0.5"
}
}
37 changes: 37 additions & 0 deletions boilerplate/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
datasource db {
url = env("DATABASE_URL")
provider = "postgresql"
}

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

generator appsync {
provider = "prisma-appsync"
}

model User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
email String @unique
name String?
role Role @default(USER)
posts Post[]
}

model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean @default(false)
title String @db.VarChar(255)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}

enum Role {
USER
ADMIN
}
Loading

1 comment on commit 5d6f395

@vercel
Copy link

@vercel vercel bot commented on 5d6f395 Apr 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.