madge.js 922 B

1234567891011121314151617181920
  1. const madge = require('madge');
  2. const fs = require('node:fs');
  3. madge('static/app/index.tsx', {
  4. fileExtensions: ['js', 'ts', 'tsx', 'pegjs', 'json'],
  5. tsConfig: './tsconfig.json',
  6. webpackConfig: './webpack.config.js',
  7. }).then(async res => {
  8. fs.writeFileSync('madge', JSON.stringify(res.obj(), null, 2));
  9. fs.writeFileSync('madge.warning', JSON.stringify(res.warnings(), null, 2));
  10. fs.writeFileSync('madge.circular', JSON.stringify(res.circular(), null, 2));
  11. fs.writeFileSync('madge.circularGraph', JSON.stringify(res.circularGraph(), null, 2));
  12. // fs.writeFileSync('madge.depends', res.depends());
  13. fs.writeFileSync('madge.orphans', JSON.stringify(res.orphans(), null, 2));
  14. fs.writeFileSync('madge.leaves', JSON.stringify(res.leaves(), null, 2));
  15. await res.image('madge.png');
  16. await res.image('madge.circular.png', true);
  17. await res.svg('madge.svg');
  18. await res.svg('madge.circular.svg', true);
  19. });