diff --git a/build.sh b/build.sh index a01c77a9f..349b411f5 100644 --- a/build.sh +++ b/build.sh @@ -30,16 +30,6 @@ cp examples/static/iconfont.css sdk/ cp examples/static/iconfont.eot sdk/ # ็”Ÿๆˆ .d.ts ๆ–‡ไปถ -./node_modules/.bin/tsc --allowJs --declaration - -cd output - -for f in $(find . -name "*.d.ts"); do - mkdir -p ../lib/$(dirname $f) && mv $f ../lib/$(dirname $f) -done - -cd .. - -rm -rf output +./node_modules/.bin/tsc --declaration --emitDeclarationOnly --outDir ./lib --project ./tsconfig-for-declaration.json npm run build-schemas diff --git a/tsconfig-for-declaration.json b/tsconfig-for-declaration.json new file mode 100644 index 000000000..9a0d26611 --- /dev/null +++ b/tsconfig-for-declaration.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "outDir": "output/", + "module": "commonjs", + "target": "es5", + "lib": ["es6", "dom", "ES2015"], + "sourceMap": true, + "jsx": "react", + "moduleResolution": "node", + "rootDir": "src", + "importHelpers": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "sourceRoot": "src", + "noImplicitReturns": true, + "noImplicitThis": true, + "noImplicitAny": true, + "strictNullChecks": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "typeRoots": ["./node_modules/@types", "./types"], + "skipLibCheck": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "acceptance-tests", "webpack", "jest"], + "types": ["node", "typePatches"] +} diff --git a/tsconfig.json b/tsconfig.json index 18eb48a48..6b6ac233c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,11 +7,11 @@ "sourceMap": true, "jsx": "react", "moduleResolution": "node", - "rootDir": "src", + "rootDir": "", "importHelpers": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "sourceRoot": "src", + "sourceRoot": "", "noImplicitReturns": true, "noImplicitThis": true, "noImplicitAny": true, @@ -21,7 +21,7 @@ "typeRoots": ["./node_modules/@types", "./types"], "skipLibCheck": true }, - "include": ["src/**/*", "src/custom.d.ts", "examples/**/*"], + "include": ["src/**/*", "examples/**/*"], "exclude": ["node_modules", "acceptance-tests", "webpack", "jest"], "types": ["node", "typePatches"] } diff --git a/types/custom/index.d.ts b/types/custom/index.d.ts new file mode 100644 index 000000000..ce85f4dad --- /dev/null +++ b/types/custom/index.d.ts @@ -0,0 +1,9 @@ +declare module '*.svg' { + const content: any; + export default content; +} + +declare module '*.md' { + const content: any; + export default content; +}