-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(versioning): allow independent versioning (#984)
* feat(versioning): allow independent versioning For that to work, pass the `version` hook, and prevent most logic of `prepare` * more text * Apply suggestions from code review Co-authored-by: Sarah Dayan <[email protected]> Co-authored-by: Sarah Dayan <[email protected]>
- Loading branch information
1 parent
91a9e95
commit 53f2f0b
Showing
13 changed files
with
173 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ import { run } from '../../../util'; | |
import createGitTag from '../createGitTag'; | ||
|
||
describe('createGitTag', () => { | ||
it('works', () => { | ||
const { tagName } = createGitTag({ | ||
it('works with one tag', () => { | ||
const { tagNames } = createGitTag({ | ||
version: '1.2.3', | ||
config: { getTagName: () => 'v1.2.3' }, | ||
dir: '.', | ||
|
@@ -15,6 +15,22 @@ describe('createGitTag', () => { | |
dir: '.', | ||
dryRun: false, | ||
}); | ||
expect(tagName).toEqual('v1.2.3'); | ||
expect(tagNames).toEqual(['v1.2.3']); | ||
}); | ||
|
||
it('works with multiple tags', () => { | ||
const { tagNames } = createGitTag({ | ||
version: '1.2.3', | ||
config: { getTagName: () => ['[email protected]', 'swag@4'] }, | ||
dir: '.', | ||
dryRun: false, | ||
}); | ||
expect(run).toHaveBeenCalledTimes(1); | ||
expect(run).toHaveBeenCalledWith({ | ||
command: 'git tag [email protected] && git tag swag@4', | ||
dir: '.', | ||
dryRun: false, | ||
}); | ||
expect(tagNames).toEqual(['[email protected]', 'swag@4']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import runStep from '../runStep'; | ||
import { run } from '../../util'; | ||
import { arrayify, run } from '../../util'; | ||
|
||
export default ({ version, config, dir, dryRun }) => | ||
runStep({ title: 'Creating a git tag.' }, () => { | ||
const { getTagName } = config; | ||
const tagName = getTagName({ version }); | ||
const command = `git tag ${tagName}`; | ||
const tagNames = arrayify(getTagName({ version })); | ||
const command = tagNames.map((tag) => `git tag ${tag}`).join(' && '); | ||
run({ command, dir, dryRun }); | ||
return { tagName }; | ||
return { tagNames }; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const arrayify = (itemOrArray) => | ||
Array.isArray(itemOrArray) ? itemOrArray : [itemOrArray]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.