paljs / prisma-tools

Prisma tools to help you generate CRUD system for GraphQL servers
https://paljs.com
MIT License
681 stars 55 forks source link

Cannot exclude models from generation #221

Closed raymclee closed 3 years ago

raymclee commented 3 years ago

I have below pal.js, when I use pal -g. it still generate all model

module.exports = {
  backend: {
    generator: "nexus",
    onDelete: true,
    output: "lib/api/graphql",
    models: ["User", "Shop", "Order", "OrderItem", "Table", "Product"],
    excludeFieldsByModel: { User: ["accounts", "sessions"] },
  },
};
AhmedElywa commented 3 years ago

@raymclee our cli not delete your old files if you delete all output: "lib/api/graphql", content and run again will generate the models you put in the pal.js file

raymclee commented 3 years ago

I have tried to change the output to new folder and it still generate all model.

excludeModels also not working but "excludeFieldsByModel" works

AhmedElywa commented 3 years ago

Yes, you are right. working on a fix now

raymclee commented 3 years ago

Yes, you are right. working on a fix now

many thanks!

AhmedElywa commented 3 years ago

Also, you can use pal generate User,Shop,Order,OrderItem,Table,Product

raymclee commented 3 years ago

Also, you can use pal generate User,Shop,Order,OrderItem,Table,Product

yeah, that works thanks.

is it possible to get the generated file in lowercase?

AhmedElywa commented 3 years ago

is it possible to get the generated file in lowercase?

It's hard and will make a breaking change.

you can build a small script to run after our generator to select all folder and change their names Don't forget to change imports in the index file

raymclee commented 3 years ago

is it possible to get the generated file in lowercase?

It's hard and will make a breaking change.

you can build a small script to run after our generator to select all folder and change their names Don't forget to change imports in the index file

got it. thanks!

AhmedElywa commented 3 years ago

this cli issue now fixed in the last version 3.4.0