【问题标题】:How to comment in package-scripts.js to show up in package.json?如何在 package-scripts.js 中注释以显示在 package.json 中?
【发布时间】:2020-12-17 11:35:27
【问题描述】:

目标

我想在我的package.json 中显示来自package-scripts.js 的nps 命令的cmets,如下所示:

试过

我实际上不知道这个覆盖的内容(“通过'npm test'命令运行”)来自哪里(vscode、npm、nps?)。我查找了他们所有的 GitHub 存储库,但没有成功。

我尝试通过以下方式添加 cmets,但没有结果:

// package-scripts.js  
module.exports = {
  scripts: {
    /** Build image */
    build: "docker build"
  }
}
// package.json
{
  scripts: {
    "build": "nps build"
  }
}

有可能吗?显示的评论是如何做出的?

【问题讨论】:

标签: npm package.json jsdoc npm-scripts


【解决方案1】:

这似乎适用于:

  • 您的 vscode 设置中的 json 架构或
  • 在 vscode 中切换到 jsonc 模式

两者都记录在这里:https://code.visualstudio.com/docs/languages/json

我建议扩展 package.json 架构 https://json.schemastore.org/package 以满足您的需求,但我没有任何在 vscode 中将 cmets 显示为工具提示的经验。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-11
    • 1970-01-01
    • 2021-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多