Skip to content

Instantly share code, notes, and snippets.

@Gbacc
Gbacc / list-imports.js
Last active February 19, 2024 13:52
List react components imports
const fs = require('fs');
const path = require('path');
const stats = {};
const numberOfImports = {};
function extractComponentNames(importStatement) {
const match = importStatement.match(
/import\s+(?:(\w*),?\s?{?(\s?[^\}]*\s?)}?)\s+from\s+['"](@talend\/.[^\/]*)\/*.*['"]/,
);
if (match) {