Skip to content

Commit

Permalink
fix: Models Only CLI Option
Browse files Browse the repository at this point in the history
  • Loading branch information
bcanfield committed Sep 5, 2023
1 parent 1f6d26b commit 601e96e
Show file tree
Hide file tree
Showing 4 changed files with 529 additions and 519 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
#### **Did you find a bug?**

- **Submit the bug** on [Github](https://github.com/bcanfield/nexquik/issues/new).
- Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
- At the bare minimum - please include your prisma schema or a minimal example.

#### **Did you write a patch that fixes a bug?**

- Open a new GitHub pull request with the patch.

- Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.

Thanks! ❤️ ❤️ ❤️
Thank you!

Nexquik Team
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ This also allows you to benefit from enhancements to the project from the open s
| --appTitle <title> | Title to be used in the header of your app (default: "App") |
| --rootName <dirName> | Desired name for the root app dir for your generated groups (this is the first directory nested under your 'app' directory. (default: "gen") |
| --depth <depthValue> | Maximum recursion depth for your models. (Changing this for large data models is not recommended, unless you filter down your models with the 'include' or 'exclude' flags also.) (default: "5") |
| --modelsOnly | Only generates components for your models. Skips the boilerplate files - root page.tsx,layout.tsx, globals.css, etc.... |
| --prismaImport <prismaImportString> | Import location for your prisma client if it differs from the standard setup. (default: "import prisma from '@/lib/prisma';") |
| --disabled | Disable the generator (default: false) |
| -h, --help | Display help for command |
Expand Down
9 changes: 7 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export async function run(options?: GeneratorOptions) {
"Maximum recursion depth for your models. (Changing this for large data models is not recommended, unless you filter down your models with the 'include' or 'exclude' flags also.)",
"5"
)
.option(
"--modelsOnly",
"Only generates components for your models. Skips the boilerplate files - root page.tsx,layout.tsx, globals.css, etc...."
)
.option(
"--prismaImport <prismaImportString>",
"Import location for your prisma client if it differs from the standard setup.",
Expand Down Expand Up @@ -141,14 +145,14 @@ export async function run(options?: GeneratorOptions) {
const prismaImportString = cliArgs.prismaImport;
const init = cliArgs.init || false;
const extendOnly = cliArgs.extendOnly || false;
const modelsOnly = cliArgs.modelsOnly || false;
const disabled =
process.env.DISABLE_NEXQUIK === "true" || cliArgs.disabled === true;
const appTitle = cliArgs.appTitle;
if (disabled) {
return console.log("Nexquik generation disabled due to env var");
}

// console.log({ cliArgs });
await generate(
prismaSchemaPath,
outputDirectory,
Expand All @@ -159,7 +163,8 @@ export async function run(options?: GeneratorOptions) {
extendOnly,
deps,
prismaImportString,
appTitle
appTitle,
modelsOnly
);

if (!deps) {
Expand Down
Loading

0 comments on commit 601e96e

Please sign in to comment.