Giter VIP home page Giter VIP logo

Comments (15)

rlidwka avatar rlidwka commented on June 10, 2024

I'm hesitant to do this because it's not a source file, and it's not supposed to be edited manually. It's a pain to keep it in sync, so I try to avoid this as much as possible.

It's basically the same thing as with .js files in coffee-script project. They shouldn't be in repository.

That way people can install directly from the repo, because sometimes the version on npmjs.org is outdate, like now, there's a bug on dist-tags.

They can install it directly from repo now, nothing is really stopping it.

But if the version on npmjs.org is broken, it's a good reason to open an issue and demand to fix that as soon as possible. npmjs version wasn't outdated, it was broken, and it just shouldn't happen.

from sinopia.

thegiantbeast avatar thegiantbeast commented on June 10, 2024

@rlidwka you can't install with sinopia without the package.json.
But if that's your point (which is valid!), could you put a script to generate that file? Like picking the info from package.yml and rendered as json?

And when I said "outdated" was because there were commits in the repo without a release version. I wasn't saying that it was a very old version.

from sinopia.

rlidwka avatar rlidwka commented on June 10, 2024

@rlidwka you can't install with sinopia without the package.json.

Yeah, you do, just not with default npm installation which is a shame.

$ npm install -g yapm
$ yapm install https://github.com/rlidwka/sinopia.git

But if that's your point (which is valid!), could you put a script to generate that file?

The script would be:

$ npm install -g js-yaml
$ js-yaml -j package.yaml > package.json

But you still can't do it without installing additional software. :(

from sinopia.

josephg avatar josephg commented on June 10, 2024

Can you document this package.json build line somewhere? I just wasted a bunch of time trying to figure out how to npm install in a git checkout.

from sinopia.

ralphtheninja avatar ralphtheninja commented on June 10, 2024

+1

It's very confusing if the package.json is missing. A normal workflow for me (and I suspect other node devs) is to fork the git repo, clone it and then simply do npm install/npm link. I had the same feeling as @josephg. yapm adds extra noise and is yet another way of installing something that I have to learn.

from sinopia.

rlidwka avatar rlidwka commented on June 10, 2024

Okay, question:

How do I create a package.json file that does this?:

  1. installs js-yaml
  2. compiles package.yaml into package.json
  3. re-runs npm again

Would that work? js-yaml is a dependency, so it would need to be installed anyway.

from sinopia.

ralphtheninja avatar ralphtheninja commented on June 10, 2024

Why not just use package.json and be done with it?

from sinopia.

rlidwka avatar rlidwka commented on June 10, 2024

Why not just use package.json and be done with it?

JSON is pain to manage, so I hope npm would eventually move to something more sensible. The more people use it, the more is chance that it would be so.

I'd note that I have a private project in my company where it is actually required to use yaml, just because there is need to comment out dependencies.

When I created this a year ago, I was the only developer, and other people didn't have any issues with it because they used version from npm (which has it compiled automatically on publish).

Now I see that it's necessary to provide some support for it, but I can't quite understand how to do that. Best bet is probably "prepublish": "make" with a Makefile, won't be portable though.

from sinopia.

ralphtheninja avatar ralphtheninja commented on June 10, 2024

Sure, I can agree with you that JSON is a pain to manage, but that's the de facto format for handling modules on npm. This is obviously not a problem for people that just want to use the module, since they simply do npm install, but if they want to develop on sinopia they are forced to install yet another tool, which shouldn't be necessary. My point is that since yml is convenient for you, it might be inconvenient for others.

from sinopia.

josephg avatar josephg commented on June 10, 2024

I think there's two problems:

  1. I have no idea how to compile package.yaml to package.json - when I was messing around, I spent 10 minutes trying to figure out how to do that then I gave up and installed from npm and copied the package.yaml over. I still don't know how to compile package.yaml to package.json.
  2. Like it or not, JSON is the standard, and at this point nodejs will never move away from package.json. Maybe a couple of years ago if you convinced enough of the right people, that might have happened.. But its not going to happen now. I ended up abandoning coffeescript in my opensource projects for the same reason - which was sad, but I think the social cost of coffee is bigger than the technical benefit of coffee. (This is despite my company using coffeescript exclusively for our internal code).

Anyway, 1 is solved really easily - just add a makefile, or really clear instructions in the readme, or something for humans.

Separately, you should also add a "prepublish":"hidden yaml commands" step to make sure package.json is up-to-date whenever you npm publish.

from sinopia.

ralphtheninja avatar ralphtheninja commented on June 10, 2024

If you really want to use yaml, another think you can do is just to generate the package.json and commit that as well.

from sinopia.

rlidwka avatar rlidwka commented on June 10, 2024

@ralphtheninja

but if they want to develop on sinopia they are forced to install yet another tool

No, it's just js-yaml package.yaml > package.json, and js-yaml is a dependency anyway because of config file format. But it needs to be automated somehow.

@josephg

I have no idea how to compile package.yaml to package.json - when I was messing around, I spent 10 minutes trying to figure out

I'm sorry about that, it really shouldn't happen...

I ended up abandoning coffeescript in my opensource projects for the same reason

Why? When I moved out from coffeescript, it was for pure technical reasons (namely, "node debug" showed compiled js back then).

from sinopia.

rlidwka avatar rlidwka commented on June 10, 2024

Okay, I added package.json to the repository. It's really ugly hack, it shouldn't be like this, but as far as I see, it works mostly.

I'll also try to contact these guys, they seem to have the same problem.

from sinopia.

josephg avatar josephg commented on June 10, 2024

... Because I got tired of having this argument every 4 months or so. Also, to many people coffeescript is a flag on your repo kind of saying "I don't think of myself as part of the community". There's a surprising amount of emotion that comes out of that sort of thing, especially when people notice that at the same instant they're deciding whether to use your module. The YAML thing is much more minor.

from sinopia.

rlidwka avatar rlidwka commented on June 10, 2024

I might have found a way to avoid it after all.

npm allows to define package metadata in index.js file with /**package ... **/format like that. It's still valid JSON only, so no point in using that directly.

But it could contain postinstall scripts to compile actual package.json and re-run npm again after that. This way npm users will be able to install it (at least npm install rlidwka/sinopia works fine).

Testing this idea right now...

from sinopia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.