cap-js / cds-types

Type definitions for CDS
Apache License 2.0
10 stars 10 forks source link

[BUG] Symlink to sap__types is deleted after each npm command #251

Open levkovsb opened 1 month ago

levkovsb commented 1 month ago

The issue persists in the version 0.6.5. As long as I execute any npm script in one of the workspaces of our monorepo, the symlink is gone and the project is no longer runnable. Please investigate further

Originally posted by @levkovsb in https://github.com/cap-js/cds-types/issues/216#issuecomment-2371170882

daogrady commented 1 month ago

Hi @levkovsb ,

thanks for bringing this up again. Can you run npm rebuild in your repository and see if that recreates the symlink?

Best, Daniel

daogrady commented 4 weeks ago

@levkovsb also, can you please describe your setup in more detail or, preferably, provide a minimal reproduction setup? Is cds-types referenced in the mono repo root or in one of the subprojects?

levkovsb commented 3 weeks ago

@daogrady I have tried npm rebuild, it does not solve the issue. We have cds-types referenced in the package.json file in the monorepo root as a devDependency. There we also define our workspaces, e.g. "plugin/cross/*". Then in the plugin/cross/com folder we have its own package.json file that does not reference cds-types. The problem occurs when we run commands like npm publish.

Markus-Schroeder-de commented 1 week ago

The symlink is often deleted. if i call mtb build, afterwards it is gone (because it calls npm i). "npm rebuild" does the magic.

daogrady commented 6 days ago

Hi @levkovsb ,

as @Markus-Schroeder-de suggested, you can try npm repair to see if that fixes the symlink. Could you elaborate why you don't just reference @cap-js/cds-types in each project's devDependency list?

Best, Daniel