diff --git a/UILib.tsconfig.json b/UILib.tsconfig.json index 36084ba9e..e1d5124b7 100644 --- a/UILib.tsconfig.json +++ b/UILib.tsconfig.json @@ -2,9 +2,9 @@ "extends": "./node_modules/@standardnotes/config/src/tsconfig.json", "compilerOptions": { "module": "esnext", - "target": "es5", + "target": "es6", "lib": ["es6", "dom", "es2016", "es2017"], - "types": ["react"], + "types": ["react", "jest"], "jsx": "react-jsx", "declaration": true, "moduleResolution": "node", diff --git a/common.jest.json b/common.jest.json new file mode 100644 index 000000000..dae8bc635 --- /dev/null +++ b/common.jest.json @@ -0,0 +1,19 @@ +{ + "collectCoverageFrom": ["src/**/*.{ts,tsx}", "!**/index.ts"], + "coverageReporters": ["text", "lcov", "html", "json-summary"], + "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(tsx?)$", + "testPathIgnorePatterns": ["/node_modules/"], + "coveragePathIgnorePatterns": ["/node_modules/"], + "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json"], + "transform": { + "^.+\\.tsx?$": ["ts-jest", { "tsconfig": "tsconfig.json" }] + }, + "coverageThreshold": { + "global": { + "branches": 100, + "functions": 100, + "lines": 100, + "statements": 100 + } + } +} diff --git a/packages/api/jest.config.js b/packages/api/jest.config.js index 640e600c6..9e629f726 100644 --- a/packages/api/jest.config.js +++ b/packages/api/jest.config.js @@ -1,12 +1,10 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, + transform: { + '^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.json' }], }, coverageThreshold: { global: { diff --git a/packages/models/src/Domain/Api/Workspace/Workspace.ts b/packages/api/src/Domain/Client/Workspace/Workspace.ts similarity index 100% rename from packages/models/src/Domain/Api/Workspace/Workspace.ts rename to packages/api/src/Domain/Client/Workspace/Workspace.ts diff --git a/packages/models/src/Domain/Api/Workspace/WorkspaceUser.ts b/packages/api/src/Domain/Client/Workspace/WorkspaceUser.ts similarity index 100% rename from packages/models/src/Domain/Api/Workspace/WorkspaceUser.ts rename to packages/api/src/Domain/Client/Workspace/WorkspaceUser.ts diff --git a/packages/api/src/Domain/Client/index.ts b/packages/api/src/Domain/Client/index.ts index 996a87657..f31a0bf5b 100644 --- a/packages/api/src/Domain/Client/index.ts +++ b/packages/api/src/Domain/Client/index.ts @@ -8,3 +8,5 @@ export * from './WebSocket/WebSocketApiService' export * from './WebSocket/WebSocketApiServiceInterface' export * from './Workspace/WorkspaceApiService' export * from './Workspace/WorkspaceApiServiceInterface' +export * from './Workspace/WorkspaceUser' +export * from './Workspace/Workspace' diff --git a/packages/api/src/Domain/Response/Workspace/WorkspaceListResponseBody.ts b/packages/api/src/Domain/Response/Workspace/WorkspaceListResponseBody.ts index d48824e11..080b6384b 100644 --- a/packages/api/src/Domain/Response/Workspace/WorkspaceListResponseBody.ts +++ b/packages/api/src/Domain/Response/Workspace/WorkspaceListResponseBody.ts @@ -1,4 +1,4 @@ -import { Workspace } from '@standardnotes/models' +import { Workspace } from './../../Client/Workspace/Workspace' export type WorkspaceListResponseBody = { ownedWorkspaces: Array diff --git a/packages/api/src/Domain/Response/Workspace/WorkspaceUserListResponseBody.ts b/packages/api/src/Domain/Response/Workspace/WorkspaceUserListResponseBody.ts index c2c810204..e6e137387 100644 --- a/packages/api/src/Domain/Response/Workspace/WorkspaceUserListResponseBody.ts +++ b/packages/api/src/Domain/Response/Workspace/WorkspaceUserListResponseBody.ts @@ -1,4 +1,4 @@ -import { WorkspaceUser } from '@standardnotes/models' +import { WorkspaceUser } from './../../Client/Workspace/WorkspaceUser' export type WorkspaceUserListResponseBody = { users: Array diff --git a/packages/blocks-editor/package.json b/packages/blocks-editor/package.json index 1472386ce..1077d76c0 100644 --- a/packages/blocks-editor/package.json +++ b/packages/blocks-editor/package.json @@ -4,7 +4,7 @@ "private": true, "main": "./src/index.ts", "scripts": { - "start": "tsc -p tsconfig.json --watch" + "tsc": "tsc -p tsconfig.json" }, "dependencies": { "@lexical/react": "^0.6.0", diff --git a/packages/encryption/jest.config.js b/packages/encryption/jest.config.js index ad1ceabb0..00fb56219 100644 --- a/packages/encryption/jest.config.js +++ b/packages/encryption/jest.config.js @@ -1,11 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - } -}; +} diff --git a/packages/features/jest.config.js b/packages/features/jest.config.js index ad1ceabb0..00fb56219 100644 --- a/packages/features/jest.config.js +++ b/packages/features/jest.config.js @@ -1,11 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - } -}; +} diff --git a/packages/filepicker/jest.config.js b/packages/filepicker/jest.config.js index 265540288..36f5b3060 100644 --- a/packages/filepicker/jest.config.js +++ b/packages/filepicker/jest.config.js @@ -1,14 +1,7 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - }, - coveragePathIgnorePatterns: [ - "/example/" - ] -}; + coveragePathIgnorePatterns: ['/example/'], +} diff --git a/packages/files/jest.config.js b/packages/files/jest.config.js index ad1ceabb0..00fb56219 100644 --- a/packages/files/jest.config.js +++ b/packages/files/jest.config.js @@ -1,11 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - } -}; +} diff --git a/packages/mobile/src/Lib/Interface.ts b/packages/mobile/src/Lib/Interface.ts index 6f3f23aa7..60b31ad35 100644 --- a/packages/mobile/src/Lib/Interface.ts +++ b/packages/mobile/src/Lib/Interface.ts @@ -1,6 +1,6 @@ import AsyncStorage from '@react-native-community/async-storage' import SNReactNative from '@standardnotes/react-native-utils' -import { AppleIAPReceipt } from '@standardnotes/services/dist/Domain/Subscription/AppleIAPReceipt' +import { AppleIAPReceipt } from '@standardnotes/services' import { AppleIAPProductId, ApplicationIdentifier, diff --git a/packages/models/jest.config.js b/packages/models/jest.config.js index ad1ceabb0..00fb56219 100644 --- a/packages/models/jest.config.js +++ b/packages/models/jest.config.js @@ -1,11 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - } -}; +} diff --git a/packages/models/package.json b/packages/models/package.json index f07dba3be..55344f506 100644 --- a/packages/models/package.json +++ b/packages/models/package.json @@ -5,19 +5,11 @@ "node": ">=16.0.0 <17.0.0" }, "description": "Models used in SNJS library", - "main": "dist/index.js", "author": "Standard Notes", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], + "main": "./src/index.ts", "license": "AGPL-3.0-or-later", "scripts": { - "clean": "rm -fr dist", - "prestart": "yarn clean", - "start": "tsc -p tsconfig.json --watch", - "prebuild": "yarn clean", - "build": "tsc -p tsconfig.json", + "tsc": "tsc -p tsconfig.json", "lint": "eslint src --ext .ts", "test": "jest" }, diff --git a/packages/models/src/Domain/Syncable/Theme/Theme.ts b/packages/models/src/Domain/Syncable/Theme/Theme.ts index c5ea79e1a..ece75dc9c 100644 --- a/packages/models/src/Domain/Syncable/Theme/Theme.ts +++ b/packages/models/src/Domain/Syncable/Theme/Theme.ts @@ -12,7 +12,7 @@ export const isTheme = (x: ItemInterface): x is SNTheme => x.content_type === Co export class SNTheme extends SNComponent { public override area: ComponentArea = ComponentArea.Themes - public override readonly package_info!: ThemePackageInfo + public declare readonly package_info: ThemePackageInfo isLayerable(): boolean { return useBoolean(this.package_info && this.package_info.layerable, false) diff --git a/packages/models/src/Domain/index.ts b/packages/models/src/Domain/index.ts index 2fa362958..c95f30c38 100644 --- a/packages/models/src/Domain/index.ts +++ b/packages/models/src/Domain/index.ts @@ -29,8 +29,6 @@ export * from './Api/Subscription/Invitation' export * from './Api/Subscription/InvitationStatus' export * from './Api/Subscription/InviteeIdentifierType' export * from './Api/Subscription/InviterIdentifierType' -export * from './Api/Workspace/Workspace' -export * from './Api/Workspace/WorkspaceUser' export * from './Device/Environment' export * from './Device/Platform' export * from './Local/KeyParams/RootKeyParamsInterface' diff --git a/packages/models/tsconfig.json b/packages/models/tsconfig.json index c82bc5e86..12eec31dd 100644 --- a/packages/models/tsconfig.json +++ b/packages/models/tsconfig.json @@ -1,13 +1,10 @@ { - "extends": "../../node_modules/@standardnotes/config/src/tsconfig.json", + "extends": "../../UILib.tsconfig.json", "compilerOptions": { "skipLibCheck": true, "rootDir": "./src", - "outDir": "./dist", + "outDir": "./dist" }, - "include": [ - "src/**/*" - ], - "references": [], + "include": ["src/**/*"], "exclude": ["**/*.spec.ts"] } diff --git a/packages/responses/jest.config.js b/packages/responses/jest.config.js index ad1ceabb0..00fb56219 100644 --- a/packages/responses/jest.config.js +++ b/packages/responses/jest.config.js @@ -1,11 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - } -}; +} diff --git a/packages/services/jest.config.js b/packages/services/jest.config.js index 9460b4b2a..0ba59ef63 100644 --- a/packages/services/jest.config.js +++ b/packages/services/jest.config.js @@ -1,19 +1,17 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, + transform: { + '^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.json' }], }, coverageThreshold: { global: { branches: 6, functions: 9, lines: 13, - statements: 13 - } - } -}; + statements: 13, + }, + }, +} diff --git a/packages/services/package.json b/packages/services/package.json index b205a115e..57ec14962 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -5,20 +5,12 @@ "node": ">=16.0.0 <17.0.0" }, "description": "Services for Standard Notes SNJS library", - "main": "dist/index.js", + "main": "./src/index.ts", "author": "Standard Notes", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], "private": true, "license": "AGPL-3.0-or-later", "scripts": { - "clean": "rm -fr dist", - "prestart": "yarn clean", - "start": "tsc -p tsconfig.json --watch", - "prebuild": "yarn clean", - "build": "tsc -p tsconfig.json", + "tsc": "tsc --project tsconfig.json", "lint": "eslint src --ext .ts", "lint:fix": "eslint src --ext .ts --fix", "test": "jest spec --coverage" diff --git a/packages/services/src/Domain/Workspace/WorkspaceClientInterface.ts b/packages/services/src/Domain/Workspace/WorkspaceClientInterface.ts index 9a4baefcc..c74171161 100644 --- a/packages/services/src/Domain/Workspace/WorkspaceClientInterface.ts +++ b/packages/services/src/Domain/Workspace/WorkspaceClientInterface.ts @@ -1,5 +1,5 @@ import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' -import { Workspace, WorkspaceUser } from '@standardnotes/models' +import { Workspace, WorkspaceUser } from '@standardnotes/api' export interface WorkspaceClientInterface { createWorkspace(dto: { diff --git a/packages/services/src/Domain/Workspace/WorkspaceManager.ts b/packages/services/src/Domain/Workspace/WorkspaceManager.ts index 41a7180f9..fca97be4a 100644 --- a/packages/services/src/Domain/Workspace/WorkspaceManager.ts +++ b/packages/services/src/Domain/Workspace/WorkspaceManager.ts @@ -1,7 +1,5 @@ -import { WorkspaceApiServiceInterface } from '@standardnotes/api' +import { WorkspaceApiServiceInterface, Workspace, WorkspaceUser } from '@standardnotes/api' import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common' -import { Workspace, WorkspaceUser } from '@standardnotes/models' - import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface' import { AbstractService } from '../Service/AbstractService' import { WorkspaceClientInterface } from './WorkspaceClientInterface' diff --git a/packages/services/tsconfig.json b/packages/services/tsconfig.json index f3dac14ef..39b1efa35 100644 --- a/packages/services/tsconfig.json +++ b/packages/services/tsconfig.json @@ -1,13 +1,10 @@ { - "extends": "../../node_modules/@standardnotes/config/src/tsconfig.json", + "extends": "../../UILib.tsconfig.json", "compilerOptions": { "skipLibCheck": true, "rootDir": "./src", - "outDir": "./dist", + "outDir": "./dist" }, - "include": [ - "src/**/*" - ], - "references": [], - "exclude": ["**/*.spec.ts", "dist", "node_modules"] + "include": ["src/**/*"], + "exclude": ["**/*.spec.ts", "node_modules"] } diff --git a/packages/sncrypto-common/jest.config.js b/packages/sncrypto-common/jest.config.js index ad1ceabb0..00fb56219 100644 --- a/packages/sncrypto-common/jest.config.js +++ b/packages/sncrypto-common/jest.config.js @@ -1,11 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - } -}; +} diff --git a/packages/snjs/jest.config.js b/packages/snjs/jest.config.js index 8ffd791ce..8a0cd35bb 100644 --- a/packages/snjs/jest.config.js +++ b/packages/snjs/jest.config.js @@ -1,5 +1,5 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, @@ -7,12 +7,11 @@ module.exports = { '@Lib/(.*)': '/lib/$1', '@Services/(.*)': '/lib/Services/$1', }, - globals: { - 'ts-jest': { - tsconfig: '/lib/tsconfig.json', - isolatedModules: true, - babelConfig: 'babel.config.js', - }, + transform: { + '^.+\\.tsx?$': [ + 'ts-jest', + { tsconfig: './lib/tsconfig.json', isolatedModules: true, babelConfig: 'babel.config.js' }, + ], }, clearMocks: true, collectCoverageFrom: ['lib/**/{!(index),}.ts'], @@ -23,9 +22,6 @@ module.exports = { roots: ['/lib'], setupFiles: ['/jest-global.ts'], setupFilesAfterEnv: [], - transform: { - '^.+\\.(ts|js)?$': 'ts-jest', - }, coverageThreshold: { global: { branches: 13, diff --git a/packages/ui-services/jest.config.js b/packages/ui-services/jest.config.js index ad1ceabb0..00fb56219 100644 --- a/packages/ui-services/jest.config.js +++ b/packages/ui-services/jest.config.js @@ -1,11 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - } -}; +} diff --git a/packages/ui-services/package.json b/packages/ui-services/package.json index 1a9b13fa0..9ad303aac 100644 --- a/packages/ui-services/package.json +++ b/packages/ui-services/package.json @@ -5,20 +5,12 @@ "node": ">=16.0.0 <17.0.0" }, "description": "UI Services for Standard Notes clients", - "main": "dist/index.js", + "main": "./src/index.ts", "author": "Standard Notes", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], "private": true, "license": "AGPL-3.0-or-later", "scripts": { - "clean": "rm -fr dist", - "prestart": "yarn clean", - "start": "tsc -p tsconfig.json --watch", - "prebuild": "yarn clean", - "build": "tsc -p tsconfig.json", + "tsc": "tsc --project tsconfig.json", "lint": "eslint src --ext .ts", "test": "jest spec" }, diff --git a/packages/ui-services/tsconfig.json b/packages/ui-services/tsconfig.json index e2096ea2c..6e7b1ea93 100644 --- a/packages/ui-services/tsconfig.json +++ b/packages/ui-services/tsconfig.json @@ -1,14 +1,11 @@ { - "extends": "../../node_modules/@standardnotes/config/src/tsconfig.json", + "extends": "../../UILib.tsconfig.json", "compilerOptions": { "skipLibCheck": true, "rootDir": "./src", "outDir": "./dist", - "jsx": "react-jsx", + "jsx": "react-jsx" }, - "include": [ - "src/**/*" - ], - "references": [], - "exclude": ["**/*.spec.ts", "dist", "node_modules"] + "include": ["src/**/*"], + "exclude": ["**/*.spec.ts", "node_modules"] } diff --git a/packages/utils/jest.config.js b/packages/utils/jest.config.js index bef9ea6b9..6809d0e84 100644 --- a/packages/utils/jest.config.js +++ b/packages/utils/jest.config.js @@ -1,19 +1,14 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires -const base = require('../../node_modules/@standardnotes/config/src/jest.json'); +const base = require('../../common.jest.json') module.exports = { ...base, - globals: { - 'ts-jest': { - tsconfig: 'tsconfig.json', - }, - }, coverageThreshold: { global: { branches: 4, functions: 4, lines: 24, - statements: 25 - } - } -}; + statements: 25, + }, + }, +}