diff --git a/apps/client/package.json b/apps/client/package.json index 128d80827..0fbd5655f 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -21,7 +21,6 @@ "framer-motion": "^8.0.2", "jotai": "^1.10.0", "luxon": "^3.1.0", - "ontime-utils": "workspace:*", "react": "^18.2.0", "react-beautiful-dnd": "^13.1.1", "react-dom": "^18.2.0", @@ -80,6 +79,8 @@ "eslint-plugin-simple-import-sort": "^8.0.0", "eslint-plugin-testing-library": "^5.9.1", "jsdom": "^21.1.0", + "ontime-types": "workspace:*", + "ontime-utils": "workspace:*", "prettier": "^2.8.3", "prop-types": "^15.8.1", "sass": "^1.57.1", diff --git a/apps/client/src/index.tsx b/apps/client/src/index.tsx index 7e2274770..0a0e6a366 100644 --- a/apps/client/src/index.tsx +++ b/apps/client/src/index.tsx @@ -2,6 +2,7 @@ import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import * as Sentry from '@sentry/react'; import { BrowserTracing } from '@sentry/tracing'; +import { TimerType } from 'ontime-types'; import App from './App'; import { ONTIME_VERSION } from './ONTIME_VERSION'; @@ -19,6 +20,10 @@ Sentry.init({ enabled: import.meta.env.PROD, }); +// TODO: apply code and remove, refs PR #290 +const sharedType: TimerType = TimerType.CountDown; +console.log('WIP', sharedType); + root.render( diff --git a/apps/server/package.json b/apps/server/package.json index abdbcea5b..dcf39a455 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -32,6 +32,7 @@ "eslint": "^8.31.0", "eslint-plugin-prettier": "^4.2.1", "nodemon": "^2.0.20", + "ontime-types": "workspace:*", "prettier": "^2.8.3", "shx": "^0.3.4", "ts-node": "^10.9.1", diff --git a/apps/server/src/app.ts b/apps/server/src/app.ts index 36667c2e7..e18520c4a 100644 --- a/apps/server/src/app.ts +++ b/apps/server/src/app.ts @@ -23,6 +23,11 @@ import { DataProvider } from './classes/data-provider/DataProvider.js'; import { socketProvider } from './classes/socket/SocketController.js'; import { eventTimer } from './services/TimerService.js'; import { promise } from './modules/loadDb.js'; +import { TimerType } from 'ontime-types'; + +// TODO: apply code and remove, refs PR #290 +const sharedType: TimerType = TimerType.CountDown; +console.log('WIP', sharedType); console.log(`Starting Ontime version ${ONTIME_VERSION}`); diff --git a/packages/types/.eslintrc b/packages/types/.eslintrc new file mode 100644 index 000000000..3581c4ab2 --- /dev/null +++ b/packages/types/.eslintrc @@ -0,0 +1,15 @@ +{ + "env": { + "browser": true, + "node": true + }, + "parser": "@typescript-eslint/parser", + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module" + } +} diff --git a/packages/types/package.json b/packages/types/package.json new file mode 100644 index 000000000..5f44bc21e --- /dev/null +++ b/packages/types/package.json @@ -0,0 +1,20 @@ +{ + "name": "ontime-types", + "type": "module", + "main": "./src/index.ts", + "types": "./src/index.ts", + "private": true, + "description": "shared typings for ontime", + "scripts": { + "cleanup": "rm -rf .turbo && rm -rf node_modules" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.48.1", + "@typescript-eslint/parser": "^5.48.1", + "eslint": "^8.31.0", + "typescript": "^4.9.4" + } +} diff --git a/packages/types/src/definitions/TimerType.ts b/packages/types/src/definitions/TimerType.ts new file mode 100644 index 000000000..0f2861236 --- /dev/null +++ b/packages/types/src/definitions/TimerType.ts @@ -0,0 +1,7 @@ +enum TimerType { + CountDown = 'count-down', + CountUp = 'count-up', + Clock = 'clock' +} + +export default TimerType diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts new file mode 100644 index 000000000..625b61a2c --- /dev/null +++ b/packages/types/src/index.ts @@ -0,0 +1,3 @@ +import TimerType from './definitions/TimerType.js'; + +export { TimerType }; diff --git a/utils/.eslintrc b/packages/utils/.eslintrc similarity index 100% rename from utils/.eslintrc rename to packages/utils/.eslintrc diff --git a/utils/.prettierrc b/packages/utils/.prettierrc similarity index 100% rename from utils/.prettierrc rename to packages/utils/.prettierrc diff --git a/utils/index.ts b/packages/utils/index.ts similarity index 100% rename from utils/index.ts rename to packages/utils/index.ts diff --git a/utils/package.json b/packages/utils/package.json similarity index 100% rename from utils/package.json rename to packages/utils/package.json diff --git a/utils/src/generate-id/generateId.test.ts b/packages/utils/src/generate-id/generateId.test.ts similarity index 100% rename from utils/src/generate-id/generateId.test.ts rename to packages/utils/src/generate-id/generateId.test.ts diff --git a/utils/src/generate-id/generateId.ts b/packages/utils/src/generate-id/generateId.ts similarity index 100% rename from utils/src/generate-id/generateId.ts rename to packages/utils/src/generate-id/generateId.ts diff --git a/utils/tsconfig.json b/packages/utils/tsconfig.json similarity index 100% rename from utils/tsconfig.json rename to packages/utils/tsconfig.json diff --git a/utils/vite.config.ts b/packages/utils/vite.config.ts similarity index 100% rename from utils/vite.config.ts rename to packages/utils/vite.config.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a8b25d26b..a8e18956a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -71,6 +71,7 @@ importers: jotai: ^1.10.0 jsdom: ^21.1.0 luxon: ^3.1.0 + ontime-types: workspace:* ontime-utils: workspace:* prettier: ^2.8.3 prop-types: ^15.8.1 @@ -111,7 +112,6 @@ importers: framer-motion: 8.4.3_biqbaboplfbrettd7655fr4n2y jotai: 1.13.0_react@18.2.0 luxon: 3.2.1 - ontime-utils: link:../../utils react: 18.2.0 react-beautiful-dnd: 13.1.1_biqbaboplfbrettd7655fr4n2y react-dom: 18.2.0_react@18.2.0 @@ -146,6 +146,8 @@ importers: eslint-plugin-simple-import-sort: 8.0.0_eslint@8.31.0 eslint-plugin-testing-library: 5.9.1_iukboom6ndih5an6iafl45j2fe jsdom: 21.1.0 + ontime-types: link:../../packages/types + ontime-utils: link:../../packages/utils prettier: 2.8.3 prop-types: 15.8.1 sass: 1.57.1 @@ -194,6 +196,7 @@ importers: node-osc: ^8.0.9 node-xlsx: ^0.21.0 nodemon: ^2.0.20 + ontime-types: workspace:* ontime-utils: workspace:* passport: ^0.6.0 passport-local: ~1.0.0 @@ -217,7 +220,7 @@ importers: nanoid: 4.0.0 node-osc: 8.0.9 node-xlsx: 0.21.0 - ontime-utils: link:../../utils + ontime-utils: link:../../packages/utils passport: 0.6.0 passport-local: 1.0.0 socket.io: 4.5.4 @@ -230,13 +233,26 @@ importers: eslint: 8.31.0 eslint-plugin-prettier: 4.2.1_ilxq7usaoskowiuvcfaznp7pcm nodemon: 2.0.20 + ontime-types: link:../../packages/types prettier: 2.8.3 shx: 0.3.4 ts-node: 10.9.1_qacynw5b4krdzzrloasmebsynu typescript: 4.9.4 vitest: 0.27.1 - utils: + packages/types: + specifiers: + '@typescript-eslint/eslint-plugin': ^5.48.1 + '@typescript-eslint/parser': ^5.48.1 + eslint: ^8.31.0 + typescript: ^4.9.4 + devDependencies: + '@typescript-eslint/eslint-plugin': 5.48.1_3jon24igvnqaqexgwtxk6nkpse + '@typescript-eslint/parser': 5.48.1_iukboom6ndih5an6iafl45j2fe + eslint: 8.31.0 + typescript: 4.9.4 + + packages/utils: specifiers: '@typescript-eslint/eslint-plugin': ^5.48.1 '@typescript-eslint/parser': ^5.48.1 @@ -3703,7 +3719,7 @@ packages: /axios/0.25.0_debug@4.3.4: resolution: {integrity: sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==} dependencies: - follow-redirects: 1.15.2_debug@4.3.4 + follow-redirects: 1.15.2 transitivePeerDependencies: - debug dev: true @@ -5393,19 +5409,6 @@ packages: peerDependenciesMeta: debug: optional: true - dev: false - - /follow-redirects/1.15.2_debug@4.3.4: - resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dependencies: - debug: 4.3.4 - dev: true /for-each/0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 52038aa79..4d00eb2a8 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,4 @@ # https://pnpm.io/pnpm-workspace_yaml packages: - # all packages in direct subdirectories of apps/ - "apps/*" - - "utils" + - "packages/*"