npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

semver-from-git

v0.1.0

Published

Generate a new SEMVER based on last git semver tag

Downloads

1

Readme

semver-from-git

Generates a new SEMVER based on existing SEMVER tags in the git repo its run in.

Overview

Calculates and outputs a new SEMVER value based on existing SEMVER values.

  • SEMVER must be in the form of <MAJOR>.<MINOR>.<PATCH> I.E.: 0.1.0
    • or optionally based on the --prefix argument (in this example --prefix v) <PREFIX><MAJOR>.<MINOR>.<PATCH> I.E.: v0.1.0
  • SEMVER PATCH is incremented by one if the current commit is one or more commits later than the last SEMVER git tag in the repo

By default the program outputs the new SEMVER to stdout and to the file VERSION You can override the output filename/path by adding name to the command:

semver-from-git my-version-file
semver-from-git /somepath/my-version-file

If you don't want it to write to a file use the -n / --no-file flags

semver-from-git -n

SEMVER Scenarios

No Previous SEMVER Tag

If there are no git tag in the form of a SEMVER, it will consider 0.0.0 as the earlier SEMVER and will create a new SEMVER 0.0.1 as long as the current git commit is later than the first commit.

Bump the Major or Minor numbers

Create a tag in the form of RELEASE-<MAJOR>.<MINOR>. For instance to make SEMVERs start from 0.1.0:

git tag RELEASE-0.1
git push origin refs/tags/RELEASE-0.1

The next SEMVER the program will produce will be 0.1.0. Each one after that will bump the PATCH (last number) by one until a new RELEASE-m.n is created.

Your SEMVER tags have a prefix

You may have a prefix in front of the SEMVER such as a v: v0.1.0 If so run the program with the -p or --prefix flag

semver-from-git -p v

Note that the results do NOT have the prefix. It is up to you to add a prefix when you make the tag such as:

NEWTAG=v`semver-from-git -p v`

General Usage

$> semver-from-git -h
Generate a new semver based incremented from the last git tag that is a semver

Writes the result to stdout and to a file
The default output filename is VERSION

Usage: semver-from-git [filename]

Options:
  -p, --prefix PREFIX  Require a prefix before SEMVER
  -s, --sync           Do a git fetch --prune --tags first
  -n, --no-file        Only write to stdout. No output file
  -h, --help

Hacking

The program is written in Clojurescript and uses Lumo, a standalone ClojureScript environment that runs on Node.js and the V8 JavaScript engine.

The main source is in src/semver_from_git/core.cljs. A Bash script, bin/semver-from-git, is used to start it up as a lumo script. The Bash script has logic to run within the development environment:

git clone [email protected]:omnypay/semver-from-git.git
cd semver-from-git
npm install
bin/semver-from-git

Or after it is installed from npmjs.com or other source

npm install semver-from-git -g
semver-from-git

Adding New Clojure/Clojurescript Libraries

Note that this program expects to have any Clojure/Clojurescript libraries installed in lib/. They are explicitly specified in the lumo command line in bin/semver-from-git. Lumo requires that you must use libraries that are compatible with bootstrapped clojurescript.

For instance if you want to use core.async you must use the andar version.

It is possible to get these dependencies from your local maven repo by adding the -D to the lumo command line but that will not allow you to package the program up into your own npm package.

So you must put all the jars of any Clojure/Clojurescript libraries you want to use into lib/ in the repo. Also recursively any dependencies those libraries have. There isn't tooling yet to automate this. Calvin-cljs looks promising to help with this. Lumo project may also have something eventually.

Adding new NPM Libraries

Incorporating npm libraries is basically easy. You follow the normal npm process of adding dependencies by doing the following in the top of the repo:

npm install <package> --save

This should update your package.json with the new dependency

Author

Robert J. Berger @rberger Omnyway Inc.

Copyright & License

The MIT License (MIT)

Copyright © 2017 Omnyway Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.