Skip to content

Commit 9c81067

Browse files
committed
Lint files.
1 parent 35bd7af commit 9c81067

15 files changed

Lines changed: 182 additions & 115 deletions

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "npm"
9-
directory: "/"
8+
- package-ecosystem: npm
9+
directory: /
1010
schedule:
11-
interval: "weekly"
11+
interval: weekly

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Test CI
55

66
on:
77
push:
8-
branches: ["main"]
8+
branches: [main]
99
pull_request:
10-
branches: ["main"]
10+
branches: [main]
1111

1212
jobs:
1313
test:
@@ -28,7 +28,7 @@ jobs:
2828
uses: actions/setup-node@v4
2929
with:
3030
node-version: ${{ matrix.node-version }}
31-
cache: "pnpm"
31+
cache: pnpm
3232

3333
- name: Prepare environment
3434
run: |
@@ -48,8 +48,8 @@ jobs:
4848

4949
automerge:
5050
if: >
51-
github.event_name == 'pull_request' &&
52-
github.event.pull_request.user.login == 'dependabot[bot]'
51+
github.event_name == 'pull_request' &&
52+
github.event.pull_request.user.login == 'dependabot[bot]'
5353
needs: test
5454
runs-on: ubuntu-latest
5555
permissions:

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ You need a working `git` binary in your `PATH`.
4949
The package also exposes some methods so you could use `versionize` inside your project:
5050

5151
```javascript
52-
import { getCurrentVersion, bumpVersion } from '@uscreen.de/versionize'
52+
import { bumpVersion, getCurrentVersion } from '@uscreen.de/versionize'
5353
```
5454

5555
#### getCurrentVersion
@@ -101,56 +101,76 @@ bumpVersion('stable', { tag: true })
101101
> Format according to https://keepachangelog.com
102102
103103
### v0.8.0
104+
104105
#### Changed
106+
105107
- adjust node requirements
106108
- upgrade multiple packages
107109
- replace tap with native node tests
108110
- migrate to pnpm
109111

110112
### v0.7.1
113+
111114
#### Fixed
115+
112116
- fix api documentation in readme
113117

114118
### v0.7.0
119+
115120
#### Added
121+
116122
- expose method to bump version
117123

118124
#### Removed
125+
119126
- node v16 support
120127

121128
### v0.6.1
129+
122130
#### Fixed
131+
123132
- write newline to end of package file
124133

125134
### v0.6.0
135+
126136
#### Added
137+
127138
- cli option to commit changes to git without tag
128139

129140
### v0.5.0
141+
130142
#### Added
143+
131144
- cli option to commit changes to git and tag new commit
132145

133146
### v0.4.0
147+
134148
#### Added
149+
135150
- cli option for raw output
136151

137152
### v0.3.0
153+
138154
#### Added
155+
139156
- show current version when calling versionize without arguments
140157

141158
#### Changed
159+
142160
- give feedback about current version, too
143161
- small ui changes
144162
- refactoring
145163

146164
### v0.2.0
147165

148166
#### Added
167+
149168
- give feedback about new version
150169

151170
### v0.1.0
152171

153172
#### Added
173+
154174
- initial version with basic functionality
155175

156176
---

bin/cli.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#!/usr/bin/env node
22

3+
import { createRequire } from 'node:module'
4+
import process from 'node:process'
35
import { Argument, Command, Option } from 'commander'
4-
import { createRequire } from 'module'
56

67
import {
7-
getCurrentVersion,
88
bumpVersion,
9-
releaseTypes,
10-
info,
11-
warn,
129
error,
1310
execCommit,
14-
execCommitAndTag
11+
execCommitAndTag,
12+
getCurrentVersion,
13+
info,
14+
releaseTypes,
15+
warn
1516
} from '../src/utils.js'
1617

1718
const require = createRequire(import.meta.url)
@@ -32,25 +33,36 @@ const versionizeAction = (
3233
try {
3334
if (!releaseType) {
3435
const version = getCurrentVersion()
35-
if (raw) return console.log(version)
36+
if (raw) {
37+
return console.log(version)
38+
}
3639

3740
info(`Current version is ${version}`)
38-
} else {
41+
}
42+
else {
3943
const { currentVersion, newVersion, files } = bumpVersion(releaseType)
4044

4145
try {
42-
if (tag) execCommitAndTag(newVersion, files)
43-
else if (commit) execCommit(newVersion, files)
44-
} catch (e) {
46+
if (tag) {
47+
execCommitAndTag(newVersion, files)
48+
}
49+
else if (commit) {
50+
execCommit(newVersion, files)
51+
}
52+
}
53+
catch {
4554
warn('git execution failed')
4655
}
4756

48-
if (raw) return console.log(newVersion)
57+
if (raw) {
58+
return console.log(newVersion)
59+
}
4960

5061
info(`Current version is ${currentVersion}`)
5162
info(`New version is ${newVersion}`)
5263
}
53-
} catch (e) {
64+
}
65+
catch (e) {
5466
error(e)
5567
}
5668
}

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
{
22
"name": "@uscreen.de/versionize",
3+
"type": "module",
34
"version": "0.8.2",
5+
"packageManager": "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd",
46
"description": "opinionated package versioner",
5-
"main": "src/index.js",
6-
"type": "module",
7+
"author": "Martin Herting <herting@uscreen.de>",
8+
"license": "MIT",
79
"homepage": "https://github.com/uscreen/versionize",
810
"repository": {
911
"type": "git",
1012
"url": "git+https://github.com/uscreen/versionize.git"
1113
},
14+
"main": "src/index.js",
1215
"bin": {
1316
"versionize": "./bin/cli.js"
1417
},
15-
"author": "Martin Herting <herting@uscreen.de>",
16-
"license": "MIT",
18+
"files": [
19+
"bin/",
20+
"src/"
21+
],
1722
"engines": {
1823
"node": ">=20"
1924
},
@@ -25,22 +30,17 @@
2530
"lint": "eslint .",
2631
"lint:fix": "eslint . --fix"
2732
},
28-
"files": [
29-
"bin/",
30-
"src/"
31-
],
32-
"devDependencies": {
33-
"@antfu/eslint-config": "^7.6.1",
34-
"c8": "^11.0.0",
35-
"eslint": "^9.39.3",
36-
"eslint-plugin-format": "^1.5.0",
37-
"tempy": "^3.1.0"
38-
},
3933
"dependencies": {
4034
"chalk": "^5.6.2",
4135
"commander": "^14.0.2",
4236
"package-directory": "^8.1.0",
4337
"semver": "^7.7.3"
4438
},
45-
"packageManager": "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd"
39+
"devDependencies": {
40+
"@antfu/eslint-config": "^7.6.1",
41+
"c8": "^11.0.0",
42+
"eslint": "^9.39.3",
43+
"eslint-plugin-format": "^1.5.0",
44+
"tempy": "^3.1.0"
45+
}
4646
}

src/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
22
bumpVersion as _bumpVersion,
3-
releaseTypes,
43
execCommit,
5-
execCommitAndTag
4+
execCommitAndTag,
5+
releaseTypes
66
} from './utils.js'
77

88
export { getCurrentVersion } from './utils.js'
@@ -12,15 +12,19 @@ export const bumpVersion = (
1212
{ commit = false, tag = false, cwd } = {}
1313
) => {
1414
if (!releaseTypes.includes(releaseType)) {
15-
throw Error('Invalid release type')
15+
throw new Error('Invalid release type')
1616
}
1717

1818
const { currentVersion, newVersion, files } = _bumpVersion(releaseType, {
1919
cwd
2020
})
2121

22-
if (tag) execCommitAndTag(newVersion, files, { cwd })
23-
else if (commit) execCommit(newVersion, files, { cwd })
22+
if (tag) {
23+
execCommitAndTag(newVersion, files, { cwd })
24+
}
25+
else if (commit) {
26+
execCommit(newVersion, files, { cwd })
27+
}
2428

2529
return { currentVersion, newVersion }
2630
}

0 commit comments

Comments
 (0)