Socket
Socket
Sign inDemoInstall

appversion

Package Overview
Dependencies
61
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.0 to 1.5.2

appversion.json

2

appversion.default.json

@@ -18,3 +18,3 @@ {

"config": {
"appversion": "1.5.0",
"appversion": "1.5.2",
"markdown": [],

@@ -21,0 +21,0 @@ "json": [],

/*
* Project: appversion
* Version: 1.5.0
* Version: 1.5.2
* Author: delvedor
* Twitter: @delvedor
* License: GNU GPLv2
* License: MIT
* GitHub: https://github.com/delvedor/appversion

@@ -13,3 +13,3 @@ */

const fs = require('fs')
const path = require('path')
const join = require('path').join
const directory = require('app-root-path').path

@@ -26,3 +26,3 @@ const check = require('type-check').typeCheck

try {
let obj = JSON.parse(fs.readFileSync(path.join(directory, JSON_FILE)))
let obj = require(join(directory, JSON_FILE))
delete obj.config

@@ -43,3 +43,3 @@ return obj

if (!check('Function', callback)) throw new Error('getAppVersion() -> callback is not a function')
fs.readFile(path.join(directory, JSON_FILE), (err, data) => {
fs.readFile(join(directory, JSON_FILE), (err, data) => {
data = JSON.parse(data)

@@ -46,0 +46,0 @@ if (data) delete data.config

@@ -5,6 +5,6 @@ #! /usr/bin/env node

* Project: appversion
* Version: 1.5.0
* Version: 1.5.2
* Author: delvedor
* Twitter: @delvedor
* License: GNU GPLv2
* License: MIT
* GitHub: https://github.com/delvedor/appversion

@@ -16,3 +16,4 @@ */

// Modules
const program = require('commander')
const minimist = require('minimist')
const chalk = require('chalk')
// apv parameters and functions

@@ -27,30 +28,55 @@ const update = require('./lib/update').update

const apvVersion = require('./lib/parameters').apvVersion
const helpDocs = require('./lib/parameters').helpDocs
const help = require('./lib/help').help
// commands arguments
program
.version(apvVersion)
.usage('<option> <param>')
.option('update <param>', 'Updates the <param> that can be major|minor|patch|build|commit', update)
.option('set-version <param>', 'Sets a specific version number, the <param> must be x.y.z', setVersion)
.option('set-status <param>', 'Sets a specific status, the <param> stage can be stable|rc|beta|alpha and the number must be a number', setStatus)
.option('generate-badge <param>', 'Generates the .md code of a shield badge with the version of your application, <param> can be version|status', createBadge)
.option('add-git-tag, --tag', 'Adds a tag with the version number to the git repo.', addGitTag)
.option('init', 'Generates the appversion.json file', init)
.on('*', function (command) {
this.commands.some(function (command) {
return command._name === process.argv[0]
}) || this.help()
})
// arguments parser
const args = minimist(process.argv.slice(2))
// Custom docs
program.on('--help', () => {
console.log(helpDocs)
})
// if the flag -v|--version is passed
if (args.v || args.version) {
console.log(chalk.cyan(apvVersion))
process.exit(1)
}
program.parse(process.argv)
// Calls help() if there are no parameters
if (process.argv.length <= 2) program.help()
// if the flag -h|--help is passed
if (args.h || args.help) {
help()
process.exit(1)
}
// if there are not arguments
if (!args._.length) {
help()
process.exit(1)
}
if (args._.length > 2) console.log(chalk.yellow('AppVersion accepts only one command per time'))
const cmd = args._[0]
const param = args._[1] || null
switch (cmd) {
case 'update':
update(param)
if (args.tag) addGitTag()
break
case 'set-version':
setVersion(param)
if (args.tag) addGitTag()
break
case 'set-status':
setStatus(param)
break
case 'generate-badge':
createBadge(param)
break
case 'add-git-tag':
addGitTag()
break
case 'init':
init()
break
default:
help()
}
// Checks for an update
checkUpdate()
# Changelog
## v1.5.2
- Reimplemented argv management with minimist
- Now readJson makes use of require instead of readFileSync
- Written help function
- Changed license, moved form GPLv2 to MIT
## v1.5.0

@@ -4,0 +10,0 @@ - Added automatic Git tag

@@ -6,6 +6,4 @@ 'use strict'

// apv parameters and functions
exports.apvVersion = '1.5.0'
exports.apvVersion = '1.5.2'
exports.JSON_FILE = 'appversion.json'
exports.JSON_FILE_DEFAULT = resolve(__dirname, '../', 'appversion.default.json')
exports.helpDocs = ` Semantic Versioning: http://semver.org
AppVersion documentation: https://github.com/delvedor/appversion\n`

@@ -6,3 +6,2 @@ 'use strict'

const resolve = require('path').resolve
const fs = require('fs')
const chalk = require('chalk')

@@ -21,4 +20,8 @@ // apv parameters and functions

if (!check('String', file)) return
if (file.slice(-5) !== '.json') {
console.log(chalk.red(`\n${chalk.bold('AppVersion:')} ${file} is not a Json\n`))
process.exit(1)
}
try {
let obj = JSON.parse(fs.readFileSync(file === JSON_FILE ? resolve('./', file) : resolve(file)))
let obj = require(file === JSON_FILE ? resolve('./', file) : resolve(file))
// checks if the appversion.json is at the latest version

@@ -28,3 +31,3 @@ if (file === JSON_FILE && (!obj.config || obj.config.appversion !== apvVersion)) obj = updateAppversion(obj)

} catch (err) {
if (err.code === 'ENOENT') {
if (err.code === 'MODULE_NOT_FOUND') {
console.log(chalk.red(`\n${chalk.bold('AppVersion:')} Could not find appversion.json\nType ${chalk.bold('\'apv init\'')} for generate the file and start use AppVersion.\n`))

@@ -31,0 +34,0 @@ process.exit(1)

@@ -77,4 +77,3 @@ 'use strict'

}
// If the "version" field is not present in the json file we add it
fileObj.version = version
if (fileObj.version) fileObj.version = version
let json = `${JSON.stringify(fileObj, null, 2)}\n`

@@ -81,0 +80,0 @@ fs.writeFileSync(resolve(root, fileStats.name), json)

{
"name": "appversion",
"version": "1.5.0",
"version": "1.5.2",
"description": "AppVersion is a CLI tool whose purpose is to provide a unique manager of the version of you application.",

@@ -29,3 +29,3 @@ "main": "appversion.js",

"author": "Tomas Della Vedova - @delvedor (http://delved.org)",
"license": "GPLv2",
"license": "MIT",
"bugs": {

@@ -45,3 +45,3 @@ "url": "https://github.com/delvedor/appversion/issues"

"chalk": "^1.1.1",
"commander": "^2.9.0",
"minimist": "^1.2.0",
"request": "^2.69.0",

@@ -48,0 +48,0 @@ "semver": "^5.1.0",

# AppVersion <a name="version"></a><a name="status"></a>
[![AppVersion-version](https://img.shields.io/badge/AppVersion-1.5.0-brightgreen.svg?style=flat)](https://github.com/delvedor/appversion?#version) [![AppVersion-status](https://img.shields.io/badge/Status-RC-brightgreen.svg?style=flat)](https://github.com/delvedor/appversion?#status) [![Build Status](https://travis-ci.org/delvedor/appversion.svg?branch=master)](https://travis-ci.org/delvedor/appversion) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
[![AppVersion-version](https://img.shields.io/badge/AppVersion-1.5.2-brightgreen.svg?style=flat)](https://github.com/delvedor/appversion?#version) [![AppVersion-status](https://img.shields.io/badge/Status-RC-brightgreen.svg?style=flat)](https://github.com/delvedor/appversion?#status) [![Build Status](https://travis-ci.org/delvedor/appversion.svg?branch=master)](https://travis-ci.org/delvedor/appversion) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
**AppVersion** is a CLI tool whose purpose is to provide a **unique manager** of the version of you application.
It follows the **semver** guidelines, so the version of your code is divided in Major, Minor and Patch, [here](http://semver.org/) you can find the Semantic Versioning specification.
In addition AppVersion keeps track of the **build** with the last buold date, the build of the current version and the total number of build; it also keeps track of the **status** (stable, rc, ...) and the **commit code**.
In addition AppVersion keeps track of the **build** with the last build date, the build of the current version and the total number of build; it also keeps track of the **status** (stable, rc, ...) and the **commit code**.
AppVersion interacts with **NPM**, when you update the version using the AppVersion CLI tool, it updates automatically the *package.json* as well, and you can use the CLI commands inside your **NPM scripts**.
Furthermore AppVersion works well with **Git**, indeed you can add a Tag with the current version of your application to the repository and you can add one badge with the version and one badge with the status of your application to the *README.md*.
AppVersion also provides four easy to use APIs to access your version, build, status and commit from your application.
AppVersion also provides easy to use APIs to access your version, build, status and commit from your application.

@@ -83,4 +83,2 @@ The tool creates a json file named ```appversion.json``` in the root of your project with the following structure:

| init | | Generates the appversion.json file.|
| |
| help | | Prints the commands list. |

@@ -93,4 +91,4 @@ Some usage examples:

```
If you want to add a *Git tag* to your repo with the version number of your code, you have two options:
1. Add the `--tag` flag after `update` and `set-version` commands
If you want to add a *Git tag* to your repo with the version number of your code, you have two options:
1) Add the `--tag` flag after `update` and `set-version` commands
```

@@ -100,3 +98,3 @@ $ apv update minor --tag

```
2. Use `add-git-tag`
2) Use `add-git-tag`
```

@@ -222,2 +220,3 @@ $ apv add-git-tag

- [ ] SHA generator
- [ ] Integration with Grunt/Gulp

@@ -243,4 +242,4 @@ ## Build

## License
The code is released under the GPLv2 license.
The code is released under the MIT license.
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 non infringement. 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.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc