Nodejs in xycode

Posted by ExiaHuang on December 19, 2019

Agenda

Use xycode and nodejs.

config

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
    "tasks": [
        {
            "label": "node:run",
            "description": "run node file",
            "cwd": "${fileDirname}",
            "command": "node \"${file}\""
        },
        {
            "label": "node:version",
            "description": "print node version",
            "command": "node -v"
        }
    ],
    "variables": {},
    "onSaveEvents": [
        {
            "label": "run js file",
            "description": "run javascript",
            "filetypes": [".js"],
            "inActive": false,
            "cwd": "${fileDirname}",
            "command": "node \"${file}\""
        }
    ]
}

write hello world

1
console.log('hello world, nodejs');

After save the file, you can see the result.