version-io 4.0.1 → 5.0.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/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ 2025.03.30, v5.0.0
2
+
3
+ feature:
4
+ - 1624b5d version-io: migrate to ESM
5
+ - a11fae2 version-io: putout v39.5.0
6
+ - 626950e version-io: pkg-up v5.0.0
7
+ - 7aff931 version-io: madrun v11.0.0
8
+ - cacb058 version-io: eslint-plugin-putout v26.1.0
9
+ - 74a5de6 version-io: eslint v9.23.0
10
+
1
11
  2020.04.28, v4.0.1
2
12
 
3
13
  fix:
package/README.md CHANGED
@@ -6,7 +6,6 @@ Semantic versioning tool. Apply major, minor, patch and version to `package.json
6
6
 
7
7
  `npm i version-io -g`
8
8
 
9
-
10
9
  ## How to use?
11
10
 
12
11
  Show current version:
@@ -15,6 +14,7 @@ Show current version:
15
14
  # version
16
15
  v1.0.0
17
16
  ```
17
+
18
18
  Set new version:
19
19
 
20
20
  ```
@@ -39,16 +39,17 @@ npm i version-io --save
39
39
  ```
40
40
 
41
41
  Format: `version(number, callback);`
42
+
42
43
  - `number` could be new version number or `minor|major|patch`
43
44
 
44
45
  You could update version in `package.json` with:
46
+
45
47
  ```js
46
- import version from 'version-io';
48
+ import versionio from 'version-io';
47
49
 
48
- const version = await version();
50
+ const version = await versionio();
49
51
  ```
50
52
 
51
53
  ## License
52
54
 
53
55
  MIT
54
-
package/bin/version.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- 'use strict';
3
+ import process from 'node:process';
4
+ import {createRequire} from 'node:module';
5
+ import readjson from 'readjson';
6
+ import tryToCatch from 'try-to-catch';
7
+ import {packageUp} from 'package-up';
8
+ import version from '../lib/version.js';
4
9
 
5
- const readjson = require('readjson');
6
- const tryToCatch = require('try-to-catch');
10
+ const require = createRequire(import.meta.url);
11
+ const [arg] = process.argv.slice(2);
7
12
 
8
- const version = require('..');
9
- const args = process.argv.slice(2);
10
- const arg = args[0];
11
- const pkgUp = require('pkg-up');
12
-
13
- main()
13
+ main();
14
14
 
15
15
  async function main() {
16
16
  if (/^(-v|--version)$/.test(arg))
17
17
  return console.log('v' + require('../package').version);
18
-
18
+
19
19
  if (arg) {
20
20
  const [e, data] = await tryToCatch(version, arg);
21
21
 
@@ -28,7 +28,7 @@ async function main() {
28
28
  return;
29
29
  }
30
30
 
31
- const name = await pkgUp();
31
+ const name = await packageUp();
32
32
 
33
33
  if (!name)
34
34
  return console.error('package.json: not found');
@@ -43,4 +43,3 @@ async function main() {
43
43
 
44
44
  return console.error('package.json:', error.message);
45
45
  }
46
-
package/lib/version.js CHANGED
@@ -1,15 +1,13 @@
1
- 'use strict';
1
+ import assert from 'node:assert';
2
+ import readjson from 'readjson';
3
+ import writejson from 'writejson';
4
+ import minor from 'minor';
5
+ import {packageUp} from 'package-up';
2
6
 
3
- const assert = require('assert');
4
- const readjson = require('readjson');
5
- const writejson = require('writejson');
6
- const minor = require('minor');
7
- const pkgUp = require('pkg-up');
8
-
9
- module.exports = async (version) => {
7
+ export default async (version) => {
10
8
  assert(version, 'version could not be empty!');
11
9
 
12
- const name = await pkgUp();
10
+ const name = await packageUp();
13
11
  const json = await readjson(name);
14
12
 
15
13
  if (!version)
@@ -24,7 +22,6 @@ async function update(name, version, info) {
24
22
 
25
23
  if (mmpRegExp.test(version))
26
24
  version = minor(version, info.version);
27
-
28
25
  else if (vRegExp.test(version))
29
26
  version = version.slice(1);
30
27
 
@@ -34,4 +31,3 @@ async function update(name, version, info) {
34
31
  space: 2,
35
32
  });
36
33
  }
37
-
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "version-io",
3
- "version": "4.0.1",
3
+ "version": "5.0.0",
4
+ "type": "module",
4
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
6
  "description": "Semantic versioning tool. Apply major, minor, patch and version to package.json.",
6
7
  "homepage": "http://github.com/coderaiser/version-io",
@@ -10,25 +11,24 @@
10
11
  },
11
12
  "repository": {
12
13
  "type": "git",
13
- "url": "git://github.com/coderaiser/version-io.git"
14
+ "url": "git+https://github.com/coderaiser/version-io.git"
14
15
  },
15
16
  "dependencies": {
16
17
  "minor": "^1.2.0",
17
- "pkg-up": "^3.1.0",
18
+ "package-up": "^5.0.0",
18
19
  "readjson": "^2.0.1",
19
20
  "try-to-catch": "^3.0.0",
20
21
  "writejson": "^3.0.0"
21
22
  },
22
23
  "engines": {
23
- "node": ">=8"
24
+ "node": ">=20"
24
25
  },
25
26
  "license": "MIT",
26
27
  "devDependencies": {
27
- "eslint": "^6.8.0",
28
- "eslint-plugin-node": "^11.1.0",
29
- "eslint-plugin-putout": "^3.7.1",
30
- "madrun": "^5.5.0",
31
- "putout": "^7.23.0"
28
+ "eslint": "^9.23.0",
29
+ "eslint-plugin-putout": "^26.1.0",
30
+ "madrun": "^11.0.0",
31
+ "putout": "^39.5.0"
32
32
  },
33
33
  "scripts": {
34
34
  "lint": "madrun lint",