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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets).

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md).
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/short-wolves-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'cffjs': patch
---

Update readme and change to a community repository owned by Continuous Science Foundation
27 changes: 11 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,24 @@ jobs:
with:
fetch-depth: 2
submodules: recursive
- name: Use Node.js
uses: actions/setup-node@v1
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
node-version: 20.x
- run: npm install
- run: npm run lint:format
- run: npm run lint
bun-version: latest
- run: bun install
- run: bun run lint:format
- run: bun run lint
test:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18', '20', '21']
name: Testing on node ${{ matrix.node }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
submodules: recursive
- name: Setup Node.js environment
uses: actions/setup-node@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm install
- run: npm run test
bun-version: latest
- run: bun install
- run: bun test
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'

- name: Update npm to latest
run: npm install -g npm@latest

- name: Install Dependencies
run: bun install

- name: Build
run: bun run build

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
with:
version: bun run version
publish: bun run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
dist
.claude
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2024 Curvenote Inc.
Copyright (c) 2026 Continuous Science Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
74 changes: 63 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,70 @@
# Citation CFF Utils
# cffjs

Typescript utility library for `CITATION.cff` files.
[![cffjs on npm](https://img.shields.io/npm/v/cffjs.svg)](https://www.npmjs.com/package/cffjs)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/continuous-foundation/cffjs/blob/main/LICENSE)
![CI](https://github.com/continuous-foundation/cffjs/workflows/CI/badge.svg)

[Citation File Format](https://github.com/citation-file-format/citation-file-format) is used to provide citation metadata for software and datasets in YAML.
Types and utilities for working with [`CITATION.cff`](https://github.com/citation-file-format/citation-file-format) files in TypeScript.

## Current scope
The Citation File Format provides citation metadata for software and datasets in YAML.

- Reading, writing, validating `CITATION.cff` files
- Convert from `MyST` frontmatter to CFF
- Only CFF version 1.2.0 supported
## Install

## Potential goals
```bash
npm install cffjs
```

- Conversion to `MyST` frontmatter
## Usage

```ts
import { readCFF, writeCFF, validateCFF } from 'cffjs';

const cff = readCFF('./CITATION.cff');

validateCFF(cff);

writeCFF(cff, './output');
```

## API

### Reading & Writing

- `readCFF(file)` - Read CFF data from a `CITATION.cff` file (or directory containing one). Returns the parsed object without validation.
- `writeCFF(cff, directory)` - Write CFF data as `CITATION.cff` into the given directory, creating it if needed.

### Validating

- `validateCFF(input)` - Validate an in-memory CFF object against the CFF 1.2.0 JSON schema. Throws on failure.
- `validateCFFFile(file)` - Read a CFF file and validate it. Throws on failure.

### MyST Conversion

Convert [MyST](https://mystmd.org) frontmatter into CFF data:

- `mystFrontmatterToCFF(frontmatter, abstract?)` - Convert MyST `PageFrontmatter` into a complete CFF document.
- `mystFrontmatterToCFFReference(frontmatter, abstract?)` - Convert MyST `PageFrontmatter` into a CFF `Reference` entry.

### Types

The package exports TypeScript types for `CFF`, `ReferenceCFF`, `PersonCFF`, `EntityCFF`, and `IdentifierCFF`, along with the `ReferenceType` and `ReferenceStatus` enums.

## Scope

- Reading, writing, and validating `CITATION.cff` files
- Conversion from MyST frontmatter to CFF
- CFF version 1.2.0 only

### Potential goals

- Conversion to MyST frontmatter
- Support for other CFF versions
- Conversion to/from other formats (e.g. bibtex)
- CLI
- Conversion to/from other formats (e.g. BibTeX)
- CLI

<p style="text-align: center; color: #aaa; padding-top: 50px">
Made with love by
<a href="https://continuous.foundation" target="_blank" style="color: #aaa">
Continuous Science Foundation <img src="https://cdn.curvenote.com/static/site/csf/icon.svg" style="height: 1em" />
</a>
</p>
Loading
Loading