From c9ad18538bec9d040e092ff9f1e6a070b765450c Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 2 Dec 2024 16:04:58 +0100 Subject: [PATCH] feat(core): Refactor project structure for better modularity and code organization --- changelog.md | 7 +++++++ package.json | 6 ++++-- test/test.ts | 2 +- ts/00_commitinfo_data.ts | 2 +- ts/classes.pdfservice.ts | 3 +-- ts/plugins.ts | 5 +++++ ts/tspublish.json | 3 +++ {ts/shared => ts_shared}/demoletter.ts | 10 ++++----- {ts/shared => ts_shared}/index.ts | 3 +++ {ts => ts_shared}/interfaces/document.ts | 4 ++-- {ts => ts_shared}/interfaces/index.ts | 0 {ts => ts_shared}/interfaces/translation.ts | 0 ts_shared/plugins.ts | 4 ++++ {ts/shared => ts_shared}/translation.ts | 2 +- ts_shared/tspublish.json | 3 +++ ts_web/00_commitinfo_data.ts | 2 +- ts_web/elements/contentinvoice.ts | 18 +++++++--------- ts_web/elements/document.demo.ts | 5 +++-- ts_web/elements/document.ts | 7 ++----- ts_web/elements/index.ts | 2 -- ts_web/elements/letterheader.ts | 15 +++++++------- ts_web/elements/page.ts | 12 +++++------ ts_web/elements/pagecontainer.ts | 6 +++--- ts_web/elements/pagecontent.ts | 11 +++++----- ts_web/elements/pagefooter.ts | 23 +++++++++------------ ts_web/elements/pageheader.ts | 13 +++++------- ts_web/elements/viewer.demo.ts | 4 ++-- ts_web/elements/viewer.ts | 3 +-- ts_web/plugins.ts | 5 +++++ ts_web/tspublish.json | 3 +++ 30 files changed, 100 insertions(+), 83 deletions(-) create mode 100644 ts/tspublish.json rename {ts/shared => ts_shared}/demoletter.ts (94%) rename {ts/shared => ts_shared}/index.ts (74%) rename {ts => ts_shared}/interfaces/document.ts (58%) rename {ts => ts_shared}/interfaces/index.ts (100%) rename {ts => ts_shared}/interfaces/translation.ts (100%) create mode 100644 ts_shared/plugins.ts rename {ts/shared => ts_shared}/translation.ts (98%) create mode 100644 ts_shared/tspublish.json create mode 100644 ts_web/tspublish.json diff --git a/changelog.md b/changelog.md index 3f15f14..f8e583b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2024-12-02 - 1.5.0 - feat(core) +Refactor project structure for better modularity and code organization + +- Moved shared components to a dedicated 'dist_ts_shared' directory for better separation of concerns. +- Updated import statements across the codebase to align with the new file structure. +- Introduced translations directly under 'ts_shared' for language-specific string management. + ## 2024-12-02 - 1.4.0 - feat(translation) Add French and Italian translations for document interface diff --git a/package.json b/package.json index e464b3d..3aa774c 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,10 @@ "main": "dist_ts_web/index.js", "typings": "dist_ts_web/index.d.ts", "exports": { - "./ts": "./dist_ts/index.js", - "./ts_web": "./dist_ts_web/index.js" + ".": "./dist_ts/index.js", + "./web": "./dist_ts_web/index.js", + "./shared": "./dist_ts_shared/index.js", + "./interfaces": "./dist_ts_shared/interfaces/index.js" }, "scripts": { "test": "npm run build && tstest test/", diff --git a/test/test.ts b/test/test.ts index 5f7f520..ea67a58 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,6 +1,6 @@ import * as plugins from './plugins.js'; import * as paths from './paths.js'; -import * as interfaces from '../ts/interfaces/index.js'; +import * as interfaces from '../ts_shared/interfaces/index.js'; import { expect, tap } from '@push.rocks/tapbundle'; import * as deesDocumentServer from '../ts/index.js'; diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 8033d5a..0311e55 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@design.estate/dees-document', - version: '1.4.0', + version: '1.5.0', description: 'A sophisticated framework for dynamically generating and rendering business documents like invoices with modern web technologies, featuring PDF creation, templating, and automation.' } diff --git a/ts/classes.pdfservice.ts b/ts/classes.pdfservice.ts index f749e2d..e6849d7 100644 --- a/ts/classes.pdfservice.ts +++ b/ts/classes.pdfservice.ts @@ -1,6 +1,5 @@ import * as plugins from './plugins.js'; import * as helpers from './helpers.js'; -import type { IDocumentSettings} from '../ts/interfaces/index.js'; export interface IPdfServiceConstructorOptions { @@ -46,7 +45,7 @@ export class PdfService { */ public async createPdfFromLetterObject(optionsArg: { letterData: plugins.tsclass.business.ILetter, - documentSettings: IDocumentSettings + documentSettings: plugins.shared.interfaces.IDocumentSettings }) { const html = `