Skip to content

Commit b445f33

Browse files
committed
Release configs
1 parent a8ec3ca commit b445f33

File tree

4 files changed

+88
-6
lines changed

4 files changed

+88
-6
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const outputPath = 'Debug' !== 'Release' ? '../wwwroot' : '../obj/Debug/net8.0/clientassets'

src/Umbraco.Cms.Integrations.Crm.Hubspot/Client/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { defineConfig } from "vite";
22
import tsconfigPaths from "vite-tsconfig-paths";
3+
import { outputPath } from "./config.outputPath.js";
34

45
export default defineConfig({
56
build: {
67
lib: {
78
entry: "src/index.ts",
89
formats: ["es"],
910
},
10-
outDir: "../wwwroot/App_Plugins/HubspotForms",
11+
outDir: outputPath,
1112
emptyOutDir: true,
1213
sourcemap: true,
1314
rollupOptions: {

src/Umbraco.Cms.Integrations.Crm.Hubspot/Umbraco.Cms.Integrations.Crm.Hubspot.csproj

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22
<PropertyGroup>
33
<TargetFramework>net8.0</TargetFramework>
4-
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
54
<Nullable>enable</Nullable>
65
<ImplicitUsings>enable</ImplicitUsings>
7-
<StaticWebAssetBasePath>/</StaticWebAssetBasePath>
6+
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
7+
<EnableDefaultContentItems>false</EnableDefaultContentItems>
8+
<StaticWebAssetBasePath>/App_Plugins/HubspotForms</StaticWebAssetBasePath>
89
</PropertyGroup>
910

1011
<PropertyGroup>
1112
<PackageId>Umbraco.Cms.Integrations.Crm.Hubspot</PackageId>
1213
<Title>Umbraco CMS Integrations: CRM - Hubspot</Title>
1314
<Description>An extension for Umbraco CMS providing a form picker and rendering component for Hubspot.</Description>
1415
<PackageIconUrl></PackageIconUrl>
15-
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cms.Integrations/blob/main/src/Umbraco.Cms.Integrations.Crm.Hubspot</PackageProjectUrl>
16+
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cms.Integrations/blob/main-v14/src/Umbraco.Cms.Integrations.Crm.Hubspot</PackageProjectUrl>
1617
<RepositoryUrl>https://github.com/umbraco/Umbraco.Cms.Integrations</RepositoryUrl>
1718
<Version>5.0.0</Version>
1819
<Authors>Umbraco HQ</Authors>
@@ -22,12 +23,17 @@
2223
<PackageReadmeFile>readme.md</PackageReadmeFile>
2324
</PropertyGroup>
2425

26+
<ItemGroup>
27+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
28+
<SupportedPlatform Include="browser" />
29+
</ItemGroup>
30+
2531
<ItemGroup>
2632
<PackageReference Include="Umbraco.Cms.Api.Common" Version="[14.0.0,15)" />
2733
<PackageReference Include="Umbraco.Cms.Web.Website" Version="[14.0.0,15)" />
2834
<PackageReference Include="Umbraco.Cms.Web.Common" Version="[14.0.0,15)" />
2935
</ItemGroup>
30-
36+
3137
<ItemGroup>
3238
<Content Include="hubspot.png">
3339
<Pack>true</Pack>
@@ -40,7 +46,20 @@
4046
</ItemGroup>
4147

4248
<ItemGroup>
43-
<Folder Include="wwwroot\" />
49+
<Content Include="Views\**" />
50+
</ItemGroup>
51+
52+
<!-- Build client assets using NPM -->
53+
<Import Project="build\Microsoft.AspNetCore.ClientAssets.targets" />
54+
<PropertyGroup>
55+
<!-- Use this to (temporarily) disable building client assets, e.g. to start the project and generate updated API models -->
56+
<ShouldRunClientAssetsBuild>true</ShouldRunClientAssetsBuild>
57+
</PropertyGroup>
58+
<Target Name="ClientAssetsBuildOutputPath" BeforeTargets="ClientAssetsBuild">
59+
<WriteLinesToFile File="Client\config.outputPath.js" Lines="export const outputPath = '$(Configuration)' !== 'Release' ? '../wwwroot' : '../$(IntermediateOutputPath.Replace('\', '/'))clientassets';" Overwrite="true" />
60+
</Target>
61+
<ItemGroup>
62+
<ClientAssetsInputs Remove="Client\config.outputPath.js" />
4463
</ItemGroup>
4564

4665
</Project>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<Project>
2+
<!--
3+
Copied from: https://github.com/aspnet/AspLabs/blob/main/src/ClientAssets/Microsoft.AspNetCore.ClientAssets/build/netstandard2.0/Microsoft.AspNetCore.ClientAssets.targets
4+
5+
More information:
6+
- https://devblogs.microsoft.com/dotnet/build-client-web-assets-for-your-razor-class-library/
7+
- https://github.com/dotnet/aspnetcore/issues/38445
8+
-->
9+
<PropertyGroup>
10+
<ClientAssetsDirectory Condition="'$(ClientAssetsDirectory)' == ''">Client\</ClientAssetsDirectory>
11+
<ClientAssetsRestoreInputs Condition="'$(ClientAssetsRestoreInputs)' == ''">$(ClientAssetsDirectory)\package-lock.json;$(ClientAssetsDirectory)\package.json</ClientAssetsRestoreInputs>
12+
<ClientAssetsRestoreOutputs Condition="'$(ClientAssetsRestoreOutputs)' == ''">$(ClientAssetsDirectory)node_modules\.package-lock.json</ClientAssetsRestoreOutputs>
13+
<ClientAssetsRestoreCommand Condition="'$(ClientAssetsRestoreCommand)' == ''">npm ci --no-fund --no-audit --prefer-offline</ClientAssetsRestoreCommand>
14+
<ClientAssetsBuildCommand Condition="'$(ClientAssetsBuildCommand)' == ''">npm run build</ClientAssetsBuildCommand>
15+
16+
<!-- Include project file to pick up changes in the above values -->
17+
<ClientAssetsRestoreInputs>$(MSBuildProjectFile);$(ClientAssetsRestoreInputs)</ClientAssetsRestoreInputs>
18+
<!-- Run restore only once for multi targeting builds -->
19+
<ClientAssetsRestoreBeforeTargets Condition="'$(TargetFramework)' == ''">DispatchToInnerBuilds</ClientAssetsRestoreBeforeTargets>
20+
<!-- Allow multitargeting projects to choose the target framework in which they run by setting this value to true only for a given target framework -->
21+
<ShouldRunClientAssetsBuild Condition="'$(ShouldRunClientAssetsBuild)' == ''">true</ShouldRunClientAssetsBuild>
22+
</PropertyGroup>
23+
24+
<ItemGroup>
25+
<ClientAssetsInputs Include="$(ClientAssetsDirectory)**" Exclude="$(DefaultItemExcludes)" />
26+
</ItemGroup>
27+
28+
<Target Name="ClientAssetsRestore" BeforeTargets="$(ClientAssetsRestoreBeforeTargets)" Inputs="$(ClientAssetsRestoreInputs)" Outputs="$(ClientAssetsRestoreOutputs)">
29+
<Message Text="Restoring NPM packages" Importance="high" />
30+
<Exec Command="$(ClientAssetsRestoreCommand)" WorkingDirectory="$(ClientAssetsDirectory)"/>
31+
</Target>
32+
33+
<Target Name="ClientAssetsBuild" Condition="'$(ShouldRunClientAssetsBuild)' == 'true'" DependsOnTargets="ClientAssetsRestore" BeforeTargets="AssignTargetPaths" Inputs="@(ClientAssetsInputs)" Outputs="$(IntermediateOutputPath)clientassetsbuild.complete.txt">
34+
<PropertyGroup>
35+
<_ClientAssetsOutputFullPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)clientassets'))</_ClientAssetsOutputFullPath>
36+
</PropertyGroup>
37+
38+
<Message Text="Executing NPM build script" Importance="High" />
39+
40+
<MakeDir Directories="$(_ClientAssetsOutputFullPath)" />
41+
<Exec Command="$(ClientAssetsBuildCommand)" WorkingDirectory="$(ClientAssetsDirectory)" />
42+
43+
<ItemGroup>
44+
<_ClientAssetsBuildOutput Include="$(IntermediateOutputPath)clientassets\**"></_ClientAssetsBuildOutput>
45+
</ItemGroup>
46+
47+
<WriteLinesToFile File="$(IntermediateOutputPath)clientassetsbuild.complete.txt" Lines="@(_ClientAssetsBuildOutput)" />
48+
</Target>
49+
50+
<Target Name="DefineClientAssets" AfterTargets="ClientAssetsBuild" DependsOnTargets="ResolveStaticWebAssetsConfiguration">
51+
<ItemGroup>
52+
<FileWrites Include="@(_ClientAssetsBuildOutput)" />
53+
<FileWrites Include="$(IntermediateOutputPath)clientassetsbuild.complete.txt" />
54+
</ItemGroup>
55+
56+
<DefineStaticWebAssets CandidateAssets="@(_ClientAssetsBuildOutput)" SourceId="$(PackageId)" SourceType="Computed" ContentRoot="$(_ClientAssetsOutputFullPath)" BasePath="$(StaticWebAssetBasePath)">
57+
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
58+
</DefineStaticWebAssets>
59+
</Target>
60+
61+
</Project>

0 commit comments

Comments
 (0)