-
-
Notifications
You must be signed in to change notification settings - Fork 625
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
feat: more flexible ignores configuration #2022
Conversation
Β Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
β Live Preview ready!
|
β Live Preview ready!
|
β Deploy Preview for nuxt-content ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
Thanks for the PR, The only concern I have is about the breaking change we are creating with this PR. |
That was my only concern too. Could potentially:
Feels a bit confusing though. Or:
I've seen it in Nuxt, haven't really looked at it. How do they choose / document successful experiments to the core? Or:
Feel safer. My hunch is that the existing Thinking about it; the new ignores options widen the scope for ignored content, so the worst that could happen is less content is published, rather than something sensitive being made available:
Regarding any warnings, I don't have any experience in this. Would you use something like a |
I like this approach.
|
Aha! It exists! https://github.com/nuxt/content/blob/main/src/module.ts#L281-L284 OK, I'll get that written now π Is there any existing format for warnings? Just |
We can change docs a bit to introduce this experimental flag (the ones you've added in the PR). WDYT? |
OK, copying the example here: consola.warn('The `ignores` config is being made more flexible in version 2.7. See the docs for more information: `https://content.nuxtjs.org/api/configuration#ignores`') |
OK! All done. Sorry it took me so long, but here are the main changes: FormatI made a small modification so the new format now supports This means users won't need to use
|
I think it's better to just have an experimental flag, and use the same export default defineNuxtConfig({
content: {
experimental: {
advancedIgnoresPattern: true
},
ignores: [
'hidden',
'/hidden/',
// ...
]
}
}) WDYT? |
OK, done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π
@davestewart Looks great. Do you mind fixing CI? |
Co-authored-by: Farnabaz <[email protected]>
Re. release, I haven't updated the package version or anything. How are releases normally coordinated? |
BTW, writing some tests for this, this morning. |
I'm planning to release v2.6 today Also, before that, once we merge this PR you can test it on edge-channel |
Question, for future reference... I presume PRs are squashed, so as per the Conventional Commits docs β do I need to use the
It's a bit of a pain choosing which prefix to use with so many small updates... |
Not sure I'm getting your point here. But For me this is an improvement and new feature so I'd use |
Yeah I meant for those in the branch. OK, good to know, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π
Let's wait for CI to finish and you can test in edge channel |
FWIW I get a 503 at my end with the edge channel:
Have hacked node modules so I can test the feature. |
Which version of Nuxt are you using? |
OK, did that and still get it:
|
This is strange, named export is suggested why to import Do you have Please check which version of |
OK, it looks like I had a reference to Have just nuked everything and rerun and it compiles! Bloody computers π (/humans) |
Also, pleased to report that the updates mean I can get the next couple of optimisations for Nuxt Content Assets out! Thanks so much for working through this PR with me. Really appreciated! |
π Linked issue
β Type of change
π Description
This PR enhances Nuxt Content's ignores implementation.
It has three main aims:
Options
Right now, the
ignores
implementation transforms user-supplied options so that they work with atoms of theunstorage
path syntax, by converting the string to a RegExp and prefixing it with a:
delimiter (which equates to/
).Thus,
'hidden'
will only ever match/hidden
and not/my-hidden-folder
. In order for a user to get around this they would need some additional RegExp acrobatics, i.e.'.+hidden'
. Ignoring file extensions would require'.+\\.ext'
rather than the more idiomatic'\\.ext$'
.This change gives the user the flexibility to decide how to ignore content, whist respecting the current defaults to ignore
.dot
and-dash
files.Predicate
The new
makeIgnores()
factory function returns a predicate which eliminates the duplicate code from the rest of the module.Watch
Currently the module's watch functionality doesn't respect ignored files, and triggers an application refresh even when ignored files are saved.
The update uses the predicate function to ignore ignored file updates and not refresh the app.
Testing
I'm not 100% sure how to test this functionality using a test framework, but I have updated the
playground/document-driven
to test it out in the browser.Resolves #2017
π Checklist