-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yusef Almamari
committed
Nov 27, 2024
0 parents
commit 7d62a43
Showing
15 changed files
with
1,324 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# See https://eslint.org/docs/latest/use/configure/ignore for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
# prodiction | ||
dist/ |
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,26 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
}, | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"node": true, | ||
}, | ||
"plugins": ["@typescript-eslint", "import", "prettier"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/errors", | ||
"plugin:prettier/recommended", | ||
], | ||
"rules": { | ||
"indent": ["warn", 4], | ||
"quotes": ["warn", "double"], | ||
"no-unused-vars": "warn", | ||
"@typescript-eslint/no-var-requires": "off", | ||
}, | ||
} |
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,54 @@ | ||
name: Publish NPM package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "20" | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
# - name: Test | ||
# run: npm run test | ||
|
||
- name: Check the version | ||
id: check | ||
run: | | ||
CURRENT_VERSION=$(jq -r .version package.json) | ||
echo "Current version: $CURRENT_VERSION" | ||
LATEST_VERSION=$(npm show <package-name> version || echo "0.0.0") | ||
echo "Latest version: $LATEST_VERSION" | ||
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; | ||
then | ||
echo "Version changed" | ||
echo "version_changed=true" >> $GITHUB_OUTPUT | ||
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | ||
else | ||
echo "Version not changed" | ||
echo "version_changed=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Build | ||
run: npm run build | ||
if: steps.check.outputs.version_changed == 'true' | ||
|
||
- name: Publish | ||
if: steps.check.outputs.version_changed == 'true' | ||
run: npm publish --access public --no-git-checks | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,10 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# production | ||
/dist | ||
|
||
# misc | ||
package-lock.json |
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,4 @@ | ||
# See https://prettier.io/docs/en/ignore.html for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules/ |
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,7 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"printWidth": 120, | ||
"tabWidth": 4, | ||
"semi": true, | ||
"singleQuote": false | ||
} |
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,7 @@ | ||
Copyright © 2024 Ganemede Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,149 @@ | ||
# CiteEase CLI | ||
|
||
![npm](https://img.shields.io/npm/v/citeease-cli) | ||
![npm](https://img.shields.io/npm/dw/citeease-cli) | ||
![License](https://img.shields.io/npm/l/citeease-cli) | ||
|
||
`citeease-cli` is a CLI tool that generates formatted citations (references) based on various unique identifiers, including URL, DOI, ISBN, PMID, and PMCID. Just pass in your identifiers, and `citeease-cli` will handle the rest! | ||
|
||
## 📋 Table of Contents | ||
|
||
- [Installation](#-installation) | ||
- [Usage](#-usage) | ||
- [Configuration](#-configuration) | ||
- [Supported Identifiers](#-supported-identifiers) | ||
- [Data Sources](#-data-sources) | ||
- [Output](#-output) | ||
- [License](#-license) | ||
- [Contact](#-contact) | ||
|
||
## ⚙️ Installation | ||
|
||
Install `citeease-cli` globally via npm: | ||
|
||
```bash | ||
npm install -g citeease-cli | ||
``` | ||
|
||
Or use it directly with `npx` without global installation: | ||
|
||
```bash | ||
npx citeease-cli cite <list of identifiers> | ||
``` | ||
|
||
## 🚀 Usage | ||
|
||
To generate citations, provide a list of unique identifiers as arguments. `citeease-cli` will attempt to identify the type of each identifier automatically. | ||
|
||
### Options | ||
|
||
- `--style`, `-s <style>`: Choose the citation style for the output (e.g., `apa`, `modern-language-association`, `chicago-author-date`). The default is APA. | ||
- `--locale`, `-l <locale>`: Set the locale for the citation language (e.g., `en-US` for U.S. English, `fr-FR` for French, `ar` for Arabic). The default is `en-US`. | ||
- `--format`, `-f <format>`: Specify the output format. Options include `text` (default), `html`, `rtf`, and `asciidoc`. | ||
- `--log-errors`, `-e`: Enable logging of errors for debugging purposes. | ||
- `--version`, `-v`: Display the current version of `citeease-cli`. | ||
|
||
> **Note:** You can check available citation styles and locales at: | ||
> | ||
> - Styles: [https://github.com/citation-style-language/styles](https://github.com/citation-style-language/styles) | ||
> - Locales: [https://github.com/citation-style-language/locales](https://github.com/citation-style-language/locales) | ||
### Examples | ||
|
||
```bash | ||
# Using a globally installed package | ||
cite 10.1000/xyz123 978-3-16-148410-0 | ||
|
||
# Specifying a citation style and locale | ||
cite --style modern-language-association --locale en-GB 10.1000/xyz123 | ||
|
||
# Specifying an output format | ||
cite --format html 10.1000/xyz123 | ||
``` | ||
|
||
Or with `npx`: | ||
|
||
```bash | ||
npx citeease-cli cite --style chicago-author-date --locale fr-FR --format rtf https://example.com/article | ||
``` | ||
|
||
### Specifying Identifier Types | ||
|
||
If `citeease-cli` misinterprets an identifier’s type or if you want to force a specific type, you can prefix it with the type and a colon, like so: | ||
|
||
```bash | ||
cite "url: https://doi.org/10.xyz123" "isbn: 978-3-16-148410-0" | ||
``` | ||
|
||
This will force `citeease-cli` to treat the first identifier as a URL and the second as an ISBN. This works for all identifier types: **url**, **doi**, **isbn**, **pmid**, and **pmcid**. | ||
|
||
--- | ||
|
||
## ⚙️ Configuration | ||
|
||
`citeease-cli` allows you to configure default settings for citation generation using the `config` command. This helps you avoid repeating options like style, locale, or format with every command. | ||
|
||
### Configuration Options | ||
|
||
- **`style`**: Set the default citation style (e.g., `apa`, `mla`, `chicago-author-date`). | ||
- **`locale`**: Set the default locale (e.g., `en-US`, `fr-FR`, `ar`). | ||
- **`format`**: Set the default output format (e.g., `text`, `HTML`, `rtf`, `asciidoc`). | ||
- **`reset`**: Reset all configurations to their default values. | ||
|
||
### Examples | ||
|
||
```bash | ||
# Set default citation style to APA | ||
cite config style apa | ||
|
||
# Set default locale to en-US | ||
cite config locale en-US | ||
|
||
# Set default output format to HTML | ||
cite config format html | ||
|
||
# Reset all configurations | ||
cite config reset | ||
``` | ||
|
||
Use the `config <KEY>` command without a value to view the current setting for a key. | ||
|
||
--- | ||
|
||
## 🆔 Supported Identifiers | ||
|
||
- **DOI**: e.g., `10.1093/ajae/aaq063` | ||
- **URL**: e.g., `https://example.com` | ||
- **ISBN**: e.g., `978-3-16-148410-0` | ||
- **PMID**: e.g., `27097605` | ||
- **PMCID**: e.g., `PMC6323133` | ||
|
||
--- | ||
|
||
## 🌐 Data Sources | ||
|
||
`citeease-cli` uses the following free APIs to retrieve citation data: | ||
|
||
- [CrossRef](https://www.crossref.org/documentation/retrieve-metadata/rest-api/): For DOI-based data, e.g., `https://api.crossref.org/works/<DOI>` | ||
- [Open Library](https://openlibrary.org/developers/api): For ISBN-based data, e.g., `https://openlibrary.org/search.json?q=isbn:<ISBN>&mode=everything&fields=*,editions` | ||
- [NCBI](https://api.ncbi.nlm.nih.gov/lit/ctxp/): For data from PubMed and PubMed Central, e.g., `https://api.ncbi.nlm.nih.gov/lit/ctxp/v1/pubmed/?format=csl&id=<PMID>` and `https://api.ncbi.nlm.nih.gov/lit/ctxp/v1/pmc/?format=csl&id=<PMCID>` | ||
|
||
These APIs provide open-access data for research and citation. | ||
|
||
--- | ||
|
||
## 📄 Output | ||
|
||
`citeease-cli` generates a formatted citation (reference) for each identifier. The output is styled for easy copy-pasting into documents and includes all relevant citation details, formatted according to standard citation styles, locale settings, and output format. | ||
|
||
--- | ||
|
||
## 📜 License | ||
|
||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. | ||
|
||
--- | ||
|
||
## 📧 Contact | ||
|
||
For inquiries or more information, you can reach out to us at [ganemedelabs@gmail.com](mailto:ganemedelabs@gmail.com). |
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,73 @@ | ||
{ | ||
"name": "citeease-cli", | ||
"version": "1.0.0", | ||
"description": "citeease-cli is a CLI tool that generates formatted citations (references) based on various unique identifiers, including URL, DOI, ISBN, PMID, and PMCID.", | ||
"private": false, | ||
"bin": { | ||
"citeease-cli": "dist/citeease-cli.js", | ||
"cite": "dist/index.js" | ||
}, | ||
"types": "dist/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ganymedelabs/citeease-cli.git" | ||
}, | ||
"author": "ganymedelabs", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ganymedelabs/citeease-cli/issues" | ||
}, | ||
"homepage": "https://github.com/ganymedelabs/citeease-cli#readme", | ||
"keywords": [ | ||
"citation", | ||
"reference", | ||
"references", | ||
"bibliography", | ||
"doi", | ||
"isbn", | ||
"pmid", | ||
"pmcid", | ||
"url", | ||
"citation-generator", | ||
"cli-tool", | ||
"command-line", | ||
"bibliography-generator", | ||
"academic", | ||
"research", | ||
"csl", | ||
"citation-style-language" | ||
], | ||
"files": [ | ||
"dist", | ||
"README.md", | ||
"LICENSE", | ||
"package.json" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"dev": "ts-node src/index.ts", | ||
"start": "node dist/index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"format": "prettier --write \"./**/*.{js,ts,json}\"" | ||
}, | ||
"dependencies": { | ||
"citeproc": "^2.4.63", | ||
"jsdom": "^25.0.1", | ||
"xmlhttprequest": "^1.8.0" | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.6.0", | ||
"@types/node": "^22.9.0", | ||
"@typescript-eslint/eslint-plugin": "^7.18.0", | ||
"@typescript-eslint/parser": "^7.18.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"prettier": "^3.3.2", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.6.3" | ||
} | ||
} |
Oops, something went wrong.