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/ChangeLog +15 -0
- package/README.md +20 -7
- package/bin/version.js +44 -29
- package/bun.lock +1726 -0
- package/lib/version.js +14 -9
- package/package.json +13 -7
package/ChangeLog
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
2026.02.02, v6.1.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 8960b49 version: add support of peerDependencies
|
|
5
|
+
|
|
6
|
+
2026.02.02, v6.0.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 97aea7c version-io: add -e
|
|
10
|
+
- dd68ea2 version-io: drop support of node < 22
|
|
11
|
+
- 0a6d90b version-io: try-to-catch v4.0.5
|
|
12
|
+
- a8c2a33 version-io: putout v41.16.0
|
|
13
|
+
- 566b17c version-io: madrun v12.1.3
|
|
14
|
+
- b9bb256 version-io: eslint-plugin-putout v30.0.2
|
|
15
|
+
|
|
1
16
|
2025.03.30, v5.0.0
|
|
2
17
|
|
|
3
18
|
feature:
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Version-io
|
|
2
2
|
|
|
3
|
-
Semantic versioning tool. Apply major
|
|
3
|
+
Semantic versioning tool. Apply `major`, `minor`, `patch` and version to `package.json`.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -30,24 +30,37 @@ Apply minor, major or patch:
|
|
|
30
30
|
v1.1.0
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
Extended view:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
# version -e
|
|
37
|
+
|
|
38
|
+
1 | {
|
|
39
|
+
2 | "version": "5.0.0",
|
|
40
|
+
3 | "engines": {
|
|
41
|
+
4 | "node": ">=22"
|
|
42
|
+
5 | }
|
|
43
|
+
6 | }
|
|
44
|
+
```
|
|
45
|
+
|
|
33
46
|
## Use as module
|
|
34
47
|
|
|
35
48
|
Install `version-io` with:
|
|
36
49
|
|
|
37
50
|
```
|
|
38
|
-
npm i version-io
|
|
51
|
+
npm i version-io -g
|
|
39
52
|
```
|
|
40
53
|
|
|
41
|
-
|
|
54
|
+
## API
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
### `updateVersion(number: VersionNumber)`
|
|
44
57
|
|
|
45
|
-
|
|
58
|
+
- `VersionNumber` could be new version number or `minor|major|patch`
|
|
46
59
|
|
|
47
60
|
```js
|
|
48
|
-
import
|
|
61
|
+
import {updateVersion} from 'version-io';
|
|
49
62
|
|
|
50
|
-
|
|
63
|
+
await updateVersion('patch');
|
|
51
64
|
```
|
|
52
65
|
|
|
53
66
|
## License
|
package/bin/version.js
CHANGED
|
@@ -1,45 +1,60 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import {createRequire} from 'node:module';
|
|
5
4
|
import readjson from 'readjson';
|
|
6
|
-
import tryToCatch from 'try-to-catch';
|
|
5
|
+
import {tryToCatch} from 'try-to-catch';
|
|
7
6
|
import {packageUp} from 'package-up';
|
|
8
|
-
import
|
|
7
|
+
import {updateVersion} from '../lib/version.js';
|
|
8
|
+
|
|
9
|
+
const {stringify} = JSON;
|
|
9
10
|
|
|
10
|
-
const require = createRequire(import.meta.url);
|
|
11
11
|
const [arg] = process.argv.slice(2);
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const isExtended = arg && arg === '-e';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const [e, data] = await tryToCatch(version, arg);
|
|
21
|
-
|
|
22
|
-
if (e)
|
|
23
|
-
return console.error(e.message);
|
|
24
|
-
|
|
25
|
-
if (data)
|
|
26
|
-
console.log(data);
|
|
27
|
-
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
15
|
+
if (/^(-v|--version)$/.test(arg))
|
|
16
|
+
process.exit();
|
|
17
|
+
|
|
18
|
+
if (arg && !isExtended) {
|
|
19
|
+
const [e, data] = await tryToCatch(updateVersion, arg);
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
if (e)
|
|
22
|
+
process.exit();
|
|
32
23
|
|
|
33
|
-
if (
|
|
34
|
-
|
|
24
|
+
if (data)
|
|
25
|
+
console.log(data);
|
|
35
26
|
|
|
36
|
-
|
|
27
|
+
process.exit();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const name = await packageUp();
|
|
31
|
+
|
|
32
|
+
if (!name)
|
|
33
|
+
process.exit();
|
|
34
|
+
|
|
35
|
+
const [error, info] = await tryToCatch(readjson, name);
|
|
36
|
+
|
|
37
|
+
if (!error) {
|
|
38
|
+
if (!isExtended) {
|
|
39
|
+
console.log(info.version || '<no version>');
|
|
40
|
+
process.exit();
|
|
41
|
+
}
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
const {codeFrameColumns} = await import('@putout/babel');
|
|
44
|
+
const result = stringify({
|
|
45
|
+
version: info.version,
|
|
46
|
+
engines: info.engines,
|
|
47
|
+
peerDependencies: info.peerDependencies,
|
|
48
|
+
}, null, 4);
|
|
40
49
|
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
console.log(codeFrameColumns(result, {}, {
|
|
51
|
+
highlightCode: true,
|
|
52
|
+
}));
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
process.exit();
|
|
45
55
|
}
|
|
56
|
+
|
|
57
|
+
if (error.code === 'ENOENT')
|
|
58
|
+
process.exit(1);
|
|
59
|
+
|
|
60
|
+
console.error('package.json:', error.message);
|