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

ci-auto-version

v0.3.3

Published

Auto versioning for continuous integration pipelines.

Downloads

4

Readme

CI-AUTO-VERSION

Automatic Versioning for Continuous Integration Pipelines

About

ci-auto-version is designed to seemlesly intagrate semantic versioning in to your pipeline automation. It is tested under bicbucket CI Pipelines but will work on others such as gitlab as well.

Usage

Add [minor] or [major] into the merge commit message to upgrade respective semver digit. If nothing is added, patch upgrade will be implemented by default.

Installation to pipeline

sample 'bitbucket-pipelines.yml' file

image: node:10.15.3

pipelines:
  branches:
    master:
      - step:
          caches:
            - node
          script: # Modify the commands below to build your repository.
            - npm install
            - # npm test
            - npm install [email protected] --no-save
            - node node_modules/ci-auto-version/auto_version.js
        

The above pipeline automation script will run on every commit to master including merge requests. If you have npm test script in your package please uncomment # npm test line above to run your tests before.

Full Usage with Merge (Pull) Request and Postgres Database Support and npm test script implemented.

sample 'bitbucket-pipelines.yml' file

image: node:10.15.3

pipelines:
  branches:
    master:
      - step:
          caches:
            - node
          script: # Modify the commands below to build your repository.
            - npm install
            - npm test
            - npm install [email protected] --no-save
            - node node_modules/ci-auto-version/auto_version.js
          services:
            - postgres

  pull-requests:
    '**': #this runs as default for any branch not elsewhere defined
      - step:
          caches:
            - node
          script: # Modify the commands below to build your repository.
            - npm install
            - npm test
          services:
            - postgres

definitions:
  services:
    postgres:
      image: postgres
      variables:
        POSTGRES_DB: 'my_db_name'
        POSTGRES_USER: 'my_postgres_user'
        POSTGRES_PASSWORD: 'my_postgres_pwd'

The above code may be used to initiate your pipeline automation with full Postgres support.

Notes
  • Don't forget to change node version according to your package.
  • Install during pipeline is invoked with --no-save , since ci-auto-versioning script modifies package.json and pushs to original repositories master. --no-save enables that our temporary installation during pipeline stays temporary.
  • You may change ci-auto-version command line parameters. Eg. running it with --verbose or -vb , will give more information about the on going process, exposing git commands and their results into the pipeline terminal.
  • If you always want to use latest version of ci-auto-version, you may prefer to install it without version suffix as npm install ci-auto-version. However, it is safer to change version manually after a new release has been published and tested.
Running Pipeline with Environment Variables
  • ci-auto-version uses $CI_AUTO_VERSION environment varible to pass arguments pefore running the pipeline manually.
  • Please pass the arguments into $CI_AUTO_VERSION environment varible as string like --force --verbose , or -ft -vb one line string.
  • Run the pipeline manually.

Example Usage:

Force update existing tags :

node ./node_modules/ci-auto-version/auto_version.js --user UserName --email [email protected] -force

OR

Execute using sh file showing git commands and results :

sh ./node_modules/ci-auto-version/auto_version.sh -us Lorem -em [email protected] -vb
Command Line Options

--operation, -op [ major | minor | patch | ignore ] Definition : Defines the semver digit to increase. Default Value : last_commit_message

--user-name, -us [ | last_commit_author ] Definition : Defines username of commit to repository. Default Value : last_commit_author

--email, -em [ | last_commit_email ] Definition : Defines email of commit to repository. Default Value : last_commit_email

--commit-message, -cm [ "" | last_commit_message ] Definition : Defines commit message of the commit to repository. Default Value : last_commit_message

--force-tag, -ft
Definition : Forces update tag if it already exists. Default Value : false

--ignore-error, -ir
Definition : Ignores errors and continue process with next command.(NOT RECOMENDED!) Default Value : true

--print-result, -pr
Definition : Prints result of the git commands to the pipeline terminal. Default Value : false

--print-command, -pd
Definition : Prints git commands to the pipeline terminal. Default Value : false

--print-parameters, -pp
Definition : Prints run time parameters to the pipeline terminal. Default Value : false

--print-arguments, -pa
Definition : Prints command line arguments to the pipeline terminal. Default Value : false

--print-envvar, -pe
Definition : Prints environment variable content to the pipeline terminal. Default Value : false

--verbose, -vb
Definition : Prints all output including git commands and results to the pipeline terminal. Default Value : false

--silent, -si
Definition : Does not print anything rather than errors to the pipeline terminal. Default Value : false

--major-pattern, -mj Definition : Defines commit message pattern for major version upgrade. Default Value : [major]

--minor-pattern, -mp Definition : Defines commit message pattern for minor version upgrade. Default Value : [minor]

--patch-pattern, -pp Definition : Defines commit message pattern for minor version upgrade. Default Value : [patch]

--ignore-pattern, -gp Definition : Defines commit message pattern to bypass version upgrade. Default Value : [ignore]

--default-action, -df [ patch | minor | major | ignore ] Definition : Defines default action when no pattern matched in commit message. Default Value : patch

--skip-ci-pattern, -sp Definition : Defines pipeline command used in commit message, not to run pipeline. Default Value : [skip CI]

--no-skip-ci, -ns
Definition : Does not add skip-ci-pattern eg.[skip CI] into commit message. Pipeline runs twice but version does not change since there will be no commit on last run. Default Value : false

--version-prefix, -vp Definition : Defines string which will be added as prefix of the version in tag name. Eg. v2.3.12 Default Value : v

--initial-version, -vi .. Definition : The initial value of version if no version tag is found and it can not be extracted from package file. Default Value : 1.0.0

--package-file, -pf <PackageFileName.json> Definition : Json file in which version field will be changed. Default Value : package.json

--version-field, -pv Definition : Version field name which will be updated in package json file. Default Value : version

--env-var, -ev Definition : Environment Variable name which is used to pass arguments. Default Value : CI_AUTO_VERSION

--simulate, -sm
Definition : Simulates write to file and git commands preventing permanent changes to the repo. Default Value : false

--test-repo, -tr Definition : Defines remote repository changes are pushed. Default Value : null

--test-folder, -tf Definition : Defines local folder where git commands are executed. Default Value : null

--test-run, -test
Definition : Runs in test mode where git commands are executed in local test folder and changes are pushed to test repo Default Value : null

--test-message, -tm "" Definition : Defines commit message for test purposes from where version command is extracted. Default Value : null

--create-test-commit, -ct Definition : Creates a new test commit to test versioning. Default Value : null