Giter Site home page Giter Site logo

Create version bumping task about xjs HOT 3 CLOSED

mikeybanez avatar mikeybanez commented on August 11, 2024
Create version bumping task

from xjs.

Comments (3)

 avatar commented on August 11, 2024

@Matrim-Cauthon, should we go ahead and use npm version minor by using npm.commands? I found this on NPM website:

Although npm can be used programmatically, its API is meant for use by the CLI only, and no guarantees are made regarding its fitness for any other purpose. If you want to use npm to reliably perform some task, the safest thing to do is to invoke the desired npm command with appropriate arguments.

We could however go ahead and use it programmatically, but there are alternatives to this.

  • One is by updating the package.json and bower.json files
  • Or, by executing a CLI command through nodejs using require('child_process').exec

I tried both approach, and it would work as expected. One thing to note though is that when using npm version, it would auto-tag it and auto-commit it (thus requiring the current branch to be clean) unless we add a --no-git-tag-version flag and --force flag to prevent it from auto-committing and auto-tagging.

Another possible approach is by using the ordinary npm version on the CLI itself, but adding a 'scripts' attribute on the package.json:

"scripts": {
  "preversion": "gulp test",
  "version": "gulp version && git add",
  "postversion": "git push && git push --tags"
}

The gulp version should build the file and add the necessary comments on the compiled xjs.js. Also, it could version up the bower file programmatically.

from xjs.

mikeybanez avatar mikeybanez commented on August 11, 2024

should we go ahead and use npm version minor

Note that we don't just need to bump the minor version. This will be true especially when we do true semver, which will happen when we get to a stable version --- 1.X.X or higher.

I'm biased towards a gulp-based approach since we're using that to define our most-commonly used tasks anyway. How it's implemented under the hood is not important as long as we're able to specify how to bump the version number 👍

from xjs.

 avatar commented on August 11, 2024

The npm version minor was just an example. So we'll just go ahead and do this:

One is by updating the package.json and bower.json files

This way, we will be the ones to manually commit the changes, and manually add the tag. I believe this is OK since we usually bump the versions on the develop or release branch, while we tag the versions on our master branch.

The command would be like this:

gulp version --major|minor|patch --up|down

Without the flags, it would behave as gulp version --minor --up

What this gulp task would do is execute the default task first, then execute the version up/down task.

from xjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.