Skip to content

Commit c494004

Browse files
imnasnainaectjcouch-silFoolRunningirahopkinsonlyonsil
authored
Update from template (#23)
* Initial commit * Added Vite/TypeScript/React and pulling papi types * Added package.json for extension because Paranext needs it * Changed extensions back to commonjs because paranext does not support es modules in production * Removed data provider info * Added scss style example * Added support for running paranext with this extension, added source map for main.ts * Fixed typo in type declaration reference * Updated to new command-line argument name * Moved vite config into vite folder * Began splitting Vite into two build steps * WebViews transpile and output into adjacent temp-vite folder * Build step 2 grabs web view files built in step 1, excluded imports from web views are now exact matches * Got two-step vite build working, changed React webviews to use global variable instead of component name to prevent tree shaking * Cleanup * Fixed build:vite, cleanup * Small fix to the readme * Some cleanup, adding comments where config is shared with paranext-core * Upgraded to latest rollup-plugin-import-manager which includes the patch we made * Used imports in web view * Added notice about import manager false positive * Updated calls to addWebView * Update rollup-plugin-import-manager to latest * Replace NODE_ENV on WebViews in Vite (#12) * Updated data provider to data type api, other updates to match existing extension code to show other features and such * Updated useData to new type api * Updated to newer data provider api * Fix vite security vulnerability (#16) * Converted papi components to use package * Bumped rollup-plugin-import-manager to fix irregular require statements * Updated template to use web view provider api * Update for split `papi.d.ts` (#20) * Upgrade TypeScript (#21) * Shared paranext extension types, improved getting papi-dts * Converted extension types to modules, removed unnecessary path aliases * Fixed extension import in main * Use extension lib types instead of dist * Replace fetch to bible-api.com with the USFM data provider (#22) * Set `.editorconfig` (#23) - also VS Code rulers and EOF * Update command syntax for papi-commands * Added more explanation for why we have public/assets/index.d.ts * Lower camel case in most ids * Fix problems seen when using the latest core branch (#25) * Update security vulnerabilities (#30) - also fix VerseRef selector - also fix Greet button - also add prettier config * Changed build tool to webpack, many other small improvements * Changed folder structure: lib to src, dist to release, and build to dist * Various fixes and tweaks found while converting paranext-core to webpack * Added DEBUG_PROD for sourcemaps in production builds * Minor update to package-lock.json * Added import that got removed in the rebase * Switched to commonjs-static modules for more predictable use * Prettier formatted all files * Changed extension dependencies to peerDependencies since the only ingestor Paranext must have them installed to be able to provide them * Removed data url support since paranext does not support them * Apply updates based on changes to core * Debug production (#34) * Extend readme with update section (#36) * Extend readme with update section * Rename papi-commands to papi-shared-types * Update deps and prettier config (#38) * Setup linting rules * Configure eslint setup. Way too many packages installed though * Remove unnecessary packages * Remove .eslintcache * Add .eslintcache to gitignore * Remove contents of template * Sort contents of package.json * Review comments * Delete eslintcache * Add eslintcache to gitignore * Processed review comments * Add empty browserlist to package.json * Update readme * Rename types file * Revert changes to paranext-extension-template naming * Change types file extension * Fix broken links to types file * Bump postcss from 8.4.29 to 8.4.31 (#46) * Update webpack.config.base.ts * Bump @babel/traverse from 7.22.11 to 7.23.2 (#47) Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.11 to 7.23.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Revert "Update webpack.config.base.ts" This reverts commit 5eeb763. * Allow data urls * update import from papi-backend, and add papi-frontend/react to webpack externals * Added cache/extension-types to typeRoots for easy sharing extension types * Add ESLint rule for flagging use of "null" * Refactored imports * Prep for use in multi-extension-template - moved files, synced formatting settings with core, added more template instructions to readme * Changed Paranext to Platform.Bible in various places, misc improvements * Added warning about editing update merge commit history * Moved Special features description to this repo for lower frequency of merge conflicts * Genericized license * Added 'shared with' statements to various style files and brought them in sync * Removed no-non-null-assertion as it is covered by no-type-assertion * Fixed emotion package duplication * Reworked explanation for package aliases. Also removed note about splitting into its own repo as this problem will not be solved as long as the package used is local * npm updates (#59) - also add Volta node version * Add contributions folder for menus.json * Added settings and project settings contribution files * Fixed swc bindings not found error * security update `@sillsdev/scripture` (#63) - also update other npm packages * Updated to node 20.11.1 LTS * update all npm packages (#65) - except `typescript` and `@typescript-eslint/*` * Fixed dts self-import * Added localized string contribution doc * Fixed typo in contributions path * Bump braces from 3.0.2 to 3.0.3 (#69) Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](micromatch/braces@3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat: added displayData.json file for localization * fix: adjusted displayData.json to have localizedDisplayInfo field * update `@sillsdev/scripture` (#71) - enable full serialization that can now include verse ranges, sequences, and segments. * refactor: adjusted file structure for extension descriptions * feat: added 'moreInfoUrl' and 'supportUrl' to manifest * refactor: adjusted structure for fields in manifest.json * fix: changed elevatedPrivileges to an array * update `@sillsdev/scripture` (#74) - fix .NET deserialization * #481: Changed a couple places in files where we descriptions that refer to Paranext (#75) * Removed outdated change description line, add comment template info section and instructions to avoid merge conflicts * Bump webpack from 5.91.0 to 5.94.0 (#78) Bumps [webpack](https://github.com/webpack/webpack) from 5.91.0 to 5.94.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](webpack/webpack@v5.91.0...v5.94.0) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Clarify readme uncommenting directions * update dependencies (#80) - also ran `npx update-browserslist-db@latest` * Added tailwind to extension template * Fixed template info comment not closing properly * Updated sass * Moved LIBRARY_TYPE to match multi template * update dependencies (#83) - also fix stylelint that was failing on `@tailwind` * Changed tailwind file to .css * provide for type checking (#76) - use `noImplicitReturns` instead of `consistent-return` * improve linting (#85) - use the TS version of `class-methods-use-this` so we can ignore override methods. * add missing format checks (#86) - let prettier format CSS & SCSS - also `npm audit fix` * Update tailwind.css (#87) follow up of - intensify secondary color in platform theme #1360 * update dependencies (#88) - `npm audit fix` - update minor and patch dependencies * #1587: Changed (c) to © in LICENSE file (for consistency) (#89) * Added publisher to manifest * update dependencies (#91) * fix linting (#92) - remove jest (no longer used) - remove duplicated eslint rule * Changed main file target so it understands built-in modules except crypto are not available * Adjusted extension name guidance - lowerCamelCase and kebab-case * Remove MUI * Update .eslintrc.js from paranext-core * PT-2390: Minor wording improvements to README (#96) * PT-2390: Minor wording improvements to README * PT-2390: Consolidated repetitive instructions. Wording improvements * PT-2390: Made it clear that updating a newly cloned extension template repo *should* be updated from the template before starting development. * Set up auto-release workflow (#99) * Set up auto-release workflow * Added explanation of .github files * Removed line numbers from file link urls * Fixed out-of-order readme section (#100) * Added consistent return in bump-versions (#101) * Small fixes to auto-release process (#102) * PT-1886: Set up theme contributions, fixed raw file imports not working properly (#103) Set up theme contributions, fixed raw file imports not working properly * Add "remote-allow-origins" to launch.json to allow external debugging * Add codeql.yml to run CodeQL manually (#105) * Add github action for CI with lint and format check (#106) * Add github action for CI with lint and format check * Fix lint.yml GitHub workflow and run npm install to update package-lock.json (#107) * Update Tailwind prose colors * In package.json sripts, update lint:scripts, lint:styles (#109) Matching the multi extension template * Swapped built-in logs to debug since we already have logs that cover this in core; they are just sample actions (#110) * Use standard 'WebView' in comments * PT-2390: Clarify template use in README.md (#112) * Added CODEOWNERS matching our code stewardship list (#113) * PT-2390: README improvements (#114) * PT-2390: Clarify template use in README.md * Minor formatting/capitalization/wording tweaks and addition of some content and HTML comments to bring README.md into sync with the one in paranext-multi-extension-template This will also make it easier to keep the two versions appropriately in sync in the future * Improved wording about editing the README itself when basing an extension on the template * Extended the comment in paranext-extension-template.d.ts to point to the useful section of the wiki page * Fixed typo and added link to wiki in Summary section. Reverted: Extended the comment in paranext-extension-template.d.ts to point to the useful section of the wiki page * Removed SYNC points in README. * Fix lint issue and updated package-lock.json * PT-3107: Improve release workflow (#116) * PT-3107: Improve release workflow (#44) * Fix typo * Fixed typo: proceeding (#117) * Pinned @swc/core to 1.10.18 to fix native binding issue (#118) * Bump versions of node and swc to align with core (#119) * PT-3107: Fixed path to bump versions action in Publish workflow (#121) Fixed path to bump versions action in Publish workflow * Reworked readme to link to correct explanation of swc/core problems, updated readme with bump-versions.yml (#122) Reworked readme to link to correct explanation of swc/core problems * PT-3049 Align tailwind.css with index.css (#95) * Update popover color in ext template * Update shared regions of tailwind.css * Updated themes from core and shadcn * Re-add tw- prefix --------- Co-authored-by: tjcouch-sil <tj_couch@sil.org> * Ran "npm audit fix", "npm prune", and "npx update-browserslist-db@latest" (#123) * fix dependencies (#127) - run `npm audit fix` - bump `glob` version * Added TJ and Ira to every CODEOWNER line Matt is currently on (#128) * Sync a few config files with their counterparts in core (#129) * update vulnerable deps (#133) - upgrade lock file to v3 - ran `npm audit fix` - Bump lodash from 4.17.21 to 4.17.23 - Bump webpack from 5.97.1 to 5.105.2 * Fix all npm audit vulnerabilities by upgrading dependencies (#136) - Upgrade @typescript-eslint/* v6 → v8 to fix minimatch ReDoS vulnerabilities - Upgrade copy-webpack-plugin v12 → v14 to fix serialize-javascript RCE vulnerability - Replace eslint-config-erb with direct airbnb, promise, compat, and prettier configs to remove peer dependency conflicts with @typescript-eslint v8 - Add @stylistic/eslint-plugin-ts for lines-between-class-members rule with exceptAfterOverload support (removed from @typescript-eslint v8) - Add allowJs to tsconfig.lint.json to replace removed createDefaultProgram parser option - Remove jest integration; extensions that use jest will need to add eslint-plugin-jest themselves Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * Eslint naming convention (#137) - PR #550 suggested a lint check for type naming conventions * update vulnerable deps (#139) - `npm audit fix` * Bump picomatch (#140) Bumps and [picomatch](https://github.com/micromatch/picomatch). These dependencies needed to be updated together. Updates `picomatch` from 4.0.3 to 4.0.4 - [Release notes](https://github.com/micromatch/picomatch/releases) - [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md) - [Commits](micromatch/picomatch@4.0.3...4.0.4) Updates `picomatch` from 2.3.1 to 2.3.2 - [Release notes](https://github.com/micromatch/picomatch/releases) - [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md) - [Commits](micromatch/picomatch@4.0.3...4.0.4) --- updated-dependencies: - dependency-name: picomatch dependency-version: 4.0.4 dependency-type: indirect - dependency-name: picomatch dependency-version: 2.3.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump serialize-javascript from 7.0.4 to 7.0.5 (#141) Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) from 7.0.4 to 7.0.5. - [Release notes](https://github.com/yahoo/serialize-javascript/releases) - [Commits](yahoo/serialize-javascript@v7.0.4...v7.0.5) --- updated-dependencies: - dependency-name: serialize-javascript dependency-version: 7.0.5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix vulnerable dependencies (#142) - `npm aduit fix` * Added repoRoot (propagated changes from multi-template) (#143) Propagated changes from mutli-template * Add dark mode selector to match paranext-core * fix vulnerable dependencies (#152) - `npm audit fix` - update `@sillsdev/scripture` * Finish merge resolution; Fix linting --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: TJ Couch <104016682+tjcouch-sil@users.noreply.github.com> Co-authored-by: tjcouch-sil <tj_couch@sil.org> Co-authored-by: FoolRunning <foolrunning@gmail.com> Co-authored-by: Ira Hopkinson <irahopkinson@users.noreply.github.com> Co-authored-by: Matt Lyons <matt_lyons@sil.org> Co-authored-by: rolfheij-sil <108285668+rolfheij-sil@users.noreply.github.com> Co-authored-by: rolfheij-sil <rolf_heij@sil.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jolie Rabideau <jolierabideau@Jolies-MacBook-Pro.local> Co-authored-by: jolierabideau <135999578+jolierabideau@users.noreply.github.com> Co-authored-by: Danny Hammer <denialhammer@gmail.com> Co-authored-by: Danny Hammer <HammerAPI@gmail.com> Co-authored-by: Tom Bogle <tom_bogle@sil.org> Co-authored-by: Katherine Jensen <katherine_jensen@sil.org> Co-authored-by: Sebastian-ubs <141921979+Sebastian-ubs@users.noreply.github.com> Co-authored-by: Jason Naylor <jasonleenaylor@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bc02e99 commit c494004

7 files changed

Lines changed: 1849 additions & 1536 deletions

File tree

.eslintrc.js

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@ const path = require('path');
44

55
module.exports = {
66
extends: [
7-
// https://github.com/electron-react-boilerplate/eslint-config-erb/blob/main/index.js
8-
// airbnb rules are embedded in erb https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
9-
'erb',
7+
// https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
8+
'airbnb',
9+
'airbnb/hooks',
10+
'plugin:promise/recommended',
11+
'plugin:compat/recommended',
1012
// https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#typescript
1113
'plugin:import/recommended',
1214
'plugin:import/typescript',
1315
// Make sure this is last so it gets the chance to override other configs.
1416
// See https://github.com/prettier/eslint-config-prettier and https://github.com/prettier/eslint-plugin-prettier
1517
'plugin:prettier/recommended',
1618
],
19+
env: {
20+
browser: true,
21+
node: true,
22+
},
1723

1824
rules: {
1925
// Some rules in this following shared region are not applied since they are overridden in subsequent regions
@@ -30,6 +36,7 @@ module.exports = {
3036
'import/no-import-module-exports': 'off',
3137
'import/no-unresolved': 'error',
3238
'import/prefer-default-export': 'off',
39+
'no-param-reassign': ['error', { props: false }],
3340
'react/jsx-filename-extension': 'off',
3441
'react/react-in-jsx-scope': 'off',
3542

@@ -47,12 +54,32 @@ module.exports = {
4754
],
4855
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
4956
'lines-between-class-members': 'off',
50-
'@typescript-eslint/lines-between-class-members': [
57+
'@stylistic/ts/lines-between-class-members': [
5158
'error',
5259
'always',
5360
{ exceptAfterSingleLine: true, exceptAfterOverload: true },
5461
],
5562
'@typescript-eslint/member-ordering': 'error',
63+
'@typescript-eslint/naming-convention': [
64+
'error',
65+
{
66+
selector: 'variableLike',
67+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
68+
leadingUnderscore: 'allowSingleOrDouble',
69+
},
70+
{
71+
selector: 'enumMember',
72+
format: ['PascalCase'],
73+
},
74+
{
75+
selector: 'function',
76+
format: ['camelCase', 'PascalCase'],
77+
},
78+
{
79+
selector: 'typeLike',
80+
format: ['PascalCase'],
81+
},
82+
],
5683
'no-empty-function': 'off',
5784
'@typescript-eslint/no-empty-function': [
5885
'error',
@@ -166,14 +193,14 @@ module.exports = {
166193
},
167194
},
168195
],
196+
parser: '@typescript-eslint/parser',
169197
parserOptions: {
170198
ecmaVersion: 2022,
171199
sourceType: 'module',
172200
project: './tsconfig.lint.json',
173201
tsconfigRootDir: __dirname,
174-
createDefaultProgram: true,
175202
},
176-
plugins: ['@typescript-eslint', 'jest', 'no-type-assertion', 'no-null'],
203+
plugins: ['@typescript-eslint', '@stylistic/ts', 'jest', 'no-type-assertion', 'no-null'],
177204
settings: {
178205
'import/resolver': {
179206
typescript: {

README.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -160,39 +160,40 @@ These steps will walk you through releasing a version on GitHub and bumping the
160160
1. Make sure the versions in this repo are on the version number you want to release. If they are not, manually dispatch the [Bump Versions workflow](#bumping-version-without-publishing-a-release) or run the `bump-versions` npm script to set the versions to what you want to release on the branch you want to release from.
161161

162162
2. Manually dispatch the Publish workflow in GitHub Actions targeting the branch you want to release from. This workflow creates a new pre-release for the version you intend to release and creates a new `bump-versions-<next_version>` branch to bump the version after the release so future changes apply to a new in-progress version instead of to the already released version. This workflow has the following inputs:
163-
- `version`: Enter the version you intend to publish (e.g. 0.2.0). This is simply for verification to make sure you release the code that you intend to release. It is compared to the version in the code, and the workflow will fail if they do not match.
164-
- `newVersionAfterPublishing`: Enter the version you want to bump to after releasing (e.g. 0.3.0-alpha.0). Future changes will apply to this new version instead of to the version that was already released. Leave blank if you don't want to bump.
165-
- `bumpRef`: Enter the Git ref you want to create the bump versions branch from, e.g. `main`. Leave blank if you want to use the branch selected for the workflow run. For example, if you release from a stable branch named `release-prep`, you may want to bump the version on `main` so future development work happens on the new version, then you can rebase `release-prep` onto `main` when you are ready to start preparing the next stable release.
163+
164+
- `version`: Enter the version you intend to publish (e.g. 0.2.0). This is simply for verification to make sure you release the code that you intend to release. It is compared to the version in the code, and the workflow will fail if they do not match.
165+
- `newVersionAfterPublishing`: Enter the version you want to bump to after releasing (e.g. 0.3.0-alpha.0). Future changes will apply to this new version instead of to the version that was already released. Leave blank if you don't want to bump.
166+
- `bumpRef`: Enter the Git ref you want to create the bump versions branch from, e.g. `main`. Leave blank if you want to use the branch selected for the workflow run. For example, if you release from a stable branch named `release-prep`, you may want to bump the version on `main` so future development work happens on the new version, then you can rebase `release-prep` onto `main` when you are ready to start preparing the next stable release.
166167

167168
<details>
168169
<summary>[Optional] Create a new pre-release and bump versions branch manually </summary>
169170

170-
#### Manually create a new pre-release and bump versions branch
171+
#### Manually create a new pre-release and bump versions branch
171172

172-
Alternatively, you can create a new pre-release manually:
173+
Alternatively, you can create a new pre-release manually:
173174

174-
```bash
175-
npm run package
176-
# Create a new pre-release in GitHub on tag `v<version>`
177-
# Copy `.github/assets/release-body.md` into the release body
178-
# Press the "Generate release notes" button in the release creation page to generate a changelog
179-
# Attach contents of `release` folder to the release
180-
```
175+
```bash
176+
npm run package
177+
# Create a new pre-release in GitHub on tag `v<version>`
178+
# Copy `.github/assets/release-body.md` into the release body
179+
# Press the "Generate release notes" button in the release creation page to generate a changelog
180+
# Attach contents of `release` folder to the release
181+
```
181182

182-
Then bump versions by running the following:
183+
Then bump versions by running the following:
183184

184-
```bash
185-
npm run bump-versions <next_version>
186-
```
185+
```bash
186+
npm run bump-versions <next_version>
187+
```
187188

188-
Or bump versions manually:
189+
Or bump versions manually:
189190

190-
```bash
191-
git checkout -b bump-versions-<next_version>
192-
npm version <next_version> --git-tag-version false
193-
# Change version in the extension's `manifest.json`
194-
git commit -a -m "Bumped versions to <next_version>"; git push -u origin HEAD
195-
```
191+
```bash
192+
git checkout -b bump-versions-<next_version>
193+
npm version <next_version> --git-tag-version false
194+
# Change version in the extension's `manifest.json`
195+
git commit -a -m "Bumped versions to <next_version>"; git push -u origin HEAD
196+
```
196197

197198
</details>
198199

lib/git.util.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@ import { exec, ExecException, ExecOptions } from 'child_process';
22
import { promisify } from 'util';
33
import path from 'path';
44

5+
// #region shared with https://github.com/paranext/paranext-multi-extension-template/blob/main/lib/git.util.ts
6+
57
const execAsync = promisify(exec);
68

9+
/** Absolute path to the repo root directory */
10+
const repoRoot = path.resolve(path.join(__dirname, '..'));
11+
12+
// #endregion
13+
714
// #region shared with https://github.com/paranext/paranext-multi-extension-template/blob/main/lib/git.util.ts
815

916
/**
@@ -23,12 +30,15 @@ export async function execCommand(
2330
if (!quiet) console.log(`\n>${execOptions.cwd ? ` cd ${execOptions.cwd};` : ''} ${command}`);
2431
try {
2532
const result = await execAsync(command, {
26-
cwd: path.resolve(path.join(__dirname, '..')),
33+
cwd: repoRoot,
2734
...execOptions,
2835
});
2936
if (!quiet && result.stdout) console.log(result.stdout);
3037
if (!quiet && result.stderr) console.log(result.stderr);
31-
return result;
38+
return {
39+
stdout: result.stdout.toString(),
40+
stderr: result.stderr.toString(),
41+
};
3242
} catch (error: unknown) {
3343
if (error instanceof Error) {
3444
// Use the more specific type for `exec`.

0 commit comments

Comments
 (0)