Created
January 25, 2024 09:13
-
-
Save tubackkhoa/72079fedebe5ef98eaeed7ed261134d0 to your computer and use it in GitHub Desktop.
import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const glob = require('glob'); | |
const util = require('util'); | |
const globPromise = util.promisify(glob); | |
const importArr = []; | |
const exportArr = ['export default {']; | |
const paths = [ | |
'node_modules/@tharsis/proto/dist/proto/evmos/**/*.js', | |
'node_modules/@tharsis/proto/dist/proto/ethermint/**/*.js', | |
]; | |
(async () => { | |
let ind = 100; | |
for (const importPath of paths) { | |
const files = await globPromise(importPath); | |
for (const file of files) { | |
exportArr.push(`\t..._${ind},`); | |
importArr.push( | |
`import * as _${ind} from '${file | |
.replace(/^node_modules\//, '') | |
.replace(/\.js$/, '')}';` | |
); | |
ind++; | |
} | |
} | |
exportArr.push('}'); | |
// ..._137, | |
console.log(importArr.join('\n')); | |
console.log(exportArr.join('\n')); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment