Code Monkey home page Code Monkey logo

semver-bumper-for-file-text's Introduction

semver-bumper-for-file-text

Bump the version number in the text of all appropriate files in a package.

Install

Locally for just a specific package:

npm install --save-dev semver-bumper-for-file-text

and/or globally:

npm install -g semver-bumper-for-file-text

How To Use

CLI (currently you must do it from the top-level directory of the package)

If you installed globally:

semver-bumper-for-file-text --help
semver-bumper-for-file-text bump

If you only installed locally:

./node_modules/semver-bumper-for-file-text/bin/semver-bumper-for-file-text --help
./node_modules/semver-bumper-for-file-text/bin/semver-bumper-for-file-text bump

In Code:

var semverBumperForFileText = require('semver-bumper-for-file-text');
semverBumperForFileText.bump().subscribe();

Test

npm test

TODO

  • Add testing for main.js, including bumping of JSON files. Possibly split JSON bumping out into its own file.

  • Allow for saving user's answer for whether to bump each grepped version match, using code something like this: ```js var filepath = './run-inc.js'; var lineIndex = 3; var chunkIndex = 1; var chunk = 'This version is now 1.2.3'; var versionNumberRE = /[0-9]+.[0-9]+.[0-9]+(-(alpha|beta|rc)(.[0-9]+)?)?/; var nonVersionInput = chunk.replace(versionNumberRE, ''); var semverBumperSettings = { 'jsonFiles': [ { 'filepath': 'package.json', 'key': 'version' } ], 'grepOptions': { 'include': [], 'exclude': [], 'excludeDir': [ 'test' ] }, savedAnswers: { '4446b9f25a40b91f4b83b0d3a244384d': false, '595f44fec1e92a71d3e9e77456ba80d1': true, '71f920fa275127a7b60fa4d4d41432a3': false, '43c191bf6d6c3f263a8cd0efd4a058ab': false } };

    var crypto = require('crypto');
    var hash = crypto.createHash('md5')
      .update([filepath, lineIndex, chunkIndex, nonVersionInput].join(','))
      .digest('hex');
    console.log('ask user? ' + !!semverBumperSettings.savedAnswers[hash]);
    ```
    

semver-bumper-for-file-text's People

Contributors

ariutta avatar

Watchers

 avatar  avatar  avatar

semver-bumper-for-file-text's Issues

Save answers re: bumping grepped matches

Allow for saving user's answers for whether to bump each grepped version match, using code something like this:

var filepath = './run-inc.js';
var lineIndex = 3;
var chunkIndex = 1;
var chunk = 'This version is now 1.2.3';
var versionNumberRE = /[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?/;
var nonVersionInput = chunk.replace(versionNumberRE, '');
var semverBumperSettings = {
  'jsonFiles': [
    {
      'filepath': 'package.json',
      'key': 'version'
    }
  ],
  'grepOptions': {
    'include': [],
    'exclude': [],
    'excludeDir': [
      'test'
    ]
  },
  savedAnswers: {
    '4446b9f25a40b91f4b83b0d3a244384d': false,
    '595f44fec1e92a71d3e9e77456ba80d1': true,
    '71f920fa275127a7b60fa4d4d41432a3': false,
    '43c191bf6d6c3f263a8cd0efd4a058ab': false
  }
};

var crypto = require('crypto');
var hash = crypto.createHash('md5')
  .update([filepath, lineIndex, chunkIndex, nonVersionInput].join(','))
  .digest('hex');
console.log('ask user? ' + !!semverBumperSettings.savedAnswers[hash]);

Testing for main.js and CLI

Add testing for main.js, including bumping of JSON files. If needed for easier testing, consider splitting JSON bumping (e.g., code related to this) out into its own file.

Add testing for bin/semver-bumper-for-file-text, at a minimum including making sure that node bin/semver-bumper-for-file-text --help works.

Didn't work for me. Crashed on --help

Hey, this looks like a cool project. Exactly what I needed. It installed, but didn't work for me.

☀  npm install --save-dev semver-bumper-for-file-text                                            New master
npm WARN package.json [email protected] No repository field.
[email protected] node_modules/semver-bumper-for-file-text
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected])

☀  ./node_modules/semver-bumper-for-file-text/bin/semver-bumper-for-file-text --help          NewMod master

module.js:340
    throw err;
          ^
  Error: Cannot find module 'rx'

  - module.js:338 Function.Module._resolveFilename
    module.js:338:15

  - module.js:280 Function.Module._load
    module.js:280:25

  - module.js:364 Module.require
    module.js:364:17

  - module.js:380 require
    module.js:380:17

  - index.js:3 Object.<anonymous>
    [electron]/[semver-bumper-for-file-text]/[rx-fs]/index.js:3:10

  - module.js:456 Module._compile
    module.js:456:26

  - module.js:474 Object.Module._extensions..js
    module.js:474:10

  - module.js:356 Module.load
    module.js:356:32

  - module.js:312 Function.Module._load
    module.js:312:12

  - module.js:364 Module.require
    module.js:364:17



☔  node --version                                                                             NewMod master
v0.10.36

☀  nvm use 5.4                                                                                NewMod master
Now using node v5.4.0 (npm v3.6.0)

☀  ./node_modules/semver-bumper-for-file-text/bin/semver-bumper-for-file-text --help          NewMod master
module.js:328
    throw err;
    ^

  Error: Cannot find module 'rx'

  - module.js:326 Function.Module._resolveFilename
    module.js:326:15

  - module.js:277 Function.Module._load
    module.js:277:25

  - module.js:354 Module.require
    module.js:354:17

  - module.js:12 require
    internal/module.js:12:17

  - index.js:3 Object.<anonymous>
    [electron]/[semver-bumper-for-file-text]/[rx-fs]/index.js:3:10

  - module.js:398 Module._compile
    module.js:398:26

  - module.js:405 Object.Module._extensions..js
    module.js:405:10

  - module.js:344 Module.load
    module.js:344:32

  - module.js:301 Function.Module._load
    module.js:301:12

  - module.js:354 Module.require
    module.js:354:17

  - module.js:12 require
    internal/module.js:12:17

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.