Skip to content

Nodejs build automation utility

Zeioth edited this page Nov 18, 2023 · 9 revisions

When compiler.nvim detects a package.json file in the current working directory, Telescope will be populated with all its script entries.

Hello world

Create a package.json file in your working directory and copy/paste this:

{
  "name": "hello-world-app",
  "version": "1.0.0",
  "scripts": {
    "start": "node index.js"
  }
}

Now let's create the file we are building on the example above: Create index.js in the same directory.

console.log("Hello, World!");

When you open the compiler you will see the option to run it screenshot_2023-11-18_04-03-36_077009168

And this is the result screenshot_2023-11-18_04-03-26_249266649

In the same way you can run hello world, you can execute any command necessary to build your program.

More info

(optionally) You can define the next globals

global defaut value accepted values
NODEJS_PACKAGE_MANAGER npm npm, yarn

Example:

let g:NODEJS_PACKAGE_MANAGER='yarn'

Globals persist between Neovim sessions.