sverweij / dependency-cruiser

Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.
https://npmjs.com/dependency-cruiser
MIT License
5.27k stars 250 forks source link

chore: makes sources type:module ready & publish as type:module #915

Closed sverweij closed 8 months ago

sverweij commented 8 months ago

Description

Motivation and Context

dependency-cruiser has been ESM only since version 13. Until now it didn't advertise this in its package manifest. This is a non-standard way of doing ESM only modules. Then why didn't we do it the standard way? Well, glad you asked. Test fixtures and mocks are affected by the "type": "module" setting as well. As we have several tests that have .js files with commonjs in them, these got qualified as ESM - which jump-scares the nodejs ESM processor.

This PR circumvents this issue by

For this to work properly the last remnants of files still called ".js" but actually having commonjs content in src and configs needed to be renamed to .cjs. For good measure we did the same for all other .js module that wasn't a mock or fixture.

How Has This Been Tested?

Types of changes

Checklist

codeclimate[bot] commented 8 months ago

Code Climate has analyzed commit 4fdb75ab and detected 0 issues on this pull request.

View more on Code Climate.