When the main field of a pilet's package.json is pointing to the source file instead of the anticipated output then the Piral CLI first removes the corresponding source folder and then exists with an error that the source file is not longer found (true, it first removes it).
Steps to Reproduce
Scaffold a new pilet
Change main to be src/index.tsx instead of dist/index.js
Run pilet publish --fresh ...
Expected behavior
The format expects the package.json's main to point to the target / produced file so maybe printing an error might be the correct response.
Actual behavior
The source folder is removed.
Possible Origin/Solution
Validate the package.json validity beforehand - make sure that the target != source (such that deleting the target would never delete the source).
Bug Report
For more information, see the
CONTRIBUTING
guide.Prerequisites
Environment Details and Version
Ubuntu, Piral CLI 1.4.1
Description
When the
main
field of a pilet's package.json is pointing to the source file instead of the anticipated output then the Piral CLI first removes the corresponding source folder and then exists with an error that the source file is not longer found (true, it first removes it).Steps to Reproduce
main
to besrc/index.tsx
instead ofdist/index.js
pilet publish --fresh ...
Expected behavior
The format expects the package.json's
main
to point to the target / produced file so maybe printing an error might be the correct response.Actual behavior
The source folder is removed.
Possible Origin/Solution
Validate the package.json validity beforehand - make sure that the target != source (such that deleting the target would never delete the source).