Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 65 additions & 61 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,78 +10,82 @@ on:
workflow_dispatch:

jobs:
build:
dotnet:
name: .NET samples
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '10.0.x' # Use .NET 10
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Restore dependencies
run: dotnet restore Samples.slnx
- name: Restore dependencies
run: dotnet restore Samples.slnx

- name: Build
run: dotnet build Samples.slnx --configuration Release --no-restore
- name: Build Debug and generate proxies
run: dotnet build Samples.slnx --configuration Debug --no-restore

- name: Run tests
run: dotnet test Samples.slnx --configuration Release --no-build --verbosity normal
- name: Run focused Debug specifications
run: |
for project in \
Arc/React/Arc.React.Specs/Arc.React.Specs.csproj \
Chronicle/Backend/Backend.Specs/Backend.Specs.csproj \
Chronicle/CrossStore/CrossStore.Specs/CrossStore.Specs.csproj \
Chronicle/MultiTenancy/MultiTenancy.Specs/MultiTenancy.Specs.csproj \
Chronicle/OperationsDiagnosis/OperationsDiagnosis.Specs/OperationsDiagnosis.Specs.csproj \
Chronicle/Processing/Processing.Specs/Processing.Specs.csproj
do
dotnet test "$project" --configuration Debug --no-build --verbosity normal
done

frontend-install:
runs-on: ubuntu-latest
- name: Build Release without regenerating proxies
run: dotnet build Samples.slnx --configuration Release --no-restore -p:CratisProxiesOutputPath=

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
.yarn/cache
**/node_modules
**/.eslintcache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
- name: Install dependencies
run: yarn

frontend-build:
frontend:
name: Frontend — ${{ matrix.project }}
runs-on: ubuntu-latest
needs: frontend-install
strategy:
fail-fast: false
matrix:
project: [Library]
project:
- Arc/React
- Library/Lending
- Library/Members

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
.yarn/cache
**/node_modules
**/.eslintcache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}

- name: Install dependencies
run: yarn

- name: Build ${{ matrix.project }}
run: yarn build
working-directory: ${{ matrix.project }}
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23'

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install

- name: Validate sample catalog
run: yarn samples:validate

- name: Lint ${{ matrix.project }}
working-directory: ${{ matrix.project }}
run: yarn lint:ci

- name: Compile ${{ matrix.project }}
working-directory: ${{ matrix.project }}
run: yarn compile

- name: Test ${{ matrix.project }}
working-directory: ${{ matrix.project }}
run: yarn test --passWithNoTests

- name: Build ${{ matrix.project }}
working-directory: ${{ matrix.project }}
run: yarn build
7 changes: 5 additions & 2 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
folder: [Library]
folder:
- Arc/React
- Library/Lending
- Library/Members
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -80,7 +83,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '23'

- name: Pull latest changes
run: git pull --rebase
Expand Down
18 changes: 18 additions & 0 deletions Arc/React/.frontend/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Cratis. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import { Arc } from '@cratis/arc.react';
import { DialogComponents } from '@cratis/arc.react/dialogs';
import { CratisComponentsProvider } from '@cratis/components/Common';
import { BusyIndicatorDialog, ConfirmationDialog } from '@cratis/components/Dialogs';
import { Board } from '../Ideas/Board/Board';

export const App = () => (
<CratisComponentsProvider value={{ ripple: true }}>
<Arc>
<DialogComponents confirmation={ConfirmationDialog} busyIndicator={BusyIndicatorDialog}>
<Board />
</DialogComponents>
</Arc>
</CratisComponentsProvider>
);
58 changes: 58 additions & 0 deletions Arc/React/.frontend/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* Copyright (c) Cratis. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/

:root {
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
color: var(--text-color);
background: var(--surface-ground);
font-synthesis: none;
text-rendering: optimizeLegibility;
}

* {
box-sizing: border-box;
}

html {
min-width: 320px;
min-height: 100%;
background: var(--surface-ground);
}

body {
min-width: 320px;
min-height: 100vh;
margin: 0;
background:
radial-gradient(circle at 86% 7%, color-mix(in srgb, var(--primary-color) 15%, transparent), transparent 32rem),
radial-gradient(circle at 8% 44%, color-mix(in srgb, var(--highlight-bg) 60%, transparent), transparent 36rem),
var(--surface-ground);
}

button,
input,
textarea {
font: inherit;
}

button,
a {
-webkit-tap-highlight-color: transparent;
}

#root {
min-height: 100vh;
}

.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
18 changes: 18 additions & 0 deletions Arc/React/.frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
Copyright (c) Cratis. All rights reserved.
Licensed under the MIT license. See LICENSE file in the project root for full license information.
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#ffffff" />
<meta name="description" content="A focused standalone Cratis Arc and React sample." />
<title>Idea Loom · Arc + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/index.tsx"></script>
</body>
</html>
24 changes: 24 additions & 0 deletions Arc/React/.frontend/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Cratis. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import '@cratis/components/tokens';
import '@cratis/components/styles';
import 'primeicons/primeicons.css';
import 'primereact/resources/primereact.min.css';
import 'primereact/resources/themes/lara-light-blue/theme.css';
import 'reflect-metadata';
import './index.css';
import { Bindings } from '@cratis/arc.react.mvvm';
import { configure as configureMobx } from 'mobx';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { App } from './App';

Bindings.initialize();
configureMobx({ enforceActions: 'never' });

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
21 changes: 21 additions & 0 deletions Arc/React/.frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "../../../.frontend/tsconfig.base.json",
"compilerOptions": {
"allowImportingTsExtensions": true,
"baseUrl": "..",
"moduleResolution": "bundler",
"types": [
"chai",
"react",
"react-dom",
"vitest/globals"
]
},
"include": [
"../**/*.ts",
"../**/*.tsx"
],
"exclude": [
"vite.config.ts"
]
}
6 changes: 6 additions & 0 deletions Arc/React/.frontend/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../../.frontend/tsconfig.node.json",
"include": [
"vite.config.ts"
]
}
51 changes: 51 additions & 0 deletions Arc/React/.frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) Cratis. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import { EmitMetadataPlugin } from '@cratis/arc.vite';
import react from '@vitejs/plugin-react';
import { fileURLToPath } from 'node:url';
import type { PluginOption } from 'vite';
import { defineConfig } from 'vitest/config';

const backend = 'http://localhost:5064';

export default defineConfig({
root: fileURLToPath(new URL('./', import.meta.url)),
build: {
outDir: '../wwwroot',
emptyOutDir: true,
assetsDir: 'assets',
target: 'esnext',
modulePreload: false,
chunkSizeWarningLimit: 700,
},
plugins: [
react(),
// SAFETY: Arc and this app share Vite's plugin lifecycle; the cast only bridges their bundled Vite type identities.
EmitMetadataPlugin({
tsconfigPath: fileURLToPath(new URL('./tsconfig.json', import.meta.url)),
}) as unknown as PluginOption,
],
server: {
host: true,
port: 5173,
open: false,
proxy: {
'/api': {
target: backend,
ws: true,
},
'/.cratis': {
target: backend,
ws: true,
},
},
},
test: {
globals: true,
environment: 'node',
include: ['../**/for_*/when_*/**/*.ts', '../**/for_*/when_*.ts'],
exclude: ['../wwwroot/**', '../bin/**', '../obj/**', '../node_modules/**'],
setupFiles: fileURLToPath(new URL('../../../.frontend/vitest.setup.ts', import.meta.url)),
},
});
26 changes: 26 additions & 0 deletions Arc/React/Arc.React.Specs/Arc.React.Specs.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<RootNamespace>Arc.React.Specs</RootNamespace>
<!-- Cratis Specifications uses snake_case facts, inline attributes, and convention-based teardown. -->
<NoWarn>$(NoWarn);CA1001;IDE1006;SA1134</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cratis.Fundamentals" />
<PackageReference Include="Cratis.Specifications.XUnit" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../Arc.React.csproj">
<AdditionalProperties>CratisProxiesOutputPath=</AdditionalProperties>
</ProjectReference>
</ItemGroup>
</Project>
Loading
Loading