Skip to content

Commit

Permalink
Replace types declaration plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgallardo committed Dec 4, 2023
1 parent 9ed87c1 commit f5b19c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 32 deletions.
22 changes: 9 additions & 13 deletions getRollupConfig.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
const commonjs = require('@rollup/plugin-commonjs');
const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve');
const command = require('rollup-plugin-command');
const { babel } = require('@rollup/plugin-babel');
const image = require('@rollup/plugin-image');
const typescript = require('@rollup/plugin-typescript');
const ignoreImport = require('rollup-plugin-ignore-import');
const path = require('path');
const tsc = require('node-typescript-compiler');
const json = require('@rollup/plugin-json');

const compileTypings = (cwd) => () => {
return tsc.compile({
project: cwd,
emitDeclarationOnly: true,
});
};

module.exports = (dirname, project) => {
const pkgPath = path.join(dirname, 'package.json');
// eslint-disable-next-line import/no-dynamic-require, global-require
Expand All @@ -40,11 +32,15 @@ module.exports = (dirname, project) => {
return external.includes(namespace);
},
plugins: [
command(compileTypings(project || dirname), {
exitOnFail: true,
wait: true,
}),
resolve({ extensions }),
typescript({
tsconfig: project || dirname,
noForceEmit: true,
compilerOptions: {
emitDeclarationOnly: true,
noEmitOnError: true,
},
}),
commonjs(),
babel({
extensions,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.5",
"cross-spawn": "^7.0.3",
"minimist": "^1.2.8",
"node-typescript-compiler": "^3.0.0",
"rollup": "^4.6.0",
"rollup-plugin-command": "^1.1.3",
"rollup-plugin-ignore-import": "^1.3.2",
Expand Down
29 changes: 11 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,14 @@
is-module "^1.0.0"
resolve "^1.22.1"

"@rollup/plugin-typescript@^11.1.5":
version "11.1.5"
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-11.1.5.tgz#039c763bf943a5921f3f42be255895e75764cb91"
integrity sha512-rnMHrGBB0IUEv69Q8/JGRD/n4/n6b3nfpufUu26axhUcboUzv/twfZU8fIBbTOphRAe0v8EyxzeDpKXqGHfyDA==
dependencies:
"@rollup/pluginutils" "^5.0.1"
resolve "^1.22.1"

"@rollup/pluginutils@^5.0.1":
version "5.0.2"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33"
Expand Down Expand Up @@ -1911,7 +1919,7 @@ core-js-pure@^3.30.2:
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.32.0.tgz#5d79f85da7a4373e9a06494ccbef995a4c639f8b"
integrity sha512-qsev1H+dTNYpDUEURRuOXMvpdtAnNEvQWS/FMJ2Vb5AY8ZP4rAPQldkE27joykZPJTe0+IVgHZYh1P5Xu1/i1g==

cross-spawn@^7, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
Expand Down Expand Up @@ -2952,7 +2960,7 @@ lodash.merge@^4.6.2:
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==

lodash@^4, lodash@^4.17.10, lodash@^4.17.21:
lodash@^4.17.10, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down Expand Up @@ -3062,16 +3070,6 @@ node-releases@^2.0.13:
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d"
integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==

node-typescript-compiler@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/node-typescript-compiler/-/node-typescript-compiler-3.0.0.tgz#f6ed772eb3f1b890fb7896348d63ab5a2e8d6e7d"
integrity sha512-b3sE88wRNdVW2bNa51ASzh97sAf/P/p1ArTybW/rBWL7QBKv9y4amv5EodKXUe2sL9bDatNqZIkD66AlwksfjA==
dependencies:
cross-spawn "^7"
lodash "^4"
path-exists "^4"
tildify "^2"

npm-run-path@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea"
Expand Down Expand Up @@ -3220,7 +3218,7 @@ parent-module@^1.0.0:
dependencies:
callsites "^3.0.0"

path-exists@^4, path-exists@^4.0.0:
path-exists@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
Expand Down Expand Up @@ -3610,11 +3608,6 @@ text-table@^0.2.0:
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=

tildify@^2:
version "2.0.0"
resolved "https://registry.yarnpkg.com/tildify/-/tildify-2.0.0.tgz#f205f3674d677ce698b7067a99e949ce03b4754a"
integrity sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw==

titleize@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53"
Expand Down

0 comments on commit f5b19c8

Please sign in to comment.