Skip to content

Commit 625173e

Browse files
authored
Merge pull request #426 from citation-file-format/404-unsorted-yaml
2 parents 020b8e2 + 0f8fee9 commit 625173e

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/store/cffstr.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ export function useCffstr () {
3535

3636
const makeJavascriptObject = () => {
3737
const cff = {
38-
abstract: abstract.value,
39-
authors: authors.value,
40-
commit: commit.value,
4138
cffVersion: cffVersion.value,
42-
dateReleased: dateReleased.value,
43-
identifiers: identifiers.value,
44-
keywords: keywords.value,
45-
license: license.value,
46-
message: message.value,
47-
repository: repository.value,
48-
repositoryArtifact: repositoryArtifact.value,
49-
repositoryCode: repositoryCode.value,
5039
title: title.value,
40+
message: message.value,
5141
type: type.value,
42+
authors: authors.value,
43+
identifiers: identifiers.value,
44+
repositoryCode: repositoryCode.value,
5245
url: url.value,
53-
version: version.value
46+
repository: repository.value,
47+
repositoryArtifact: repositoryArtifact.value,
48+
abstract: abstract.value,
49+
keywords: keywords.value,
50+
license: license.value,
51+
commit: commit.value,
52+
version: version.value,
53+
dateReleased: dateReleased.value
5454
} as CffType
5555
const filtered = deepfilter(cff, notEmpty)
5656
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
@@ -59,7 +59,7 @@ export function useCffstr () {
5959

6060
const makeCffstr = () => {
6161
const kebabed = makeJavascriptObject()
62-
const yamlString = yaml.dump(kebabed, { indent: 2, sortKeys: true, lineWidth: 53 })
62+
const yamlString = yaml.dump(kebabed, { indent: 2, lineWidth: 53 })
6363
const generatedBy = '# This CITATION.cff file was generated with cffinit.\n# Visit https://bit.ly/cffinit to generate yours today!\n\n'
6464
return generatedBy + yamlString
6565
}

test/jest/__tests__/store/cffstr.jest.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('useCffstr', () => {
1212
})
1313
describe('initial content', () => {
1414
it('should only have fields with defaults', () => {
15-
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\ntype: software\n'
15+
const expected = generatedBy + 'cff-version: 1.2.0\ntype: software\nauthors: []\n'
1616
expect(cffstr.value).toEqual(expected)
1717
})
1818
})
@@ -23,7 +23,7 @@ describe('useCffstr', () => {
2323
})
2424

2525
it('should have title', () => {
26-
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\ntitle: sometitle\ntype: software\n'
26+
const expected = generatedBy + 'cff-version: 1.2.0\ntitle: sometitle\ntype: software\nauthors: []\n'
2727
expect(cffstr.value).toEqual(expected)
2828
})
2929
})
@@ -34,7 +34,7 @@ describe('useCffstr', () => {
3434
})
3535

3636
it('should have a keyword', () => {
37-
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\nkeywords:\n - keyword1\ntype: software\n'
37+
const expected = generatedBy + 'cff-version: 1.2.0\ntype: software\nauthors: []\nkeywords:\n - keyword1\n'
3838
expect(cffstr.value).toEqual(expected)
3939
})
4040
})
@@ -45,7 +45,7 @@ describe('useCffstr', () => {
4545
})
4646

4747
it('should have a identifier', () => {
48-
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\nidentifiers:\n - type: doi\n value: 10.5281/zenodo.5171937\ntype: software\n'
48+
const expected = generatedBy + 'cff-version: 1.2.0\ntype: software\nauthors: []\nidentifiers:\n - type: doi\n value: 10.5281/zenodo.5171937\n'
4949
expect(cffstr.value).toEqual(expected)
5050
})
5151
})

0 commit comments

Comments
 (0)