jats-cli 0.0.0 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # jats-cli
2
2
 
3
3
  [![jats-cli on npm](https://img.shields.io/npm/v/jats-cli.svg)](https://www.npmjs.com/package/jats-cli)
4
- [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/curvenote/jats-cli/blob/main/LICENSE)
5
- [![CI](https://github.com/curvenote/jats-cli/workflows/CI/badge.svg)](https://github.com/curvenote/jats-cli/actions)
4
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/curvenote/jats/blob/main/LICENSE)
5
+ [![CI](https://github.com/curvenote/jats/workflows/CI/badge.svg)](https://github.com/curvenote/jats-cli/actions)
6
6
 
7
7
  Node CLI for working with JATS XML documents.
8
8
 
@@ -11,7 +11,7 @@ Read, write, and convert JATS XML and log summaries from the command line.
11
11
  To use from the command line, use the `-g` to create a global install, which will provide a `jats` CLI:
12
12
 
13
13
  ```
14
- npm install -g jats-xml
14
+ npm install -g jats-cli
15
15
  jats -v
16
16
  ```
17
17
 
@@ -30,10 +30,20 @@ Commands available:
30
30
  `download`: attempt to find the JATS file and download it locally.
31
31
 
32
32
  ```bash
33
- jats download https://elifesciences.org/articles/81952 article.jats
33
+ jats download https://elifesciences.org/articles/81952 -o article.jats
34
34
  ```
35
35
 
36
- Note, currently this just downloads the XML, **not** the associated files.
36
+ For some Open Access PMC articles, you may download associated files with the `--data` option.
37
+
38
+ ```bash
39
+ jats download PMC11025918 --data
40
+ ```
41
+
42
+ `convert`: convert a JATS file to MyST-compatible JSON. The `--frontmatter project` option will write frontmatter to a `myst.yml` file.
43
+
44
+ ```bash
45
+ jats convert article.jats --frontmatter project
46
+ ```
37
47
 
38
48
  `summary`: summarize the contents of the JATS, given a URL, DOI, or local file
39
49
 
@@ -84,6 +94,6 @@ As of v1.0.0 this package is [ESM only](https://gist.github.com/sindresorhus/a39
84
94
  <p style="text-align: center; color: #aaa; padding-top: 50px">
85
95
  Made with love by
86
96
  <a href="https://curvenote.com" target="_blank" style="color: #aaa">
87
- <img src="https://curvenote.dev/images/icon.png" style="height: 1em" /> Curvenote
97
+ <img src="https://cdn.curvenote.com/brand/logo-blue-icon.png" style="height: 1em" /> Curvenote
88
98
  </a>
89
99
  </p>
@@ -1 +1 @@
1
- {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAiB5C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,QAE7C"}
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AA8B5C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,QAE7C"}
package/dist/convert.js CHANGED
@@ -1,11 +1,14 @@
1
1
  import { Command, Option } from 'commander';
2
2
  import { jatsConvert } from 'jats-convert';
3
+ import { clirun, getSession } from 'myst-cli-utils';
3
4
  function makeConvertCLI(program) {
4
5
  const command = new Command('convert')
5
6
  .description('Convert JATS file to MyST mdast json')
6
7
  .argument('<input>', 'The JATS file')
7
8
  .addOption(new Option('--frontmatter <frontmatter>', 'Treat JATS frontmatter fields as page or project, or ignore if not specified').choices(['page', 'project']))
8
- .action(jatsConvert);
9
+ .addOption(new Option('--no-doi, --no-dois', 'By default, DOIs are used for references when available, to be later resolved against doi.org. This option disables that behavior and creates bibtex entries for citations with DOIs.'))
10
+ .addOption(new Option('--no-bib, --no-bibtex', 'By default, a bibtex file will be written with referenced citations. This option prevents writing that file'))
11
+ .action(clirun(jatsConvert, { program, getSession }));
9
12
  return command;
10
13
  }
11
14
  export function addConvertCLI(program) {
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function addDownloadCLI(program: Command): void;
3
+ //# sourceMappingURL=download.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAqB5C,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAE9C"}
@@ -0,0 +1,17 @@
1
+ import { Command, Option } from 'commander';
2
+ import { jatsFetch } from 'jats-fetch';
3
+ import { clirun, getSession } from 'myst-cli-utils';
4
+ function makeDownloadCLI(program) {
5
+ const command = new Command('download')
6
+ .alias('fetch')
7
+ .description('Download JATS from URL or identifier')
8
+ .argument('<input>', 'URL or other article identifier')
9
+ .addOption(new Option('-o, --output <output>', 'Output filename or folder'))
10
+ .addOption(new Option('--data', 'Attempt to fetch all data associated with JATS XML'))
11
+ .addOption(new Option('--listing <listing>', 'Pointer to PMC listing file; if not provided, listing file will be downloaded and cached as needed'))
12
+ .action(clirun(jatsFetch, { program, getSession }));
13
+ return command;
14
+ }
15
+ export function addDownloadCLI(program) {
16
+ program.addCommand(makeDownloadCLI(program));
17
+ }
package/dist/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import version from './version.js';
4
- import { addDownloadCLI } from './parse.js';
4
+ import { addParseCLI } from './parse.js';
5
5
  import { addValidateCLI } from './validate.js';
6
6
  import { addTestCLI } from './jats-test.js';
7
7
  import { addConvertCLI } from './convert.js';
8
+ import { addDownloadCLI } from './download.js';
8
9
  const program = new Command();
9
10
  addDownloadCLI(program);
11
+ addParseCLI(program);
10
12
  addValidateCLI(program);
11
13
  addConvertCLI(program);
12
14
  addTestCLI(program);