Skip to content

Commit 78d2d4b

Browse files
committed
upgrade deps && docs [skip ci]
1 parent de63544 commit 78d2d4b

File tree

2 files changed

+72
-72
lines changed

2 files changed

+72
-72
lines changed

docs/index.md

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Home
44
nav_order: 1
55
---
66

7-
# Git Json Resolver Semver <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 40px"/>
7+
# git-json-resolver-semver <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 40px"/>
88

99
[![test](https://github.com/react18-tools/git-json-resolver-semver/actions/workflows/test.yml/badge.svg)](https://github.com/react18-tools/git-json-resolver-semver/actions/workflows/test.yml)
1010
[![Maintainability](https://qlty.sh/gh/react18-tools/projects/git-json-resolver-semver/maintainability.svg)](https://qlty.sh/gh/react18-tools/projects/git-json-resolver-semver)
@@ -13,25 +13,27 @@ nav_order: 1
1313
[![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/git-json-resolver-semver.svg)](https://www.npmjs.com/package/git-json-resolver-semver)
1414
![npm bundle size](https://img.shields.io/bundlephobia/minzip/git-json-resolver-semver)
1515

16-
Git Json Resolver Semver is a comprehensive library designed to unlock the full potential of React 18 server components. It provides customizable loading animation components and a fullscreen loader container, seamlessly integrating with React and Next.js.
16+
**Semver-aware plugin for [`git-json-resolver`](https://github.com/react18-tools/git-json-resolver)** — resolve JSON version conflicts (e.g., `package.json`) via semantic-version strategies.
1717

18-
✅ Fully Treeshakable (import from `git-json-resolver-semver/client/loader-container`)
18+
**Strategies (this release):**
1919

20-
✅ Fully TypeScript Supported
20+
- `semver-max` → pick the higher version
21+
- `semver-min` → pick the lower version
22+
- `semver-ours` → prefer ours if valid, else (optionally) prefer valid theirs
23+
- `semver-theirs` → prefer theirs if valid, else (optionally) prefer valid ours
2124

22-
✅ Leverages the power of React 18 Server components
23-
24-
✅ Compatible with all React 18 build systems/tools/frameworks
25-
26-
✅ Documented with [Typedoc](https://react18-tools.github.io/git-json-resolver-semver) ([Docs](https://react18-tools.github.io/git-json-resolver-semver))
25+
---
2726

28-
✅ Examples for Next.js, and Vite
27+
## ✨ Features
2928

30-
> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Star [this repository](https://github.com/react18-tools/git-json-resolver-semver) and share it with your friends.
29+
- Avoid manual conflict resolution in `package.json`
30+
- Small & tree-shakable (0 runtime dependencies)
31+
- Works with **direct import** or **dynamic plugin loading**
32+
- TypeScript types included
3133

32-
## Getting Started
34+
> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Star the repo if it saved your merge. And and also share it with your friends.
3335
34-
### Installation
36+
## 📦 Install
3537

3638
```bash
3739
pnpm add git-json-resolver-semver
@@ -49,86 +51,83 @@ npm install git-json-resolver-semver
4951
yarn add git-json-resolver-semver
5052
```
5153

52-
## Want Lite Version? [![npm bundle size](https://img.shields.io/bundlephobia/minzip/git-json-resolver-semver-lite)](https://www.npmjs.com/package/git-json-resolver-semver-lite) [![Version](https://img.shields.io/npm/v/git-json-resolver-semver-lite.svg?colorB=green)](https://www.npmjs.com/package/git-json-resolver-semver-lite) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/git-json-resolver-semver-lite.svg)](https://www.npmjs.com/package/git-json-resolver-semver-lite)
53-
54-
```bash
55-
pnpm add git-json-resolver-semver-lite
56-
```
57-
58-
**or**
59-
60-
```bash
61-
npm install git-json-resolver-semver-lite
62-
```
63-
64-
**or**
54+
Peer dependencies:
6555

6656
```bash
67-
yarn add git-json-resolver-semver-lite
57+
pnpm install git-json-resolver
6858
```
6959

70-
> You need `r18gs` as a peer-dependency
60+
---
7161

72-
### Import Styles
62+
## 🚀 Usage
7363

74-
You can import styles globally or within specific components.
64+
### 1. Direct Import
7565

76-
```css
77-
/* globals.css */
78-
@import "git-json-resolver-semver/dist";
79-
```
66+
```ts
67+
import { semverMax } from "git-json-resolver-semver";
68+
import { resolveConflicts } from "git-json-resolver";
8069

81-
```tsx
82-
// layout.tsx
83-
import "git-json-resolver-semver/dist/index.css";
70+
await resolveConflicts({
71+
customStrategies: {
72+
"semver-max": semverMax,
73+
},
74+
rules: {
75+
"dependencies.react": ["semver-max"],
76+
"devDependencies.vitest": ["semver-min"],
77+
},
78+
});
8479
```
8580

86-
For selective imports:
81+
### 2. Dynamic Loading
8782

88-
```css
89-
/* globals.css */
90-
@import "git-json-resolver-semver/dist/client"; /** required if you are using LoaderContainer */
91-
@import "git-json-resolver-semver/dist/server/bars/bars1";
83+
```json
84+
{
85+
"plugins": ["git-json-resolver-semver"],
86+
"rules": {
87+
"dependencies.react": ["semver-max"],
88+
"devDependencies.vitest": ["semver-min"]
89+
}
90+
}
9291
```
9392

94-
### Usage
93+
**_or_** TypeScript Config
9594

96-
Using loaders is straightforward.
95+
```ts
96+
// git-json-resolver.config.ts
97+
import type { Config } from "git-json-resolver";
9798

98-
```tsx
99-
import { Bars1 } from "git-json-resolver-semver/dist/server/bars/bars1";
99+
const config: Config = {
100+
plugins: ["git-json-resolver-semver"],
101+
rules: {
102+
"dependencies.react": ["semver-max"],
103+
"devDependencies.vitest": ["semver-min"],
104+
},
105+
};
100106

101-
export default function MyComponent() {
102-
return someCondition ? <Bars1 /> : <>Something else...</>;
103-
}
107+
export default config;
104108
```
105109

106-
For detailed API and options, refer to [the API documentation](https://react18-tools.github.io/git-json-resolver-semver).
110+
---
107111

108-
**Using LoaderContainer**
112+
## ⚙️ Behavior notes
109113

110-
`LoaderContainer` is a fullscreen component. You can add this component directly in your layout and then use `useLoader` hook to toggle its visibility.
114+
- **strict** mode (default) accepts only `x.y.z`. Set non-strict to allow prereleases/ranges.
115+
- **preferValid** (default) returns the valid side when the other is invalid.
116+
- **fallback** controls behavior when neither side is valid (`ours` | `theirs` | `continue` | `error`).
111117

112-
```tsx
113-
// layout.tsx
114-
<LoaderContainer />
115-
...
116-
```
118+
## ⚙️ Strategies
117119

118-
```tsx
119-
// some other page or component
120-
import { useLoader } from "git-json-resolver-semver/dist/hooks";
121-
122-
export default MyComponent() {
123-
const { setLoading } = useLoader();
124-
useCallback(()=>{
125-
setLoading(true);
126-
...do some work
127-
setLoading(false);
128-
}, [])
129-
...
130-
}
131-
```
120+
| Strategy | Behavior | Example (`ours` vs `theirs`) | Result |
121+
| --------------- | --------------------------------------------------------------------- | ---------------------------- | ------- |
122+
| `semver-max` | Picks the higher valid semver | `1.2.3` vs `1.3.0` | `1.3.0` |
123+
| `semver-min` | Picks the lower valid semver | `2.0.0` vs `2.1.0` | `2.0.0` |
124+
| `semver-ours` | Picks `ours` if valid semver, else apply `preferValid` / `fallback` | `1.2.3` vs `banana` | `1.2.3` |
125+
| `semver-theirs` | Picks `theirs` if valid semver, else apply `preferValid` / `fallback` | `foo` vs `2.0.0` | `2.0.0` |
126+
127+
## 🙏 Acknowledgments
128+
129+
- [`git-json-resolver`](https://github.com/...) for the plugin system
130+
- [`compare-versions`](https://github.com/omichelsen/compare-versions) for lightweight semver checks
132131

133132
## License
134133

@@ -139,6 +138,7 @@ This library is licensed under the MPL-2.0 open-source license.
139138
<hr />
140139

141140
<p align="center" style="text-align:center">with 💖 by <a href="https://mayank-chaudhari.vercel.app" target="_blank">Mayank Kumar Chaudhari</a></p>
141+
```
142142
143143
## Modules
144144

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@
4242
"next@>=15.0.0 <15.2.3": ">=15.2.3"
4343
}
4444
}
45-
}
45+
}

0 commit comments

Comments
 (0)