@aexol/axolotl-scripts 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/packages.ts +16 -7
package/package.json
CHANGED
package/src/packages.ts
CHANGED
|
@@ -34,7 +34,8 @@ const remapPackages = async () => {
|
|
|
34
34
|
roots.map(async (relative) => {
|
|
35
35
|
const root = path.join(process.cwd(), relative);
|
|
36
36
|
try {
|
|
37
|
-
const
|
|
37
|
+
const entries = await fs.readdir(root, { withFileTypes: true });
|
|
38
|
+
const dir = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
38
39
|
return { root, dir };
|
|
39
40
|
} catch (error) {
|
|
40
41
|
const err = error as NodeJS.ErrnoException;
|
|
@@ -47,14 +48,22 @@ const remapPackages = async () => {
|
|
|
47
48
|
);
|
|
48
49
|
const allJsons = await Promise.all(
|
|
49
50
|
dirs.map(async ({ dir, root }) => {
|
|
50
|
-
const all =
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const all: { packageJSON: PackageJSON; packagePath: string }[] = [];
|
|
52
|
+
for (const p of dir) {
|
|
53
|
+
const packagePath = path.join(root, p, 'package.json');
|
|
54
|
+
try {
|
|
53
55
|
const packageJSONString = await fs.readFile(packagePath, 'utf-8');
|
|
54
56
|
const packageJSON = JSON.parse(packageJSONString) as PackageJSON;
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
|
|
57
|
+
all.push({ packageJSON, packagePath });
|
|
58
|
+
} catch (error) {
|
|
59
|
+
const err = error as NodeJS.ErrnoException;
|
|
60
|
+
if (err.code === 'ENOENT') {
|
|
61
|
+
console.warn(`Skipping "${path.join(root, p)}" because package.json is missing`);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
throw err;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
58
67
|
return all;
|
|
59
68
|
}),
|
|
60
69
|
);
|