Skip to content

Commit

Permalink
build: prevent error ENOTDIR when starting application [skip ci] (#3441)
Browse files Browse the repository at this point in the history
Some OSes stores custom attribute in a specific files like `.DS_Store`.

```sh
(node:88679) UnhandledPromiseRejectionWarning: Error: ENOTDIR: not a directory, open 'packages/manager/apps/.DS_Store/package.json'
```

Signed-off-by: Antoine Leblanc <[email protected]>
  • Loading branch information
antleblanc authored Aug 14, 2020
1 parent 69bbdc8 commit d277fdb
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions scripts/start-application.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ const applicationsWorkspace = 'packages/manager/apps';
* @return {Array} Applications' list.
*/
const choices = () =>
readdirSync(applicationsWorkspace, {
withFileTypes: true,
}).map((application) => {
const data = readFileSync(
`${applicationsWorkspace}/${application.name}/package.json`,
'utf8',
);
const { name } = JSON.parse(data);
// Skip scoped package name.
// `@ovh-ux/foo` => `foo`.
const [, formatedName] = name.split('/');
readdirSync(applicationsWorkspace, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map(({ name: application }) => {
const data = readFileSync(
`${applicationsWorkspace}/${application}/package.json`,
'utf8',
);
const { name } = JSON.parse(data);
// Skip scoped package name.
// `@ovh-ux/foo` => `foo`.
const [, formatedName] = name.split('/');

return {
name: formatedName,
value: name,
};
});
return {
name: formatedName,
value: name,
};
});

/**
* Ask for both packageName and region to start the corresponding application.
Expand Down

0 comments on commit d277fdb

Please sign in to comment.