Node.js 作为tarball发布的Oclif cli:如何在不必写入;npm链接;?

Node.js 作为tarball发布的Oclif cli:如何在不必写入;npm链接;?,node.js,shell,npm,npm-link,oclif,Node.js,Shell,Npm,Npm Link,Oclif,我正在尝试将使用oclif构建的cli作为tarball发布。在本地环境中,我需要编写npm-link来将代码与命令链接起来。但在prod中,我不希望用户在下载zip后打开终端并编写npm链接 似乎npm不能运行预安装脚本,除非调用“npm安装”。编写shell脚本听起来是一个很好的解决方案,但同样,用户必须手动执行该脚本。 我想知道是否真的没有办法让这个“npm链接”在用户下载zip后自动执行。我肯定奥克利夫有办法,但我在医生里找不到 谢谢你的帮助。 下面是该项目的package.json {

我正在尝试将使用oclif构建的cli作为tarball发布。在本地环境中,我需要编写npm-link来将代码与命令链接起来。但在prod中,我不希望用户在下载zip后打开终端并编写npm链接

似乎npm不能运行预安装脚本,除非调用“npm安装”。编写shell脚本听起来是一个很好的解决方案,但同样,用户必须手动执行该脚本。 我想知道是否真的没有办法让这个“npm链接”在用户下载zip后自动执行。我肯定奥克利夫有办法,但我在医生里找不到

谢谢你的帮助。 下面是该项目的package.json

{
  "name": "galaxycli",
  "version": "0.11.0",
  "description": "An open source CLI for darillium users, built with the OCLIF framework",
  "bin": {
    "galaxy": "./bin/run"
  },
  "oclif.macos.identifier": "com.heroku.cli",
  "dependencies": {
    "@oclif/command": "^1.5.18",
    "@oclif/config": "^1.13.3",
    "@oclif/plugin-autocomplete": "^0.1.3",
    "@oclif/plugin-help": "^2.2.1",
    "@oclif/plugin-not-found": "^1.2.3",
    "@types/inquirer": "^6.5.0",
    "@types/node-notifier": "^5.4.0",
    "axios": "^0.19.0",
    "chalk": "^2.4.2",
    "cli-ux": "^5.3.1",
    "inquirer": "^6.5.1",
    "node-notifier": "^5.4.3",
    "node-persist": "^3.0.5",
    "tslib": "^1.10.0"
  },
  "devDependencies": {
    "@oclif/dev-cli": "^1.22.2",
    "@types/node": "^10.14.16",
    "globby": "^10.0.1",
    "rimraf": "^3.0.0",
    "ts-node": "^8.3.0",
    "typescript": "^3.5.3",
    "aws-sdk": "^2.304.0"
  },
  "engines": {
    "node": ">=8.0.0"
  },
  "files": [
    "/bin",
    "/lib",
    "/npm-shrinkwrap.json",
    "/oclif.manifest.json"
  ],
  "homepage": "https://github.com/Darillium/kitlings",
  "keywords": [
    "oclif"
  ],
  "license": "MIT",
  "main": "lib/index.js",
  "oclif": {
    "commands": "./lib/commands",
    "bin": "galaxy",
    "plugins": [
      "@oclif/plugin-help",
      "@oclif/plugin-not-found",
      "@oclif/plugin-autocomplete"
    ],
    "s3": {
      "bucket": "oclif-staging",
      "templates": {
        "target": {
          "unversioned": "tarballs/<%- bin %>/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-<%- platform %>-<%- arch %><%- ext %>",
          "versioned": "tarballs/<%- bin %>/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %><%- ext %>",
          "manifest": "tarballs/<%- bin %>/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- platform %>-<%- arch %>"
        },
        "vanilla": {
          "unversioned": "tarballs/<%- bin %>/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %><%- ext %>",
          "versioned": "tarballs/<%- bin %>/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %><%- ext %>",
          "manifest": "tarballs/<%- bin %>/<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %>version"
        }
      }
    },
    "node": {
      "version": "10.4.0",
      "targets": [
        "linux-x64",
        "win32-x64"
      ]
    }
  },
  "repository": "https://github.com/Darillium/kitlings",
  "scripts": {
    "postpack": "rimraf oclif.manifest.json",
    "prepack": "rimraf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
    "test": "echo NO TESTS",
    "version": "oclif-dev readme && git add README.md",
    "postinstall": "npm link"
  },
  "types": "lib/index.d.ts"
}


{
“名称”:“galaxycli”,
“版本”:“0.11.0”,
“描述”:“一个面向darillium用户的开源CLI,使用OCLIF框架构建”,
“bin”:{
“银河”:“/bin/run”
},
“oclif.macos.identifier”:“com.heroku.cli”,
“依赖项”:{
“@oclif/command”:“^1.5.18”,
“@oclif/config”:“^1.13.3”,
“@oclif/plugin autocomplete”:“^0.1.3”,
“@oclif/插件帮助”:“^2.2.1”,
“@oclif/未找到插件”:“^1.2.3”,
“@types/inquirer”:“^6.5.0”,
“@types/node通知程序”:“^5.4.0”,
“axios”:“^0.19.0”,
“粉笔”:“^2.4.2”,
“cli ux”:“^5.3.1”,
“查询者”:“^6.5.1”,
“节点通知程序”:“^5.4.3”,
“节点持久化”:“^3.0.5”,
“tslib”:“^1.10.0”
},
“依赖性”:{
“@oclif/dev cli”:“^1.22.2”,
“@types/node”:“^10.14.16”,
“globby”:“^10.0.1”,
“rimraf”:“^3.0.0”,
“ts节点”:“^8.3.0”,
“类型脚本”:“^3.5.3”,
“aws sdk”:“^2.304.0”
},
“发动机”:{
“节点”:“>=8.0.0”
},
“文件”:[
“/bin”,
“/lib”,
“/npm shrinkwrap.json”,
“/oclif.manifest.json”
],
“主页”:https://github.com/Darillium/kitlings",
“关键词”:[
“oclif”
],
“许可证”:“麻省理工学院”,
“main”:“lib/index.js”,
“oclif”:{
“命令”:“/lib/commands”,
“bin”:“galaxy”,
“插件”:[
“@oclif/插件帮助”,
“@oclif/未找到插件”,
“@oclif/插件自动完成”
],
“s3”:{
“bucket”:“oclif staging”,
“模板”:{
“目标”:{
“未版本”:“tarballs/-”,
“版本化”:“tarballs/-v/-v--”,
“舱单”:“tarballs/-”
},
“香草”:{
“未版本”:“tarballs/”,
“版本化”:“tarballs/-v/-v”,
“清单”:“tarballs//version”
}
}
},
“节点”:{
“版本”:“10.4.0”,
“目标”:[
“linux-x64”,
“win32-x64”
]
}
},
“存储库”:https://github.com/Darillium/kitlings",
“脚本”:{
“postpack”:“rimraf oclif.manifest.json”,
“预包装”:“rimraf lib和tsc-b和oclif开发清单和oclif开发自述文件”,
“测试”:“无回声测试”,
“版本”:“oclif-dev-readme&&git-add-readme.md”,
“安装后”:“npm链接”
},
“类型”:“lib/index.d.ts”
}