Skip to content
This repository has been archived by the owner on Jan 25, 2025. It is now read-only.

1.2.4 #167

Merged
merged 2 commits into from
Apr 16, 2024
Merged

1.2.4 #167

merged 2 commits into from
Apr 16, 2024

Conversation

JensAstrup
Copy link
Owner

What's Changed

  • Package now supports ESM and CJS

Copy link

I've conducted a review based on the diff provided, examining each change for potential issues such as typos, non-functioning code, code style inconsistencies, and whether best practices were followed. Here's the feedback:

  1. .eslintignore and .gitignore updates: Adding /dist/ to both ignore files is a best practice when the dist directory is used for build artifacts which should not be tracked in version control. This is a sound change.

  2. package.json changes:

    • Incrementing the version number from 1.2.3 to 1.2.4 follows semantic versioning rules; this is expected for changes that do not introduce breaking changes but add improvements or fixes.
    • Adjusting the "main", "module", and "types" fields from lib to dist with respective subdirectories and file extensions is consistent with a change in the build system structure. It indicates a shift to producing both CommonJS (cjs) and ECMAScript modules (esm).
    • Revising "scripts" to include separate commands for compiling esm and cjs modules, renaming file extensions, and fixing import paths align with the restructuring and are necessary adjustments. The use of "renamer" and a focus on import formats indicates attention to compatibility across different module systems.
    • It's good to see the addition of renamer to devDependencies, which is needed for the newly introduced rename scripts in the package.json.
  3. Addition of reformat-cjs-imports.js and reformat-esm-imports.js scripts: These scripts appropriately address the need to ensure correct file extensions in module imports, a common stumbling block when accommodating multiple module systems. The approach taken here is diligent and helps maintain compatibility and functionality.

  4. Removal of reformat-imports.js: Assuming this script was replaced by reformat-cjs-imports.js and reformat-esm-imports.js, this is a logical step. Keeping codebase and utilities lean and focused on current requirements is good practice.

  5. New tsconfig.base.json setup: Introduction of base TypeScript config to extend for different module systems (cjs, esm) is a best practice for maintaining shared configurations in a DRY (Don't Repeat Yourself) manner. It simplifies the project configuration and reduces redundancy.

  6. tsconfig.cjs.json and tsconfig.esm.json extensions: These files correctly extend the base config and specialize for CommonJS and ECMAScript modules, respectively. It's a clear and effective way to manage builds for different targets.

Overall, the changes are well-thought-out and indicate a thorough approach to migrating the package's build and module system towards a more flexible and modern structure. These adaptations are expected to facilitate better module interoperability and build management. No issues or concerns are evident from the provided diff.

@JensAstrup JensAstrup merged commit c69b0e9 into main Apr 16, 2024
9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant