JavaScript
主页 > 网络编程 > JavaScript >

npm发包实践使用gRPC教程

2022-08-11 | 秩名 | 点击:

1、目的

2、步骤

1、敲这个 命令  输入 npm 上注册的 username password 还有邮箱

npm adduser --registry https://registry.npmjs.org/

2、敲这个 

npm publish --registry https://registry.npmjs.org/

3、结果

这个包的地址

www.npmjs.com/package/grp…

4、package.json 参考

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

27

28

29

30

31

32

{

  "name": "grpc-node-demo",

  "version": "1.2.0",

  "main": "index.js",

  "scripts": {

    "test": "echo \"Error: no test specified\" && exit 1",

    "start": "node server.js",

    "client": "node client.js"

  },

  "keywords": [

    "grpc",

    "node",

    "demo"

  ],

  "author": {

    "name": "Mark_Fu",

    "weChat": "getXiLan",

    "url": "https://juejin.cn/user/1741228277763278"

  },

  "license": "ISC",

  "dependencies": {

    "@grpc/proto-loader": "^0.7.0",

    "grpc": "^1.24.11"

  },

  "devDependencies": {},

  "description": "To help you quickly create a new Node-GrPC server and understand GRPC quickly, this is a best practice for understanding GRPC",

  "repository": {

    "type": "git",

    "url": "https://github.com/huanhunmao/grpc-node-demo"

  },

  "homepage": "https://github.com/huanhunmao"

}

ps:

为啥命令 后面需要带 --registry registry.npmjs.org/ 因为 我这边 设置了全局淘宝源(公司 npm 在淘宝源,这样处理最简单,发布公司的 npm 包 直接 npm publish 即可)

原文链接:https://juejin.cn/post/7130161124325998599
相关文章
最新更新