Git Product home page Git Product logo

editioncrafter-cli's Introduction

editioncrafter-cli

This is the command line tool to take a TEI XML file and turn it into a IIIF Manifest and the necessary Web Annotations to display the text in EditionCrafter.

Installing

Node

EditionCrafter CLI requires Node. To check if Node is installed, open your terminal or command line and type:

node --version

If the output is a number, you already have Node installed. If the output is an error like "Command not found", you need to install Node.

Please note that EditionCrafter CLI supports Node 14 and higher. If your version of Node is below 14, you'll need to upgrade.

To install or upgrade Node, visit https://nodejs.org/en/download and follow the instructions for your operating system. Alternatively, if you're using the Windows Subsystem for Linux, you should upgrade the version of Linux you're running to one that comes with a newer version of Node.

Installing EditionCrafter

To install the latest version, run:

npm install -g @cu-mkp/editioncrafter-cli

The editioncrafter command will now be available. If it doesn't work right away, try restarting your terminal program.

Usage

The following commands are available to the EditionCrafter CLI. Note that you may optionally pass the path of a configuration file as -c config_path rather than passing individual parameters. The optional configuration file is a JSON file with the following options:

{
    "targetPath": "myfile.xml",
    "outputPath": ".",
    "baseURL": "http://localhost:8080",
    "thumbnailWidth": 124,
    "thumbnailHeight": 192
}

help

Usage:

editioncrafter help

This will display information on the syntax for passing commands to the CLI as well as a list of available commands.

iiif

Usage:

editioncrafter iiif <iiif_url> <output_path>

This will create an XML file at the location of the provided <output_path> based on the information in the IIIF manifest supplied. Note that in this case the <output_path> should be a single XML File, e.g. /MyFiles/TEI/index.xml.

process

Usage:

editioncrafter process <tei_file> <output_path> <base_url>

This will create all of the artifacts that EditionCrafter needs in order to display your document on the web, and place them in the specified <output_path> folder. The <base_url> parameter should be the URL at which you intend to host these artifacts.

Generates the following files:

tei_document_id/tei/index.xml tei_document_id/tei/resource_id/index.xml tei_document_id/tei/resource_id/surface_id/index.xml

tei_document_id/iiif/manifest.json

tei_document_id/html/index.html tei_document_id/html/resource_id/index.html tei_document_id/html/resource_id/surface_id/index.html

Running a development build

The first time you run this program, you'll need to install its dependencies with npm install.

Within the root folder, run npm link to make the repo available as a global command. The entry point is configured by the bin property in package.json.

Open a new terminal session and type which editioncrafter to verify that it linked correctly.

editioncrafter-cli's People

Contributors

camdendotlol avatar ajolipa avatar nicklaiacona avatar

Watchers

 avatar Terry Catapano avatar Naomi Rosenkranz avatar  avatar

editioncrafter-cli's Issues

Dev server needs cache control headers

While making frequent changes to the CLI app during development, I'm constantly being served old versions of the manifests after updating them. This is really getting in the way of development, because I have to fight with the server and with my browser to get the newly-updated files in the EditionCrafter frontend.

It appears that http-server needs to pass headers to tell browsers not to cache responses: https://stackoverflow.com/questions/38295463/node-http-server-not-serving-updated-html-files

Should be a simple fix, I'll do it in a separate branch when I'm finished with the annotation work.

Thumbnails for static images

For editions serving their own images statically, need a way to generate thumbnails for the build to complete (@NickLaiacona - please change the wording to make more sense if needed!)

error running editioncrafter locally

After installing editioncrafter-cli on Naomi's WSL machine, we ran this command: editioncrafter process ../editioncrafter-data/texts/fr640_3r-3v-example.xml . http://localhost:8080 and got the following error:

ReferenceError: structuredClone is not defined: ReferenceError: structuredClone is not defined
    at renderManifest (/mnt/c/Users/naomi/Github/editioncrafter-cli/src/render.js:139:22)
    at renderTEIDocument (/mnt/c/Users/naomi/Github/editioncrafter-cli/src/render.js:274:22)
    at processTEIDocument (/mnt/c/Users/naomi/Github/editioncrafter-cli/src/index.js:17:20)
    at run (/mnt/c/Users/naomi/Github/editioncrafter-cli/src/index.js:27:9)
    at editionCrafterCLI (/mnt/c/Users/naomi/Github/editioncrafter-cli/src/index.js:109:9)
    at Object.<anonymous> (/mnt/c/Users/naomi/Github/editioncrafter-cli/editioncrafter:5:1)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)

error running cli on mac

Terry’s machine (Mac OS 12.6 (21G115)); node v18.16.0:

editioncrafter process ../editioncrafter-data/texts/fr640_3r-3v-example.xml . http://localhost:8080

node:internal/modules/cjs/loader:1078
  throw err;
  ^
Error: Cannot find module 'jsdom'
Require stack:
- /Users/thc4/Github/editioncrafter-cli/src/render.js
- /Users/thc4/Github/editioncrafter-cli/src/index.js
- /Users/thc4/Github/editioncrafter-cli/editioncrafter
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/thc4/Github/editioncrafter-cli/src/render.js:1:15)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/thc4/Github/editioncrafter-cli/src/render.js',
    '/Users/thc4/Github/editioncrafter-cli/src/index.js',
    '/Users/thc4/Github/editioncrafter-cli/editioncrafter'
  ]
}
Node.js v18.16.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.