-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c045200
commit 702dcf6
Showing
12 changed files
with
185 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
exports['should work with a custom output dir 1'] = [ | ||
{ | ||
"id": 1, | ||
"email": "bob@bob.bob", | ||
"name": "Bobby Brown Sqlite" | ||
} | ||
] |
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
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
2 changes: 2 additions & 0 deletions
2
src/packages/cli/src/__tests__/fixtures/example-project/.gitignore
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,2 @@ | ||
!prisma | ||
!prisma/dev.db |
9 changes: 9 additions & 0 deletions
9
src/packages/cli/src/__tests__/fixtures/example-project/main.ts
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 @@ | ||
import { PrismaClient } from './generated/client' | ||
|
||
export async function main() { | ||
const client = new PrismaClient() | ||
|
||
const data = await client.user.findMany() | ||
client.disconnect() | ||
return data | ||
} |
Binary file not shown.
34 changes: 34 additions & 0 deletions
34
src/packages/cli/src/__tests__/fixtures/example-project/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,34 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
output = "../generated/client" | ||
} | ||
|
||
datasource db { | ||
provider = "sqlite" | ||
url = "file:dev.db" | ||
} | ||
|
||
model Post { | ||
id Int @default(autoincrement()) @id | ||
createdAt DateTime @default(now()) | ||
title String | ||
content String? | ||
published Boolean @default(false) | ||
author User @relation(fields: [authorId], references: [id]) | ||
authorId Int | ||
} | ||
|
||
model Profile { | ||
id Int @default(autoincrement()) @id | ||
bio String? | ||
user User @relation(fields: [userId], references: [id]) | ||
userId Int @unique | ||
} | ||
|
||
model User { | ||
id Int @default(autoincrement()) @id | ||
email String @unique | ||
name String? | ||
posts Post[] | ||
profile Profile? | ||
} |
9 changes: 9 additions & 0 deletions
9
src/packages/cli/src/__tests__/fixtures/example-project/tsconfig.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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2017" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, | ||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, | ||
"strict": true /* Enable all strict type-checking options. */, | ||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, | ||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
src/packages/cli/src/__tests__/fixtures/example-project/yarn.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,72 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@prisma/cli@^2.0.0-alpha.1137": | ||
version "2.0.0-alpha.1137" | ||
resolved "https://registry.yarnpkg.com/@prisma/cli/-/cli-2.0.0-alpha.1137.tgz#5edb93bb430958d3def715679dda22e7c62ad0eb" | ||
integrity sha512-54YANz8G7oVpEE+gVF6prbxT61Pyea3YHv2fPYZemBXscXlrlG7GZkDh0JX0yR1Rcp9cjL4QMsJvNO5XKzwAew== | ||
|
||
"@prisma/client@^2.0.0-alpha.1137": | ||
version "2.0.0-alpha.1137" | ||
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-2.0.0-alpha.1137.tgz#fd5216e4a8b836a373b887aa20466a53e3942828" | ||
integrity sha512-UNKgKySmeC17YZ3OfqZpwU0zR4Ljfi1gWEO4+aLWo7DyrK3sdp/45G2EZGIOpX/weVDM+vcZWIMcWOyJ3apkEQ== | ||
|
||
"@types/node@^13.11.1": | ||
version "13.11.1" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.11.1.tgz#49a2a83df9d26daacead30d0ccc8762b128d53c7" | ||
integrity sha512-eWQGP3qtxwL8FGneRrC5DwrJLGN4/dH1clNTuLfN81HCrxVtxRjygDTUoZJ5ASlDEeo0ppYFQjQIlXhtXpOn6g== | ||
|
||
arg@^4.1.0: | ||
version "4.1.3" | ||
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" | ||
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== | ||
|
||
buffer-from@^1.0.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" | ||
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== | ||
|
||
diff@^4.0.1: | ||
version "4.0.2" | ||
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" | ||
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== | ||
|
||
make-error@^1.1.1: | ||
version "1.3.6" | ||
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" | ||
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== | ||
|
||
source-map-support@^0.5.6: | ||
version "0.5.16" | ||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" | ||
integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== | ||
dependencies: | ||
buffer-from "^1.0.0" | ||
source-map "^0.6.0" | ||
|
||
source-map@^0.6.0: | ||
version "0.6.1" | ||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" | ||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== | ||
|
||
ts-node@^8.8.2: | ||
version "8.8.2" | ||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.8.2.tgz#0b39e690bee39ea5111513a9d2bcdc0bc121755f" | ||
integrity sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q== | ||
dependencies: | ||
arg "^4.1.0" | ||
diff "^4.0.1" | ||
make-error "^1.1.1" | ||
source-map-support "^0.5.6" | ||
yn "3.1.1" | ||
|
||
typescript@^3.8.3: | ||
version "3.8.3" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061" | ||
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w== | ||
|
||
yn@3.1.1: | ||
version "3.1.1" | ||
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" | ||
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== |
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,29 @@ | ||
import tempy from 'tempy' | ||
import path from 'path' | ||
import copy from '@apexearth/copy' | ||
import execa from 'execa' | ||
import assert from 'assert' | ||
import snapshot from 'snap-shot-it' | ||
import 'ts-node/register' | ||
|
||
it('should work with a custom output dir', async () => { | ||
// get temp dir | ||
const target = tempy.directory() | ||
// copy example into temp dir | ||
// why a tmp dir? To make sure, we're outside of this workspace | ||
await copy({ | ||
from: path.join(__dirname, './fixtures/example-project'), | ||
to: target, | ||
recursive: true, | ||
}) | ||
// generate into temp dir | ||
await execa.node(path.join(__dirname, '../../build/index.js'), ['generate'], { | ||
cwd: target, | ||
stdio: 'ignore', | ||
}) | ||
// run code | ||
const { main } = await import(path.join(target, 'main.ts')) | ||
const result = await main() | ||
snapshot(result) | ||
assert(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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.