|
|
@@ -32,3 +32,24 @@ export const listScopedPackages = (scopes, opts = defaultOpts) => {
|
|
|
|
|
|
return scopedPackages;
|
|
|
};
|
|
|
+
|
|
|
+// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
+export const listPrefixedPackages = (prefixes, opts = defaultOpts) => {
|
|
|
+ const prefixedPackages = [];
|
|
|
+
|
|
|
+ fs.readdirSync(nodeModulesPath)
|
|
|
+ .filter(name => prefixes.some(prefix => name.startsWith(prefix)))
|
|
|
+ .filter(name => !name.startsWith('.'))
|
|
|
+ .forEach((folderName) => {
|
|
|
+ const { name, ignoreTranspileModules } = require(path.resolve(
|
|
|
+ nodeModulesPath,
|
|
|
+ folderName,
|
|
|
+ 'package.json',
|
|
|
+ ));
|
|
|
+ if (!ignoreTranspileModules && !opts.ignorePackageNames.includes(name)) {
|
|
|
+ prefixedPackages.push(name);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return prefixedPackages;
|
|
|
+};
|