Skip to content

Commit

Permalink
Merge pull request #147 from vitonsky/56-enhancement-export-types
Browse files Browse the repository at this point in the history
Export types
  • Loading branch information
vitonsky authored Oct 25, 2024
2 parents 4e0ba69 + 3633506 commit 6cfaf69
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 46 deletions.
43 changes: 39 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"prettier": "^3.2.5",
"rollup": "^4.14.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-dts": "^6.1.1",
"ts-jest": "^29.1.2",
"tslib": "^2.6.2",
"typescript": "^5.4.3"
Expand Down
92 changes: 52 additions & 40 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,46 +1,58 @@
import copy from 'rollup-plugin-copy';
import dts from 'rollup-plugin-dts';
import typescript from '@rollup/plugin-typescript';

export default {
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'cjs',
},
plugins: [
typescript(),
copy({
targets: [
{
src: 'LICENSE',
dest: 'dist',
},
{
src: 'README.md',
dest: 'dist',
},
{
src: 'package.json',
dest: 'dist',
transform(content) {
const ignoredProps = ['devDependencies', 'scripts'];
export default [
{
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'cjs',
},
plugins: [
typescript(),
copy({
targets: [
{
src: 'LICENSE',
dest: 'dist',
},
{
src: 'README.md',
dest: 'dist',
},
{
src: 'package.json',
dest: 'dist',
transform(content) {
const ignoredProps = ['devDependencies', 'scripts'];

const json = JSON.parse(content.toString());
return JSON.stringify(
{
...Object.fromEntries(
Object.entries(json).filter(
([key]) => !ignoredProps.includes(key),
const json = JSON.parse(content.toString());
return JSON.stringify(
{
...Object.fromEntries(
Object.entries(json).filter(
([key]) => !ignoredProps.includes(key),
),
),
),
main: 'index.js',
},
null,
4,
);
main: 'index.js',
},
null,
4,
);
},
},
},
],
}),
],
};
],
}),
],
},
{
// Generate declaration file
input: 'src/index.ts',
output: {
file: 'dist/index.d.ts',
format: 'cjs',
},
plugins: [dts()],
},
];
4 changes: 2 additions & 2 deletions src/rules/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function findAlias(

// TODO: implement option to force relative path instead of alias (for remove alias case)
// TODO: add tests
const rule: Rule.RuleModule = {
const rule = {
meta: {
fixable: 'code',
schema: {
Expand Down Expand Up @@ -157,6 +157,6 @@ const rule: Rule.RuleModule = {
},
};
},
};
} satisfies Rule.RuleModule;

export default rule;

0 comments on commit 6cfaf69

Please sign in to comment.