@gjsify/semver 0.4.43 → 0.4.44
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/README.md +35 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @gjsify/semver
|
|
2
|
+
|
|
3
|
+
Node-free semver implementation (parse, compare, satisfies, ranges) used by `gjsify install` and the CLI for dependency-version resolution on GJS. Supports caret, tilde, hyphen, x/star ranges, and OR (`||`) expressions. Runs on both Node.js and GJS.
|
|
4
|
+
|
|
5
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gjsify install @gjsify/semver
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { parse, compare, satisfies, maxSatisfying, SemVer, Range } from '@gjsify/semver';
|
|
17
|
+
|
|
18
|
+
// Parse and inspect a version
|
|
19
|
+
const v = parse('1.2.3-beta.1');
|
|
20
|
+
console.log(v?.major, v?.minor, v?.patch); // 1 2 3
|
|
21
|
+
|
|
22
|
+
// Compare two versions
|
|
23
|
+
compare('1.2.3', '1.2.4'); // -1
|
|
24
|
+
|
|
25
|
+
// Check whether a version satisfies a range
|
|
26
|
+
satisfies('1.5.0', '^1.2.0'); // true
|
|
27
|
+
satisfies('2.0.0', '^1.2.0'); // false
|
|
28
|
+
|
|
29
|
+
// Find the highest matching version in a list
|
|
30
|
+
maxSatisfying(['1.0.0', '1.5.0', '2.0.0'], '^1.2.0'); // '1.5.0'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/semver",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.44",
|
|
4
4
|
"description": "Subset of node-semver for the gjsify install backend — cross-platform Node + GJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
],
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@gjsify/cli": "^0.4.
|
|
40
|
-
"@gjsify/unit": "^0.4.
|
|
39
|
+
"@gjsify/cli": "^0.4.44",
|
|
40
|
+
"@gjsify/unit": "^0.4.44",
|
|
41
41
|
"typescript": "^6.0.3"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|