-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow for projects that do not use workspaces (#23)
- Loading branch information
Showing
118 changed files
with
3,168 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@phoria/vite-plugin-dotnet-dev-certs": patch | ||
"@phoria/phoria": patch | ||
"@phoria/phoria-svelte": patch | ||
"@phoria/phoria-react": patch | ||
"@phoria/phoria-vue": patch | ||
--- | ||
|
||
Fix build warning due to exports order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@phoria/phoria": patch | ||
"phoria-dotnet": patch | ||
--- | ||
|
||
Fix build and runtime errors when running Vite outside of the web app directory |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# ui build stage | ||
FROM node:22-slim AS uibuild | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
WORKDIR /src | ||
|
||
# Copy source code | ||
COPY . . | ||
|
||
# Install deps | ||
|
||
RUN corepack enable | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
# Build the app | ||
ENV NODE_ENV=production | ||
ENV DOTNET_ENVIRONMENT=Production | ||
|
||
RUN pnpm lerna run --ignore phoria-dotnet --ignore framework-multiple --ignore with-workspace build | ||
RUN pnpm lerna run --ignore phoria-dotnet --ignore with-workspace build:islands | ||
RUN pnpm lerna run --ignore phoria-dotnet --ignore with-workspace build:server | ||
RUN pnpm --filter=framework-multiple deploy --prod /app | ||
|
||
# dotnet build stage | ||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS appbuild | ||
WORKDIR /src | ||
|
||
# Copy source code | ||
COPY . . | ||
|
||
# Restore all projects | ||
RUN dotnet restore ./e2e/framework-multiple/WebApp/WebApp.csproj | ||
|
||
# Publish web app | ||
RUN dotnet publish ./e2e/framework-multiple/WebApp/WebApp.csproj -c Release --no-restore -o /app | ||
|
||
# Runtime stage | ||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 | ||
ENV NODE_ENV=production | ||
ENV DOTNET_ENVIRONMENT=Production | ||
WORKDIR /app | ||
|
||
# Copy built assets | ||
|
||
COPY --from=appbuild /app . | ||
RUN mv /app/WebApp /app/WebAppCmd | ||
COPY --from=uibuild /app . | ||
|
||
# Install node | ||
|
||
ENV NODE_VERSION=22.11.0 | ||
RUN apt-get -y update \ | ||
&& apt-get install -y curl \ | ||
&& curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} -o nodesource_setup.sh | bash \ | ||
&& apt-get install -y --no-install-recommends nodejs \ | ||
&& apt-get clean | ||
|
||
# Run the app | ||
|
||
USER $APP_UID | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["./WebAppCmd"] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"phoria": { | ||
"server": { | ||
"process": { | ||
"command": "node", | ||
"arguments": ["WebApp/ui/dist/server/server.js"] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning", | ||
"System.Net.Http.HttpClient.Phoria.Vite.DevServer.DevHttpClient": "Warning" | ||
} | ||
}, | ||
"allowedHosts": "*", | ||
"phoria": { | ||
"root": "WebApp/ui", | ||
"entry": "src/entry-client.ts", | ||
"ssrEntry": "src/entry-server.ts" | ||
} | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import path from "node:path" | ||
import { fileURLToPath } from "node:url" | ||
import { | ||
createPhoriaCsrRequestHandler, | ||
createPhoriaDevCsrRequestHandler, | ||
createPhoriaDevSsrRequestHandler, | ||
createPhoriaSsrRequestHandler, | ||
parsePhoriaAppSettings | ||
} from "@phoria/phoria/server" | ||
import { createApp, toNodeListener } from "h3" | ||
import { type ListenOptions, listen } from "listhen" | ||
|
||
// Get environment and appsettings | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = path.dirname(__filename) | ||
|
||
const nodeEnv = process.env.NODE_ENV ?? "development" | ||
const isProduction = nodeEnv === "production" | ||
|
||
const dotnetEnv = process.env.DOTNET_ENVIRONMENT ?? process.env.ASPNETCORE_ENVIRONMENT ?? "Development" | ||
const appsettings = await parsePhoriaAppSettings({ environment: dotnetEnv, cwd: __dirname }) | ||
|
||
// Create Vite dev server if not in production environment | ||
|
||
const viteDevServer = isProduction | ||
? undefined | ||
: await import("vite").then((vite) => | ||
vite.createServer({ | ||
appType: "custom", | ||
server: { | ||
middlewareMode: true | ||
} | ||
}) | ||
) | ||
|
||
// Create http server | ||
|
||
const app = createApp() | ||
|
||
if (viteDevServer) { | ||
// Let the Vite dev server handle CSR requests, HMR and SSR | ||
|
||
app.use(createPhoriaDevCsrRequestHandler(viteDevServer)) | ||
|
||
app.use(createPhoriaDevSsrRequestHandler(viteDevServer, appsettings)) | ||
} else { | ||
// Configure the server to handle CSR and SSR requests | ||
|
||
app.use(createPhoriaCsrRequestHandler(appsettings)) | ||
|
||
app.use(createPhoriaSsrRequestHandler(appsettings)) | ||
} | ||
|
||
// Handle errors | ||
|
||
app.options.onError = (error) => { | ||
const err = error instanceof Error ? error : new Error("Unknown error", { cause: error }) | ||
viteDevServer?.ssrFixStacktrace(err) | ||
|
||
console.log({ | ||
message: err.message, | ||
stack: err.stack, | ||
cause: { | ||
message: err.cause | ||
} | ||
}) | ||
} | ||
|
||
// Start server | ||
|
||
const listenOptions: Partial<ListenOptions> = { | ||
https: false, | ||
isProd: isProduction, | ||
qr: false, | ||
tunnel: false | ||
} | ||
|
||
if (viteDevServer) { | ||
// In dev, we will source the listener options from the vite dev server config | ||
|
||
listenOptions.hostname = | ||
typeof viteDevServer.config.server.host === "boolean" | ||
? viteDevServer.config.server.host | ||
? "0.0.0.0" | ||
: undefined | ||
: viteDevServer.config.server.host | ||
|
||
listenOptions.port = viteDevServer.config.server.port | ||
|
||
if (viteDevServer.config.server?.https) { | ||
listenOptions.https = { | ||
cert: viteDevServer.config.server.https.cert?.toString(), | ||
key: viteDevServer.config.server.https.key?.toString() | ||
} | ||
} | ||
} else { | ||
// In production, we will source the listener options from appsettings | ||
|
||
listenOptions.hostname = appsettings.server.host | ||
listenOptions.port = appsettings.server.port ?? 5173 | ||
|
||
// NOTE: If using https in production, you will need to source and pass the https options to the listener | ||
} | ||
|
||
const listener = await listen(toNodeListener(app), listenOptions) | ||
|
||
// Handle server shutdown | ||
|
||
function shutdown(signal: NodeJS.Signals) { | ||
console.log(`Received signal ${signal}. Shutting down server.`) | ||
|
||
void listener.close().then(() => { | ||
console.log("Server listener closed.") | ||
|
||
process.exit(0) | ||
}) | ||
|
||
// Force shutdown after 5 seconds | ||
|
||
setTimeout(() => { | ||
console.error("Could not shutdown gracefully. Forcefully shutting down server.") | ||
|
||
process.exit(1) | ||
}, 5000) | ||
} | ||
|
||
process.on("SIGTERM", (signal) => shutdown(signal)) | ||
process.on("SIGINT", (signal) => shutdown(signal)) | ||
|
||
export { app, listener } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json | ||
|
||
name: framework-multiple | ||
metadata: | ||
template: [email protected] | ||
services: | ||
web-app: | ||
project: WebApp | ||
host: containerapp | ||
language: dotnet | ||
docker: | ||
path: ./Dockerfile | ||
context: ../../../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"analysisServicesServers": "as", | ||
"apiManagementService": "apim-", | ||
"appConfigurationStores": "appcs-", | ||
"appManagedEnvironments": "cae-", | ||
"appContainerApps": "ca-", | ||
"authorizationPolicyDefinitions": "policy-", | ||
"automationAutomationAccounts": "aa-", | ||
"blueprintBlueprints": "bp-", | ||
"blueprintBlueprintsArtifacts": "bpa-", | ||
"cacheRedis": "redis-", | ||
"cdnProfiles": "cdnp-", | ||
"cdnProfilesEndpoints": "cdne-", | ||
"cognitiveServicesAccounts": "cog-", | ||
"cognitiveServicesFormRecognizer": "cog-fr-", | ||
"cognitiveServicesTextAnalytics": "cog-ta-", | ||
"computeAvailabilitySets": "avail-", | ||
"computeCloudServices": "cld-", | ||
"computeDiskEncryptionSets": "des", | ||
"computeDisks": "disk", | ||
"computeDisksOs": "osdisk", | ||
"computeGalleries": "gal", | ||
"computeSnapshots": "snap-", | ||
"computeVirtualMachines": "vm", | ||
"computeVirtualMachineScaleSets": "vmss-", | ||
"containerInstanceContainerGroups": "ci", | ||
"containerRegistryRegistries": "cr", | ||
"containerServiceManagedClusters": "aks-", | ||
"databricksWorkspaces": "dbw-", | ||
"dataFactoryFactories": "adf-", | ||
"dataLakeAnalyticsAccounts": "dla", | ||
"dataLakeStoreAccounts": "dls", | ||
"dataMigrationServices": "dms-", | ||
"dBforMySQLServers": "mysql-", | ||
"dBforPostgreSQLServers": "psql-", | ||
"devicesIotHubs": "iot-", | ||
"devicesProvisioningServices": "provs-", | ||
"devicesProvisioningServicesCertificates": "pcert-", | ||
"documentDBDatabaseAccounts": "cosmos-", | ||
"eventGridDomains": "evgd-", | ||
"eventGridDomainsTopics": "evgt-", | ||
"eventGridEventSubscriptions": "evgs-", | ||
"eventHubNamespaces": "evhns-", | ||
"eventHubNamespacesEventHubs": "evh-", | ||
"hdInsightClustersHadoop": "hadoop-", | ||
"hdInsightClustersHbase": "hbase-", | ||
"hdInsightClustersKafka": "kafka-", | ||
"hdInsightClustersMl": "mls-", | ||
"hdInsightClustersSpark": "spark-", | ||
"hdInsightClustersStorm": "storm-", | ||
"hybridComputeMachines": "arcs-", | ||
"insightsActionGroups": "ag-", | ||
"insightsComponents": "appi-", | ||
"keyVaultVaults": "kv-", | ||
"kubernetesConnectedClusters": "arck", | ||
"kustoClusters": "dec", | ||
"kustoClustersDatabases": "dedb", | ||
"logicIntegrationAccounts": "ia-", | ||
"logicWorkflows": "logic-", | ||
"machineLearningServicesWorkspaces": "mlw-", | ||
"managedIdentityUserAssignedIdentities": "id-", | ||
"managementManagementGroups": "mg-", | ||
"migrateAssessmentProjects": "migr-", | ||
"networkApplicationGateways": "agw-", | ||
"networkApplicationSecurityGroups": "asg-", | ||
"networkAzureFirewalls": "afw-", | ||
"networkBastionHosts": "bas-", | ||
"networkConnections": "con-", | ||
"networkDnsZones": "dnsz-", | ||
"networkExpressRouteCircuits": "erc-", | ||
"networkFirewallPolicies": "afwp-", | ||
"networkFirewallPoliciesWebApplication": "waf", | ||
"networkFirewallPoliciesRuleGroups": "wafrg", | ||
"networkFrontDoors": "fd-", | ||
"networkFrontdoorWebApplicationFirewallPolicies": "fdfp-", | ||
"networkLoadBalancersExternal": "lbe-", | ||
"networkLoadBalancersInternal": "lbi-", | ||
"networkLoadBalancersInboundNatRules": "rule-", | ||
"networkLocalNetworkGateways": "lgw-", | ||
"networkNatGateways": "ng-", | ||
"networkNetworkInterfaces": "nic-", | ||
"networkNetworkSecurityGroups": "nsg-", | ||
"networkNetworkSecurityGroupsSecurityRules": "nsgsr-", | ||
"networkNetworkWatchers": "nw-", | ||
"networkPrivateDnsZones": "pdnsz-", | ||
"networkPrivateLinkServices": "pl-", | ||
"networkPublicIPAddresses": "pip-", | ||
"networkPublicIPPrefixes": "ippre-", | ||
"networkRouteFilters": "rf-", | ||
"networkRouteTables": "rt-", | ||
"networkRouteTablesRoutes": "udr-", | ||
"networkTrafficManagerProfiles": "traf-", | ||
"networkVirtualNetworkGateways": "vgw-", | ||
"networkVirtualNetworks": "vnet-", | ||
"networkVirtualNetworksSubnets": "snet-", | ||
"networkVirtualNetworksVirtualNetworkPeerings": "peer-", | ||
"networkVirtualWans": "vwan-", | ||
"networkVpnGateways": "vpng-", | ||
"networkVpnGatewaysVpnConnections": "vcn-", | ||
"networkVpnGatewaysVpnSites": "vst-", | ||
"notificationHubsNamespaces": "ntfns-", | ||
"notificationHubsNamespacesNotificationHubs": "ntf-", | ||
"operationalInsightsWorkspaces": "log-", | ||
"portalDashboards": "dash-", | ||
"powerBIDedicatedCapacities": "pbi-", | ||
"purviewAccounts": "pview-", | ||
"recoveryServicesVaults": "rsv-", | ||
"resourcesResourceGroups": "rg-", | ||
"searchSearchServices": "srch-", | ||
"serviceBusNamespaces": "sb-", | ||
"serviceBusNamespacesQueues": "sbq-", | ||
"serviceBusNamespacesTopics": "sbt-", | ||
"serviceEndPointPolicies": "se-", | ||
"serviceFabricClusters": "sf-", | ||
"signalRServiceSignalR": "sigr", | ||
"sqlManagedInstances": "sqlmi-", | ||
"sqlServers": "sql-", | ||
"sqlServersDataWarehouse": "sqldw-", | ||
"sqlServersDatabases": "sqldb-", | ||
"sqlServersDatabasesStretch": "sqlstrdb-", | ||
"storageStorageAccounts": "st", | ||
"storageStorageAccountsVm": "stvm", | ||
"storSimpleManagers": "ssimp", | ||
"streamAnalyticsCluster": "asa-", | ||
"synapseWorkspaces": "syn", | ||
"synapseWorkspacesAnalyticsWorkspaces": "synw", | ||
"synapseWorkspacesSqlPoolsDedicated": "syndp", | ||
"synapseWorkspacesSqlPoolsSpark": "synsp", | ||
"timeSeriesInsightsEnvironments": "tsi-", | ||
"webServerFarms": "plan-", | ||
"webSitesAppService": "app-", | ||
"webSitesAppServiceEnvironment": "ase-", | ||
"webSitesFunctions": "func-", | ||
"webStaticSites": "stapp-" | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.