hpack
hpack copied to clipboard
Add equivalent to NPMs `private` field
NOTE: This is an idea. Feedback is very much welcome!
https://docs.npmjs.com/files/package.json#private
When a user adds
private: true
to package.yaml
he wants to guard against accidental publication of the package.
Build tools like stack
can look at this information and refuse to publish it if it's set to true
.
An other method, that does not require any support from build tools, would be to generate a .cabal
file that will be rejected by Hackage when private: true
.
I used to use license: AllRightsReserved
to mark a package as "private". However it looks like the SPDX changes in Cabal have made that invalid:
unexpected Unknown SPDX license identifier: 'AllRightsReserved' You can use
NONE as a value of license field.
Setting license: NONE
and running cabal check
spits this out:
The following errors will cause portability problems on other environments:
* The 'license' field is missing or is NONE.
Hackage would reject this package.
So maybe setting private: true
could set license: NONE
?
So maybe setting private: true could set license: NONE
That is a good point; omiting license
all together should have the same effect I guess.
This also means that a user can already simulate this feature by simply omitting license
from package.yaml
. Maybe this is already good enough?
I used to use
license: AllRightsReserved
to mark a package as "private". However it looks like the SPDX changes in Cabal have made that invalid:
hpack
will continue to support traditional cabal license identifiers, including AllRightsReserved
, alongside SPDX license expression. If cabal-version
is >= 2.2
traditional license identifiers are mapped to SPDX license expressions. AllRightsReserved
is mapped to NONE
. I updated the README https://github.com/sol/hpack/commit/f54994557e4a25597463bd3f171a109feb73f06a.