improve readme
This commit is contained in:
parent
814542e9cd
commit
20283c6cda
11
README.md
11
README.md
@ -22,6 +22,17 @@ Then use it in package.json's script section to trigger a build:
|
|||||||
by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to
|
by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to
|
||||||
`./index.js` and `./test.js`
|
`./index.js` and `./test.js`
|
||||||
|
|
||||||
|
npmts also creates a index.d.ts declaration file.
|
||||||
|
You can reference it in your package.json like this:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"main": "index.js",
|
||||||
|
"typings": "./index.d.ts",
|
||||||
|
```
|
||||||
|
|
||||||
|
When requiring the module from other TypeScript files,
|
||||||
|
the TypeScript Compiler will use the declaration file to resolve typings.
|
||||||
|
|
||||||
#### Declaration files
|
#### Declaration files
|
||||||
|
|
||||||
### Custom behaviour
|
### Custom behaviour
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"description": "write npm modules with TypeScript",
|
"description": "write npm modules with TypeScript",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"typings": "./index.d.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"npmts": "index.js"
|
"npmts": "./index.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(cd compile && node compile.js)",
|
"test": "(cd compile && node compile.js)",
|
||||||
|
0
test/index.d.ts
vendored
Normal file
0
test/index.d.ts
vendored
Normal file
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
console.log("test");
|
console.log("test");
|
||||||
}());
|
}());
|
||||||
|
Loading…
Reference in New Issue
Block a user