后羿 преди 1 година
родител
ревизия
7d1e751e15
променени са 9 файла, в които са добавени 33 реда и са изтрити 9 реда
  1. 0 1
      .gitignore
  2. 1 0
      lib/index.js
  3. 8 0
      lib/test.js
  4. 3 2
      package.json
  5. 1 3
      src/index.ts
  6. 9 0
      src/test.ts
  7. 9 3
      tsconfig.json
  8. 1 0
      types/index.d.ts
  9. 1 0
      types/test.d.ts

+ 0 - 1
.gitignore

@@ -1,2 +1 @@
 /node_modules
-/lib

+ 1 - 0
lib/index.js

@@ -0,0 +1 @@
+export * from "./test";

+ 8 - 0
lib/test.js

@@ -0,0 +1,8 @@
+export function log(s) {
+    return new Promise((resolve) => {
+        setTimeout(() => {
+            console.log(s);
+            resolve(true);
+        }, 1000);
+    });
+}

+ 3 - 2
package.json

@@ -2,10 +2,11 @@
   "name": "ludash",
   "version": "1.0.0",
   "description": "toolkit",
-  "main": "index.js",
+  "main": "lib/index.js",
+  "typings": "type/index.d.ts",
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
-    "lib": "tsc ./src/index.ts"
+    "lib": "tsc"
   },
   "repository": "https://gitee.com/swust_0602/ludash.git",
   "author": "shawn",

+ 1 - 3
src/index.ts

@@ -1,3 +1 @@
-export function log(s: string) {
-  console.log(s);
-}
+export * from "./test"

+ 9 - 0
src/test.ts

@@ -0,0 +1,9 @@
+export function log(s: string) {
+    return new Promise<true>((resolve) => {
+      setTimeout(() => {
+        console.log(s)
+        resolve(true)
+      }, 1000)
+    })
+  }
+  

+ 9 - 3
tsconfig.json

@@ -1,9 +1,15 @@
 {
   "compilerOptions": {
-    "outDir": "./lib",
+    "outDir": "lib",
     "target": "ES2015",
+    "removeComments": true,
     "module": "ES2015",
     "declaration": true,
-    "declarationDir": "./types"
-  }
+    "declarationDir": "types",
+    "esModuleInterop": true,   
+    "skipLibCheck": true,                     
+    "forceConsistentCasingInFileNames": true,
+  },
+  "include": ["./src/**/*.ts"],
+  "exclude": ["node_modules"]
 }

+ 1 - 0
types/index.d.ts

@@ -0,0 +1 @@
+export * from "./test";

+ 1 - 0
types/test.d.ts

@@ -0,0 +1 @@
+export declare function log(s: string): Promise<true>;