Main: How do i require modules that have example
field in it's package.json
?
For example:
const path = require( "path" );
const glob = require( "glob" );
const modules = glob.sync( './node_modules/*' );
for ( let mod in modules ) {
const modPackage = require( path.resolve( __dirname, "node_modules", mod, "package.json" ) );
if ( modPackage.hasOwnProperty( "example" ) ) {
console.log( "Module:", mod, "Has Field 'example'" );
}
}
Addiotinal: How do i require modules that have a specific tag? (for example: "demo")
via Hasan Bayat
No comments:
Post a Comment