5 ms·
npm install sigh...
by cachestash 6y ago
npm install
sigh...
- camdenlock 6y agoYeah, this is where I lost interest too.
- crispyporkbites 6y agoI don’t understand why npm install is so bad here? It’s just a package manager. It’s not hard to write your implementation without npm if you prefer.
- fabianhjr 6y agoit is, I tried with haskell and gave up when I noticed I couldn't easily get json serialization to be in the same order as the javascript implementation and therefor couldn't verify nor sign messages with interoperability with the current clients.
- codygman 6y ago> I tried with haskell and gave up when I noticed I couldn't easily get json serialization to be in the same order as the javascript implementation and therefor couldn't verify nor sign messages with interoperability with the current clients. This gets you most of the way there: > With the Aeson library, the order of keys in objects is undefined due to objects being implemented as HashMaps. To allow user-specified key orders in the pretty-printed JSON, encodePretty' can be configured with a comparison function. - https://hackage.haskell.org/package/aeson-pretty-0.8.7/docs/Data-Aeson-Encode-Pretty.html#g:3 https://hackage.haskell.org/package/aeson-pretty-0.8.7/docs/... I'm not sure that messes with spacing or not though or you require specific space preserving requirements to interoperate with current clients. Even if not you can probably look at the source of encodePretty' and work out how to not mess with spacing or keep it all on one line. I've wanted a version of Aeson for a while that preserves order and all formatting for things like linters that are very unobtrusive. It seems your use case would have benefitted from that as well.
- fabianhjr 6y agoWell, the problem is replicating the javascript order which isn't lexicographical. :/
- codygman 6y agoThis gives you the ability to arbitrarily order via user defined list (the first argument) and then to order by some comparison function if for instance a new key were added (length in this example). Given the example: { "baz": ..., "bar": ..., "foo": ..., "quux": ..., } Then listing all of the keys in your desired order: comp :: Text -> Text -> Ordering comp = keyOrder ["foo","bar","baz","qux"] `mappend` comparing length Note if you list all keys in the first argument of keyOrder it never goes to comparing length. There is probably a cleaner way to denote that this is the case but I can't be bothered to figure it out atm. You can use this function: encodePretty' defConfig { confCompare = comp } YourType And it will produce: { "foo": ..., "bar": ..., "baz": ..., "quux": ..., } Can you give a sample of the javascript in the order necessary? This is from NPM? They have to use some comparison function to figure out how to sort their keys I'd imagine, so you could just copy that with Haskell.
- Aeolun 6y agoI think npm is barely a package manager. Yarn is a bit better, but it’s also my experience with most of the stuff in the JS ecosystem.
- capableweb 6y agoI think the quality of X doesn't determine what X is. npm is a package manager, it manages packages for you. Hard to escape that fact. It's a bit rubbish, but it doesn't make it _not_ a package manager. Same with the USA, might be a shitty country, doesn't mean it's barely a country
- Aeolun 6y agoDepends I think. If you make a package manager, but the only function it has is text editing, is it a package manager? If you get too far from what people aim to use your tool for, are you still a tool for x?
- capableweb 6y ago> If you make a package manager, but the only function it has is text editing If it quacks like a duck, looks like a duck, it's a duck. If it doesn't quack and doesn't look like a duck, it's not a duck. So in your example, if npm just provides text editing, I'd call it a text editor, not package manager. If it manages packages, I'd call it a package manager. So this is judging things based on their functionality, rather than what they want to use it for. Don't think the intended purpose matters too much in what something is. It is what it is, it is not what it was aimed to be but what the current state of it is. And AFAIK, people _mostly_ use npm for managing packages, other use cases are not nearly as popular (like distributing assets).
- alephnan 6y agoThen again, JavaScript can be thought of as the language of the distributed web...