hello_freedom

0.0.2 • Public • Published

发布包 npm_demo

1.编写模块 exports.sayHello = function(){ return 'Hello World.'; }

保存为hello_freedom.js

2.初始化包描述文件 $ npm init package.json

{ "name": "hello_freedom", "version": "0.0.1", "description": "A hello world package", "main": "./hello.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "keywords": [ "Hello", "World" ], "author": "freedom93", "license": "MIT" }

3.注册报仓库账号

验证你在 npmjs.org 上的账号(freedom93,1563607296@qq.com)

$ npm adduser

4.上传包 $ npm publish .

5.安装包 $ npm install hello_freedom

6.管理包权限

查看模块拥有者 $ npm owner ls <package_name> $ npm owner ls hello_freedom

添加一个发布者 $ npm owner add <package_name> $ npm owner add freedom hello_freedom

删除一个发布者 $ npm owner rm <package_name> $ npm owner rmfreedom hello_freedom

7.分析包

查看当前项目引入了哪些包 npm ls

8 使用引入的包 var hello = require('hello_freedom'); hello.sayHello()

Readme

Keywords

Package Sidebar

Install

npm i hello_freedom

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • freedom93