Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fixes wrong order of pre-release tags #274

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM node:12.14.1-alpine3.11
# syntax=docker/dockerfile:1
FROM node:lts-alpine3.20
ENV NODE_ENV=production

# install dependencies
RUN apk add --no-cache git=2.24.1-r0
RUN apk add --no-cache git \
&& git config --global --add safe.directory /app

# build gitmoji-changelog from source
WORKDIR /usr/src/gitmoji-changelog
Expand All @@ -13,4 +15,3 @@ RUN yarn --frozen-lockfile && yarn cache clean
RUN ln -s /usr/src/gitmoji-changelog/node_modules/.bin/gitmoji-changelog /usr/bin
WORKDIR /app
ENTRYPOINT ["gitmoji-changelog"]
USER node
2 changes: 1 addition & 1 deletion packages/gitmoji-changelog-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"dependencies": {
"@gitmoji-changelog/core": "^2.2.0",
"@gitmoji-changelog/markdown": "^2.2.0",
"compare-versions": "^6.1.1",
"hosted-git-info": "^3.0.2",
"immutadot": "^1.0.0",
"inquirer": "^6.3.1",
Expand All @@ -43,7 +44,6 @@
"rc": "^1.2.8",
"read-pkg-up": "^7.0.1",
"semver": "^5.6.0",
"semver-compare": "^1.0.0",
"simple-git": "^1.113.0",
"toml": "^3.0.0",
"yaml": "^1.10.2",
Expand Down
26 changes: 26 additions & 0 deletions packages/gitmoji-changelog-cli/src/cli.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,32 @@ describe('generate changelog', () => {

expect(getChangelog()).includes(['1.0.0', '2.0.0'])
})
it('should get three versions 1.0.0 and 1.0.1-alpha.1 and 1.0.1-alpha.2 in the right order while initializing changelog', async () => {
await makeChanges('file1')
await commit(':sparkles: Add some file')
await bumpVersion('1.0.0')
await commit(':bookmark: Version 1.0.0')
await tag('1.0.0')

await makeChanges('file2')
await commit(':sparkles: Add another file')
await bumpVersion('1.0.1-alpha.1')
await commit(':bookmark: Version 1.0.1-alpha.1')
await tag('1.0.1-alpha.1')

await makeChanges('file3')
await commit(':sparkles: Add one more file')
await bumpVersion('1.0.1-alpha.2')
await commit(':bookmark: Version 1.0.1-alpha.2')
await tag('1.0.1-alpha.2')

gitmojiChangelog()

const tags = /name="([^"]+)"/g
const foundTags = [...getChangelog().matchAll(tags)].flatMap(entry => entry[1])

expect([...foundTags]).toEqual(['1.0.1-alpha.2', '1.0.1-alpha.1', '1.0.0'])
})
})

describe('update', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/gitmoji-changelog-cli/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { get } = require('lodash')
const { set } = require('immutadot')
const libnpm = require('libnpm')
const semver = require('semver')
const semverCompare = require('semver-compare')
const { compareVersions: semverCompare } = require('compare-versions')
const rc = require('rc')

const { generateChangelog, logger, FunctionalError } = require('@gitmoji-changelog/core')
Expand Down
2 changes: 1 addition & 1 deletion packages/gitmoji-changelog-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"homepage": "https://github.com/frinyvonnick/gitmoji-changelog#readme",
"dependencies": {
"compare-versions": "^6.1.1",
"concat-stream": "^1.6.2",
"fast-levenshtein": "^2.0.6",
"git-raw-commits": "^2.0.0",
Expand All @@ -27,7 +28,6 @@
"normalize-package-data": "^2.4.0",
"read-pkg-up": "^7.0.1",
"semver": "^5.6.0",
"semver-compare": "^1.0.0",
"signale": "^1.3.0",
"split-lines": "^2.0.0",
"through2": "^2.0.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/gitmoji-changelog-core/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const semver = require('semver')
const semverCompare = require('semver-compare')
const { compareVersions: semverCompare } = require('compare-versions')

const { isEmpty } = require('lodash')

Expand Down
Loading