Skip to content

Commit

Permalink
Squashed 'extensions/' changes from 23e0d6595..6618a9acc
Browse files Browse the repository at this point in the history
6618a9acc refactor: adjusted file structure for extension descriptions (#22)
91edebb69 refactor: adjusted file structure for extension descriptions
7ecd681de update `@sillsdev/scripture` (#21)
b1bcc265b feat: added displayData.json file for localization (#20)
a06d5926f docs: updated README regarding displayData
e617913f4 feat: added displayData.json file for localization
d73ba0094 Bump braces from 3.0.2 to 3.0.3 (#19)
2e4d5bfa2 Added find and replace description to manual add extension explanation (#18)
0b85f2d44 Added find and replace description to manual add extension explanation

git-subtree-dir: extensions
git-subtree-split: 6618a9acc4f26e17ac1398d0f8191f468111068e
  • Loading branch information
irahopkinson committed Jul 2, 2024
1 parent 630a385 commit 29bff7e
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 33 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ This is a webpack project configured to build Platform.Bible extensions. The gen
- `src/types/<extension_name>.d.ts` is this extension's types file that defines how other extensions can use this extension through the `papi`
- `*.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 Expand Up @@ -143,6 +146,15 @@ git fetch paranext-extension-template main
git subtree add --prefix src/<extension_name> paranext-extension-template main --squash
```

After running these commands, run a regex find and replace inside the new extension folder to fix
the file paths pointing to `paranext-core`:

- Find: `([^/])\.\.\/paranext-core`
- Replace with: `$1../../../paranext-core`

You can ignore occurrences from many files. Please see [`./lib/git.util.ts`](./lib/git.util.ts) -> `formatExtensionFolder` for more
information.

</details>

## To update this repo and extensions from the templates
Expand Down
100 changes: 70 additions & 30 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"react-dom": ">=18.2.0"
},
"dependencies": {
"@sillsdev/scripture": "^1.4.3",
"@sillsdev/scripture": "^2.0.0",
"platform-bible-utils": "file:../paranext-core/lib/platform-bible-utils"
},
"devDependencies": {
Expand Down
7 changes: 6 additions & 1 deletion webpack/webpack.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ const staticFiles: {
{ from: '<project_settings>', noErrorOnMissing: true },
// Copy the localized strings JSON file into the output folder based on its listing in `manifest.localizedStrings`
{ from: '<localized_strings>', noErrorOnMissing: true },
// Copy the display data JSON file into the output folder based on its listing in `manifest.localizedStrings`
{ from: '<display_data>', noErrorOnMissing: true },
];

/** Get the actual static file name from the template static file name */
Expand All @@ -143,7 +145,8 @@ function getStaticFileName(staticFile: string, extensionInfo: ExtensionInfo) {
.replace(/<menus>/g, extensionInfo.menus ?? '')
.replace(/<settings>/g, extensionInfo.settings ?? '')
.replace(/<project_settings>/g, extensionInfo.projectSettings ?? '')
.replace(/<localized_strings>/g, extensionInfo.localizedStrings ?? '');
.replace(/<localized_strings>/g, extensionInfo.localizedStrings ?? '')
.replace(/<display_data>/g, extensionInfo.displayData ?? '');
}

/** Get CopyFile plugin patterns for copying static files for an extension */
Expand Down Expand Up @@ -291,6 +294,8 @@ type ExtensionManifest = {
projectSettings?: string;
/** Path to the JSON file that defines the localized strings this extension is adding. */
localizedStrings?: string;
/** Path to the JSON file that defines the localized display data this extension is adding. */
displayData?: string;
activationEvents: string[];
};

Expand Down

0 comments on commit 29bff7e

Please sign in to comment.