From 3783540e12ce158f3c6079af3ec4b854fd02d952 Mon Sep 17 00:00:00 2001 From: Lennart Heinrich Date: Thu, 16 Oct 2025 20:39:26 +0200 Subject: [PATCH] typescript model --- .gitignore | 15 ++++--- .idea/jsLibraryMappings.xml | 6 +++ .idea/model.iml | 1 + .../templates/infinimotion/angular/.npmrc.vm | 1 + .../infinimotion/angular/Xmodel_ts.vm | 6 +++ .../infinimotion/angular/index_ts.vm | 9 ++++ .../infinimotion/angular/package_json.vm | 27 ++++++++++++ .../infinimotion/angular/tsconfig_json.vm | 44 +++++++++++++++++++ .../infinimotion/angular/tsup.config_ts.vm | 10 +++++ .../templates/infinimotion/templates.cfg | 10 ++++- 10 files changed, 121 insertions(+), 8 deletions(-) create mode 100644 .idea/jsLibraryMappings.xml create mode 100644 TelosysTools/templates/infinimotion/angular/.npmrc.vm create mode 100644 TelosysTools/templates/infinimotion/angular/Xmodel_ts.vm create mode 100644 TelosysTools/templates/infinimotion/angular/index_ts.vm create mode 100644 TelosysTools/templates/infinimotion/angular/package_json.vm create mode 100644 TelosysTools/templates/infinimotion/angular/tsconfig_json.vm create mode 100644 TelosysTools/templates/infinimotion/angular/tsup.config_ts.vm diff --git a/.gitignore b/.gitignore index 529d1b0..c01f3ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ -/plantuml/ -/sql/ -/src/ -/pom_jpa.xml -/TelosysTools/downloads -/TelosysTools/templates -!/TelosysTools/templates/infinimotion \ No newline at end of file +./plantuml +./sql +./src +./angular +./pom_jpa.xml +./TelosysTools/downloads +./TelosysTools/templates +!./TelosysTools/templates/infinimotion \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..cc3da93 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/model.iml b/.idea/model.iml index cebd128..e0f12d2 100644 --- a/.idea/model.iml +++ b/.idea/model.iml @@ -16,6 +16,7 @@ + diff --git a/TelosysTools/templates/infinimotion/angular/.npmrc.vm b/TelosysTools/templates/infinimotion/angular/.npmrc.vm new file mode 100644 index 0000000..ae6098b --- /dev/null +++ b/TelosysTools/templates/infinimotion/angular/.npmrc.vm @@ -0,0 +1 @@ +@InfiniMotion:registry=https://npm.pkg.github.com \ No newline at end of file diff --git a/TelosysTools/templates/infinimotion/angular/Xmodel_ts.vm b/TelosysTools/templates/infinimotion/angular/Xmodel_ts.vm new file mode 100644 index 0000000..8c28f2d --- /dev/null +++ b/TelosysTools/templates/infinimotion/angular/Xmodel_ts.vm @@ -0,0 +1,6 @@ +#set( $env.language = 'TypeScript' ) +export default interface $entity.name { +#foreach( $attribute in $entity.attributes ) + ${attribute.name}: ${attribute.type}; +#end +} \ No newline at end of file diff --git a/TelosysTools/templates/infinimotion/angular/index_ts.vm b/TelosysTools/templates/infinimotion/angular/index_ts.vm new file mode 100644 index 0000000..a87168f --- /dev/null +++ b/TelosysTools/templates/infinimotion/angular/index_ts.vm @@ -0,0 +1,9 @@ +#foreach( $entity in $model.allEntities ) +import $entity.name from "./${entity.name}"; +#end + +export type { +#foreach( $entity in $model.allEntities ) + $entity.name, +#end +} \ No newline at end of file diff --git a/TelosysTools/templates/infinimotion/angular/package_json.vm b/TelosysTools/templates/infinimotion/angular/package_json.vm new file mode 100644 index 0000000..445aa50 --- /dev/null +++ b/TelosysTools/templates/infinimotion/angular/package_json.vm @@ -0,0 +1,27 @@ +{ + "name": "@InfiniMotion/model-frontend", + "version": "0.0.0", + "description": "InfiniMotion Model for Frontend", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsup", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Lennart Heinrich", + "license": "ISC", + "devDependencies": { + "@types/node": "^24.8.0", + "ts-node": "^10.9.2", + "tsup": "^8.5.0", + "typescript": "^5.9.3" + }, + "repository": "https://github.com/InfiniMotion/model.git", + "publishConfig": { + "registry": "https://npm.pkg.github.com" + } +} diff --git a/TelosysTools/templates/infinimotion/angular/tsconfig_json.vm b/TelosysTools/templates/infinimotion/angular/tsconfig_json.vm new file mode 100644 index 0000000..3de4731 --- /dev/null +++ b/TelosysTools/templates/infinimotion/angular/tsconfig_json.vm @@ -0,0 +1,44 @@ +{ + // Visit https://aka.ms/tsconfig to read more about this file + "compilerOptions": { + // File Layout + // "rootDir": "./src", + "outDir": "./dist", + + // Environment Settings + // See also https://aka.ms/tsconfig/module + "module": "nodenext", + "target": "esnext", + "types": ["node"], + // For nodejs: + // "lib": ["esnext"], + // "types": ["node"], + // and npm install -D @types/node + + // Other Outputs + "sourceMap": true, + "declaration": true, + "declarationMap": true, + + // Stricter Typechecking Options + "noUncheckedIndexedAccess": true, + "exactOptionalPropertyTypes": true, + + // Style Options + // "noImplicitReturns": true, + // "noImplicitOverride": true, + // "noUnusedLocals": true, + // "noUnusedParameters": true, + // "noFallthroughCasesInSwitch": true, + // "noPropertyAccessFromIndexSignature": true, + + // Recommended Options + "strict": true, + "jsx": "react-jsx", + "verbatimModuleSyntax": false, + "isolatedModules": true, + "noUncheckedSideEffectImports": true, + "moduleDetection": "force", + "skipLibCheck": true, + } +} diff --git a/TelosysTools/templates/infinimotion/angular/tsup.config_ts.vm b/TelosysTools/templates/infinimotion/angular/tsup.config_ts.vm new file mode 100644 index 0000000..dca4f13 --- /dev/null +++ b/TelosysTools/templates/infinimotion/angular/tsup.config_ts.vm @@ -0,0 +1,10 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + entry: ["index.ts"], + format: ["cjs", "esm"], // Build for commonJS and ESmodules + dts: true, // Generate declaration file (.d.ts) + splitting: false, + sourcemap: true, + clean: true, +}); \ No newline at end of file diff --git a/TelosysTools/templates/infinimotion/templates.cfg b/TelosysTools/templates/infinimotion/templates.cfg index 91a3d83..34e122f 100644 --- a/TelosysTools/templates/infinimotion/templates.cfg +++ b/TelosysTools/templates/infinimotion/templates.cfg @@ -31,4 +31,12 @@ Tests : generic class ; JpaTest.java ; ${TEST_SRC}/${ROOT_PKG}/enti Tests : database init ; DatabaseInit.java ; ${TEST_SRC}/${ROOT_PKG}/entities/tooling ; test-java/DatabaseInit_java.vm ; 1 Tests : entity tests ; ${BEANNAME}JpaTest.java ; ${TEST_SRC}/${ROOT_PKG}/entities ; test-java/XxxJpaTest_java.vm ; * #--- src/test/resources -Tests : persistence.xml ; persistence.xml ; ${TEST_RES}/META-INF ; test-resources/persistence_xml.vm ; 1 \ No newline at end of file +Tests : persistence.xml ; persistence.xml ; ${TEST_RES}/META-INF ; test-resources/persistence_xml.vm ; 1 + +# Angular +.npmrc ; .npmrc ; angular ; angular/.npmrc.vm ; 1 +package.json ; package.json ; angular ; angular/package_json.vm ; 1 +tsconfig.json ; tsconfig.json ; angular ; angular/tsconfig_json.vm ; 1 +tsup.config.ts ; tsup.config.ts ; angular ; angular/tsup.config_ts.vm ; 1 +index.ts ; index.ts ; angular ; angular/index_ts.vm ; 1 +TypeScript Models ; ${BEANNAME}.ts ; angular ; angular/Xmodel_ts.vm \ No newline at end of file