diff --git a/package.json b/package.json index 30e53111f386..c024b3534a40 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "camelcase": "^5.0.0", "chalk": "^2.0.1", "codecov": "^3.0.0", + "cp-file": "^6.1.0", "debug": "^4.0.1", "eslint": "^5.6.0", "eslint-config-prettier": "^3.1.0", diff --git a/scripts/buildTs.js b/scripts/buildTs.js index ec5479be5c4b..24075be646ed 100644 --- a/scripts/buildTs.js +++ b/scripts/buildTs.js @@ -12,6 +12,8 @@ const path = require('path'); const chalk = require('chalk'); const execa = require('execa'); +const glob = require('glob'); +const cpFile = require('cp-file'); const {getPackages, adjustToTerminalWidth, OK} = require('./buildUtils'); const packages = getPackages(); @@ -27,6 +29,16 @@ process.stdout.write(adjustToTerminalWidth('Building\n')); try { execa.sync('tsc', args, {stdio: 'inherit'}); + packagesWithTs.forEach(p => { + const srcDir = path.resolve(p, 'src'); + const buildDir = path.resolve(p, 'build'); + + glob.sync(path.join(srcDir, '**/*.d.ts')).forEach(file => { + const resultFile = path.resolve(buildDir, path.relative(srcDir, file)); + + cpFile.sync(file, resultFile); + }); + }); process.stdout.write(`${OK}\n`); } catch (e) { process.stdout.write('\n'); diff --git a/yarn.lock b/yarn.lock index 340a5d50f880..6739385aeabe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4040,6 +4040,17 @@ cosmiconfig@^5.0.5, cosmiconfig@^5.1.0: lodash.get "^4.4.2" parse-json "^4.0.0" +cp-file@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/cp-file/-/cp-file-6.1.0.tgz#b48d2d80577d4c5025c68eb597a38093c1dc9ccf" + integrity sha512-an34I0lJwKncRKjxe3uGWUuiIIVYsHHjBGKld3OQB56hfoPCYom31VysvfuysKqHLbz6drnqP5YrCfLw17I2kw== + dependencies: + graceful-fs "^4.1.2" + make-dir "^2.0.0" + nested-error-stacks "^2.0.0" + pify "^4.0.1" + safe-buffer "^5.0.1" + create-ecdh@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" @@ -8398,6 +8409,14 @@ make-dir@^1.0.0, make-dir@^1.2.0, make-dir@^1.3.0: dependencies: pify "^3.0.0" +make-dir@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + make-fetch-happen@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz#141497cb878f243ba93136c83d8aba12c216c083" @@ -9117,6 +9136,11 @@ neo-async@^2.5.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835" integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA== +nested-error-stacks@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz#0fbdcf3e13fe4994781280524f8b96b0cdff9c61" + integrity sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug== + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"