FieldWorks Lite packaged as an extension for Platform.Bible.
The general file structure is as follows:
package.jsoncontains information about this extension's npm package. It is required for Platform.Bible to use the extension properly. It is copied into the build foldermanifest.jsonis the manifest file that defines the extension and important properties for Platform.Bible. It is copied into the build foldersrc/contains the source code for the extensionsrc/components/contains stand-alone (i.e., WebView- and service-independent) componentssrc/main.tsis the main entry file for the extensionsrc/services/contains services to be used withnetworkObjects.set()insrc/main.tssrc/types/fw-lite-extension.d.tsis this extension's types file that defines how other extensions can use this extension through thepapi. It is copied into the build foldersrc/utils/contains utility classes and functionssrc/web-views/contains WebView components to be used withregisterWebViewProvider()insrc/main.ts*.web-view.tsxfiles will be treated as React WebViews*.web-view.htmlfiles are a conventional way to provide HTML WebViews (no special functionality)
assets/contains asset files the extension and its WebViews can retrieve using thepapi-extension:protocol, as well as textual descriptions in various languages. It is copied into the build folderassets/displayData.jsoncontains (optionally) a path to the extension's icon file as well as text for the extension's display name, short summary, and path to the full description fileassets/descriptions/contains textual descriptions of the extension in various languagesassets/descriptions/description-<locale>.mdcontains a brief description of the extension in the language specified by<locale>
contributions/contains JSON files the platform uses to extend data structures for things like menus and settings. The JSON files are referenced from the manifestpublic/contains other static files that are copied into the build folderwebpack/contains configs, scripts, and utils used bywebpack.config.tsin the root folderdist/is a generated folder containing the built extension filesrelease/is a generated folder containing a zip of the built extension files
See the Extension Anatomy wiki page for more information about the various files that comprise an extension and their relationships to each other.
In order to interact with paranext-core, you must clone paranext-core in the same parent directory in which you cloned this repository so you do not have to reconfigure paths to paranext-core. For example, if you cloned this repository in C:\dev\LexBox\, you would clone paranext-core in C:\dev\paranext-core\.
- In the
paranext-corerepository, runnpm install - In this folder, run
npm installto install local and published dependencies
First, you must build FieldWorks Lite using the task defined in this folder:
task build-fw-lite-webThis is a normal production build, so changes to FwLite files will not be rebuilt automatically. If you want to do FwLite development, look at README.md
To run Platform.Bible with this extension:
npm start
Note: The built extension will be in the dist folder. In order for Platform.Bible to run this extension, you must provide the directory to this built extension to Platform.Bible via a command-line argument. This command-line argument is already provided in this package.json's start script. If you want to start Platform.Bible and use this extension any other way, you must provide this command-line argument or put the dist folder into Platform.Bible's extensions folder.
To watch extension files (in src) for changes:
npm run watch
To build the extension once:
npm run build