npm / ndm

ndm allows you to deploy OS-specific service-wrappers directly from npm-packages.
ISC License
182 stars 22 forks source link

Infer module, description, and scripts.start from package.json #84

Closed zeke closed 10 years ago

zeke commented 10 years ago

Things would be a bit more DRY in service.json if ndm would read from package.json in the absence of certain properties. Instead of this:

{
  "newww": {
    "module": "newww",
    "description": "A total rewrite of npm-www using hapijs",
    "scripts": {
      "start": "node server.js"
    },
    "env": {
      "PORT": "8081"
    },
    "args": {}
  },
  "newww2": {
    "module": "newww",
    "description": "A total rewrite of npm-www using hapijs",
    "scripts": {
      "start": "node server.js"
    },
    "env": {
      "PORT": "8082"
    },
    "args": {}
  },
  "newww3": {
    "module": "newww",
    "description": "A total rewrite of npm-www using hapijs",
    "scripts": {
      "start": "node server.js"
    },
    "env": {
      "PORT": "8083"
    },
    "args": {}
  },
  "newww4": {
    "module": "newww",
    "description": "A total rewrite of npm-www using hapijs",
    "scripts": {
      "start": "node server.js"
    },
    "env": {
      "PORT": "8084"
    },
    "args": {}
  }
}

I would prefer something like this:

{
  "newww": {
    "env": {
      "PORT": "8081",
      "NODE_ENV": "PRODUCTION"
    }
  },
  "newww2": {
    "env": {
      "PORT": "8082",
      "NODE_ENV": "PRODUCTION"
    }
  },
  "newww3": {
    "env": {
      "PORT": "8083",
      "NODE_ENV": "PRODUCTION"
    }
  },
  "newww4": {
    "env": {
      "PORT": "8084",
      "NODE_ENV": "PRODUCTION"
    }
  }
}

For personal reference, these spots in the code are related:

zeke commented 10 years ago

PS This is related to https://github.com/npm/newww/pull/164

bcoe commented 10 years ago

I've implemented your suggestions in: https://github.com/npm/ndm/pull/85, really helps clean things up.