Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: prevent error ENOTDIR when starting application #3441

Merged
merged 1 commit into from
Aug 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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