Skip to content

Conversation

@axic
Copy link
Contributor

@axic axic commented Oct 10, 2016

Fixes the out of order versions.

However for simplicity we should just move to dates in the form of YYYY.MM.DD (and not YYYY.M.D).

@chriseth
Copy link
Contributor

Haha! Yes, we could use yyyy-mm-dd, but that would not be semver, because leading zeros are not allowed, not even in the prerelease components....

update Outdated
version += '-' + build.prerelease;
}
if (build.build && build.build.length > 0) {
version += '-' + build.build;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be '+' here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

fs.readdir(path.join(__dirname, '/bin'), function (err, files) {
if (err) return err

function buildVersion (build) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to rebuild it again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually if we rebuild it with MM.DD we don't even need semver to do the comparison.

.map(function (pars) { console.log(pars[0]); return { path: pars[0], version: pars[1], prerelease: pars[3], build: pars[5] } })
.sort(function (a, b) {
// NOTE: a vs. b (the order is important), because we want oldest first in the list
return semver.compare(buildVersion(a), buildVersion(b))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just use the semver module to also parse the version string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, the only downside having semver is that it must be npm installed before running update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually semver doesn't seem to return the build part (only versions and prerelease).

@axic
Copy link
Contributor Author

axic commented Oct 13, 2016

This works well with #11 (parsedList becomes the sortedList).

@axic
Copy link
Contributor Author

axic commented Oct 13, 2016

@chriseth are we happy adding semver a requirement of update?

The Solidity push script
a) needs to be changed to include npm install semver or
b) we need to add package.json and the script needs to be change to include npm install

I prefer a) for the moment, until we add more dependencies.

@axic
Copy link
Contributor Author

axic commented Oct 14, 2016

Actually I think it is more future proof (less changes in the Solidity repo) if we have a package.json (marked private).

@chriseth added that in that case we could also run npm run build in Solidity and therefore making the Solidity repo even less dependent on the layout of this repo.

@chriseth chriseth merged commit 46fac73 into gh-pages Oct 19, 2016
@axic axic deleted the sort branch October 19, 2016 12:34
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

Successfully merging this pull request may close these issues.

3 participants