@pob/version 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/.editorconfig +13 -0
- package/.yo-rc.json +13 -0
- package/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +163 -0
- package/dist/index-node.mjs +1419 -0
- package/dist/index-node.mjs.map +1 -0
- package/package.json +81 -0
- package/rollup.config.mjs +12 -0
- package/src/__fixtures__/bun-basic/package.json +4 -0
- package/src/__fixtures__/bun-no-version/package.json +3 -0
- package/src/__fixtures__/yarn-basic/package.json +4 -0
- package/src/__fixtures__/yarn-basic/yarn.lock +12 -0
- package/src/__fixtures__/yarn-monorepo/package.json +7 -0
- package/src/__fixtures__/yarn-monorepo/packages/package-1/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo/packages/package-2/package.json +7 -0
- package/src/__fixtures__/yarn-monorepo/packages/package-3/package.json +7 -0
- package/src/__fixtures__/yarn-monorepo/packages/package-4/package.json +7 -0
- package/src/__fixtures__/yarn-monorepo/packages/package-5/package.json +8 -0
- package/src/__fixtures__/yarn-monorepo/yarn.lock +0 -0
- package/src/__fixtures__/yarn-monorepo-duplicate-names/package.json +7 -0
- package/src/__fixtures__/yarn-monorepo-duplicate-names/packages/pkg-a/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-duplicate-names/packages/pkg-b/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-invalid-package-json/package.json +7 -0
- package/src/__fixtures__/yarn-monorepo-invalid-package-json/packages/pkg-with-invalid-json/package.json +5 -0
- package/src/__fixtures__/yarn-monorepo-nested/package.json +9 -0
- package/src/__fixtures__/yarn-monorepo-nested/packages/deep-nested/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-nested/packages/nested-1/packages/package-nested.json +4 -0
- package/src/__fixtures__/yarn-monorepo-nested/packages/nested-1/packages/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-nested/packages/package-1/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-no-name/package.json +7 -0
- package/src/__fixtures__/yarn-monorepo-no-name/packages/no-name-package/package.json +3 -0
- package/src/__fixtures__/yarn-monorepo-object-form/package.json +9 -0
- package/src/__fixtures__/yarn-monorepo-object-form/packages/package-1/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-object-form/packages/package-2/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-object-form/packages/package-3/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-object-form/packages/package-4/package.json +4 -0
- package/src/__fixtures__/yarn-monorepo-object-form/packages/package-5/package.json +4 -0
- package/src/__fixtures__/yarn-no-version/package.json +3 -0
- package/src/__fixtures__/yarn-no-version/yarn.lock +0 -0
- package/src/__fixtures__/yarn-with-lifecycle/.yarn/install-state.gz +0 -0
- package/src/__fixtures__/yarn-with-lifecycle/package.json +7 -0
- package/src/__fixtures__/yarn-with-lifecycle/yarn.lock +11 -0
- package/src/commands/version.test.ts +114 -0
- package/src/commands/version.ts +936 -0
- package/src/index.ts +13 -0
- package/src/missing-types.d.ts +10 -0
- package/src/pm/BunPackageManager.ts +12 -0
- package/src/pm/PackageManager.ts +66 -0
- package/src/pm/YarnPackageManager.ts +34 -0
- package/src/utils/UsageError.ts +6 -0
- package/src/utils/bumpTypeUtils.ts +113 -0
- package/src/utils/conventionalChangelogUtils.test.ts +762 -0
- package/src/utils/conventionalChangelogUtils.ts +104 -0
- package/src/utils/conventionalCommitConfigUtils.ts +20 -0
- package/src/utils/execCommand.ts +214 -0
- package/src/utils/generatorUtils.ts +11 -0
- package/src/utils/gitUtils.ts +193 -0
- package/src/utils/githubUtils.ts +114 -0
- package/src/utils/mapUtils.ts +7 -0
- package/src/utils/mapWorkspaces.test.ts +89 -0
- package/src/utils/packageDependenciesUtils.test.ts +25 -0
- package/src/utils/packageDependenciesUtils.ts +80 -0
- package/src/utils/packageUtils.test.ts +32 -0
- package/src/utils/packageUtils.ts +127 -0
- package/src/utils/updateChangelog.ts +39 -0
- package/src/utils/workspaceUtils.ts +142 -0
- package/tsconfig.json +21 -0
- package/vitest.config.js +9 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# EditorConfig helps developers define and maintain consistent
|
|
2
|
+
# coding styles between different editors and IDEs
|
|
3
|
+
# http://editorconfig.org
|
|
4
|
+
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
end_of_line = lf
|
|
11
|
+
charset = utf-8
|
|
12
|
+
trim_trailing_whitespace = true
|
|
13
|
+
insert_final_newline = true
|
package/.yo-rc.json
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [1.0.1](https://github.com/christophehurpeau/pob/compare/@pob/version@1.0.0...@pob/version@1.0.1) (2025-12-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* warn if no changes made
|
|
11
|
+
|
|
12
|
+
## [1.0.0](https://github.com/christophehurpeau/pob/compare/@pob/version@5.2.0...@pob/version@1.0.0) (2025-12-06)
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* use gh cli instead of octokit/rest
|
|
17
|
+
* migrate pob-version to @pob/version and add initial bun support
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* drop @pob/version
|
|
22
|
+
* migrate pob-version to @pob/version and add initial bun support
|
|
23
|
+
* try to implement publish with bun
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* use replaceAll for newline handling in version command logging
|
|
28
|
+
|
|
29
|
+
### Code Refactoring
|
|
30
|
+
|
|
31
|
+
* use gh cli instead of octokit/rest
|
|
32
|
+
|
|
33
|
+
Version bump for dependency: @pob/rollup-esbuild
|
|
34
|
+
|
|
35
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<h3 align="center">
|
|
2
|
+
@pob/version
|
|
3
|
+
</h3>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
versionning using conventional commits
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
yarn add --dev @pob/version conventional-changelog-conventionalcommits
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn @pob/version version --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Options
|
|
22
|
+
|
|
23
|
+
`--bump-dependents-highest-as` is for updates in dependent packages. In a monorepo, when a package B has a peer dependency on package A, if A is updated with a breaking change (major), but B has no changes, B will be updated with this option. Sometimes, a major in A should update B with patch or minor. Sometimes, it should also be a major as it also breaks things for B. The default is `major`. If A is `minor` and the value is `major`, B will be updated as `minor`.
|
|
24
|
+
|
|
25
|
+
## Example with Github Action, for a simple repository
|
|
26
|
+
|
|
27
|
+
```yml
|
|
28
|
+
name: Release
|
|
29
|
+
on:
|
|
30
|
+
workflow_dispatch:
|
|
31
|
+
inputs:
|
|
32
|
+
dry-run:
|
|
33
|
+
description: "Dry run"
|
|
34
|
+
required: true
|
|
35
|
+
type: boolean
|
|
36
|
+
default: false
|
|
37
|
+
|
|
38
|
+
permissions:
|
|
39
|
+
id-token: write # Required for OIDC
|
|
40
|
+
contents: write # Required to create release
|
|
41
|
+
|
|
42
|
+
jobs:
|
|
43
|
+
release:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v5
|
|
47
|
+
with:
|
|
48
|
+
fetch-depth: 0
|
|
49
|
+
|
|
50
|
+
- name: Enable Corepack
|
|
51
|
+
run: corepack enable
|
|
52
|
+
|
|
53
|
+
- uses: actions/setup-node@v6
|
|
54
|
+
with:
|
|
55
|
+
node-version: 24
|
|
56
|
+
|
|
57
|
+
- name: Install Dependencies
|
|
58
|
+
run: yarn install --immutable --immutable-cache
|
|
59
|
+
|
|
60
|
+
- name: New version (dry run)
|
|
61
|
+
if: github.ref == 'refs/heads/main' && inputs.dry-run
|
|
62
|
+
run: yarn pob-version --dry-run
|
|
63
|
+
|
|
64
|
+
- name: Configure Git user
|
|
65
|
+
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
66
|
+
run: |
|
|
67
|
+
git config --global user.name 'github-actions[bot]'
|
|
68
|
+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
69
|
+
|
|
70
|
+
- name: New version
|
|
71
|
+
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
72
|
+
run: |
|
|
73
|
+
yarn pob-version --create-release=github -m 'chore: release %v [skip ci]'
|
|
74
|
+
env:
|
|
75
|
+
HUSKY: 0
|
|
76
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
77
|
+
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
|
78
|
+
|
|
79
|
+
- name: Publish to npm
|
|
80
|
+
run: |
|
|
81
|
+
if [ -z "$NODE_AUTH_TOKEN" ]; then
|
|
82
|
+
echo "Missing env variable NODE_AUTH_TOKEN"
|
|
83
|
+
exit 1
|
|
84
|
+
fi
|
|
85
|
+
echo >> ./.yarnrc.yml
|
|
86
|
+
echo "npmAuthToken: $NODE_AUTH_TOKEN" >> ./.yarnrc.yml
|
|
87
|
+
yarn npm publish
|
|
88
|
+
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
89
|
+
env:
|
|
90
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Example with Github Action, for a monorepo
|
|
94
|
+
|
|
95
|
+
```yml
|
|
96
|
+
name: Release
|
|
97
|
+
on:
|
|
98
|
+
workflow_dispatch:
|
|
99
|
+
inputs:
|
|
100
|
+
dry-run:
|
|
101
|
+
description: "Dry run"
|
|
102
|
+
required: true
|
|
103
|
+
type: boolean
|
|
104
|
+
default: false
|
|
105
|
+
bump-dependents-highest-as:
|
|
106
|
+
description: "Bump dependents highest as"
|
|
107
|
+
required: false
|
|
108
|
+
type: choice
|
|
109
|
+
options:
|
|
110
|
+
- major
|
|
111
|
+
- minor
|
|
112
|
+
- patch
|
|
113
|
+
default: "major"
|
|
114
|
+
|
|
115
|
+
jobs:
|
|
116
|
+
release:
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
steps:
|
|
119
|
+
- uses: actions/checkout@v5
|
|
120
|
+
with:
|
|
121
|
+
fetch-depth: 0
|
|
122
|
+
|
|
123
|
+
- name: Enable Corepack
|
|
124
|
+
run: corepack enable
|
|
125
|
+
|
|
126
|
+
- uses: actions/setup-node@v3
|
|
127
|
+
with:
|
|
128
|
+
node-version: 24
|
|
129
|
+
|
|
130
|
+
- name: Install Dependencies
|
|
131
|
+
run: yarn install --immutable --immutable-cache
|
|
132
|
+
|
|
133
|
+
- name: New version (dry run)
|
|
134
|
+
if: github.ref == 'refs/heads/main' && inputs.dry-run
|
|
135
|
+
run: yarn pob-version --dry-run --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}
|
|
136
|
+
- name: Configure Git user
|
|
137
|
+
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
138
|
+
run: |
|
|
139
|
+
git config --global user.name 'github-actions[bot]'
|
|
140
|
+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
141
|
+
|
|
142
|
+
- name: New version
|
|
143
|
+
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
144
|
+
run: |
|
|
145
|
+
yarn pob-version --create-release=github --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }} -m 'chore: release [skip ci]\n\n%t'
|
|
146
|
+
env:
|
|
147
|
+
HUSKY: 0
|
|
148
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
149
|
+
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
|
150
|
+
|
|
151
|
+
- name: Publish to npm
|
|
152
|
+
run: |
|
|
153
|
+
if [ -z "$NODE_AUTH_TOKEN" ]; then
|
|
154
|
+
echo "Missing env variable NODE_AUTH_TOKEN"
|
|
155
|
+
exit 1
|
|
156
|
+
fi
|
|
157
|
+
echo >> ./.yarnrc.yml
|
|
158
|
+
echo "npmAuthToken: $NODE_AUTH_TOKEN" >> ./.yarnrc.yml
|
|
159
|
+
yarn workspaces foreach --parallel --no-private npm publish --tolerate-republish
|
|
160
|
+
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
161
|
+
env:
|
|
162
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
163
|
+
```
|