redis-semaphore icon indicating copy to clipboard operation
redis-semaphore copied to clipboard

update package.json with files array

Open hilleer opened this issue 1 year ago • 2 comments

Use files property in package.json to explicit show what files are included (in contradiction to .npmignore where you specifically exclude "some" files).

This way one avoids accidentally publishing non-compiled code like src/ folder etc:

Screenshot 2024-07-25 at 09 03 00

Note that a bunch of files are always considered when publishing and does not have to be listed in the list accordingly to the docs:

Screenshot 2024-07-25 at 09 01 49

hilleer avatar Jul 25 '24 07:07 hilleer

Hi! The src folder is included in the package intentionally, because it is convenient for debugging errors occurring inside the library. Why it is necessary to remove it?

swarthy avatar Oct 12 '24 09:10 swarthy

Hi! The src folder is included in the package intentionally, because it is convenient for debugging errors occurring inside the library. Why it is necessary to remove it?

You can close it if that is the intention 👍 I thought it was a mistake and potential gain for reducing the size of the published library slightly. Is there any use of the source code for users of the library?

hilleer avatar Oct 14 '24 07:10 hilleer

Hi, I'm facing some TypeScript issues due to the included src folder. I have an ESM package with verbatimModuleSyntax option enabled in tsconfig.json. Type-check is reporting:

node_modules/redis-semaphore/src/errors/LostLockError.ts:1:1 - error TS1287: A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled.

1 export default class LostLockError extends Error {}
  ~~~~~~

Removing src folder from node_modules resolves the issue. How about excluding src from the package?

CatchMe2 avatar Mar 12 '25 12:03 CatchMe2

@swarthy If you intend to keep shipping ts files, can they at least be made compatible with verbatimModuleSyntax option?

kibertoad avatar Mar 21 '25 21:03 kibertoad

Released in v5.6.2

swarthy avatar Mar 22 '25 11:03 swarthy

@swarthy Thank you, the change helped!

kibertoad avatar Mar 22 '25 13:03 kibertoad