ethereumjs / ethereumjs-config

[DEPRECATED] Configuration is now added within a config folder of the EthereumJS monorepo
6 stars 8 forks source link

Delete dist folders on compilation #45

Closed holgerd77 closed 4 days ago

holgerd77 commented 3 years ago

Along the v5 releases we had an issue triggered by dist and dist.folder not being deleting along the tsc build, which led to an old opcodes.ts file still being present in the dist conflicting with a new opcodes folder. This caused problems for @jochem-brouwer when working on the client and was later on reported by a user on the Discord #vm channel, will paste my answer from there:

I have been looking into this. This is likely caused by me not having deleted my local dist and dist.browser folders when doing the releases. Some time ago we had this opcode refactor PR https://github.com/ethereumjs/ethereumjs-vm/pull/896 which moved opcodes from opcodes.ts (or js) file to a dedicated directly opcodes. With this leftover files in dist the file and folder probably didn't play well with each other. As a short term measure I have now deleted my dist folders. We are planning the final releases for Thursday, issue should be gone along these.

We should make sure that these folders are deleted on builds to prevent these kind of issues in the future.

First thought was that this could be easily solved by adding something to the ts-build.sh script, but the output directory is not directly know there, so not sure if this is solvable.

An option to the TypeScript compiler not seems to be available, I tested with a --clean option suggested here - didn't work - also on the TypeScript team they doesn't seem to be that much open to such an option , see issue here e.g. https://github.com/microsoft/TypeScript/issues/13722.

Alternatively we can also just add "rm -Rf dist && [DO THE COMPILATION]" in front of our local package.json commands. Would be a bit nicer if this can be solved in a generic way though.