Skip to content

fix: studio 404 not found - #332

Closed
to-kr wants to merge 2 commits into
asyncapi:masterfrom
to-kr:studio-404
Closed

to-kr wants to merge 2 commits into
asyncapi:masterfrom
to-kr:studio-404

Conversation

@to-kr

@to-kr to-kr commented Sep 7, 2022

Copy link
Copy Markdown

Conditional resolve of Studio Build depending on installation type.

Related issue(s)
Resolves #244

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2022

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@derberg derberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@to-kr sorry for jumping into review with such delay 😞

thanks for trying to fix the issue, but I'm not 100% sure it is the best we can do. It is still kinda hacky to have hardcoded paths

could you try to use require.resolve to dynamically check where @asyncapi/studio is located?

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Comment thread src/models/Studio.ts
Comment on lines +47 to +49
const studioBuildFolder = existsSync(resolve(__dirname, '../../node_modules/@asyncapi/studio/build')) ?
resolve(__dirname, '../../node_modules/@asyncapi/studio/build') :
resolve(__dirname, '../../../../@asyncapi/studio/build');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const studioBuildFolder = existsSync(resolve(__dirname, '../../node_modules/@asyncapi/studio/build')) ?
resolve(__dirname, '../../node_modules/@asyncapi/studio/build') :
resolve(__dirname, '../../../../@asyncapi/studio/build');
const studioBuildFolder = require.resolve('@asyncapi/studio/build/index.html');

this should be universal solution. Works on my side, npm user.
wdyt?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@to-kr do you plan to continue with this one?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't catch your previous answer. Your solution looks good. Please fix it yourself.

@derberg

derberg commented Mar 27, 2023

Copy link
Copy Markdown
Member

closing in favour of #489

@derberg derberg closed this Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio 404 not found

2 participants