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

Respect copy from/copy to extended headers #530

Open
aaronadamsCA opened this issue Aug 5, 2024 · 0 comments
Open

Respect copy from/copy to extended headers #530

aaronadamsCA opened this issue Aug 5, 2024 · 0 comments

Comments

@aaronadamsCA
Copy link

Under TypeScript node16 module resolution, I often find myself needing to fix broken ESM types in packages by copying their type definition files (example package).

These diffs currently show a new file command with the full content of the copied file, which makes them very long and hard to maintain from release to release.

diff --git a/dist/hls.js.d.ts b/dist/hls.d.mts
similarity index 100%
rename from dist/hls.js.d.ts
rename to dist/hls.d.mts
diff --git a/dist/hls.d.ts b/dist/hls.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7ba8086b369797b5778b5295443cdd07e6beb72c
--- /dev/null
+++ b/dist/hls.d.ts
@@ -0,0 +1,3105 @@
+export declare interface AbrComponentAPI extends ComponentAPI {
+    firstAutoLevel: number;
+    forcedAutoLevel: number;
(3000+ more lines)

I can generate my own much smaller patch using git diff --find-copies-harder. It's both easier to understand and easier to keep updated with the underlying package.

diff --git a/dist/hls.js.d.ts b/dist/hls.d.mts
similarity index 100%
copy from dist/hls.js.d.ts
copy to dist/hls.d.mts
diff --git a/dist/hls.js.d.ts b/dist/hls.d.ts
similarity index 100%
rename from dist/hls.js.d.ts
rename to dist/hls.d.ts

Unfortunately patch-package silently ignores these copy from/copy to headers.

When applying a patch generated by git diff, it would be great if this package would copy files. If that's not possible, then it should at least refuse to apply the patch.

Full list of extended header lines: https://git-scm.com/docs/diff-generate-patch#generate_patch_text_with_p

Thanks!

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

No branches or pull requests

1 participant