操作步骤:
1.创建https://www.npmjs.org账号
2.点击npmjs网站个人账号菜单下的add organization按钮, 创建组织(存放镜像用)
3.在终端项目目录下设置组织范围
# npm init --scope=@my-org 对于组织范围的程序包,请替换my-org为您的组织名称
# npm init --scope=@my-username 对于用户范围的软件包,请my-username用您的用户名替换:
4.在项目根目录创建LICENCSE文件,并修改license值为MIT。
5.发布。发布之前需要登录账号
# npm login
# npm publish --access public
注意:
package.json
{
"name": "@orgName/包名", //组织名称或个人用户名称,后面为包名
"version": "0.0.1",
"description": "ccc",
"main": "dist/index.js",
"keywords": [
...
],
"files": [
"dist"
],
"scripts": {
"build": "webpack --mode=production",
"build:publish": "webpack --mode=production && npm publish",
"dev": "webpack --watch --progress --mode=development"
},
"author": "xmplus-xrl",
"license": "MIT",
"devDependencies": {
...
},
"::repository::": { //发布成功后自动生成
"type": "git",
"url": "http://gitlab.surveyplus.cn/surveylite/survey-core-next.git"
}
}
LICENSE文件内容(userName为发布者的npmjs.org账号):
MIT License
Copyright (c) 2023 userName
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
参考文档:
https://blog.csdn.net/zhangjing1019/article/details/102896421
https://www.jianshu.com/p/d695b8be52d4
https://blog.csdn.net/example440982/article/details/122100666
https://blog.csdn.net/qq_38427709/article/details/126585711
https://blog.csdn.net/hanchengmei/article/details/119104345
https://blog.csdn.net/qq_42611074/article/details/118303050
https://choosealicense.com/licenses/mit/
标签:npm,--,blog,details,https,org,npmjs From: https://www.cnblogs.com/liuxu-xrl/p/17409808.html