Skip to content

Commands

Kalinda Pride edited this page Apr 25, 2021 · 6 revisions

Here is a list of commands that you might find useful while working with LingView. All of these should be run in a terminal, from inside your main LingView directory.

Commands defined in package.json

Most of the time you only need npm run quick-build, but here's a full list.

Command Description
npm run quick-build Run this after every time you make changes. It rebuilds LingView, to incorporate any changes you have made to your ELAN, FLEx, media, and jsx files. If you're using GitHub Pages with Actions enabled, GitHub will run it for you when you change the master branch.
npm run test This command is useless because we don't currently have tests.
npm run rebuild-db-online Rebuilds your LingView database, based on your ELAN, FLEx, and media files. You will need to run webpack afterwards. Use this version if some of your media files are on a remote server that your computer does not treat as part of its filesystem.
npm run rebuild-db-offline Rebuilds your LingView database, based on your ELAN, FLEx, and media files. You will need to run webpack afterwards. Use this version if some of your media files are on a remote server that your computer can address as part of its filesystem.
npm run webpack Rebuild the bundle.js file based on your jsx and data files, to update the UI of the website.
npm run webpack-watch Rebuild the bundle.js file based on your jsx and data files, to update the UI of the website, then watch for additional changes and rebuild as needed.
npm run bundle If you want to give someone an offline, read-only copy of your LingView website, run this command, then send them the bundle directory. They can open its index.html file to view your site. You don't actually need this command, because it would also work to send them your entire LingView directory. The advantage of bundle is that you send them only what they need for viewing LingView, no extra files.
npm run quick-build-online Rebuilds LingView, to incorporate any changes you have made to your ELAN, FLEx, media, and jsx files. Use this version of quick-build if some of your media files are on a remote server that your computer does not treat as part of its filesystem.
npm run quick-build-offline Rebuilds LingView, to incorporate any changes you have made to your ELAN, FLEx, media, and jsx files. Use this version of quick-build if some of your media files are on a remote server that your computer can address as part of its filesystem.

Node commands

Each of these commands runs a script inside the preprocessing directory.

Command Description
node preprocessing/rebuild.js Rebuilds your LingView database, based on your ELAN, FLEx, and media files. You will need to run webpack afterwards. For convenience, most people should use npm run quick-build, which will run webpack for you, instead.
node preprocessing/edit.js <unique_id> Edits the author, title, etc. displayed for documents on your LingView site. Replace <unique_id> with the document ID, which is the last part of its URL in LingView. You will need to run npm run quick-build afterwards.
node preprocessing/delete.js <unique_id> Removes a document from your LingView site. Replace <unique_id> with the document ID, which is the last part of its URL in LingView. You will need to run npm run quick-build afterwards. Update: The delete.js command no longer exists; rebuild.js is now sufficient when deleting files.

Other essential commands

Command Description
cd Change directories within the terminal. For example, cd ~/Desktop/LingView
npm install Install all the third-party software required by LingView, as specified in package.json. If the software is already installed, make sure it's up-to-date. Try this command if you're getting mystery errors on the command line.

Git commands

Git is a complicated tool, and I can't do the commands justice here, but there are many good tutorials.

You might not need to use git commands at all. If you just want to run LingView locally on your computer and publish it by sending your LingView directory to other people, you never need to use git. If you want to publish via GitHub Pages or you want version control, then you should probably use git.

Clone this wiki locally