Skip to content

Commit

Permalink
fix: fix decimal import, fix BigInt generation, fix example folder
Browse files Browse the repository at this point in the history
  • Loading branch information
luisrudge committed Jan 25, 2024
1 parent 956668d commit 82e0d4e
Show file tree
Hide file tree
Showing 12 changed files with 227 additions and 78 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
yarn-error.log
build
pnpm-debug.log
.env*
.env*
example/prisma/fake-data.ts
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ 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.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file modified bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"dependencies": {
"@prisma/client": "^5.0.0",
"ts-node": "^10.9.1"
"ts-node": "^10.9.1",
"prisma-generator-fake-data": "file:../"
},
"devDependencies": {
"@types/node": "18.15.11",
Expand Down
12 changes: 7 additions & 5 deletions example/prisma/fake-data.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { UserStatus } from '@prisma/client';

This comment has been minimized.

Copy link
@unclejustin

unclejustin Jan 25, 2024

Contributor

@luisrudge This is problematic. Now fake-data includes our local user paths 😬

This comment has been minimized.

Copy link
@luisrudge

luisrudge Jan 25, 2024

Author Owner

ouch. I'll look into it

This comment has been minimized.

Copy link
@luisrudge

luisrudge Jan 25, 2024

Author Owner

I checked out the previous version and I have the same issue 🤔

This comment has been minimized.

Copy link
@luisrudge

luisrudge Jan 25, 2024

Author Owner

This comment has been minimized.

Copy link
@unclejustin

unclejustin Jan 25, 2024

Contributor

Nice thanks! 🎉

import { UserStatus } from '/Users/luisrudge/code/oss/prisma-generator-fake-data/example/node_modules/@prisma/client';
import { faker } from '@faker-js/faker';
import { fakeSettings } from './fakeData.utils';
export * from './fakeData.utils';

export function fakeUser() {
return {
email: faker.internet.email(),
name: faker.name.fullName(),
name: faker.person.fullName(),
age: faker.number.int({ min: 0, max: 99 }),
settings: fakeSettings(),
ok: faker.number.int(),
maybeString: undefined,
status: faker.helpers.arrayElement([
UserStatus.active,
Expand All @@ -18,11 +19,12 @@ export function fakeUser() {
}
export function fakeUserComplete() {
return {
id: faker.datatype.uuid(),
id: faker.string.uuid(),
email: faker.internet.email(),
name: faker.name.fullName(),
name: faker.person.fullName(),
age: faker.number.int({ min: 0, max: 99 }),
settings: fakeSettings(),
ok: faker.number.int(),
maybeString: undefined,
status: faker.helpers.arrayElement([
UserStatus.active,
Expand All @@ -40,7 +42,7 @@ export function fakeProfileComplete() {
return {
id: faker.number.int(),
someConfiguration: faker.datatype.boolean(),
userId: faker.datatype.uuid(),
userId: faker.string.uuid(),
};
}
export function fakeProfileSettings() {
Expand Down
4 changes: 1 addition & 3 deletions example/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ generator client {
}

generator custom_generator {
///in your project, you'll use it like this
///provider = "prisma-generator-fake-data"
provider = "ts-node ../src/bin.ts"
provider = "prisma-generator-fake-data"
extraImport = "import {fakeSettings} from './fakeData.utils'"
extraExport = "export * from './fakeData.utils'"
}
Expand Down
110 changes: 110 additions & 0 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
dependencies:
"@jridgewell/trace-mapping" "0.3.9"

"@faker-js/faker@^8.0.2":
version "8.4.0"
resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-8.4.0.tgz#dc09924ee5fa6438eaaa49d0a8820c64d2f8518f"
integrity sha512-htW87352wzUCdX1jyUQocUcmAaFqcR/w082EC8iP/gtkF0K+aKcBp0hR5Arb7dzR8tQ1TrhE9DNa5EbJELm84w==

"@jridgewell/resolve-uri@^3.0.3":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
Expand All @@ -34,16 +39,78 @@
dependencies:
"@prisma/engines-version" "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584"

"@prisma/[email protected]":
version "5.8.1"
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.8.1.tgz#704daa36919b0fc4d227260ecebfa1c94b155b07"
integrity sha512-tjuw7eA0Us3T42jx9AmAgL58rzwzpFGYc3R7Y4Ip75EBYrKMBA1YihuWMcBC92ILmjlQ/u3p8VxcIE0hr+fZfg==

"@prisma/engines-version@4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584":
version "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584.tgz#b36eda5620872d3fac810c302a7e46cf41daa033"
integrity sha512-HHiUF6NixsldsP3JROq07TYBLEjXFKr6PdH8H4gK/XAoTmIplOJBCgrIUMrsRAnEuGyRoRLXKXWUb943+PFoKQ==

"@prisma/[email protected]":
version "5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2.tgz#f600a45afc4cf0c0356b6ed90add6050fa3f3239"
integrity sha512-f5C3JM3l9yhGr3cr4FMqWloFaSCpNpMi58Om22rjD2DOz3owci2mFdFXMgnAGazFPKrCbbEhcxdsRfspEYRoFQ==

"@prisma/[email protected]":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.0.0.tgz#5249650eabe77c458c90f2be97d8210353c2e22e"
integrity sha512-kyT/8fd0OpWmhAU5YnY7eP31brW1q1YrTGoblWrhQJDiN/1K+Z8S1kylcmtjqx5wsUGcP1HBWutayA/jtyt+sg==

"@prisma/[email protected]":
version "5.8.1"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.8.1.tgz#b850751f5bf7d5e570b9fe16cefdc2b1fd2c02c3"
integrity sha512-TJgYLRrZr56uhqcXO4GmP5be+zjCIHtLDK20Cnfg+o9d905hsN065QOL+3Z0zQAy6YD31Ol4u2kzSfRmbJv/uA==
dependencies:
"@prisma/debug" "5.8.1"
"@prisma/engines-version" "5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2"
"@prisma/fetch-engine" "5.8.1"
"@prisma/get-platform" "5.8.1"

"@prisma/[email protected]":
version "5.8.1"
resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-5.8.1.tgz#38bb92f1fbd3669340a3cc49fce403ab4df671dd"
integrity sha512-+bgjjoSFa6uYEbAPlklfoVSStOEfcpheOjoBoNsNNSQdSzcwE2nM4Q0prun0+P8/0sCHo18JZ9xqa8gObvgOUw==
dependencies:
"@prisma/debug" "5.8.1"
"@prisma/engines-version" "5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2"
"@prisma/get-platform" "5.8.1"

"@prisma/[email protected]", "@prisma/generator-helper@^5.0.0":
version "5.8.1"
resolved "https://registry.yarnpkg.com/@prisma/generator-helper/-/generator-helper-5.8.1.tgz#11d226bf004839763375303a7a081913796df06b"
integrity sha512-2EDd0o+GHfbX1dtw5BnfOz3hQB7AtYrwe4YNiKfo2UDBvB/ne/ChZa3b/vBm/GKpjW2Xaymct8D9oIHev3juzQ==
dependencies:
"@prisma/debug" "5.8.1"

"@prisma/[email protected]":
version "5.8.1"
resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-5.8.1.tgz#8cd450b65a52a5a6ed5b2f52457136a492c0f251"
integrity sha512-wnA+6HTFcY+tkykMokix9GiAkaauPC5W/gg0O5JB0J8tCTNWrqpnQ7AsaGRfkYUbeOIioh6woDjQrGTTRf1Zag==
dependencies:
"@prisma/debug" "5.8.1"

"@prisma/internals@^5.0.0":
version "5.8.1"
resolved "https://registry.yarnpkg.com/@prisma/internals/-/internals-5.8.1.tgz#cb73784f64846a65efe74f5f563ec8908ac857e9"
integrity sha512-9okoCgLeMqql58IbEG3YmzgNLRUQdN+qZUYp2DojWC7VAmL9TSOKQ5Dcc0588cKAsCBBDUQ2jfdflorYkzeFKw==
dependencies:
"@prisma/debug" "5.8.1"
"@prisma/engines" "5.8.1"
"@prisma/fetch-engine" "5.8.1"
"@prisma/generator-helper" "5.8.1"
"@prisma/get-platform" "5.8.1"
"@prisma/prisma-schema-wasm" "5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2"
arg "5.0.2"
prompts "2.4.2"

"@prisma/prisma-schema-wasm@5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2":
version "5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2"
resolved "https://registry.yarnpkg.com/@prisma/prisma-schema-wasm/-/prisma-schema-wasm-5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2.tgz#978a1a9187477a1cda50cac65aa2d26ef8b08f0b"
integrity sha512-UAJANliORe2V/s7yDMx5EKOCj2PIbwX7yusKckxMBDb+ozaQF31c3CBwnZW/ZEdhBoZjrKw8bQlqwZudWXmiKA==

"@tsconfig/node10@^1.0.7":
version "1.0.9"
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2"
Expand Down Expand Up @@ -79,6 +146,11 @@ acorn@^8.4.1:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a"
integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==

[email protected]:
version "5.0.2"
resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c"
integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==

arg@^4.1.0:
version "4.1.3"
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
Expand All @@ -89,23 +161,61 @@ create-require@^1.1.0:
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==

decimal.js@^10.4.3:
version "10.4.3"
resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23"
integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==

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==

kleur@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==

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==

"prisma-generator-fake-data@file:..":
version "0.13.0"
dependencies:
"@faker-js/faker" "^8.0.2"
"@prisma/client" "^5.0.0"
"@prisma/generator-helper" "^5.0.0"
"@prisma/internals" "^5.0.0"
decimal.js "^10.4.3"
tiny-invariant "^1.3.1"

prisma@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.0.0.tgz#f6571c46dc2478172cb7bc1bb62d74026a2c2630"
integrity sha512-KYWk83Fhi1FH59jSpavAYTt2eoMVW9YKgu8ci0kuUnt6Dup5Qy47pcB4/TLmiPAbhGrxxSz7gsSnJcCmkyPANA==
dependencies:
"@prisma/engines" "5.0.0"

[email protected]:
version "2.4.2"
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069"
integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==
dependencies:
kleur "^3.0.3"
sisteransi "^1.0.5"

sisteransi@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==

tiny-invariant@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.1.tgz#8560808c916ef02ecfd55e66090df23a4b7aa642"
integrity sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==

ts-node@^10.9.1:
version "10.9.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"
Expand Down
Loading

0 comments on commit 82e0d4e

Please sign in to comment.