### Running Platform.Bible with Extension - npm start Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This command starts Platform.Bible with the extension. It automatically provides the `dist` folder path to Platform.Bible, which contains the built extension. This is the primary way to run the extension during development. ```bash npm start ``` -------------------------------- ### Installing Node.js Dependencies for Extension Development Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This snippet provides the command to install all necessary Node.js dependencies for the extension. This is a crucial step after cloning the repository and before running or building the extension, ensuring all required packages are available. ```bash npm install ``` -------------------------------- ### Packaging Extension for Distribution - npm run package Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This command packages the built extension into a zip file, making it ready for distribution. The zip file typically contains all necessary assets for installing the extension in Platform.Bible. ```bash npm run package ``` -------------------------------- ### Building Extension Once - npm run build Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This command performs a single build of the extension, compiling the source files into the `dist` folder. It's used for creating a production-ready build or for manual compilation. ```bash npm run build ``` -------------------------------- ### Manually Creating Pre-release - npm run package Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This command packages the extension, which is the first step in manually creating a pre-release. The subsequent comments outline the manual GitHub steps required to finalize the pre-release, including tag creation, release body population, and attaching assets. ```bash npm run package # Create a new pre-release in GitHub on tag `v` # Copy `.github/assets/release-body.md` into the release body # Press the "Generate release notes" button in the release creation page to generate a changelog # Attach contents of `release` folder to the release ``` -------------------------------- ### Adding Git Remote for Template Updates Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This command adds a new Git remote named 'template' pointing to the `paranext-extension-template` repository. This setup is crucial for easily fetching and merging updates from the upstream template into the current extension project. ```bash git remote add template https://github.com/paranext/paranext-extension-template ``` -------------------------------- ### Manually Bumping Versions - npm run bump-versions Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This command manually bumps the project's version to the specified ``. It's used after a release to prepare the repository for future development on a new version, preventing conflicts with the just-released version. ```bash npm run bump-versions ``` -------------------------------- ### Watching Extension Files for Changes - npm run watch Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This command initiates a watch process that monitors the `src` folder for any changes in the extension files. It's useful for continuous development, automatically rebuilding the extension upon file modifications. ```bash npm run watch ``` -------------------------------- ### Updating package.json for Extension Naming Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This snippet demonstrates how to modify the `package.json` file to align with the new extension's kebab-case name. This involves updating two occurrences of the package name and optionally adjusting ownership and other relevant fields. ```json { "name": "your-extension-name", "version": "1.0.0", "description": "Your extension description.", "main": "dist/main.js", "types": "dist/src/types/your-extension-name.d.ts", "scripts": { "build": "webpack --mode production", "start": "webpack --mode development --watch", "lint": "eslint . --ext .ts,.tsx", "test": "jest" }, "keywords": [ "paranext", "extension", "platform.bible" ], "author": "Your Name/Organization", "license": "MIT", "bugs": { "url": "https://github.com/your-org/your-extension-name/issues" }, "homepage": "https://github.com/your-org/your-extension-name#readme", "dependencies": { "@paranext/papi": "latest" }, "devDependencies": { "@paranext/paranext-core": "file:../paranext-core", "@types/jest": "^29.5.12", "@types/node": "^20.12.12", "@typescript-eslint/eslint-plugin": "^7.10.0", "@typescript-eslint/parser": "^7.10.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", "jest": "^29.7.0", "prettier": "^3.2.5", "ts-jest": "^29.1.4", "ts-loader": "^9.5.1", "typescript": "^5.4.5", "webpack": "^5.91.0", "webpack-cli": "^5.1.4" } } ``` -------------------------------- ### Bumping Extension Versions - Git & npm Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This sequence of commands checks out a specific branch and then runs the `bump-versions` script to update the project's version number. This is a preparatory step before releasing a new version, creating a dedicated branch for the version bump. ```bash git checkout my-branch npm run bump-versions 0.2.0 ``` -------------------------------- ### Updating Extension from Template - Git Fetch & Merge Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md These commands fetch the latest changes from the 'template' remote and then merge them into the current branch. The `--allow-unrelated-histories` flag is used for the initial merge when the repositories have no common history, facilitating updates from the upstream template. ```bash git fetch template git merge template/main --allow-unrelated-histories ``` -------------------------------- ### Manually Bumping Versions - Git & npm version Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This set of commands provides a manual way to bump the project version. It involves creating a new branch, updating the version using `npm version` without creating a Git tag, manually adjusting `manifest.json` files, committing changes, and pushing the new branch. ```bash git checkout -b bump-versions- npm version --git-tag-version false # Change version in each extension's `manifest.json` git commit -a -m "Bumped versions to "; git push -u origin HEAD ``` -------------------------------- ### Updating Main Entry File for Extension Name Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This snippet shows how to update the `src/main.ts` file, the main entry point for the extension, by replacing occurrences of 'Extension template' with the new human-readable extension name. This ensures consistent branding and identification within the extension's code. ```typescript import { papi } from '@paranext/papi'; globalThis.webViewTemplate = { // Example of a function exposed to the web view doStuff: async () => { const result = await papi.commands.sendCommand('extensionTemplate.doStuffOnMain'); return `Web view got: ${result}`; } }; export async function activate() { papi.logger.info('Your Extension Name extension is activating!'); const commandRegistrations = await papi.commands.registerCommands({ 'extensionTemplate.doStuffOnMain': () => { papi.logger.info('Your Extension Name did stuff!'); return true; } }); return { deactivate: () => { papi.logger.info('Your Extension Name extension is deactivating!'); commandRegistrations.forEach((commandRegistration) => commandRegistration.dispose()); } }; } ``` -------------------------------- ### Customizing manifest.json for Platform.Bible Extension Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This snippet illustrates how to update the `manifest.json` file to reflect the new extension's details. It involves changing the extension's internal name (lowerCamelCase) and the path to its type definition file (kebab-case), along with general ownership information. ```json { "name": "yourExtensionName", "types": "src/types/your-extension-name.d.ts", "publisher": "yourPublisherName", "license": "yourLicense", "repository": { "type": "git", "url": "yourRepositoryUrl" } } ``` -------------------------------- ### Configuring assets/displayData.json for Extension Display Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This snippet details how to configure `assets/displayData.json` to control how the extension is displayed within Platform.Bible. It covers setting the icon path, support URLs, and localized display information including the human-readable name, short summary, and full description file path for English and other supported languages. ```json { "icon": "assets/icon.svg", "moreInfoUrl": "https://your-org.com/your-extension-info", "supportUrl": "https://your-org.com/your-extension-support", "localizedDisplayInfo": { "en": { "displayName": "Your Extension Name", "shortSummary": "A short, few sentence summary of what your extension does.", "description": "assets/descriptions/description-en.md" }, ""es": { "displayName": "Nombre de tu Extensión", "shortSummary": "Un resumen corto de lo que hace tu extensión.", "description": "assets/descriptions/description-es.md" } } } ``` -------------------------------- ### Renaming and Updating Extension Type Definition File Source: https://github.com/paranext/paranext-extension-template/blob/main/README.md This snippet describes the process of renaming the extension's TypeScript declaration file (`.d.ts`) to match the new kebab-case extension name and updating its internal content to reflect this change. This file defines how other extensions can interact with this extension via the PAPI. ```typescript // src/types/your-extension-name.d.ts declare module 'your-extension-name' { // Your extension's types and declarations go here // Example: export function sayHello(name: string): string; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.