Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: conditional type exports (T1177805) #3661

Merged

Conversation

VasilyStrelyaev
Copy link
Contributor

@VasilyStrelyaev VasilyStrelyaev commented Jul 27, 2023

scripts/utils.js Outdated Show resolved Hide resolved
Co-authored-by: Timofey Traynenkov <[email protected]>
const pkg = JSON.parse(readFileSync(join(packageDirectory, 'package.json')));
const dtsOutFile = join(packageDirectory, pkg.types);
const pkg = getPackageInfo(packageDirectory);
const dtsOutFile = getDtsOutFile(packageDirectory, pkg.types);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an overcomplicating. What's the difference between your function and using join?

scripts/utils.js Outdated

export const getPackageInfo = packageDir => JSON.parse(readFileSync(join(packageDir, 'package.json')));

export const getDtsOutFile = (packageDir, typesDir) => join(packageDir, typesDir);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've simply duplicated using of join. Remove this function

@@ -21,8 +21,8 @@ export default (packageDirectory, skipBundle = false) => {
const dtsPath = join(packageDirectory, 'dist', 'dts');

if (!skipBundle) {
const pkg = JSON.parse(readFileSync(join(packageDirectory, 'package.json')));
const dtsOutFile = join(packageDirectory, pkg.types);
const pkg = getPackageInfo(packageDirectory);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to split this on steps instead of extracting this logic into util function

@VasilyStrelyaev VasilyStrelyaev merged commit db3373d into DevExpress:master Jul 28, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants