🍋
Menu
Developer

Monorepo

Monolithic Repository

A version control strategy where multiple projects or packages are stored in a single repository, simplifying dependency management.

Chi tiết kỹ thuật

Monorepo encodes backward-compatibility promises in the version number. MAJOR changes indicate breaking API changes, MINOR adds backward-compatible features, and PATCH fixes bugs without API changes. Pre-release versions use hyphens (1.0.0-alpha.1) and build metadata uses plus signs (1.0.0+20260308). The caret (^1.2.3) and tilde (~1.2.3) range operators in package managers interpret version constraints differently: caret allows minor updates, tilde allows only patch updates.

Ví dụ

```javascript
// Parse semantic version
const [major, minor, patch] = '2.4.1'.split('.').map(Number);

// Version comparison
function semverCompare(a, b) {
  const pa = a.split('.').map(Number);
  const pb = b.split('.').map(Number);
  for (let i = 0; i < 3; i++) {
    if (pa[i] !== pb[i]) return pa[i] - pb[i];
  }
  return 0;
}
```

Công cụ liên quan

Thuật ngữ liên quan