LCOV - code coverage report
Current view: top level - /lua/yoda/commands/dev_setup - javascript.lua (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 11 11
Test Date: 2026-04-14 10:33:13 Functions: - 0 0

            Line data    Source code
       1              : -- lua/yoda/commands/dev_setup/javascript.lua
       2              : -- JavaScript/TypeScript development environment setup commands
       3              : 
       4            1 : local M = {}
       5              : 
       6            1 : local notify = require("yoda-adapters.notification")
       7              : 
       8            1 : function M.setup()
       9              :   -- JavaScript/TypeScript development setup
      10           22 :   vim.api.nvim_create_user_command("YodaJavaScriptSetup", function()
      11              :     local logger = require("yoda-logging.logger")
      12              :     logger.set_strategy("console")
      13              :     logger.set_level("info")
      14              : 
      15              :     logger.info("🟨 Setting up JavaScript/TypeScript development environment...")
      16              : 
      17              :     -- Check if Mason is available
      18              :     local mason_ok, mason = pcall(require, "mason")
      19              :     if not mason_ok then
      20              :       notify.notify("❌ Mason not available. Install via :Lazy sync first", "error")
      21              :       return
      22              :     end
      23              : 
      24              :     -- Install JavaScript tools via Mason
      25              :     logger.info("Installing typescript-language-server via Mason...")
      26              :     vim.cmd("MasonInstall typescript-language-server")
      27              : 
      28              :     logger.info("Installing js-debug-adapter (Node.js debugger) via Mason...")
      29              :     vim.cmd("MasonInstall js-debug-adapter")
      30              : 
      31              :     logger.info("Installing biome (linter/formatter) via Mason...")
      32              :     vim.cmd("MasonInstall biome")
      33              : 
      34              :     -- Notify user
      35              :     notify.notify(
      36              :       "🟨 JavaScript tools installation started!\n"
      37              :         .. "Installing: typescript-language-server, js-debug-adapter, biome\n"
      38              :         .. "Check :Mason for progress.\n"
      39              :         .. "Restart Neovim after installation completes.",
      40              :       "info",
      41              :       { title = "Yoda JavaScript Setup" }
      42              :     )
      43              : 
      44              :     logger.info("✅ JavaScript setup initiated. Restart Neovim after Mason installation completes.")
      45           11 :   end, { desc = "Install JavaScript development tools (ts_ls, js-debug-adapter, biome) via Mason" })
      46              : 
      47              :   -- Node.js version detection
      48           22 :   vim.api.nvim_create_user_command("YodaNodeVersion", function()
      49              :     local handle = io.popen("node --version 2>&1")
      50              :     if handle then
      51              :       local result = handle:read("*a")
      52              :       handle:close()
      53              :       notify.notify("Node.js version: " .. result, "info", { title = "Node Version" })
      54              :     else
      55              :       notify.notify("❌ Node.js not found", "error")
      56              :     end
      57           11 :   end, { desc = "Show Node.js version" })
      58              : 
      59              :   -- NPM outdated packages
      60           22 :   vim.api.nvim_create_user_command("YodaNpmOutdated", function()
      61              :     vim.cmd("!npm outdated")
      62           11 :   end, { desc = "Check outdated npm packages" })
      63           12 : end
      64              : 
      65            1 : return M
        

Generated by: LCOV version 2.0-1