update-workspace-root-version 0.3.1 → 1.0.1
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
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# update-workspace-root-version
|
|
4
4
|
|
|
5
|
-
_Update the workspace root version in a monorepo_
|
|
6
|
-
|
|
7
5
|
1. [Why use it?](#why-use-it)
|
|
8
6
|
1. [Usage](#usage)
|
|
9
7
|
- [Arguments](#arguments)
|
|
@@ -15,18 +13,18 @@ _Update the workspace root version in a monorepo_
|
|
|
15
13
|
|
|
16
14
|
## Why use it?
|
|
17
15
|
|
|
18
|
-
Git tags mark a specific point in a repo's history and are usually created
|
|
16
|
+
Git tags mark a specific point in a repo's history and are usually created at the time of release. Thanks to these tags, we can easily send people links and point to specific code. We can also compare tags to see how files have changed.
|
|
19
17
|
|
|
20
|
-
Creating tags can be tricky in monorepos, because we can release many packages at once
|
|
18
|
+
Creating tags can be tricky in monorepos, because we can release many packages at once. How do we create just 1 tag (no matter how many packages) and give it a name that resembles a [semantic version](https://semver.org/)?
|
|
21
19
|
|
|
22
|
-
Solution: We let the workspace root
|
|
20
|
+
Solution: We let the version of the workspace root indicate the state of the whole project, then set the tag name to be this version. `update-workspace-root-version` helps you update the version automatically.
|
|
23
21
|
|
|
24
22
|
|
|
25
23
|
## Usage
|
|
26
24
|
|
|
27
|
-
At the workspace root, install `update-workspace-root-version` as a development dependency.
|
|
25
|
+
At the workspace root, install `update-workspace-root-version` as a development dependency.
|
|
28
26
|
|
|
29
|
-
For example,
|
|
27
|
+
Then, run the codemod before you create a tag. For example, after [changesets](https://github.com/changesets/changesets) updates all package versions, we update the workspace root's version.
|
|
30
28
|
|
|
31
29
|
```json5
|
|
32
30
|
/* package.json */
|
|
@@ -21,8 +21,13 @@ export function getPackageVersions(options) {
|
|
|
21
21
|
const packageRoots = getPackageRoots(options);
|
|
22
22
|
return packageRoots
|
|
23
23
|
.map((packageRoot) => {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
try {
|
|
25
|
+
const packageJson = readPackageJson({ projectRoot: packageRoot });
|
|
26
|
+
return packageJson['version'];
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
26
31
|
})
|
|
27
32
|
.filter(allow);
|
|
28
33
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "update-workspace-root-version",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Update the workspace root version in a monorepo",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
7
|
+
"semver",
|
|
7
8
|
"versioning",
|
|
8
9
|
"workspace"
|
|
9
10
|
],
|
|
@@ -29,17 +30,17 @@
|
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@babel/core": "^7.25.2",
|
|
32
|
-
"@changesets/cli": "^2.27.
|
|
33
|
+
"@changesets/cli": "^2.27.8",
|
|
33
34
|
"@changesets/get-github-info": "^0.6.0",
|
|
34
35
|
"@codemod-utils/tests": "^1.1.7",
|
|
35
36
|
"@sondr3/minitest": "^0.1.2",
|
|
36
37
|
"@tsconfig/node18": "^18.2.4",
|
|
37
38
|
"@tsconfig/strictest": "^2.0.5",
|
|
38
|
-
"@types/node": "^18.19.
|
|
39
|
+
"@types/node": "^18.19.50",
|
|
39
40
|
"@types/yargs": "^17.0.33",
|
|
40
41
|
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
41
42
|
"@typescript-eslint/parser": "^8.4.0",
|
|
42
|
-
"concurrently": "^
|
|
43
|
+
"concurrently": "^9.0.0",
|
|
43
44
|
"eslint": "^8.57.0",
|
|
44
45
|
"eslint-config-prettier": "^9.1.0",
|
|
45
46
|
"eslint-import-resolver-typescript": "^3.6.3",
|