diff --git a/src/tasks/Publish/get-git-tag-name.js b/src/tasks/Publish/get-git-tag-name.js index 1527024..69c3b4e 100644 --- a/src/tasks/Publish/get-git-tag-name.js +++ b/src/tasks/Publish/get-git-tag-name.js @@ -1,4 +1,6 @@ +import { normalisePackageNameNpm } from './normalise-package-name'; + export default function getGitTagName(pkg) { - const gitpkgPackageName = `${pkg.name}@${pkg.version}-gitpkg`; + const gitpkgPackageName = `${normalisePackageNameNpm(pkg.name)}-v${pkg.version}-gitpkg`; return gitpkgPackageName; } diff --git a/src/tasks/Publish/normalise-package-name.js b/src/tasks/Publish/normalise-package-name.js index 470da61..7870b12 100644 --- a/src/tasks/Publish/normalise-package-name.js +++ b/src/tasks/Publish/normalise-package-name.js @@ -10,10 +10,10 @@ export default async function normalisePackageName(name) { return normalisePackageNameYarn(name); } -function normalisePackageNameNpm(name) { +export function normalisePackageNameNpm(name) { return name[0] === '@' ? name.substr(1).replace(/\//g, '-') : name; } -function normalisePackageNameYarn(name) { +export function normalisePackageNameYarn(name) { return name[0] === '@' ? name.substr(1).replace('/', '-') : name; } diff --git a/test/tasks/get-git-tag-name.test.js b/test/tasks/get-git-tag-name.test.js index 73e2df1..729ac7c 100644 --- a/test/tasks/get-git-tag-name.test.js +++ b/test/tasks/get-git-tag-name.test.js @@ -1,7 +1,7 @@ import getGitTagName from '../../src/tasks/Publish/get-git-tag-name'; const pkg = { name: 'megapkg', version: '1.0.0' }; -const gitTagName = `${pkg.name}@${pkg.version}-gitpkg`; +const gitTagName = `${pkg.name}-v${pkg.version}-gitpkg`; describe('while using getGitTagName()', () => { it(`should return "${gitTagName}"`, () => {