Skip to content

Commit

Permalink
Merge pull request #12 from nabond251/feature/publish
Browse files Browse the repository at this point in the history
chore(release): publish packages
  • Loading branch information
nabond251 authored Feb 1, 2024
2 parents cdd922f + b1b1fbe commit 84bbf94
Show file tree
Hide file tree
Showing 25 changed files with 797 additions and 620 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 2023-07-09

### Changes

---

Packages with breaking changes:

- There are no breaking changes in this release.

Packages with other changes:

- [`rearch` - `v0.0.0-dev.1`](#rearch---v000-dev1)

---

#### `rearch` - `v0.0.0-dev.1`

- **FEAT**: add == check to skip some rebuilds.
- **FEAT**: working mvp.
11 changes: 1 addition & 10 deletions Rearch.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rearch.Tests", "tests\Rearc
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rearch.Reactor", "src\Rearch.Reactor\Rearch.Reactor.csproj", "{B150E8CB-1350-4F5A-9521-2EDF3C7BB42D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{D4C4AC65-6F17-461F-A631-841AF26FC2BB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rearch.Example", "sample\Rearch.Example\Rearch.Example.csproj", "{73F28DC9-D965-4C10-8C9F-E29104B52737}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rearch.Example.Tests", "tests\Rearch.Example.Tests\Rearch.Example.Tests.csproj", "{C9813C9F-2670-480A-A7EF-E8814D631806}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rearch.Example.Tests", "tests\Rearch.Example.Tests\Rearch.Example.Tests.csproj", "{C9813C9F-2670-480A-A7EF-E8814D631806}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -37,10 +33,6 @@ Global
{B150E8CB-1350-4F5A-9521-2EDF3C7BB42D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B150E8CB-1350-4F5A-9521-2EDF3C7BB42D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B150E8CB-1350-4F5A-9521-2EDF3C7BB42D}.Release|Any CPU.Build.0 = Release|Any CPU
{73F28DC9-D965-4C10-8C9F-E29104B52737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73F28DC9-D965-4C10-8C9F-E29104B52737}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73F28DC9-D965-4C10-8C9F-E29104B52737}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73F28DC9-D965-4C10-8C9F-E29104B52737}.Release|Any CPU.Build.0 = Release|Any CPU
{C9813C9F-2670-480A-A7EF-E8814D631806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9813C9F-2670-480A-A7EF-E8814D631806}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9813C9F-2670-480A-A7EF-E8814D631806}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -53,7 +45,6 @@ Global
{900169C0-3D32-430A-95C1-A713507A243D} = {F67704B8-9273-407A-B93B-7874ADCF060B}
{0583184D-B026-4170-88D4-AD8876930160} = {075AFD96-7D62-4387-BD0E-829BCBC5CA3B}
{B150E8CB-1350-4F5A-9521-2EDF3C7BB42D} = {F67704B8-9273-407A-B93B-7874ADCF060B}
{73F28DC9-D965-4C10-8C9F-E29104B52737} = {D4C4AC65-6F17-461F-A631-841AF26FC2BB}
{C9813C9F-2670-480A-A7EF-E8814D631806} = {075AFD96-7D62-4387-BD0E-829BCBC5CA3B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
66 changes: 0 additions & 66 deletions sample/Rearch.Example/Example.cs

This file was deleted.

5 changes: 0 additions & 5 deletions sample/Rearch.Example/Program.cs

This file was deleted.

37 changes: 0 additions & 37 deletions sample/Rearch.Example/Rearch.Example.csproj

This file was deleted.

17 changes: 0 additions & 17 deletions sample/Rearch.Example/stylecop.json

This file was deleted.

1 change: 1 addition & 0 deletions src/Rearch.Reactor/Rearch.Reactor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Nullable>enable</Nullable>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="SideEffects.cs" company="SdgApps">
// <copyright file="BuiltinSideEffectExtensions.cs" company="SdgApps">
// Copyright (c) SdgApps. All rights reserved.
// </copyright>

Expand All @@ -13,20 +13,30 @@ public static class BuiltinSideEffectExtensions
/// Convenience side effect that gives a copy of the
/// <see cref="ISideEffectApi"/>.
/// </summary>
/// <param name="registrar">Side effect registrar.</param>
/// <returns>A copy of the <see cref="ISideEffectApi"/>.</returns>
public static ISideEffectApi Api(this ISideEffectRegistrar registrar) =>
registrar.Register((api) => api);

/// <summary>
/// Convenience side effect that gives a copy of
/// <see cref="ISideEffectApi.Rebuild"/>.
/// </summary>
/// <param name="registrar">Side effect registrar.</param>
/// <returns>A copy of <see cref="ISideEffectApi.Rebuild"/>.</returns>
public static Action Rebuilder(this ISideEffectRegistrar registrar) =>
registrar.Api().Rebuild;

/// <summary>
/// Side effect that calls the supplied <paramref name="callback"/> once,
/// on the first build.
/// </summary>
/// <typeparam name="T">
/// Type of side effect <paramref name="callback"/> result.
/// </typeparam>
/// <param name="registrar">Side effect registrar.</param>
/// <param name="callback">Callback to be called once.</param>
/// <returns><paramref name="callback"/> result.</returns>
public static T Callonce<T>(
this ISideEffectRegistrar registrar,
Func<T> callback) =>
Expand All @@ -35,10 +45,14 @@ public static T Callonce<T>(
/// <summary>
/// Side effect that provides a way for capsules to contain some state,
/// where the initial state is computationally expensive.
/// Similar to the `useState` hook from React;
/// Similar to the <c>useState</c> hook from React;
/// see https://react.dev/reference/react/useState.
/// </summary>
public static (T, Action<T>) LazyState<T>(
/// <typeparam name="T">Type of side effect state.</typeparam>
/// <param name="registrar">Side effect registrar.</param>
/// <param name="init">Callback to initialize side effect state.</param>
/// <returns>Side effect state and setter.</returns>
public static (T State, Action<T> SetState) LazyState<T>(
this ISideEffectRegistrar registrar,
Func<T> init)
{
Expand All @@ -61,20 +75,28 @@ void Setter(T newState)

/// <summary>
/// Side effect that provides a way for capsules to contain some state.
/// Similar to the `useState` hook from React;
/// Similar to the <c>useState</c> hook from React;
/// see https://react.dev/reference/react/useState.
/// </summary>
public static (T, Action<T>) State<T>(
/// <typeparam name="T">Type of side effect state.</typeparam>
/// <param name="registrar">Side effect registrar.</param>
/// <param name="initial">Initial side effect state.</param>
/// <returns>Side effect state and setter.</returns>
public static (T State, Action<T> SetState) State<T>(
this ISideEffectRegistrar registrar,
T initial) =>
registrar.LazyState(() => initial);

/// <summary>
/// Side effect that provides a way for capsules to hold onto some value
/// between builds, where the initial value is computationally expensive.
/// Similar to the `useRef` hook from React;
/// Similar to the <c>useRef</c> hook from React;
/// see https://react.dev/reference/react/useRef.
/// </summary>
/// <typeparam name="T">Type of side effect lazy value.</typeparam>
/// <param name="registrar">Side effect registrar.</param>
/// <param name="init">Callback to initialize side effect lazy value.</param>
/// <returns>Side effect lazy value.</returns>
public static T LazyValue<T>(
this ISideEffectRegistrar registrar,
Func<T> init) =>
Expand All @@ -83,9 +105,13 @@ public static T LazyValue<T>(
/// <summary>
/// Side effect that provides a way for capsules to hold onto some value
/// between builds.
/// Similar to the `useRef` hook from React;
/// Similar to the <c>useRef</c> hook from React;
/// see https://react.dev/reference/react/useRef.
/// </summary>
/// <typeparam name="T">Type of side effect value.</typeparam>
/// <param name="registrar">Side effect registrar.</param>
/// <param name="initial">Initial side effect value.</param>
/// <returns>Side effect value.</returns>
public static T Value<T>(
this ISideEffectRegistrar registrar,
T initial) =>
Expand Down
38 changes: 38 additions & 0 deletions src/Rearch/CapsuleHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// <copyright file="CapsuleHandle.cs" company="SdgApps">
// Copyright (c) SdgApps. All rights reserved.
// </copyright>

namespace Rearch;

/// <summary>
/// Implementation of the handle given to a <see cref="Capsule{T}"/> to build its
/// data.
/// </summary>
internal sealed class CapsuleHandle(UntypedCapsuleManager manager) :
ICapsuleHandle
{
/// <summary>
/// Gets the capsule manager for this handle.
/// </summary>
public UntypedCapsuleManager Manager { get; } = manager;

/// <summary>
/// Gets index into manager's side effect data.
/// </summary>
public int SideEffectDataIndex { get; private set; }

/// <inheritdoc/>
public T Invoke<T>(Capsule<T> capsule) =>
this.Manager.Read(capsule);

/// <inheritdoc/>
public T Register<T>(SideEffect<T> sideEffect)
{
if (this.SideEffectDataIndex == this.Manager.SideEffectData.Count)
{
this.Manager.SideEffectData.Add(sideEffect(this.Manager));
}

return (T)this.Manager.SideEffectData[this.SideEffectDataIndex++]!;
}
}
Loading

0 comments on commit 84bbf94

Please sign in to comment.