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

gulp-codename

v0.1.1

Published

A gulp plugin to include codename for your application based on SEMVER version.

Downloads

832

Readme

gulp-codename

Build Status GitHub version Dependencies Progress

NPM

Utility to include a codename for your application based on version (up-to v10.X.X-X).

This works great alongside version bump utility: gulp-bump for keeping your version numbers and names up-to-date with each build.

Included codenames and patch names created with the help of the excellent codenamegenerator.com website.

Getting started

This plugin requires gulp.

Once you're familiar with that process, you may install this plugin with this command:

npm install gulp-codename --save-dev

Once the plugin has been installed, it may be enabled inside your gulpfile with this line of JavaScript:

var codename = require('gulp-codename');

The project follows the SemVer guidelines for version numbers; specifically following: 1.2.3-1 being MAJOR.MINOR.PATCH-BUILD.

N.B. The supplied codenames and patch names only include support for single-digit numbers used for minor and patch of the version field (and major up to 10) - you must supply your own custom codenames and patch names if you can't handle this restriction (but that's a lot of names)!

The "codename" task

Overview

In your project's gulpfile.js, add a task named codename.

gulp.task('codename', function() {
  return gulp.src('./package.json')
    .pipe(codename())
    .pipe(gulp.dest('./'));
});

codename allows to set the codename and patch name based on the version number of the configuration file (package.json) in your project. Only JSON files are supported, and each file must have a version field compliant to SemVer guidelines; specifically following: 1.2.3-1 being MAJOR.MINOR.PATCH-BUILD.

Remember: The supplied codenames and patch names only include support for single-digit numbers used for minor and patch of the version field (and major up to 10) - you must supply your own custom codenames and patch names if you can't handle this restriction (but that's a lot of names)!

Example JSON

codename is designed to update your package.json, manifest.json or any other JSON file with a "version" field (configured as noted above).

An example of a manifest.json file is below:

{
	"name": "My Test Application",
	"version": "1.3.2-16",
	"codename": "",
	"patchname": "",
	"description": "A test application for me."
}

Once codename has been used (with patch names enabled); the manifest.json file would be updated automatically as follows:

{
	"name": "My Test Application",
	"version": "1.3.2-16",
	"codename": "Honiara Nimitz",
	"patchname": "Ithomiid",
	"description": "A test application for me."
}

Options

options.* | Type | Default | Description ---|:---:|:---:|--- patchname|Boolean|false|Generate a name for the patch version as well as the main codename. codenames|File|undefined|Use a custom JSON file for codenames.

Default Options

Running the task in this way, the codename and patchname fields of each source file will be automatically changed to the correct codename and patch name for the build release.

gulp.task('codename', function() {
  return gulp.src('./package.json')
    .pipe(codename())
    .pipe(gulp.dest('./'));
});

Custom Options

Running the task in this way, the codename field of each source file will be changed to the correct codename but patch name will not be included.

The names contained within the user-supplied myCodenames.json file will be used.

gulp.task('codename', function() {
  return gulp.src('./package.json')
    .pipe(codename({
    	codenames: 'myCodenames.json',
    	patchname: false
    }))
    .pipe(gulp.dest('./'));
});

Use with gulp-bump

You can add the codename task alongside your bump task as follows:

gulp.task('bump', function() {
  return gulp.src('./package.json')
    .pipe(bump({ type: 'patch' }))
    .pipe(codename())
    .pipe(gulp.dest('./'))
});

Contributing

Any contribution to improve the project and/or expand it is welcome.

If you're interested in contributing to this project, take care to maintain the existing coding style.

To contribute:

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Add unit tests for any new or changed functionality. Lint and test your code using gulp.

Changelog

Changes, bug fixes and enhancements made to gulp-codename.

gulp-codename v0.1.0

"Bronze Marklar"

  • Release promoted to v0.1.0.
  • BREAKING CHANGE (if using own JSON file): Renamed "codeNames" to "codenames" within codenames.json.
  • BREAKING CHANGE (if using own JSON file): Renamed "patchNames" to "patchnames" within codenames.json.
  • Code cleanup.
  • Code commented.
  • Included additional error checking.
  • Updated gulp log during codename generation for readability.
  • Removed unnecessary patch name "0".
  • README.md updates/fixes.

gulp-codename v0.0.7

"Perseus Amber" (Malbrouck)

  • Corrected README.md.
  • Included "gulpfriendly" within package.json.

gulp-codename v0.0.6

"Perseus Amber" (Anoa)

  • Ignores unsupported 2-digit version numbers (e.g. "v.0.10.0") - unless custom JSON is used and includes support for this.
  • Codename unaltered if unavailable for current version.
  • Patch name cleared if unavailable for current version.

gulp-codename v0.0.5

"Perseus Amber" (Uromastix)

  • Updated log output.

gulp-codename v0.0.4

"Perseus Amber" (Tayra)

  • Removed debug log.
  • Updated README.md detailing use alongside bump task.

gulp-codename v0.0.3

"Perseus Amber" (Pangolin)

  • Fixed problem with loading the codenames.json file.

gulp-codename v0.0.2 (Deleted)

"Perseus Amber" (Ithomiid)

  • Fixed README.md

gulp-codename v0.0.1 (Deleted)

"Perseus Amber" (Saiga)

  • Initial commit

License

See the LICENSE distributed with the project.