Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for "build metadata"? #511

Open
Martii opened this issue Nov 26, 2014 · 4 comments
Open

Support for "build metadata"? #511

Martii opened this issue Nov 26, 2014 · 4 comments

Comments

@Martii
Copy link

Martii commented Nov 26, 2014

Apparently semver (item 10) does have a standard for build metadata... this could be quite useful to nodejitsu and your customers if it was supported in this package. TIA

@3rd-Eden
Copy link
Member

So instead of adding a - (dash) when bump your package.json version we used a + (plus sign)

@Martii
Copy link
Author

Martii commented Nov 26, 2014

REEDITED FOR CLARITY:
Not quite. Nodejitsu/jitsu still does that dash (-) numerical bump for backward compatibility... but we'd eventually like to send the commit hash (7 digit or full sha1sum) along with it to the nodejitsu backend with our project... then nodejitsu does whatever with it... e.g. perhaps append a custom name/value pairing to a nodejitsu specific portion of the package.json e.g. pass some names/values through... or even setting a custom environment variable... or just flat passing it through along with the dash bump that happens (0.0.0+sha1.12abc67 becomes 0.0.0-1+sha1.12abc67) ... so we can read one of these in programmatically. Then the issue with the -r could be resolved too since the backend has been ignoring that now from an issue I have with support.


Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata SHOULD be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85.

The bolded section is just about exactly what we are looking for from the semver docs... but the backend of jitsu e.g. nodejitsu would need to do something useful with it and jitsu would pass it through with -r or some other new switch.


Here's one of the possible examples to think about:

Sample project package.json that we do:

{
  "name": "Project",
  "description": "Projection description",
  "version": "0.0.0",
  "main": "index",
  "licenses": [
    {
      "type": "GPL-3.0+",
      "url": "http://www.gnu.org/copyleft/gpl.html"
    }
  ],
  "subdomain": "somedomain",
  "domains": [
    "somedomain.org"
  ],
  "scripts": {
    "start": "node index.js"
  },
  "engines": {
    "node": ">=0.10.33"
  }
}

We do a shell script along with a fictitious switch as of right now of:

#!/bin/bash

# Pretend this next line returns `12abc67`
HEAD=`git rev-parse --short HEAD`

# This next line would return `0.0.0`
VER=`node -p 'JSON.parse(process.argv[1]).version' "$(cat package.json)"` 

# The `-r` switch could validate numeric.numeric.numeric
# The `-b` switch could validate ASCII alphanumerics and hyphen [0-9A-Za-z-],
#    with the period `.` which can optionally mean whatever in the backend of Nodejitsu
jitsu deploy -c -r $VER -b $HEAD

Nodejitsu creates the snapshot with this package.json:

{
  "name": "Project",
  "description": "Projection description",
  "version": "0.0.0-1+12abc67",
  "main": "index",
  "licenses": [
    {
      "type": "GPL-3.0+",
      "url": "http://www.gnu.org/copyleft/gpl.html"
    }
  ],
  "subdomain": "somedomain",
  "domains": [
    "somedomain.org"
  ],
  "scripts": {
    "start": "node index.js"
  },
  "engines": {
    "node": ">=0.10.33"
  }
}

All of this could keep semver happy, nodejitsu and quite possibly more than just one customer too.

@Martii
Copy link
Author

Martii commented Nov 26, 2014

Do my huge, multiple, revisions above make more sense?

@Martii
Copy link
Author

Martii commented Jan 12, 2015

bump

Any progress of restoring the build metadata (e.g. everything including and after the + symbol) to the a projects package.json with $ jitsu deploy ?? TIA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants