pahen / madge

Create graphs from your CommonJS, AMD or ES6 module dependencies
MIT License
8.71k stars 312 forks source link

Add tests for Vue #418

Closed fdc-viktor-luft closed 1 month ago

fdc-viktor-luft commented 1 month ago
fdc-viktor-luft commented 1 month ago

@pahen I left a TODO comment in the test as I couldn't get it to work for other dependencies like existing ".vue" files to be listed. There might be some config that I couldn't find. I tried ts: {mixedImports: true} or adding all possible file extensions or turning on the includeNpm.

Also, running this single test fails via npm run mocha -- -g Vue with a babel-parsing error, but running npm run mocha works for some reason.

Maybe you just know the trick 😛

pahen commented 1 month ago

@pahen I left a TODO comment in the test as I couldn't get it to work for other dependencies like existing ".vue" files to be listed. There might be some config that I couldn't find. I tried ts: {mixedImports: true} or adding all possible file extensions or turning on the includeNpm.

Also, running this single test fails via npm run mocha -- -g Vue with a babel-parsing error, but running npm run mocha works for some reason.

Maybe you just know the trick 😛

Not sure why but specifying the tsConfig fixes both the test and the issue with running a single test  🤷‍♂️

Try this:

const tsConfig = {
    compilerOptions: {
        allowJs: true,
        esModuleInterop: true,
        jsx: 'preserve',
        module: 'esnext',
        moduleResolution: 'node',
        noEmit: true,
        noImplicitAny: true,
        strict: true,
        target: 'esnext'
    }
};

madge(dir + '/BasicComponent.vue', {tsConfig}).then((res) => {

fdc-viktor-luft commented 1 month ago

I could even reduce the TS config provided to a very minimal version to make it work. Can we make a plan to publish v8?

I'd still like to do some additional cleanups before publishing though. E.g. https://github.com/pahen/madge/pull/419 and some more dependency updates.