Skip to content

Commit

Permalink
Update next and add one-click build via Visual Studio solution: if st…
Browse files Browse the repository at this point in the history
…atic pages weren't built, build them. (#163)
  • Loading branch information
maxgolov authored Oct 18, 2024
1 parent 27a0edd commit 3edc77f
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 53 deletions.
22 changes: 17 additions & 5 deletions ChatRoom/ChatRoom.StaticWebUI/ChatRoom.StaticWebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,28 @@
</Content>
</ItemGroup>

<!-- Custom target to check if wwwroot exists -->
<Target Name="CheckWwwrootExists" BeforeTargets="PrepareForRun">
<!-- Custom target to check if wwwroot exists and build chatroom-ui if it doesn't -->
<Target Name="CheckAndBuildWwwroot" BeforeTargets="PrepareForRun">
<!-- Check if the wwwroot directory exists -->
<PropertyGroup>
<WwwrootExists Condition="Exists('$(RepoRoot)\chatroom-ui\out\index.html')">true</WwwrootExists>
</PropertyGroup>

<!-- Optionally, do something based on the existence of wwwroot -->
<Message Text="wwwroot doesn't exist. Have you built the chatroom-ui project?" Condition="'$(WwwrootExists)' == 'false'" />
<Error Text="The wwwroot directory does not exist. Please build chatroom-ui project by running `npm run build` under their root. For more information on how to build chatroom-ui, please refer to https://github.com/LittleLittleCloud/Agent-ChatRoom/tree/main/chatroom-ui" Condition="'$(WwwrootExists)' == 'false'" />
<!-- If wwwroot doesn't exist, run: npm install && npm run build -->
<!-- Run npm install if wwwroot doesn't exist -->
<Exec Command="npm install" Condition="'$(WwwrootExists)' == 'false'" WorkingDirectory="$(RepoRoot)\chatroom-ui" />
<!-- Run npm run build after npm install -->
<Exec Command="npm run build" Condition="'$(WwwrootExists)' == 'false'" WorkingDirectory="$(RepoRoot)\chatroom-ui" />
<!-- Optionally, display message after build -->
<Message Text="Running 'npm run build' to generate wwwroot as it doesn't exist." Condition="'$(WwwrootExists)' == 'false'" />

<!-- After the build, check again if wwwroot exists -->
<PropertyGroup>
<WwwrootExists Condition="Exists('$(RepoRoot)\chatroom-ui\out\index.html')">true</WwwrootExists>
</PropertyGroup>

<!-- If wwwroot still doesn't exist after the build, show an error -->
<Error Text="The wwwroot directory still does not exist after running 'npm run build'. Please check the chatroom-ui build process." Condition="'$(WwwrootExists)' == 'false'" />
</Target>

</Project>
94 changes: 47 additions & 47 deletions chatroom-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chatroom-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"emoji-mart": "^5.6.0",
"framer-motion": "^11.2.10",
"lucide-react": "^0.390.0",
"next": "14.2.3",
"next": "^14.2.15",
"next-themes": "^0.3.0",
"openapi-typescript-codegen": "^0.29.0",
"react": "18.2.0",
Expand Down

0 comments on commit 3edc77f

Please sign in to comment.