Skip to content

Commit c4beeba

Browse files
committed
Merge remote-tracking branch 'origin/main' into 209-keywords-validation
2 parents 09a95f3 + e738dea commit c4beeba

7 files changed

Lines changed: 33 additions & 31 deletions

File tree

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html><head><base href=/cffinit/ ><title>cffinit</title><meta charset=utf-8><meta name=description content="Web form to assist people in creating a CITATION.cff file for their projects."><meta name=format-detection content="telephone=no"><meta name=msapplication-tap-highlight content=no><meta name=viewport content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width"><link rel=icon type=image/png href=favicon.png><script defer src=/cffinit/js/vendor.aca7e198.js></script><script defer src=/cffinit/js/app.ec736781.js></script><link href=/cffinit/css/vendor.540f306d.css rel=stylesheet><link href=/cffinit/css/app.fde45849.css rel=stylesheet></head><body><div id=q-app></div></body></html>
1+
<!DOCTYPE html><html><head><base href=/cffinit/ ><title>cffinit</title><meta charset=utf-8><meta name=description content="Web form to assist people in creating a CITATION.cff file for their projects."><meta name=format-detection content="telephone=no"><meta name=msapplication-tap-highlight content=no><meta name=viewport content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width"><link rel=icon type=image/png href=favicon.png><script defer src=/cffinit/js/vendor.aca7e198.js></script><script defer src=/cffinit/js/app.2abb1f0e.js></script><link href=/cffinit/css/vendor.540f306d.css rel=stylesheet><link href=/cffinit/css/app.fde45849.css rel=stylesheet></head><body><div id=q-app></div></body></html>
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/chunk-common.7fc75724.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/chunk-common.d72f94a7.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/store/cff.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import { ref, computed } from 'vue'
22
import { AuthorsType, CffType, IdentifiersType, KeywordsType, TypeType } from '../types'
33

4-
const cffInitialValue = {
5-
abstract: undefined,
6-
authors: [],
7-
cffVersion: '1.2.0',
8-
commit: undefined,
9-
dateReleased: undefined,
10-
identifiers: undefined,
11-
keywords: undefined,
12-
license: undefined,
13-
message: undefined,
14-
repository: undefined,
15-
repositoryArtifact: undefined,
16-
repositoryCode: undefined,
17-
title: undefined,
18-
type: 'software',
19-
url: undefined,
20-
version: undefined
4+
const getInitialData = () => {
5+
return {
6+
abstract: undefined,
7+
authors: [],
8+
cffVersion: '1.2.0',
9+
commit: undefined,
10+
dateReleased: undefined,
11+
identifiers: undefined,
12+
keywords: undefined,
13+
license: undefined,
14+
message: undefined,
15+
repository: undefined,
16+
repositoryArtifact: undefined,
17+
repositoryCode: undefined,
18+
title: undefined,
19+
type: 'software',
20+
url: undefined,
21+
version: undefined
22+
} as CffType
2123
}
2224

23-
const cff = ref(cffInitialValue as CffType)
25+
const cff = ref(getInitialData())
2426

2527
export function useCff () {
2628
return {
@@ -56,7 +58,7 @@ export function useCff () {
5658
setUrl: (newUrl: string) => { cff.value.url = newUrl === '' ? undefined : newUrl },
5759
setVersion: (newVersion: string) => { cff.value.version = newVersion === '' ? undefined : newVersion },
5860
reset: () => {
59-
cff.value = cffInitialValue as CffType
61+
cff.value = getInitialData()
6062
}
6163
}
6264
}

src/store/cffstr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export function useCffstr () {
6060
const makeCffstr = () => {
6161
const kebabed = makeJavascriptObject()
6262
const yamlString = yaml.dump(kebabed, { indent: 2, sortKeys: true, lineWidth: 53 })
63-
const generatedBy = '# This CFF file was generated with cffinit at\n# https://bit.ly/cffinit.\n'
64-
return yamlString + generatedBy
63+
const generatedBy = '# This CITATION.cff file was generated with cffinit.\n# Visit https://bit.ly/cffinit to generate yours today!\n\n'
64+
return generatedBy + yamlString
6565
}
6666
return {
6767
jsObject: computed(makeJavascriptObject),

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { beforeEach, describe, expect, it } from '@jest/globals'
2-
import { useCff } from '../../../../src/store/cff'
3-
import { useCffstr } from '../../../../src/store/cffstr'
2+
import { useCff } from 'src/store/cff'
3+
import { useCffstr } from 'src/store/cffstr'
44

55
describe('useCffstr', () => {
66
const cff = useCff()
7-
const generatedBy = '# This CFF file was generated with cffinit at\n# https://bit.ly/cffinit.\n'
7+
const generatedBy = '# This CITATION.cff file was generated with cffinit.\n# Visit https://bit.ly/cffinit to generate yours today!\n\n'
88
const { cffstr } = useCffstr()
99

1010
beforeEach(() => {
1111
cff.reset()
1212
})
1313
describe('initial content', () => {
1414
it('should only have fields with defaults', () => {
15-
const expected = 'authors: []\ncff-version: 1.2.0\ntype: software\n' + generatedBy
15+
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\ntype: software\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 = 'authors: []\ncff-version: 1.2.0\ntitle: sometitle\ntype: software\n' + generatedBy
26+
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\ntitle: sometitle\ntype: software\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 = 'authors: []\ncff-version: 1.2.0\nkeywords:\n - keyword1\ntype: software\n' + generatedBy
37+
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\nkeywords:\n - keyword1\ntype: software\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 = 'authors: []\ncff-version: 1.2.0\nidentifiers:\n - type: doi\n value: 10.5281/zenodo.5171937\ntype: software\n' + generatedBy
48+
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\nidentifiers:\n - type: doi\n value: 10.5281/zenodo.5171937\ntype: software\n'
4949
expect(cffstr.value).toEqual(expected)
5050
})
5151
})

0 commit comments

Comments
 (0)