shama / napa

:wine_glass: A helper for installing stuff without a package.json with npm.
MIT License
413 stars 34 forks source link

Default version for generated package.json is always '0.0.0' #78

Open ZaDarkSide opened 7 years ago

ZaDarkSide commented 7 years ago

The default version for generated package.json is defined in file lib/pkg.js:

    pkg = {
      name: this.name,
      version: '0.0.0', // here is the default version
      description: '-',
      repository: {type: 'git', url: '-'},
      readme: '-'
    }

has version: '0.0.0'

It should read the version from the tag/release I have chosen in my package.json:

...
  "scripts": {
    "install": "napa"
  },
  "napa": {
    "datatables.net-plugins": "DataTables/Plugins#1.10.13" // should take version 1.10.13 from here
  }
...
Grawl commented 7 years ago

It's a complex problem because napa can download just anything and make a package out of it. I think we should not parse URL and add separate version field instead. Like this:

{
  "napa": {
    "datatables.net-plugins": {
      "url": "DataTables/Plugins#1.10.13",
      "version": "1.10.13"
  }
}