Skip to content

Commit 475c1b2

Browse files
committed
Fix type generation error handling
1 parent a2e97b8 commit 475c1b2

File tree

4 files changed

+12
-26
lines changed

4 files changed

+12
-26
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Type definition generation errors now stop the package compilation process.
13+
1014
## [0.0.2] - 2021-11-02
1115

1216
- Initial version

getRollupConfig.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ const { babel } = require('@rollup/plugin-babel');
55
const image = require('@rollup/plugin-image');
66
const ignoreImport = require('rollup-plugin-ignore-import');
77
const path = require('path');
8-
const tsc = require('node-typescript-compiler');
98
const json = require('@rollup/plugin-json');
109

11-
const compileTypings = (cwd) => () => {
12-
return tsc.compile({
13-
project: cwd,
14-
emitDeclarationOnly: true,
10+
const typeDefinitions = (dirname) =>
11+
command(`tsc --project ${dirname}/tsconfig.json --emitDeclarationOnly`, {
12+
exitOnFail: true,
13+
wait: true,
1514
});
16-
};
1715

1816
module.exports = (dirname) => {
1917
const pkgPath = path.join(dirname, 'package.json');
@@ -40,7 +38,7 @@ module.exports = (dirname) => {
4038
return external.includes(namespace);
4139
},
4240
plugins: [
43-
command(compileTypings(dirname), { exitOnFail: true, wait: true }),
41+
typeDefinitions(dirname),
4442
resolve({ extensions }),
4543
commonjs(),
4644
babel({

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"@rollup/plugin-node-resolve": "^13.0.0",
3838
"cross-spawn": "^7.0.3",
3939
"minimist": "^1.2.5",
40-
"node-typescript-compiler": "^3.0.0",
4140
"rollup": "^2.41.4",
4241
"rollup-plugin-command": "^1.1.3",
4342
"rollup-plugin-ignore-import": "^1.3.2",

yarn.lock

+3-18
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ core-js-pure@^3.19.0:
18071807
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.19.3.tgz#c69b2b36b58927317824994b532ec3f0f7e49607"
18081808
integrity sha512-N3JruInmCyt7EJj5mAq3csCgGYgiSqu7p7TQp2KOztr180/OAIxyIvL1FCjzgmQk/t3Yniua50Fsak7FShI9lA==
18091809

1810-
cross-spawn@^7, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
1810+
cross-spawn@^7.0.2, cross-spawn@^7.0.3:
18111811
version "7.0.3"
18121812
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
18131813
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@@ -2817,7 +2817,7 @@ lodash.merge@^4.6.2:
28172817
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
28182818
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
28192819

2820-
lodash@^4, lodash@^4.11.2, lodash@^4.17.10, lodash@^4.17.19, lodash@^4.17.21:
2820+
lodash@^4.11.2, lodash@^4.17.10, lodash@^4.17.19, lodash@^4.17.21:
28212821
version "4.17.21"
28222822
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
28232823
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -2915,16 +2915,6 @@ node-releases@^2.0.1:
29152915
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.1.tgz#3d1d395f204f1f2f29a54358b9fb678765ad2fc5"
29162916
integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==
29172917

2918-
node-typescript-compiler@^3.0.0:
2919-
version "3.0.0"
2920-
resolved "https://registry.yarnpkg.com/node-typescript-compiler/-/node-typescript-compiler-3.0.0.tgz#f6ed772eb3f1b890fb7896348d63ab5a2e8d6e7d"
2921-
integrity sha512-b3sE88wRNdVW2bNa51ASzh97sAf/P/p1ArTybW/rBWL7QBKv9y4amv5EodKXUe2sL9bDatNqZIkD66AlwksfjA==
2922-
dependencies:
2923-
cross-spawn "^7"
2924-
lodash "^4"
2925-
path-exists "^4"
2926-
tildify "^2"
2927-
29282918
object-assign@^4.1.1:
29292919
version "4.1.1"
29302920
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
@@ -3089,7 +3079,7 @@ path-exists@^3.0.0:
30893079
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
30903080
integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=
30913081

3092-
path-exists@^4, path-exists@^4.0.0:
3082+
path-exists@^4.0.0:
30933083
version "4.0.0"
30943084
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
30953085
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
@@ -3531,11 +3521,6 @@ through@^2.3.6:
35313521
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
35323522
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
35333523

3534-
tildify@^2:
3535-
version "2.0.0"
3536-
resolved "https://registry.yarnpkg.com/tildify/-/tildify-2.0.0.tgz#f205f3674d677ce698b7067a99e949ce03b4754a"
3537-
integrity sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw==
3538-
35393524
tiny-glob@^0.2.9:
35403525
version "0.2.9"
35413526
resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.9.tgz#2212d441ac17928033b110f8b3640683129d31e2"

0 commit comments

Comments
 (0)