Skip to content

Commit

Permalink
chore: config api-extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwong committed Dec 26, 2019
1 parent 9bbe5b1 commit 4e4b3df
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 329 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ dist
.tern-port

lib
temp
17 changes: 17 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./lib/index.d.ts",
"bundledPackages": [ ],
// 生成 api 报告,生成的还没 .d.ts 看的舒服,关了
"apiReport": {
"enabled": false,
"reportFolder": "./lib/"
},
"docModel": {
"enabled": true
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "./lib/index.d.ts"
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
"homepage": "https://github.com/simonwong/fly-helper#readme",
"scripts": {
"test": "jest --coverage --verbose -u",
"api": "api-extractor run",
"lint": "eslint --ext .js,.ts ./src",
"lint:fix": "eslint --fix --ext .js,.ts ./src"
},
"devDependencies": {
"@babel/preset-env": "^7.7.7",
"@microsoft/api-extractor": "^7.7.0",
"@types/jest": "^24.0.24",
"@typescript-eslint/eslint-plugin": "^2.13.0",
"@typescript-eslint/parser": "^2.13.0",
Expand Down
11 changes: 11 additions & 0 deletions src/add.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* 1 + 1
* @returns 2
* @example
* ```ts
* add() => 2
* ```
*
* @beta
*/
export const add = () => 1 + 1
12 changes: 12 additions & 0 deletions src/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* 返回 hello 开头的字符串
* @param str - input string
* @returns 'hello xxx'
* @example
* ```ts
* hello('ts') => 'hello ts'
* ```
*
* @beta
*/
export const hello = (str: string) => `hello ${str}`
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export default function myFirstFunc (str: string) {
return `hello ${str}`
}
export * from './hello'
export * from './add'
13 changes: 13 additions & 0 deletions test/add.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import assert from 'assert'
import { add } from '../src/add'

describe('validate:', () => {
/**
* add
*/
describe('add', () => {
test(' return 2 ', () => {
assert.strictEqual(add(), 2)
})
})
})
13 changes: 13 additions & 0 deletions test/hello.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import assert from 'assert'
import { hello } from '../src/hello'

describe('validate:', () => {
/**
* hello
*/
describe('hello', () => {
test(' return hello rollup ', () => {
assert.strictEqual(hello('rollup'), 'hello rollup')
})
})
})
13 changes: 0 additions & 13 deletions test/index.test.ts

This file was deleted.

Loading

0 comments on commit 4e4b3df

Please sign in to comment.