|
|
@@ -1,31 +1,32 @@
|
|
|
// workaround by https://github.com/martpie/next-transpile-modules/issues/143#issuecomment-817467144
|
|
|
|
|
|
-const path = require('path')
|
|
|
-const fs = require('fs')
|
|
|
+const fs = require('fs');
|
|
|
+const path = require('path');
|
|
|
|
|
|
-const node_modules = path.resolve(__dirname, '../../../../node_modules')
|
|
|
+const nodeModulesPath = path.resolve(__dirname, '../../../../node_modules');
|
|
|
|
|
|
|
|
|
+// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
export const listScopedPackages = (scopes) => {
|
|
|
- const scopedPackages = []
|
|
|
+ const scopedPackages = [];
|
|
|
|
|
|
- fs.readdirSync(node_modules)
|
|
|
- .filter((name) => scopes.includes(name))
|
|
|
+ fs.readdirSync(nodeModulesPath)
|
|
|
+ .filter(name => scopes.includes(name))
|
|
|
.forEach((scope) => {
|
|
|
- fs.readdirSync(path.resolve(node_modules, scope))
|
|
|
- .filter((name) => !name.startsWith('.'))
|
|
|
+ fs.readdirSync(path.resolve(nodeModulesPath, scope))
|
|
|
+ .filter(name => !name.startsWith('.'))
|
|
|
.forEach((folderName) => {
|
|
|
const { name, ignoreTranspileModules } = require(path.resolve(
|
|
|
- node_modules,
|
|
|
+ nodeModulesPath,
|
|
|
scope,
|
|
|
folderName,
|
|
|
- 'package.json'
|
|
|
- ))
|
|
|
+ 'package.json',
|
|
|
+ ));
|
|
|
if (!ignoreTranspileModules) {
|
|
|
- scopedPackages.push(name)
|
|
|
+ scopedPackages.push(name);
|
|
|
}
|
|
|
- })
|
|
|
- })
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
return scopedPackages;
|
|
|
-}
|
|
|
+};
|