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

Ignore EmptyResourceFileError for index files/patterns #50

Open
chronark opened this issue May 12, 2021 · 1 comment
Open

Ignore EmptyResourceFileError for index files/patterns #50

chronark opened this issue May 12, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@chronark
Copy link
Contributor

I settled on a pattern similar to this for my collections and indices

// resources/collections/accounts.ts
import {CreateCollection} from "faunadb"

export const COLLECTION_ACCOUNTS = "accounts"
export default CreateCollection({name: COLLECTION_ACCOUNTS})
// resources/index.ts
export * from "./collections/accounts"
// ...
// somewhere else
import {COLLECTION_ACCOUNTS} from "@<project>/fauna"
// .. do something with it

I do that because I ran into problems because I could not keep my naming consistent.

Anyways, fauna-schema-migrate detects the index.ts file and obviously does not see a default export and it throws the EmptyResourceFileError. A workaround would be to create the index.ts outside of resources but it would be nice to maybe add a flag to ignore index files or even better patterns of files.

Let me know what you think and I can create a PR.

@fauna-brecht
Copy link
Contributor

Sounds god, I would opt to add an 'ignore' option in the config which can contain wildcards in a similar vein as gitignores.

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

No branches or pull requests

2 participants