Skip to content

Commit

Permalink
Merge branch 'cloudDev'
Browse files Browse the repository at this point in the history
  • Loading branch information
b-straub committed Apr 27, 2024
2 parents 431e78d + 5eef94b commit 1c3990c
Show file tree
Hide file tree
Showing 224 changed files with 9,128 additions and 2,185 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@ on:
- "**"

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET 7.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Build
run: dotnet build -c Release

- name: Test
run: dotnet test -c Release
- name: Build DexieNET normal and cloud
run: dotnet build DexieCloudNET/DexieCloudNET.csproj -c Release

- name: TestSG
run: dotnet test DexieNETTest/TableGeneratorTest/DexieNETTest.TableGeneratorTest.csproj -c Release

- name: TestDB
run: dotnet test DexieNETTest/Tests/DexieNETTest.Tests.csproj -c Release
21 changes: 8 additions & 13 deletions .github/workflows/PublishNuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,29 @@ on:
types: [published]

env:
NuGetDirectory: ${{ github.workspace}}/Nuget
NuGetDirectory: ${{ github.workspace}}/.nuget

jobs:
build:

env:
SOLUTION: 'DexieNET.sln'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET 7.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Build
run: dotnet build $SOLUTION --configuration Release
- name: Build DexieNET normal and cloud
run: dotnet build DexieCloudNET/DexieCloudNET.csproj -c Release

- name: TestSG
run: dotnet test DexieNETTest/TableGeneratorTest/DexieNETTest.TableGeneratorTest.csproj -c Release

- name: Run tests
run: dotnet test --configuration Release --verbosity normal
- name: TestDB
run: dotnet test DexieNETTest/Tests/DexieNETTest.Tests.csproj -c Release

- name: Publish
run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
24 changes: 16 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,28 @@
*.user
*-template
template-*
.DS_Store
.idea
*.lock
DexieNETIntern.sln
DexieNET/npm/node_modules
DexieNET/wwwroot
DexieNETTest/TableGeneratorTest/TestResults
Publish
Nugets
GeneratorRunner
payload.json
DexieNETHelloWorld
Nuget
DexieNET/npm/src/*.js

DexieNET/npm/node_modules
DexieNET/wwwroot
DexieNET/yarn/src/*.js
DexieNET/yarn/node_modules

DexieCloudNET/yarn/node_modules
DexieCloudNET/yarn/src/**/*.js
DexieCloudNET/wwwroot/
DexieCloudNET/yarn/src/DexieNET

DexieNETCloudSample/Dexie/dexie-cloud.json
DexieNETCloudSample/Dexie/dexie-cloud.key
DexieNETCloudSample/wwwroot/dexie-cloud.json
DexieNETCloudSample/wwwroot/importfile.json
DexieNET/npm/yarn.lock
DexieNET/node_modules/.yarn-integrity

DexieNET/yarn/.eslintrc.js
4 changes: 4 additions & 0 deletions .nuget/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "DexieNETTest",
"type": "blazorwasm",
"request": "launch",
"cwd": "${workspaceFolder}/DexieNETTest/Client"
},
{
"type": "blazorwasm",
"name": "DexieNETCloudSample",
"request": "launch",
"url": "http://localhost:5223",
"cwd": "${workspaceFolder}/DexieNETCloudSample"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "DexieNET.sln"
}
34 changes: 34 additions & 0 deletions DexieCloudNET/Component/DexieCloudNET.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Microsoft.AspNetCore.Components;
using System.Diagnostics.CodeAnalysis;
using DexieNET;

namespace DexieCloudNET.Component
{
public class DexieCloudNET<T>(string cloudURL) : ComponentBase where T : DBBase, IDBBase
{
[Inject]
protected IDexieNETService<T>? DexieNETService { get; set; }

[NotNull] // OnInitializedAsync will throw
public T? Dexie { get; private set; }

protected async override Task OnInitializedAsync()
{
if (DexieNETService is not null)
{
DexieCloudOptions cloudOptions = new(cloudURL);

Dexie = await DexieNETService.DexieNETFactory.Create(true);

if (Dexie is null)
{
throw new InvalidOperationException("Can not create database.");
}

Dexie.ConfigureCloud(cloudOptions);
}

await base.OnInitializedAsync();
}
}
}
75 changes: 75 additions & 0 deletions DexieCloudNET/DexieCloudNET.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup>
<Title>DexieCloudNET</Title>
<Description>A .NET wrapper for dexie.js minimalist wrapper for IndexedDB with cloud support.</Description>
<Authors>Bernhard Straub</Authors>
<Copyright>Bernhard Straub</Copyright>
<PackageProjectUrl>https://github.com/b-straub/DexieNET</PackageProjectUrl>
<RepositoryUrl>https://github.com/b-straub/DexieNET</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>Dexie, Dexie Cloud, IndexedDB</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\.nuget</PackageOutputPath>
</PropertyGroup>

<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="." />
</ItemGroup>

<ItemGroup>
<None Include="yarn\package.json" Pack="false" />
<None Include="yarn\tsconfig.json" Pack="false" />
<Content Include="yarn\src\*.js" Pack="false" />
<Content Include="yarn\src\*.map" Pack="false" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.4" />

<PackageReference Include="System.Reactive" Version="6.0.0" />

<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.4.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<ProjectReference Include="..\DexieNET\DexieNET.csproj" />
</ItemGroup>

<PropertyGroup>
<!-- File with mtime of last successful npm install -->
<YarnInstallStampFile>npm/node_modules/.install-stamp</YarnInstallStampFile>
<Authors>Bernhard Straub</Authors>
</PropertyGroup>

<Target Name="DeleteJSFiles" BeforeTargets="BeforeBuild">
<Delete Files="wwwroot\js\*.*" />
</Target>

<Target Name="YarnInstall" BeforeTargets="BeforeBuild" Inputs="yarn/package.json" Outputs="$(YarnInstallStampFile)">
<Exec Command="yarn install" WorkingDirectory="yarn" />
<Touch Files="$(NpmInstallStampFile)" AlwaysCreate="true" />
</Target>

<Target Name="YarnCommandsDebug" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug'">
<Exec Command="yarn run buildDebug" WorkingDirectory="yarn" />
</Target>

<Target Name="YarnCommandsRelease" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
<Exec Command="yarn run buildRelease" WorkingDirectory="yarn" />
</Target>

</Project>
Loading

0 comments on commit 1c3990c

Please sign in to comment.