@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/packages.ts +16 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexol/axolotl-scripts",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "dependencies": {},
5
5
  "devDependencies": {},
6
6
  "peerDependencies": {}
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 dir = await fs.readdir(root);
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 = await Promise.all(
51
- dir.map(async (p) => {
52
- const packagePath = path.join(root, p, 'package.json');
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
- return { packageJSON, packagePath };
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
  );