Closed TheRittler closed 3 years ago
is there a way of running the generated code in node.js?
Yes. CrossEcore's TypeScript runtime is 100% pure TypeScript and has zero dependencies on other npm packages. There is only one slight restriction I can think of at the moment. When you are loading XMI models via XmiResource, you have to pass a DomParser in the constructor. I can barely remember, but I think you can use dom-parser for that in a node environment. You also might have to adjust the generated tsconfig.json.
In the end, the code will be used in a web app. (Written in Kotlin, transpiled to JS)
I do not fully understand what you are going to do: Why are you asking whether "the code runs in node.js" when "the code will be used in a web app"? What is your target platform? node.js or (browser/mobile webview/Cordova/Ionic)?
Written in Kotlin, transpiled to JS
As far as I know, you can use Java libraries from Kotlin. I wonder if you can include the original EMF Java API in your Kotlin code and transpile the whole thing to JS (without CrossEcore in the loop). Have you considered this?
I found out that CrossEcore TypeScirpt release 0.1.1. uses AMD modules that are not supported by nodejs. I think in the next release I might change that to UMD modules so that the code will run in nodejs and web browsers.
I do not fully understand what you are going to do: Why are you asking whether "the code runs in node.js" when "the code will be used in a web app"? What is your target platform? node.js or (browser/mobile webview/Cordova/Ionic)?
The target platform is web, I was just thinking that the code is currently also usable from node, so I tried some stuff in node. Releasing crossecore as UMD might be helpful!
I think I will use ES5 modules instead of UMD modules. ES6 modules are standardized and are supported by modern web browsers and node.js
When will it be released?
I have created a new branch es6-modules. Until it is released you can check out this branch and then run the following commands:
cd ecore-typescript
npm install
npm run build
npm link
cd your-app
npm link crossecore
Hi together,
is there a way of running the generated code in node.js? I am especially interested in transpiling the code to JS (e.g. with tsc) and then use it. In the end, the code will be used in a web app. (Written in Kotlin, transpiled to JS)