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

feat: support copy builder #389

Merged
merged 5 commits into from
Jun 4, 2024
Merged

feat: support copy builder #389

merged 5 commits into from
Jun 4, 2024

Conversation

dwightjack
Copy link
Contributor

@dwightjack dwightjack commented Apr 24, 2024

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR adds a copy builder, very similar to the mkdist one. Similarly to mkdist, the builder accepts input, outDir and pattern options. Example:

import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
  entries: [
    {
      builder: "copy",
      input: 'src/assets',
      pattern: '*.png', // defaults to '**'
      outDir: 'dist'
    },
});

It also provides the following hooks:

  • copy:entries: to hook to the entries array
  • copy:done: to hook to the context once the copy process has completed.

If you feel this initial implementation could be useful, I can update the documentation with an example.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

src/builder/copy.ts Outdated Show resolved Hide resolved
@pi0 pi0 changed the title Feat: add a copy builder (tentative implementation) feat: add a copy builder Apr 24, 2024
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks!

@pi0 pi0 changed the title feat: add a copy builder feat: support copy builder Jun 4, 2024
@pi0 pi0 merged commit 38c9a8f into unjs:main Jun 4, 2024
0 of 2 checks passed
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.

add copy builder
2 participants