Skip to content

Commit

Permalink
Fixed platform-scripture-editor extension not being based on the temp…
Browse files Browse the repository at this point in the history
…late (#1199)
  • Loading branch information
tjcouch-sil authored Oct 9, 2024
2 parents b3b568d + 6459938 commit 070d8a8
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 21 deletions.
80 changes: 79 additions & 1 deletion extensions/src/platform-scripture-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,81 @@

Editor extension for Platform.Bible, that can also be used in read-only mode

<!-- Opening comment tag for Template Info Section. Ignore this for now. More info in [Hide Template Info](#hide-template-info).
## Template Info
This is a webpack project template pre-configured to build a Platform.Bible extension. It contains the bare minimum of what an extension needs. Note that the `*.web-view.*` files and the `public/assets` folder mentioned in [Summary](#summary) are not present in this template. For inspiration on what these could look like, refer to any extension that is built using this template. An example would be the [Text Collection extension](https://github.com/paranext/paranext-extension-text-collection).
There is also [a template pre-configured to build an arbitrary number of Platform.Bible extensions in one repo](https://github.com/paranext/paranext-multi-extension-template).
### Customize extension details
Follow these instructions to customize the template to be your own Platform.Bible extension. This section is a more compact version of the [`Your first extension` guide](https://github.com/paranext/paranext-extension-template/wiki/Your-First-Extension).
#### Install and hook up to the template
Note: please skip this section and continue with [Replace placeholders](#replace-placeholders) if you are following these instructions as part of [creating an extension within `paranext-multi-extension-template`](https://github.com/paranext/paranext-multi-extension-template#to-create-a-new-extension-in-this-repo).
To make the process of customizing from the template as smooth as possible, we recommend you do the following before anything else:
- [Install and set up this repo](#to-install)
- [Update this extension from the template](#to-update-this-extension-from-the-template)
#### Replace placeholders
- At the top of this `README.md`:
- Replace the first line `# paranext-extension-template` with `# your-extension-name`
- Below the first line, replace the extension description with your own description
- In the [Summary](#summary) section, replace `src/types/paranext-extension-template.d.ts` with `src/types/<your_extension_name>.d.ts`
- In `manifest.json`:
- Replace `paranext-extension-template` with `your-extension-name` (2 occurrences)
- Update ownership information and other relevant fields as desired
- In `package.json`:
- Replace `paranext-extension-template` with `your-extension-name` (2 occurrences)
- Update ownership information and other relevant fields as desired
- In `assets/displayData.json`:
- If your extension has an icon, update the `icon` value to point towards the icon file (for example: `assets/icon.svg`)
- Update the `moreInfoUrl` field to web URL to a page where users can find out more information about you / your organization / your extension.
- Update the `supportUrl` field to web URL to a support page where users can request help and report issues with your extension.
- Update the `en` entry of `localizedDisplayInfo` so that:
- `displayName` contains a human-readable name for your extension (i.e. `Your Extension Name`).
- `shortSummary` contains a short, few sentence summary of what your extension does.
- `description` points to a Markdown (`.md`) file containing the full description of your extension (similar to what you would put in a `README`).
- If your extension supports multiple languages, add another entry to `localizedDisplayInfo` by copying and pasting the `en` entry, changing `en` to the [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the language you want to support, and translating the `displayName`, `shortSummary`, and `description` fields appropriately. We recommend naming your description files `description-<language tag>.md`.
- In `LICENSE`:
- Adjust as desired (feel free to choose a different license)
- If you choose to stay with the current license, update the copyright statement
- Rename `src/types/paranext-extension-template.d.ts` to `src/types/<your_extension_name>.d.ts`
- In this renamed file, replace `paranext-extension-template` with `your-extension-name`
- In `src/main.ts`, replace `Extension template` with `Your Extension Name` (2 occurrences)
#### Customize the extension manifest and package information
The `manifest.json` and `package.json` files contain information specific to your extension. Add your extension's details in these two files as needed. See more information on the `manifest.json` and `package.json` files in [Extension Anatomy](https://github.com/paranext/paranext-extension-template/wiki/Extension-Anatomy#extension-manifest).
#### Hide Template Info
Once finished customizing this template to be your own, you can uncomment the [HTML comment tag](https://www.w3schools.com/html/html_comments.asp) above the [Template Info](#template-info) section to hide this template-related info in this readme. You can do this by clicking on the line and doing CTRL + / in VS Code. You can also do this manually by removing the first opening '&lt;!--' and the only closing '-->' on the line. Leaving this info commented in your readme will hide it in your readme while avoiding merge conflicts if you decide to [update this extension from the template](#to-update-this-extension-from-the-template) in the future. If you never want to update this extension from the template, you can remove the [Template Info](#template-info) section and sub-sections of this readme.

Note: if you [update this extension from the template](#to-update-this-extension-from-the-template), there may be important changes in this section like additional customizations you must make to this extension. Please keep an eye out for readme changes when updating from the template.

<!-- Closing comment tag for Template Info Section -->

## Summary

The general file structure is as follows:
Expand All @@ -13,7 +88,10 @@ The general file structure is as follows:
- `src/types/paranext-extension-template.d.ts` is this extension's types file that defines how other extensions can use this extension through the `papi`. It is copied into the build folder
- `*.web-view.tsx` files will be treated as React WebViews
- `*.web-view.html` files are a conventional way to provide HTML WebViews (no special functionality)
- `assets/` contains asset files the extension and its WebViews can retrieve using the `papi-extension:` protocol. It is copied into the build folder
- `assets/` contains asset files the extension and its WebViews can retrieve using the `papi-extension:` protocol, as well as textual descriptions in various languages. It is copied into the build folder
- `assets/displayData.json` contains (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 file
- `assets/descriptions/` contains textual descriptions of the extension in various languages
- `assets/descriptions/description-<locale>.md` contains 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 manifest
- `public/` contains other static files that are copied into the build folder
- `dist/` is a generated folder containing the built extension files
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Editor extension for Platform.Bible that can also be used in read-only mode
12 changes: 12 additions & 0 deletions extensions/src/platform-scripture-editor/assets/displayData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"icon": "",
"moreInfoUrl": "",
"supportUrl": "",
"localizedDisplayInfo": {
"en": {
"displayName": "Platform Scripture Editor",
"shortSummary": "Editor extension for Platform.Bible",
"description": "assets/descriptions/description-en.md"
}
}
}
4 changes: 3 additions & 1 deletion extensions/src/platform-scripture-editor/manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "platformScriptureEditor",
"version": "0.0.1",
"description": "Editor extension for Platform.Bible",
"displayData": "assets/displayData.json",
"author": "Paranext",
"license": "MIT",
"main": "src/main.ts",
"extensionDependencies": {},
"elevatedPrivileges": [],
"types": "src/types/platform-scripture-editor.d.ts",
"menus": "contributions/menus.json",
"settings": "contributions/settings.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "./tsconfig",
"include": [".eslintrc.js", "*.cjs", "*.js", "*.ts", "src", "webpack"]
"include": [".eslintrc.js", "*.ts", "*.js", "lib", "src", "webpack"]
}
126 changes: 110 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@
"react-test-renderer": "^18.3.1",
"rimraf": "^6.0.1",
"run-script-os": "^1.1.6",
"sass": "^1.78.0",
"sass-loader": "^14.2.1",
"sass": "^1.79.4",
"sass-loader": "^16.0.2",
"storybook": "^8.3.4",
"style-loader": "^4.0.0",
"stylelint": "^16.9.0",
Expand Down

0 comments on commit 070d8a8

Please sign in to comment.