version-io 5.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/version.js CHANGED
@@ -1,22 +1,27 @@
1
1
  import assert from 'node:assert';
2
- import readjson from 'readjson';
3
- import writejson from 'writejson';
2
+ import _readjson from 'readjson';
3
+ import _writejson from 'writejson';
4
4
  import minor from 'minor';
5
- import {packageUp} from 'package-up';
5
+ import {packageUp as _packageUp} from 'package-up';
6
6
 
7
- export default async (version) => {
7
+ export const updateVersion = async (version, overrides) => {
8
8
  assert(version, 'version could not be empty!');
9
9
 
10
+ const {
11
+ packageUp = _packageUp,
12
+ readjson = _readjson,
13
+ writejson = _writejson,
14
+ } = overrides;
15
+
10
16
  const name = await packageUp();
11
17
  const json = await readjson(name);
12
18
 
13
- if (!version)
14
- return `v${json.version}`;
15
-
16
- await update(name, version, json);
19
+ await update(name, version, json, {
20
+ writejson,
21
+ });
17
22
  };
18
23
 
19
- async function update(name, version, info) {
24
+ async function update(name, version, info, {writejson}) {
20
25
  const mmpRegExp = /major|minor|patch/;
21
26
  const vRegExp = /^v/;
22
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "version-io",
3
- "version": "5.0.0",
3
+ "version": "6.1.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Semantic versioning tool. Apply major, minor, patch and version to package.json.",
@@ -14,24 +14,30 @@
14
14
  "url": "git+https://github.com/coderaiser/version-io.git"
15
15
  },
16
16
  "dependencies": {
17
+ "@putout/babel": "^5.2.11",
17
18
  "minor": "^1.2.0",
18
19
  "package-up": "^5.0.0",
19
20
  "readjson": "^2.0.1",
20
- "try-to-catch": "^3.0.0",
21
+ "try-to-catch": "^4.0.5",
21
22
  "writejson": "^3.0.0"
22
23
  },
23
24
  "engines": {
24
- "node": ">=20"
25
+ "node": ">=22"
25
26
  },
26
27
  "license": "MIT",
27
28
  "devDependencies": {
29
+ "c8": "^10.1.3",
28
30
  "eslint": "^9.23.0",
29
- "eslint-plugin-putout": "^26.1.0",
30
- "madrun": "^11.0.0",
31
- "putout": "^39.5.0"
31
+ "eslint-plugin-putout": "^30.0.2",
32
+ "madrun": "^12.1.3",
33
+ "putout": "^41.16.0",
34
+ "supertape": "^12.2.0"
32
35
  },
33
36
  "scripts": {
37
+ "test": "madrun test",
34
38
  "lint": "madrun lint",
35
- "fix:lint": "madrun fix:lint"
39
+ "fix:lint": "madrun fix:lint",
40
+ "coverage": "madrun coverage",
41
+ "report": "madrun report"
36
42
  }
37
43
  }