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

[python] ignore nested node_modules, .next, .nuxt, .git & .vercel #12807

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/slow-gorillas-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@vercel/python': minor
---

Update default ignored folders from the zip output:

- nested `node_modules`
- nested `.next` & `.nuxt`
- `.git` & `.vercel`
8 changes: 7 additions & 1 deletion packages/python/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ export const build: BuildV3 = async ({
ignore:
config && typeof config.excludeFiles === 'string'
? config.excludeFiles
: 'node_modules/**',
: [
'.git/**',
'.vercel/**',
'**/node_modules/**',
'**/.next/**',
'**/.nuxt/**',
],
Comment on lines +202 to +208
Copy link
Contributor

@developerjhp developerjhp Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Tom, I was reviewing this PR, and I noticed the ignore rules are directly defined in the code. I was wondering if it might be worth considering an alternative approach by separating the default ignore rules into a constant, as shown below:

const DEFAULT_IGNORE_FOLDERS = [
    '.git/**',
    '.vercel/**',
    '**/node_modules/**',
    '**/.next/**',
    '**/.nuxt/**',
];


........
ignore: config?.excludeFiles ?? DEFAULT_IGNORE_FOLDERS

This change could potentially improve the readability and maintainability of the code by clearly isolating the default rules, making them easier to manage and update if needed.

Of course, this is just a suggestion, and I'd love to hear your thoughts on whether this aligns with the team's preferences or goals for this functionality. Let me know if you think this would be helpful!

};

const files: Files = await glob('**', globOptions);
Expand Down
Loading