yuangs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/index.js +25 -0
- package/package.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# yuangs
|
|
2
|
+
|
|
3
|
+
这是我的第一个 npm 包,用于演示标准的发布流程。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install yuangs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const myPkg = require("yuangs");
|
|
15
|
+
|
|
16
|
+
// 1. 打印欢迎语
|
|
17
|
+
myPkg.sayHello("YGS");
|
|
18
|
+
// 输出: Hello, YGS! 恭喜你成功使用了 yuangs
|
|
19
|
+
|
|
20
|
+
// 2. 做加法
|
|
21
|
+
const result = myPkg.add(1, 2);
|
|
22
|
+
console.log(result); // 3
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 维护者
|
|
26
|
+
|
|
27
|
+
- yuanguangshan
|
package/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 打印一条欢迎信息
|
|
3
|
+
* @param {string} name - 用户名
|
|
4
|
+
* @returns {string} 欢迎语
|
|
5
|
+
*/
|
|
6
|
+
function sayHello(name = "World") {
|
|
7
|
+
const message = `Hello, ${name}! 恭喜你成功使用了 yuangs`;
|
|
8
|
+
console.log(message);
|
|
9
|
+
return message;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 一个简单的加法函数
|
|
14
|
+
* @param {number} a
|
|
15
|
+
* @param {number} b
|
|
16
|
+
* @returns {number}
|
|
17
|
+
*/
|
|
18
|
+
function add(a, b) {
|
|
19
|
+
return a + b;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
sayHello,
|
|
24
|
+
add,
|
|
25
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "yuangs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "我的第一个标准 npm 包,用于演示发布流程",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"demo",
|
|
11
|
+
"first-package",
|
|
12
|
+
"learning"
|
|
13
|
+
],
|
|
14
|
+
"author": "yuanguangshan",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
}
|
|
19
|
+
}
|