Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A generator provider should accept arbitrary commands #1101

Closed
steebchen opened this issue Dec 10, 2019 · 6 comments · Fixed by #1933
Closed

A generator provider should accept arbitrary commands #1101

steebchen opened this issue Dec 10, 2019 · 6 comments · Fixed by #1933
Assignees
Labels
Milestone

Comments

@steebchen
Copy link
Contributor

Generators can be any executable file, but currently this is limited to one single command, which means you can't provide any arguments to a generator:

generator photon {
	provider = "/Users/prisma/go/bin/photongo"
	output = "./photon/photon_gen.go"
	package = "photon"
}

Providing arguments doesn't work:

generator photon {
	provider = "/Users/prisma/go/bin/photongo --option=on"
	output = "./photon/photon_gen.go"
	package = "photon"
}

Instead, the provider should accept full commands with arguments.

For example, provider could accept specifying full commands:

generator photon {
	provider = "go run github.com/prisma/photongo/generator"
	output = "./photon/photon_gen.go"
	package = "photon"
}

An alternative would be an array to specify the command with arguments:

generator photon {
	provider = ["go", "run", "github.com/prisma/photongo/generator"]
	output = "./photon/photon_gen.go"
	package = "photon"
}
@robojones
Copy link

This is related to #934. Is there any progress on either of them?

steebchen added a commit that referenced this issue Mar 25, 2020
only show the JS example when generator is prisma-client-js

fix #1101
Jolg42 added a commit that referenced this issue Mar 26, 2020
* feat(prisma2/cli): allow arbitrary generator commands with flags

only show the JS example when generator is prisma-client-js

fix #1101

* Add comments

Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com>
@robojones
Copy link

Thanks 👍
I really needed this, so I can create a good project setup with prisma-client-go.
How is it even possible that I can review changes in your PRs? 😆

@Jolg42
Copy link
Member

Jolg42 commented Mar 26, 2020

@robojones You're welcome, and yes it's quite weird 🙃🤣

@pantharshit00

This comment has been minimized.

@janpio

This comment has been minimized.

@steebchen steebchen reopened this May 25, 2020
@steebchen
Copy link
Contributor Author

steebchen commented May 25, 2020

This fails on the latest alpha:

prisma Error: ENOENT: no such file or directory, stat 'go run ../../..' +72ms

It seems this is the line where the error happens:

isBinary = await isBinaryFile(this.executablePath)

We should also add a test which covers this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants