facebook

Importing / develping non-Angular TypeScript/Node-projects

  1. CodeMix & Angular IDE
  2.  > 
  3. Getting Help
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #659966 Reply

    divstar
    Participant

    Hello there,

    again – thank you for the support so far. I am really working on Angular-frontends using only CodeMix and some Terminal commands (for remote docker). It’s working out great so far.

    I’d like to know if it is possible to import a non-Angular TypeScript-/Node-project into an Eclipse-workspace. Is it possible? How would I go about it?

    I assume I’d use “Node.js Application” and “Node.js :: CodeMix” Run-Configurations for running Node.js applications, but how would I go about it? I’d really like it if I could keep working in Eclipse and apparently TypeScript-editors seem to work just fine thanks to CodeMix. So it should be possible – or is it not?

    Edit:
    Here’s an example project of what I mean (perhaps for easier testing purposes): https://github.com/innoq/typescript-base-app .

    • This topic was modified 4 years, 6 months ago by divstar.
    #659975 Reply

    support-swapna
    Moderator

    divstar,

    For importing non Angular projects, you can use the File > Open Projects from File System wizard and point to the downloaded and extracted project folder. You can also import the project from the Git Repositories view using the Git url for the project.
    Once done, double click on the project and you can run npm install for the project from the Terminal+ view to install the required dependencies.

    For Node.js applications, you can either run it via npm run serve from the Terminal+ view or right click on the JS file and select Run As > Node:CodeMix Launch

    Hope this helps. Please let us know if you have any further questions.

    –Swapna
    Genuitec Support

    #660052 Reply

    divstar
    Participant

    Hello Swapna,

    thank you for your response.

    Running this project from command line worked well.

    What I cannot exactly wrap my head around is: white running nodemon -x ts-node src/main.ts worked in terms of executing the application (this could’ve run in a Git-Bash, too), I’d like to run nodemon --watch src -x ts-node src/main.ts (with --watch) in order to be able to debug my application. Unfortunately I haven’t yet found a way to do so.

    Whenever I launch e.g. Node :: Codemix Launch (or similar), I get e.g. a launch.json. I believe this is from VSCode, but I have no idea how to actually run a launch-configuration such as this one, because when I run it from the menu – nothing seems to happen.

    Do you happen to have a pointer?

    Best regards,
    Igor.

    #660055 Reply

    support-swapna
    Moderator

    Igor,

    In the launch.json, you will see an icon in the ruler area, clicking it will initiate the debug session.
    Please see this doc for detailed steps on how to configure the launch.json and debug the app : https://www.genuitec.com/docs/debugger/debugging-in-codemix

    To start watching a project, you can select the project and go to menu Project > Start Watching with CodeMix.
    Please refer to the ‘Watching Your Project’ section for more details : https://www.genuitec.com/docs/assembly/build-pipelines/

    Hope this helps.

    –Swapna
    Genuitec Support

    #660157 Reply

    divstar
    Participant

    Yesterday someone from Genuitec helped me (using Live Chat) and together we managed to start and debug my non-Angular node.js application (in TypeScript).

    Today – using that knowledge and some more research on the subject (mostly VSCode-related posts on SO) – I managed to find a way to “attach” to a process instead of having to start it.

    My launch.json looks like this:

    
    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "type": "node",
                "request": "launch",
                "name": "Launch Program",
                "program": "${workspaceFolder}/src/main.ts",
                "preLaunchTask": "tsc: build - tsconfig.json",
                "cwd": "${workspaceFolder}/src",
                "outFiles": [
                    "${workspaceFolder}/**/*.js"
                ],
                "runtimeExecutable": "C:\\workspaces\\.codemix-store\\nodejs\\14.1.0\\node.exe"
            },
            {
                "name": "Attach to program",
                "type": "node",
                "request": "attach",
                "restart": true,
                "port": 5858,
                "sourceMaps": true,
                "outFiles": []
            }
        ]
    }
    

    The first configuration ensures the application is started right away into debugging mode. This may be useful if you do not want to start it using a command-line (such as Terminal+).

    The second configuration attaches to a correspondingly running application and allows debugging. I was focused on being able to reload / restart automatically when code changes, so I used --inspect and `ts-node/register”.

    My debug script in the package.json looks like this:

    
    ...
    "scripts": {
        ...
        "debug": "nodemon --inspect=5858 -e ts,json --exec node -r ts-node/register src/main.ts",
        ...
      },
    

    As you can see the exposed port is the same as used by the launch.json above.

    Now when I run npm run debug from the Terminal+, I can attach a debugger using the “Attach to program”-Run-Configuration and even if the application is restarted upon code change, the debugger stays attached. This way I also do not have to pick a processId each time.

    I hope this helps someone at some point when they use CodeMix, because essentially CodeMix seems to be some sort of VSCode.

    Thanks for support, Swapna and Oscar (I believe this was the guy, who helped me find out how to get debugging working yesterday)!

    • This reply was modified 4 years, 6 months ago by divstar. Reason: Code tags are a bit weird
    #660177 Reply

    support-swapna
    Moderator

    Igor,

    Glad that you got the debugging working with the help of Oscar via the live chat session.
    Thank you for posting the config steps along with the code. It will surely help other users. CodeMix brings core tech from VSCode and adds new UI and flows to make it easier. If you have experience developing with VSCode,then you will find these features familiar; however, you will access them differently in CodeMix.

    Please reach us here or via Live Chat for a quick resolution if you see any other issues with CodeMix.

    –Swapna
    Genuitec Support

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Importing / develping non-Angular TypeScript/Node-projects

You must be logged in to post in the forum log in