Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appversion

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appversion - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

5

appversion.default.json

@@ -7,3 +7,6 @@ {

},
"status": null,
"status": {
"stage": null,
"number": 0
},
"build": {

@@ -10,0 +13,0 @@ "date": null,

{
"version": {
"major": 1,
"minor": 0,
"patch": 1
"minor": 1,
"patch": 0
},
"status": null,
"status": {
"stage": null,
"number": 0
},
"build": {
"date": "2015.10.5",
"number": 0,
"total": 4
"date": "2015.11.13",
"number": 5,
"total": 16
},

@@ -13,0 +16,0 @@ "commit": null,

139

cli.js
#!/usr/bin/env node
/*
* Project: appversion
* Version: 1.1.0
* Author: delvedor
* Twitter: @delvedor
* License: GNU GPLv2
* GitHub: https://github.com/delvedor/appversion
*/
'use strict';
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _fs = require('fs');
var _path = require('path');
var _child_process = require('child_process');
var _walk = require('walk');
var _walk2 = _interopRequireDefault(_walk);
// Filenames
var JSON_FILE = 'appversion.json';
var JSON_FILE_DEFAULT = __dirname + '/appversion.default.json';
var JSON_FILE_DEFAULT = __dirname + '/appversion.default.json'

@@ -15,5 +34,6 @@ /**

*/
(function () {
;(function () {
var arg = undefined;
var param = undefined;
var ignore = undefined;
if (process.argv.length === 2) printHelp();

@@ -23,7 +43,8 @@ for (var i = 2; i < process.argv.length; i++) {

param = process.argv[i + 1];
ignore = process.argv[i + 2] || null;
// Update
if (arg === 'update') {
i++;
i = ignore ? i + 2 : i + 1;
if (param === 'major' || param === 'minor' || param === 'patch') {
updateVersion(param);
updateVersion(param, ignore);
} else if (param === 'build') {

@@ -40,6 +61,6 @@ updateBuild();

} else if (arg === 'version') {
i++;
setVersion(param);
i = ignore ? i + 2 : i + 1;
setVersion(param, ignore);
} else if (arg === 'status') {
i++;
i = ignore ? i + 2 : i + 1;
setStatus(param);

@@ -52,8 +73,6 @@

printHelp();
// All other cases
} else {
printError();
return;
}
printError();
return;
}
}

@@ -73,5 +92,5 @@ })();

} catch (err) {
console.log('File already exists');
console.log('File already exists\n');
}
console.log('Created the appversion.json, see apv help for the full instructions.');
console.log('Created the appversion.json, see apv help for the full instructions.\n');
}

@@ -89,3 +108,3 @@

} catch (err) {
//throw new Error(`${JSON_FILE} not found.`);
// throw new Error(`${JSON_FILE} not found.`)
throw new Error(err);

@@ -99,10 +118,19 @@ }

*/
function updateVersion(version) {
function updateVersion(version, ignore) {
checkType('string', version);
if (ignore) {
checkType('string', ignore);
if (ignore.indexOf('=') === -1) throw new Error('Insert a valid ignore string formatted in this way: "folder1|folder2"\n');
}
var obj = getJsonObj(JSON_FILE);
obj.version[version]++;
if (version === 'major') obj.version.minor = obj.version.patch = 0;else if (version === 'minor') obj.version.patch = 0;
if (version === 'major') {
obj.version.minor = obj.version.patch = 0;
} else if (version === 'minor') {
obj.version.patch = 0;
}
obj.build.number = 0;
writeJson('version', obj.version, obj);
updateVersionJson(obj);
updateVersionJson(obj, ignore);
console.log('Version updated to ' + obj.version.major + '.' + obj.version.minor + '.' + obj.version.patch + '\n');
}

@@ -120,2 +148,3 @@

writeJson('build', obj.build, obj);
console.log('Build updated to ' + obj.build.number + '/' + obj.build.total + '\n');
}

@@ -130,5 +159,8 @@

if (error) {
console.log('No Git repository found.');
console.log('No Git repository found.\n');
writeJson('commit', null, obj);
} else writeJson('commit', stdout.substring(0, 7), obj);
} else {
writeJson('commit', stdout.substring(0, 7), obj);
console.log('Commit updated to ' + stdout.substring(0, 7) + '\n');
}
});

@@ -141,10 +173,14 @@ }

*/
function setVersion(newVersion) {
function setVersion(newVersion, ignore) {
checkType('string', newVersion);
if (ignore) {
checkType('string', ignore);
if (ignore.indexOf('=') === -1) throw new Error('Insert a valid ignore string formatted in this way: ignore="folder1|folder2"\n');
}
var obj = getJsonObj(JSON_FILE);
var version = newVersion.split('.');
if (version.length !== 3) throw new Error('Insert a valid version number formatted in this way: "x.y.z"');
if (version.length !== 3) throw new Error('Insert a valid version number formatted in this way: "x.y.z"\n');
for (var i = 0; i < version.length; i++) {
version[i] = Number(version[i]);
if (isNaN(version[i])) throw new Error('Insert a valid number.');
if (isNaN(version[i])) throw new Error('Insert a valid number.\n');
}

@@ -162,3 +198,4 @@

});
updateVersionJson();
updateVersionJson(getJsonObj(JSON_FILE), ignore);
console.log('Version updated to ' + version[0] + '.' + version[1] + '.' + version[2] + '\n');
}

@@ -172,4 +209,10 @@

checkType('string', status);
if (status !== 'stable' && status !== 'rc' && status !== 'beta' && status !== 'alpha') throw new Error('Insert a valid status string.');
writeJson('status', status);
status = status.split('.');
status[1] = Number(status[1]) || 0;
if (status[0] !== 'stable' && status[0] !== 'rc' && status[0] !== 'beta' && status[0] !== 'alpha' && isNaN(status[1])) throw new Error('Insert a valid status string.\n');
writeJson('status', {
stage: status[0],
number: status[1]
});
console.log('Status updated to ' + status[0] + '.' + status[1] + '\n');
}

@@ -196,8 +239,8 @@

*/
function updateVersionJson() {
var obj = arguments.length <= 0 || arguments[0] === undefined ? getJsonObj(JSON_FILE) : arguments[0];
function updateVersionJson(obj, ignore) {
if (obj === undefined) obj = getJsonObj(JSON_FILE);
var currentVersion = obj.version.major + '.' + obj.version.minor + '.' + obj.version.patch;
for (var i = 0; i < obj.json.length; i++) {
updateOtherJson(obj.json[i], currentVersion);
updateOtherJson(obj.json[i], currentVersion, ignore);
}

@@ -211,14 +254,32 @@ }

*/
function updateOtherJson(filename, version) {
function updateOtherJson(filename, version, ignore) {
checkType('string', filename);
checkType('string', version);
var obj = undefined;
try {
obj = JSON.parse((0, _fs.readFileSync)(filename));
} catch (err) {
return;
if (ignore) {
ignore = ignore.substr(ignore.indexOf('=') + 1).split('|');
ignore.push('node_modules');
ignore.push('bower_components');
} else {
ignore = ['node_modules', 'bower_components'];
}
obj.version = version;
var json = JSON.stringify(obj, null, 2) + '\n';
(0, _fs.writeFileSync)(filename, json);
var walker = _walk2['default'].walk('./', {
followLinks: false,
filters: ignore
});
walker.on('file', function (root, fileStats, next) {
if (fileStats.name === filename) {
var obj = undefined;
try {
obj = JSON.parse((0, _fs.readFileSync)((0, _path.resolve)(root, filename)));
} catch (err) {
return;
}
obj.version = version;
var json = JSON.stringify(obj, null, 2) + '\n';
(0, _fs.writeFileSync)((0, _path.resolve)(root, filename), json);
}
next();
});
}

@@ -239,3 +300,3 @@

function printHelp() {
console.log('\n | appversion - help |\n\n Semantic Versioning: http://semver.org/\n\n apv <cmd> <args>\n\n Commands list:\n cmd args description\n ----------------------------------------------------------\n update major Updates major number.\n minor Updates minor number.\n patch Updates patch number.\n build Updates build number.\n commit Updates commit code.\n ----------------------------------------------------------\n version "x.y.z" Sets a specific version number.\n ----------------------------------------------------------\n status "stable" Set the status to stable.\n "rc" Set the status to rc.\n "beta" Set the status to beta.\n "alpha" Set the status to alpha.\n ----------------------------------------------------------\n init Generates the appversion.json file.\n ----------------------------------------------------------\n help Prints the commnds list.\n\n ');
console.log('\n | appversion - help |\n\n Semantic Versioning: http://semver.org/\n\n apv <cmd> <args>\n\n Commands list:\n cmd args description\n ----------------------------------------------------------\n update major Updates major number.\n minor Updates minor number.\n patch Updates patch number.\n build Updates build number.\n commit Updates commit code.\n ----------------------------------------------------------\n version "x.y.z" Sets a specific version number.\n ----------------------------------------------------------\n status "stable" Set the status to stable.\n "rc" Set the status to rc.\n "beta" Set the status to beta.\n "alpha" Set the status to alpha.\n ----------------------------------------------------------\n init Generates the appversion.json file.\n ----------------------------------------------------------\n help Prints the commnds list.\n\n - If you want to ignore some folder:\n cmd args args\n --------------------------------------------------------\n update major ignore="folder1|folder2"\n minor\n patch\n --------------------------------------------------------\n version "x.y.z" ignore="folder1|folder2"\n\n - If you want set the stage number:\n cmd args\n --------------------------------------------------------\n status "stable.1"\n "rc.2"\n "beta.4"\n "alpha.0"\n\n Full example:\n apv version "1.1.0" ignore="somefolder"\n\n Full documentation at:\n https://github.com/delvedor/appversion\n ');
}

@@ -242,0 +303,0 @@

@@ -0,1 +1,10 @@

/*
* Project: appversion
* Version: 1.1.0
* Author: delvedor
* Twitter: @delvedor
* License: GNU GPLv2
* GitHub: https://github.com/delvedor/appversion
*/
'use strict';

@@ -19,3 +28,7 @@

var slash = undefined;
if ((0, _os.platform)() === 'darwin') slash = '/';else slash = '\\';
if ((0, _os.platform)() === 'darwin') {
slash = '/';
} else {
slash = '\\';
}
var dir = (0, _path.resolve)(__dirname).split(slash + 'node_modules')[0];

@@ -42,9 +55,10 @@

// pattern:
// M : mayor
// m : minor
// p : patch
// s : status
// n : build number
// t : build total
// d : build Date
// M : version.major
// m : version.minor
// p : version.patch
// S : status.stage
// s : status.number
// n : build.number
// t : build.total
// d : build.date
// c : commit

@@ -61,3 +75,23 @@ // . : separator

var ele = pattern[i];
if (ele === 'M') ptt += obj.version.major;else if (ele === 'm') ptt += obj.version.minor;else if (ele === 'p') ptt += obj.version.patch;else if (ele === 's') ptt += obj.status;else if (ele === 'n') ptt += obj.build.number;else if (ele === 't') ptt += obj.build.total;else if (ele === 'd') ptt += obj.build.date;else if (ele === 'c') ptt += obj.commit;else ptt += ele;
if (ele === 'M') {
ptt += obj.version.major;
} else if (ele === 'm') {
ptt += obj.version.minor;
} else if (ele === 'p') {
ptt += obj.version.patch;
} else if (ele === 'S') {
ptt += obj.status.stage;
} else if (ele === 's') {
ptt += obj.status.number;
} else if (ele === 'n') {
ptt += obj.build.number;
} else if (ele === 't') {
ptt += obj.build.total;
} else if (ele === 'd') {
ptt += obj.build.date;
} else if (ele === 'c') {
ptt += obj.commit;
} else {
ptt += ele;
}
}

@@ -71,6 +105,27 @@ return ptt;

getAppVersion(function (err, obj) {
if (err) console.log(err);
var ptt = '';
for (var i = 0; i < pattern.length; i++) {
var ele = pattern[i];
if (ele === 'M') ptt += obj.version.major;else if (ele === 'm') ptt += obj.version.minor;else if (ele === 'p') ptt += obj.version.patch;else if (ele === 's') ptt += obj.status;else if (ele === 'n') ptt += obj.build.number;else if (ele === 't') ptt += obj.build.total;else if (ele === 'd') ptt += obj.build.date;else if (ele === 'c') ptt += obj.commit;else ptt += ele;
if (ele === 'M') {
ptt += obj.version.major;
} else if (ele === 'm') {
ptt += obj.version.minor;
} else if (ele === 'p') {
ptt += obj.version.patch;
} else if (ele === 'S') {
ptt += obj.status.stage;
} else if (ele === 's') {
ptt += obj.status.number;
} else if (ele === 'n') {
ptt += obj.build.number;
} else if (ele === 't') {
ptt += obj.build.total;
} else if (ele === 'd') {
ptt += obj.build.date;
} else if (ele === 'c') {
ptt += obj.commit;
} else {
ptt += ele;
}
}

@@ -77,0 +132,0 @@ callback(ptt);

{
"name": "appversion",
"version": "1.0.1",
"version": "1.1.0",
"description": "A module for keep track the version, build and commit of your javascript application.",

@@ -34,3 +34,6 @@ "main": "index.js",

"tape": "^4.2.0"
},
"dependencies": {
"walk": "^2.3.9"
}
}
# appversion
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)

@@ -18,3 +19,6 @@ **appversion** is a **cli tool** for keep track the *version*, *build* and *commit* of your javascript application.

},
"status": null,
"status": {
"stage": null,
"number": 0
},
"build": {

@@ -72,2 +76,31 @@ "date": null,

By default appversion tries to update all the json file you put in appversion.json
by searching recursively for these files starting from the current working directory.
If you want that appversion ignores some folder (it automatically excludes `node_modules` and `bower_component`) just add the ignore argument in this way:
`ignore="somefolder"`
If you want to ignore more than one folder just use `|`.
`ignore="folder1|folder2"`
| **cmd** | **args** | **args**
|:-------:|:---------:|:------------------------------------:|
| update | major | ignore="somefolder" |
| | minor | |
| | patch | |
| |
| version | "x.y.z" | ignore="somefolder" |
Full example:
`apv version "1.1.0" ignore="folder1|folder2"`
If you want to set the stage number (which is setted by default to 0) you can easily do:
| **cmd** | **args** | **description**
|:-------:|:-----------:|:-------------------------------------:|
| status | "stable.1" | Set the status to stable1. |
| | "rc.2" | Set the status to rc2. |
| | "beta.4" | Set the status to beta4. |
| | "alpha.0" | Set the status to alpha0. |
If you don't set any number appversion sets the stage number to zero.
### In app:

@@ -93,13 +126,18 @@

pattern:
- **M** : mayor
- **m** : minor
- **p** : patch
- **s** : status
- **n** : build number
- **t** : build total
- **d** : build Date
- **c** : commit
- **.** : separator
- **-** : separator
The pattern must be a string, for example a pattern could be `'M.m.p-s n-d'`.
| **Pattern** | **description** |
|:-----------:|:----------------:|
| **M** | version.major |
| **m** | version.minor |
| **p** | version.patch |
| **S** | status.stage |
| **s** | status.number |
| **n** | build.number |
| **t** | build.total |
| **d** | build.date |
| **c** | commit |
| **.** | separator |
| **-** | separator |
The pattern must be a string, for example a pattern could be `'M.m.p-Ss n-d'`.
This is the asyncronous version, so you must pass a callback to the function.

@@ -116,33 +154,35 @@

// es5:
var av = require('appversion');
var apv = require('appversion')
console.log(av.getAppVersionSync());
console.log(av.getAppVersionSync().version);
console.log(apv.getAppVersionSync())
console.log(apv.getAppVersionSync().version)
av.getAppVersion(function (err, data) {
console.log(data);
});
apv.getAppVersion(function (err, data) {
if (err) console.log(err)
console.log(data)
})
console.log(a.composePatternSync('M.m.p-s n-d'));
console.log(apv.composePatternSync('M.m.p-Ss n-d'))
a.composePattern('M.m.p-s n-d', function(ptt) {
console.log(ptt);
});
apv.composePattern('M.m.p-Ss n-d', function(ptt) {
console.log(ptt)
})
// es6 - es2015:
import { getAppVersion, getAppVersionSync, composePattern, composePatternSync } from 'appversion';
import { getAppVersion, getAppVersionSync, composePattern, composePatternSync } from 'appversion'
console.log(getAppVersionSync());
console.log(getAppVersionSync().version);
console.log(getAppVersionSync())
console.log(getAppVersionSync().version)
getAppVersion(function (err, data) {
console.log(data);
});
if (err) console.log(err)
console.log(data)
})
console.log(composePatternSync('M.m.p-s n-d'));
console.log(composePatternSync('M.m.p-Ss n-d'))
composePattern('M.m.p-s n-d', function(ptt) {
console.log(ptt);
});
composePattern('M.m.p-Ss n-d', function(ptt) {
console.log(ptt)
})
```

@@ -160,6 +200,20 @@

## Build
```
$ npm install
$ npm run build:cli
$ npm run build:index
$ chmod u+x cli.js
$ npm run test
$ ./cli.js <args>
```
## Contributing
If you feel you can help in any way, be it with examples, extra testing, or new features please open a pull request or open an issue.
If you feel you can help in any way, be it with examples, extra testing, or new features please open a pull request or open an issue.
The code follow the Standard code style.
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
______________________________________________________________________________________________________________________

@@ -166,0 +220,0 @@ ## License

@@ -1,56 +0,65 @@

'use strict';
'use strict'
let test = require('tape');
let execSync = require('child_process').execSync;
let fs = require('fs');
const JSON_FILE = 'appversion.json';
/*
* Project: appversion
* Version: 1.1.0
* Author: delvedor
* Twitter: @delvedor
* License: GNU GPLv2
* GitHub: https://github.com/delvedor/appversion
*/
const test = require('tape')
const execSync = require('child_process').execSync
const fs = require('fs')
const JSON_FILE = 'appversion.json'
test('Testing update', (t) => {
t.plan(12);
let original = JSON.parse(fs.readFileSync(JSON_FILE));
let mod;
t.plan(12)
const original = JSON.parse(fs.readFileSync(JSON_FILE))
let mod
console.log('|- Testing patch');
execSync('./cli.js update patch');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
t.equal(mod.version.patch, original.version.patch + 1, 'Patch was correctly updated.');
t.equal(mod.build.number, 0, 'Build number was correctly reset.');
console.log('|- Testing build')
execSync('./cli.js update build')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
let date = new Date()
t.equal(mod.build.number, original.build.number + 1, 'Build number was correctly updated.')
t.equal(mod.build.total, original.build.total + 1, 'Build total was correctly updated.')
t.equal(mod.build.date, `${date.getFullYear()}.${date.getMonth() + 1 }.${date.getDate()}`, 'Date was correctly updated.')
console.log('|- Testing minor');
execSync('./cli.js update minor');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
t.equal(mod.version.minor, original.version.minor + 1, 'Minor was correctly updated.');
t.equal(mod.version.patch, 0, 'Patch was correctly reset.');
t.equal(mod.build.number, 0, 'Build number was correctly reset.');
console.log('|- Testing patch')
execSync('./cli.js update patch')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
t.equal(mod.version.patch, original.version.patch + 1, 'Patch was correctly updated.')
t.equal(mod.build.number, 0, 'Build number was correctly reset.')
console.log('|- Testing major');
execSync('./cli.js update major');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
t.equal(mod.version.major, original.version.major + 1, 'Major was correctly updated.');
t.equal(mod.version.minor, 0, 'Minor was correctly reset.');
t.equal(mod.version.patch, 0, 'Patch was correctly reset.');
t.equal(mod.build.number, 0, 'Build number was correctly reset.');
console.log('|- Testing minor')
execSync('./cli.js update minor')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
t.equal(mod.version.minor, original.version.minor + 1, 'Minor was correctly updated.')
t.equal(mod.version.patch, 0, 'Patch was correctly reset.')
t.equal(mod.build.number, 0, 'Build number was correctly reset.')
console.log('|- Testing build');
execSync('./cli.js update build');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
let date = new Date();
t.equal(mod.build.number, original.build.number + 1, 'Build number was correctly updated.');
t.equal(mod.build.total, original.build.total + 1, 'Build total was correctly updated.');
t.equal(mod.build.date, `${date.getFullYear()}.${date.getMonth() + 1 }.${date.getDate()}`, 'Date was correctly updated.');
console.log('|- Testing major')
execSync('./cli.js update major')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
t.equal(mod.version.major, original.version.major + 1, 'Major was correctly updated.')
t.equal(mod.version.minor, 0, 'Minor was correctly reset.')
t.equal(mod.version.patch, 0, 'Patch was correctly reset.')
t.equal(mod.build.number, 0, 'Build number was correctly reset.')
console.log('|- Testing commit');
console.log('|-- Test not yet implemented');
console.log('|- Testing commit')
console.log('|-- Test not yet implemented')
fs.writeFileSync(JSON_FILE, JSON.stringify(original, null, 2) + '\n');
});
fs.writeFileSync(JSON_FILE, JSON.stringify(original, null, 2) + '\n')
})
test('Testing version', (t) => {
t.plan(2);
let original = JSON.parse(fs.readFileSync(JSON_FILE));
let mod;
t.plan(2)
const original = JSON.parse(fs.readFileSync(JSON_FILE))
let mod
console.log('|- Testing version "1.2.3"');
execSync('./cli.js version "1.2.3"');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
console.log('|- Testing version "1.2.3"')
execSync('./cli.js version "1.2.3"')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
t.deepEqual(mod.version, {

@@ -60,34 +69,39 @@ major: 1,

patch: 3
}, 'Version was correctly updated.');
t.equal(mod.build.number, 0, 'Build number was correctly reset.');
}, 'Version was correctly updated.')
t.equal(mod.build.number, 0, 'Build number was correctly reset.')
fs.writeFileSync(JSON_FILE, JSON.stringify(original, null, 2) + '\n');
});
execSync(`./cli.js version "${original.version.major}.${original.version.minor}.${original.version.patch}"`)
fs.writeFileSync(JSON_FILE, JSON.stringify(original, null, 2) + '\n')
})
test('Testing status', (t) => {
t.plan(4);
let original = JSON.parse(fs.readFileSync(JSON_FILE));
let mod;
t.plan(8)
const original = JSON.parse(fs.readFileSync(JSON_FILE))
let mod
console.log('|- Testing status "stable"');
execSync('./cli.js status "stable"');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
t.equal(mod.status, 'stable', 'Status "stable" was correctly updated.');
console.log('|- Testing status "stable"')
execSync('./cli.js status "stable"')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
t.equal(mod.status.stage, 'stable', 'Status.stage "stable" was correctly updated.')
t.equal(mod.status.number, 0, 'Status.number "stable" was correctly updated.')
console.log('|- |- Testing status "rc"');
execSync('./cli.js status "rc"');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
t.equal(mod.status, 'rc', 'Status "rc" was correctly updated.');
console.log('|- |- Testing status "rc.1"')
execSync('./cli.js status "rc.1"')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
t.equal(mod.status.stage, 'rc', 'Status.stage "rc" was correctly updated.')
t.equal(mod.status.number, 1, 'Status.number "rc" was correctly updated.')
console.log('|- Testing status "beta"');
execSync('./cli.js status "beta"');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
t.equal(mod.status, 'beta', 'Status "beta" was correctly updated.');
console.log('|- Testing status "beta.2"')
execSync('./cli.js status "beta.2"')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
t.equal(mod.status.stage, 'beta', 'Status.stage "beta" was correctly updated.')
t.equal(mod.status.number, 2, 'Status.number "beta" was correctly updated.')
console.log('|- Testing status "alpha"');
execSync('./cli.js status "alpha"');
mod = JSON.parse(fs.readFileSync(JSON_FILE));
t.equal(mod.status, 'alpha', 'Status "alpha" was correctly updated.');
console.log('|- Testing status "alpha.0"')
execSync('./cli.js status "alpha.0"')
mod = JSON.parse(fs.readFileSync(JSON_FILE))
t.equal(mod.status.stage, 'alpha', 'Status.stage "alpha" was correctly updated.')
t.equal(mod.status.number, 0, 'Status.number "alpha" was correctly updated.')
fs.writeFileSync(JSON_FILE, JSON.stringify(original, null, 2) + '\n');
});
fs.writeFileSync(JSON_FILE, JSON.stringify(original, null, 2) + '\n')
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc