Skip to content

Commit

Permalink
cleanup after moving utilities (#107)
Browse files Browse the repository at this point in the history
- delete the files copied to the utilities package
- update usage to new location
- update README graph
- fix typecheck on CI
- move common tsconfig settings up to root
  • Loading branch information
irahopkinson committed Jun 20, 2024
1 parent e969230 commit bd34483
Show file tree
Hide file tree
Showing 49 changed files with 204 additions and 2,413 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ NOTE: there is a [known limitation using PNPM with Volta](https://docs.volta.sh/

## Nx Monorepo Build System

| Source | Package |
| -------------------------------------- | ----------------------------------------------------------------------- |
| [perf-vanilla](/packages/perf-react) | |
| [perf-react](/packages/perf-react) | |
| [platform](/packages/platform) | [![Github Tag][npm-platform-version-image]][npm-platform-version-url] |
| [scribe](/packages/scribe) | [![Github Tag][npm-scribe-version-image]][npm-scribe-version-url] |
| [shared-react](/packages/shared-react) | |
| [shared](/packages/shared) | |
| [utilities](/packages/utilities) | [![Github Tag][npm-utilities-version-image]][npm-utilities-version-url] |

```mermaid
---
title: Nx Graph
Expand All @@ -50,8 +60,12 @@ graph TB
P(platform) --> SR
SB(scribe) --> SR
SR(shared-react) --> S
R --> SR
P --> S
SB --> S
S --> U(utilities)
P --> U
SB --> U
```

<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
Expand Down Expand Up @@ -168,4 +182,10 @@ Thanks to [CodeSandbox](https://codesandbox.io/) for the instant dev environment

<!-- define variables used above -->

[npm-platform-version-image]: https://img.shields.io/npm/v/@biblionexus-foundation/platform-editor
[npm-platform-version-url]: https://www.npmjs.com/package/@biblionexus-foundation/platform-editor
[npm-scribe-version-image]: https://img.shields.io/npm/v/@biblionexus-foundation/scribe-editor
[npm-scribe-version-url]: https://www.npmjs.com/package/@biblionexus-foundation/scribe-editor
[npm-utilities-version-image]: https://img.shields.io/npm/v/@biblionexus-foundation/scripture-utilities
[npm-utilities-version-url]: https://www.npmjs.com/package/@biblionexus-foundation/scripture-utilities
[github-license]: https://github.com/BiblioNexus-Foundation/scripture-editors/blob/main/LICENSE
3 changes: 1 addition & 2 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
"**/*.{ts,tsx}": (files) => `nx affected --target=typecheck --files=${files.join(",")}`,
"**/*.{js,ts,jsx,tsx,json,html,yml,yaml,md,cjs,mjs}": [
(files) => `prettier --write ${files.join(" ")}`,
(files) => `nx format:write --files=${files.join(",")}`,
(files) => `nx affected:lint --files=${files.join(",")}`,
(files) => `nx affected:lint --files=${files}`,
],
};
25 changes: 2 additions & 23 deletions packages/perf-react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react-jsx",

/* Bundler mode */
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"declaration": true,

/* Linting */
"strict": true,
"allowJs": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"jsx": "react-jsx"
},
"include": ["src"],
"references": [
Expand Down
21 changes: 1 addition & 20 deletions packages/perf-vanilla/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"extends": "../../tsconfig",
"include": ["src"]
}
1 change: 1 addition & 0 deletions packages/platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"react-dom": ">=18.3.1"
},
"dependencies": {
"@biblionexus-foundation/scripture-utilities": "workspace:*",
"@lexical/react": "^0.16.0",
"@lexical/selection": "^0.16.0",
"@lexical/text": "^0.16.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/platform/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Usj, usxStringToUsj } from "@biblionexus-foundation/scripture-utilities";
import { BookChapterControl, ScriptureReference } from "platform-bible-react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { usxStringToUsj } from "shared/converters/usj/usx-to-usj";
import { Usj } from "shared/converters/usj/usj.model";
import { WEB_PSA_USX as usx } from "shared/data/WEB-PSA.usx";
// import { PSA_USX as usx } from "shared/data/psa.usfm.usx";
import { WEB_PSA_COMMENTS as comments } from "shared/data/WEB_PSA.comments";
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/editor/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Usj } from "@biblionexus-foundation/scripture-utilities";
import { EditorRefPlugin } from "@lexical/react/LexicalEditorRefPlugin";
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
import { InitialConfigType, LexicalComposer } from "@lexical/react/LexicalComposer";
Expand All @@ -17,7 +18,6 @@ import React, {
useState,
} from "react";
import { ScriptureReference } from "platform-bible-react";
import { Usj } from "shared/converters/usj/usj.model";
import { TypedMarkNode } from "shared/nodes/features/TypedMarkNode";
import scriptureUsjNodes from "shared/nodes/scripture/usj";
import AnnotationPlugin, {
Expand Down
22 changes: 12 additions & 10 deletions packages/platform/src/editor/adaptors/editor-usj-adaptor.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { MarkerObject } from "@biblionexus-foundation/scripture-utilities";
import { deepEqual } from "fast-equals";
import { TypedMarkNode } from "shared/nodes/features/TypedMarkNode";
import scriptureUsjNodes from "shared/nodes/scripture/usj";
import { CHAPTER_MARKER, SerializedChapterNode } from "shared/nodes/scripture/usj/ChapterNode";
import { SerializedParaNode } from "shared/nodes/scripture/usj/ParaNode";
import { getVisibleOpenMarkerText } from "shared/nodes/scripture/usj/node.utils";
import { SerializedVerseNode, VERSE_MARKER } from "shared/nodes/scripture/usj/VerseNode";
import { createBasicTestEnvironment } from "shared/nodes/test.utils";
import { ImmutableNoteCallerNode } from "shared-react/nodes/scripture/usj/ImmutableNoteCallerNode";
// Reaching inside only for tests.
// eslint-disable-next-line @nx/enforce-module-boundaries
import {
CHAPTER_1_INDEX,
VERSE_2_EDITABLE_INDEX,
Expand All @@ -15,16 +26,7 @@ import {
usjGen1v1ImpliedPara,
usjMarks,
usjWithUnknownItems,
} from "shared/converters/usj/converter-test.data";
import { MarkerObject } from "shared/converters/usj/usj.model";
import { TypedMarkNode } from "shared/nodes/features/TypedMarkNode";
import scriptureUsjNodes from "shared/nodes/scripture/usj";
import { CHAPTER_MARKER, SerializedChapterNode } from "shared/nodes/scripture/usj/ChapterNode";
import { SerializedParaNode } from "shared/nodes/scripture/usj/ParaNode";
import { getVisibleOpenMarkerText } from "shared/nodes/scripture/usj/node.utils";
import { SerializedVerseNode, VERSE_MARKER } from "shared/nodes/scripture/usj/VerseNode";
import { createBasicTestEnvironment } from "shared/nodes/test.utils";
import { ImmutableNoteCallerNode } from "shared-react/nodes/scripture/usj/ImmutableNoteCallerNode";
} from "../../../../utilities/src/converters/usj/converter-test.data";
import editorUsjAdaptor from "./editor-usj.adaptor";
import usjEditorAdaptor from "./usj-editor.adaptor";

Expand Down
14 changes: 7 additions & 7 deletions packages/platform/src/editor/adaptors/editor-usj.adaptor.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "@biblionexus-foundation/scripture-utilities";
import {
EditorState,
LineBreakNode,
SerializedLexicalNode,
SerializedTextNode,
TextNode,
} from "lexical";
import {
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "shared/converters/usj/usj.model";
import {
COMMENT_MARK_TYPE,
SerializedTypedMarkNode,
Expand Down
14 changes: 8 additions & 6 deletions packages/platform/src/editor/adaptors/usj-editor-adaptor.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { MarkerObject } from "@biblionexus-foundation/scripture-utilities";
import { SerializedEditorState } from "lexical";
import { SerializedParaNode } from "shared/nodes/scripture/usj/ParaNode";
import { SerializedNoteNode } from "shared/nodes/scripture/usj/NoteNode";
import { SerializedImmutableNoteCallerNode } from "shared-react/nodes/scripture/usj/ImmutableNoteCallerNode";
import { MarkNodeName } from "shared-react/nodes/scripture/usj/usj-node-options.model";
// Reaching inside only for tests.
// eslint-disable-next-line @nx/enforce-module-boundaries
import {
NOTE_CALLER_INDEX,
NOTE_INDEX,
Expand All @@ -15,12 +22,7 @@ import {
usjGen1v1ImpliedPara,
usjMarks,
usjWithUnknownItems,
} from "shared/converters/usj/converter-test.data";
import { MarkerObject } from "shared/converters/usj/usj.model";
import { SerializedParaNode } from "shared/nodes/scripture/usj/ParaNode";
import { SerializedNoteNode } from "shared/nodes/scripture/usj/NoteNode";
import { SerializedImmutableNoteCallerNode } from "shared-react/nodes/scripture/usj/ImmutableNoteCallerNode";
import { MarkNodeName } from "shared-react/nodes/scripture/usj/usj-node-options.model";
} from "../../../../utilities/src/converters/usj/converter-test.data";
import { UNFORMATTED_VIEW_MODE } from "../toolbar/view-mode.model";
import { serializeEditorState, reset, initialize } from "./usj-editor.adaptor";
import { getViewOptions } from "./view-options.utils";
Expand Down
16 changes: 8 additions & 8 deletions packages/platform/src/editor/adaptors/usj-editor.adaptor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import {
BookCode,
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "@biblionexus-foundation/scripture-utilities";
import {
LineBreakNode,
SerializedEditorState,
Expand All @@ -6,14 +14,6 @@ import {
SerializedTextNode,
TextNode,
} from "lexical";
import {
BookCode,
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "shared/converters/usj/usj.model";
import {
COMMENT_MARK_TYPE,
SerializedTypedMarkNode,
Expand Down
3 changes: 0 additions & 3 deletions packages/platform/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export { default as Editorial } from "./Editorial";
export { default as Marginal, type MarginalRef } from "./marginal/Marginal";
export { type Usj } from "shared/converters/usj/usj.model";
export { usxStringToUsj } from "shared/converters/usj/usx-to-usj";
export { usjToUsxString } from "shared/converters/usj/usj-to-usx";
export { immutableNoteCallerNodeName } from "shared-react/nodes/scripture/usj/ImmutableNoteCallerNode";
export { type UsjNodeOptions } from "shared-react/nodes/scripture/usj/usj-node-options.model";
export {
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/marginal/Marginal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Usj } from "@biblionexus-foundation/scripture-utilities";
import React, {
JSX,
PropsWithChildren,
Expand All @@ -8,7 +9,6 @@ import React, {
useRef,
useState,
} from "react";
import { Usj } from "shared/converters/usj/usj.model";
import { LoggerBasic } from "shared-react/plugins/logger-basic.model";
import { Comments } from "./comments/commenting";
import CommentPlugin from "./comments/CommentPlugin";
Expand Down
25 changes: 2 additions & 23 deletions packages/platform/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react-jsx",

/* Bundler mode */
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"declaration": true,

/* Linting */
"strict": true,
"allowJs": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"jsx": "react-jsx"
},
"include": ["src"],
"references": [
Expand Down
1 change: 1 addition & 0 deletions packages/scribe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"react-dom": ">=18.3.1"
},
"dependencies": {
"@biblionexus-foundation/scripture-utilities": "workspace:*",
"@lexical/mark": "^0.16.0",
"@lexical/react": "^0.16.0",
"@lexical/selection": "^0.16.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/scribe/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Usj } from "@biblionexus-foundation/scripture-utilities";
import { useState, useMemo, SyntheticEvent, useRef, useEffect } from "react";
import { useUsfm2Usj } from "./hooks/useUsfm2Usj";
import Editor, { EditorRef } from "./components/Editor";
import { Usj } from "shared/converters/usj/usj.model";
import { getViewOptions } from "./adaptors/view-options.utils";
import { formattedViewMode as defaultViewMode } from "./plugins/view-mode.model";
import { UsjNodeOptions } from "shared-react/nodes/scripture/usj/usj-node-options.model";
Expand Down
14 changes: 7 additions & 7 deletions packages/scribe/src/adaptors/editor-usj.adaptor.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "@biblionexus-foundation/scripture-utilities";
import {
EditorState,
LineBreakNode,
SerializedLexicalNode,
SerializedTextNode,
TextNode,
} from "lexical";
import {
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "shared/converters/usj/usj.model";
import {
NBSP,
getEditableCallerText,
Expand Down
16 changes: 8 additions & 8 deletions packages/scribe/src/adaptors/note-usj-editor.adaptor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import {
BookCode,
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "@biblionexus-foundation/scripture-utilities";
import { MarkNode, SerializedMarkNode } from "@lexical/mark";
import {
LineBreakNode,
Expand All @@ -7,14 +15,6 @@ import {
SerializedTextNode,
TextNode,
} from "lexical";
import {
BookCode,
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "shared/converters/usj/usj.model";
import {
BOOK_MARKER,
BOOK_VERSION,
Expand Down
16 changes: 8 additions & 8 deletions packages/scribe/src/adaptors/usj-editor.adaptor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import {
BookCode,
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "@biblionexus-foundation/scripture-utilities";
import { MarkNode, SerializedMarkNode } from "@lexical/mark";
import {
LineBreakNode,
Expand All @@ -7,14 +15,6 @@ import {
SerializedTextNode,
TextNode,
} from "lexical";
import {
BookCode,
MarkerContent,
MarkerObject,
USJ_TYPE,
USJ_VERSION,
Usj,
} from "shared/converters/usj/usj.model";
import {
BOOK_MARKER,
BOOK_VERSION,
Expand Down
Loading

0 comments on commit bd34483

Please sign in to comment.