Skip to content

Commit f5b19c8

Browse files
committed
Replace types declaration plugin
1 parent 9ed87c1 commit f5b19c8

File tree

3 files changed

+21
-32
lines changed

3 files changed

+21
-32
lines changed

getRollupConfig.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
const commonjs = require('@rollup/plugin-commonjs');
22
const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve');
3-
const command = require('rollup-plugin-command');
43
const { babel } = require('@rollup/plugin-babel');
54
const image = require('@rollup/plugin-image');
5+
const typescript = require('@rollup/plugin-typescript');
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,
15-
});
16-
};
17-
1810
module.exports = (dirname, project) => {
1911
const pkgPath = path.join(dirname, 'package.json');
2012
// eslint-disable-next-line import/no-dynamic-require, global-require
@@ -40,11 +32,15 @@ module.exports = (dirname, project) => {
4032
return external.includes(namespace);
4133
},
4234
plugins: [
43-
command(compileTypings(project || dirname), {
44-
exitOnFail: true,
45-
wait: true,
46-
}),
4735
resolve({ extensions }),
36+
typescript({
37+
tsconfig: project || dirname,
38+
noForceEmit: true,
39+
compilerOptions: {
40+
emitDeclarationOnly: true,
41+
noEmitOnError: true,
42+
},
43+
}),
4844
commonjs(),
4945
babel({
5046
extensions,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
"@rollup/plugin-image": "^3.0.3",
3535
"@rollup/plugin-json": "^6.0.1",
3636
"@rollup/plugin-node-resolve": "^15.2.3",
37+
"@rollup/plugin-typescript": "^11.1.5",
3738
"cross-spawn": "^7.0.3",
3839
"minimist": "^1.2.8",
39-
"node-typescript-compiler": "^3.0.0",
4040
"rollup": "^4.6.0",
4141
"rollup-plugin-command": "^1.1.3",
4242
"rollup-plugin-ignore-import": "^1.3.2",

yarn.lock

+11-18
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,14 @@
13851385
is-module "^1.0.0"
13861386
resolve "^1.22.1"
13871387

1388+
"@rollup/plugin-typescript@^11.1.5":
1389+
version "11.1.5"
1390+
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-11.1.5.tgz#039c763bf943a5921f3f42be255895e75764cb91"
1391+
integrity sha512-rnMHrGBB0IUEv69Q8/JGRD/n4/n6b3nfpufUu26axhUcboUzv/twfZU8fIBbTOphRAe0v8EyxzeDpKXqGHfyDA==
1392+
dependencies:
1393+
"@rollup/pluginutils" "^5.0.1"
1394+
resolve "^1.22.1"
1395+
13881396
"@rollup/pluginutils@^5.0.1":
13891397
version "5.0.2"
13901398
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33"
@@ -1911,7 +1919,7 @@ core-js-pure@^3.30.2:
19111919
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.32.0.tgz#5d79f85da7a4373e9a06494ccbef995a4c639f8b"
19121920
integrity sha512-qsev1H+dTNYpDUEURRuOXMvpdtAnNEvQWS/FMJ2Vb5AY8ZP4rAPQldkE27joykZPJTe0+IVgHZYh1P5Xu1/i1g==
19131921

1914-
cross-spawn@^7, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
1922+
cross-spawn@^7.0.2, cross-spawn@^7.0.3:
19151923
version "7.0.3"
19161924
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
19171925
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@@ -2952,7 +2960,7 @@ lodash.merge@^4.6.2:
29522960
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
29532961
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
29542962

2955-
lodash@^4, lodash@^4.17.10, lodash@^4.17.21:
2963+
lodash@^4.17.10, lodash@^4.17.21:
29562964
version "4.17.21"
29572965
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
29582966
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -3062,16 +3070,6 @@ node-releases@^2.0.13:
30623070
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d"
30633071
integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==
30643072

3065-
node-typescript-compiler@^3.0.0:
3066-
version "3.0.0"
3067-
resolved "https://registry.yarnpkg.com/node-typescript-compiler/-/node-typescript-compiler-3.0.0.tgz#f6ed772eb3f1b890fb7896348d63ab5a2e8d6e7d"
3068-
integrity sha512-b3sE88wRNdVW2bNa51ASzh97sAf/P/p1ArTybW/rBWL7QBKv9y4amv5EodKXUe2sL9bDatNqZIkD66AlwksfjA==
3069-
dependencies:
3070-
cross-spawn "^7"
3071-
lodash "^4"
3072-
path-exists "^4"
3073-
tildify "^2"
3074-
30753073
npm-run-path@^4.0.1:
30763074
version "4.0.1"
30773075
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea"
@@ -3220,7 +3218,7 @@ parent-module@^1.0.0:
32203218
dependencies:
32213219
callsites "^3.0.0"
32223220

3223-
path-exists@^4, path-exists@^4.0.0:
3221+
path-exists@^4.0.0:
32243222
version "4.0.0"
32253223
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
32263224
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
@@ -3610,11 +3608,6 @@ text-table@^0.2.0:
36103608
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
36113609
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
36123610

3613-
tildify@^2:
3614-
version "2.0.0"
3615-
resolved "https://registry.yarnpkg.com/tildify/-/tildify-2.0.0.tgz#f205f3674d677ce698b7067a99e949ce03b4754a"
3616-
integrity sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw==
3617-
36183611
titleize@^3.0.0:
36193612
version "3.0.0"
36203613
resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53"

0 commit comments

Comments
 (0)