Skip to content

Export: Exclude node_modules and .git paths from site export #1264

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

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

ivan-ottinger
Copy link
Contributor

@ivan-ottinger ivan-ottinger commented Apr 24, 2025

Related issues

  • Resolves STU-205-linear-issue

Proposed Changes

  • exclude node_modules and .git paths from site export

Testing Instructions

  1. Check out the PR branch and build the app with npm start.
  2. Open one of your local sites in Finder / Terminal and create a bunch of directories with .git and node_modules with some random files in them.
  3. Add these directories to /wp-content/plugins, /wp-content/themes, etc. ...
  4. Head over to the Import / Export tab and export the site.
  5. Extract the export and review the directories. There should be no .git or node_modules directories present.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@ivan-ottinger ivan-ottinger self-assigned this Apr 24, 2025
Comment on lines +233 to +234
const isNodeModulesDirectory = relativePath.includes( 'node_modules' );
const isGitDirectory = relativePath.includes( '.git' );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it should be safe to exclude all those paths that include node_modules or .git in them, but happy to make it more strict if you think it's necessary. 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree IMO this should be strict enough! 👌

@ivan-ottinger ivan-ottinger marked this pull request as ready for review April 25, 2025 12:35
@ivan-ottinger ivan-ottinger requested a review from a team April 25, 2025 12:35
Copy link
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

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

I have tested it, and it works as expected. There are no node_modules or .git folders on the exported site. LGTM! :shipit:

Studio folder Exported site folder
CleanShot 2025-04-25 at 16 14 18@2x CleanShot 2025-04-25 at 16 15 56@2x

Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

Thanks @ivan-ottinger for working on this and for adding such detailed testing steps! 🙌

The changes LGTM and it's working great for me too! Thanks @epeicher for the handy tree listing command, it made screenshotting much easier! 😄

My site files exported files
CleanShot 2025-04-25 at 16 31 38@2x CleanShot 2025-04-25 at 16 34 19@2x

Comment on lines +233 to +234
const isNodeModulesDirectory = relativePath.includes( 'node_modules' );
const isGitDirectory = relativePath.includes( '.git' );
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree IMO this should be strict enough! 👌

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

Successfully merging this pull request may close these issues.

3 participants