Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/wild-comics-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"crossref-utils": patch
---

Warn if article and journal doi prefixes do not match
12 changes: 10 additions & 2 deletions src/cli/deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,13 @@ export async function deposit(session: ISession, opts: DepositOptions) {

let body: Element;
if (depositType === 'journal') {
if (!journalTitle || !journalDoi) throw new Error('Journal title and DOI are required');
if (!journalTitle) throw new Error('Journal title is required');
if (!journalDoi) throw new Error('Journal DOI is required');
let journalIssue: JournalIssue | undefined;
console.log('Deposit summary:');
console.log(' Journal:');
console.log(` Title: ${journalTitle}${journalAbbr ? ` (${journalAbbr})` : ''}`);
if (journalDoi) console.log(` Doi: ${journalDoi}`);
console.log(` Doi: ${journalDoi}`);
if (volumeNumber || issueNumber || issueDoi) {
if (!publicationDate) {
throw new Error(`publication date is required for journal issue`);
Expand All @@ -492,10 +493,17 @@ export async function deposit(session: ISession, opts: DepositOptions) {
};
}
console.log(' Articles:');
const journalDoiPrefix = journalDoi.split('/')[0];
depositArticles.forEach(({ frontmatter }) => {
console.log(
` ${frontmatter.doi} - ${frontmatter.title?.slice(0, 30)}${(frontmatter.title?.length ?? 0) > 30 ? '...' : ''}`,
);
const articleDoiPrefix = frontmatter.doi?.split('/')[0];
if (journalDoiPrefix !== articleDoiPrefix) {
session.log.warn(
` Article DOI prefix ${articleDoiPrefix} does not match Journal DOI prefix ${journalDoiPrefix}`,
);
}
});
body = journalXml(
{
Expand Down