feat: add support for watching copy source files#721
feat: add support for watching copy source files#721schplitt wants to merge 4 commits intorolldown:mainfrom
Conversation
✅ Deploy Preview for tsdown ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
tsdown
create-tsdown
tsdown-migrate
commit: |
src/features/watch.ts
Outdated
| const copyOptions: CopyOptions = | ||
| typeof config.copy === 'function' | ||
| ? await config.copy(config) | ||
| : config.copy | ||
|
|
||
| const copyFiles = ( | ||
| await Promise.all( | ||
| toArray(copyOptions).map((entry) => { | ||
| if (typeof entry === 'string') { | ||
| return resolveFilePatterns(entry, config.cwd) | ||
| } | ||
| return resolveFilePatterns(entry.from, config.cwd) | ||
| }), | ||
| ) | ||
| ).flat() |
There was a problem hiding this comment.
Do not copy existing code, extract them instead.
src/utils/general.ts
Outdated
| * @param globOptions.expandDirectories - Expand directories (default: false) | ||
| * @returns Array of absolute file paths | ||
| */ | ||
| export async function resolveFilePatterns( |
There was a problem hiding this comment.
Remove this function. See src/features/copy.ts
2f6ea1c to
dcaef07
Compare
|
Thanks for the review Please let me know if you would rather have a utility file for |
|
Hi @schplitt, thanks for the PR! It also fixes the issue where in watch mode with the |
✅ Deploy Preview for tsdown-main ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
b214f6e to
139076c
Compare
Description
Adds support for watching files specified in the
copyconfiguration option. Now triggers a rebuild whenever a copied asset is changed.Linked Issues
resolves #720
Additional context
I have manually tested this and confirmed that it works.
However, I have not found a good way to have an automated test for this.
What would be the best way forward regarding testing in this case?