ywc-npm-utils 1.0.0 → 1.0.1

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/dist/index.cjs ADDED
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ function sayHello(name) {
4
+ return `hello ${name}`
5
+ }
6
+ function formatDate(date) {
7
+ const d = new Date(date);
8
+ return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`
9
+ }
10
+
11
+ exports.formatDate = formatDate;
12
+ exports.sayHello = sayHello;
package/dist/index.mjs ADDED
@@ -0,0 +1,9 @@
1
+ function sayHello(name) {
2
+ return `hello ${name}`
3
+ }
4
+ function formatDate(date) {
5
+ const d = new Date(date);
6
+ return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`
7
+ }
8
+
9
+ export { formatDate, sayHello };
package/package.json CHANGED
@@ -1,11 +1,30 @@
1
1
  {
2
2
  "name": "ywc-npm-utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "前端通用工具函数集合",
5
- "main": "index.js",
6
- "scripts": {},
7
- "keywords": ["utils", "前端工具", "js工具函数"],
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.mjs",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.cjs"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "rollup -c"
16
+ },
17
+ "keywords": [
18
+ "utils",
19
+ "前端工具",
20
+ "js工具函数"
21
+ ],
8
22
  "author": "yuanwenchao",
9
23
  "license": "MIT",
10
- "files": ["index.js"]
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "devDependencies": {
28
+ "rollup": "^4.63.1"
29
+ }
11
30
  }
package/index.js DELETED
@@ -1,5 +0,0 @@
1
- // index.js
2
- export function sayHello(name){
3
- return `Hello ${name}`
4
- }
5
- module.exports = {sayHello}