Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Releases: Sleitnick/Knit

Release v0.0.21-alpha

19 Aug 22:32
bd05d9e
Compare
Choose a tag to compare

0.0.21-alpha

  • Fix issue with having multiple required components
  • Adds Sample and Zip to TableUtil
  • Improvements to Timer module

Release v0.0.20-alpha

12 Aug 18:38
f92a3f3
Compare
Choose a tag to compare

0.0.20-alpha

  • Fixes bug with Timer class
  • Updates Janitor
  • Removes unnecessary parentheses
  • Adds some more Luau types

Release v0.0.19-alpha

03 Aug 23:43
a50c86e
Compare
Choose a tag to compare
  • New Signal implementation
  • Remove Thread module in favor of new task.spawn and task.defer functions
  • Add Janitor / Remove Maid
  • Add Timer module

MIGRATION FROM v18 TO v19:

  • Remove requires of Thread module
  • Replace requires of Maid with Janitor
  • Thread.Spawn -> task.defer
  • Thread.SpawnNow -> task.spawn
  • Thread.Delay -> task.delay
  • Thread.DelayRepeat -> Use Timer class (see below)
  • maid:GiveTask -> janitor:Add
  • maid:GivePromise -> janitor:AddPromise
  • maid:DoCleaning -> janitor:Cleanup
  • maid[id] = nil -> janitor:Remove(id)

Timer class:
The Timer class makes it easy to schedule functions at certain intervals.

local Timer = require(Knit.Util.Timer)

local timer = Timer.new(1)
timer.Tick:Connect(function()
	print("Tock")
end)

timer:Start()
...
timer:Stop()
...
timer:Destroy()

Janitor class:
For the most part, swapping out Janitor for Maid should be quite seamless, as their APIs are nearly identical, besides some name changes. It is worth noting some significant changes:

  • Instead of clearing an item from a maid using maid[id] = nil, Janitor has a dedicated Remove method, in which you pass in the ID that you explicitly gave it on Add. For instance: janitor:Add(item, nil, "SomeID"); janitor:Remove("SomeID").
  • Janitor comes with a LinkToInstance, which lets you link the janitor instance to the life of a Roblox instance. If that instance is deparented, the janitor will be cleaned up.
  • The Add method's 2nd parameter is an optional cleanup method name, which can be used if your object's cleanup method is different than Destroy.

Removal of Thread module:
With the addition of the built-in task library, the Thread module is obsolete.

  • Use task.spawn to spawn a thread immediately (same behavior as Thread.SpawnNow).
  • Use task.defer to schedule a thread to run using the internal deferral scheduling (still within the same frame). This is roughly a replacement for Thread.Spawn. If you still want to delay a frame, simply use task.delay(0, function() ... end).
  • Use task.delay to schedule a thread to run after some period of time.
  • Use Timer class instead of Thread.DelayRepeat.

Snippets:
If you use the VS Code snippets provided from the documentation, be sure to update them to use Janitor instead of Maid.

Release v0.0.18-alpha

04 May 20:17
502391e
Compare
Choose a tag to compare

Components

  • Added optional RequiredComponents table for components
  • Added Observe method for components
  • Fixed Added and Removed events not being cleaned up when component class destroyed
  • Fixed lifecycle RunService method bindings not being cleaned up properly for future reuse

Documentation

Stability

  • Upgraded CI/CD pipeline to use latest packages

Release v0.0.17-alpha

22 Apr 15:27
Compare
Choose a tag to compare
  • Hotfix for TableUtil Sync, Assign, Extend, and Shuffle functions to do shallow copies instead of deep copies
  • Fix release GitHub action to properly use "Knit" as the top-level directory name within the zipped file
  • Fix documentation to properly use user preference theme (light/dark)

Release v0.0.16-alpha

21 Apr 17:28
Compare
Choose a tag to compare

[BR] = Breaking Change

Fixes, Additions, and Improvements

  • Project directory restructure
  • Can now include Knit as a Git submodule and reference the default rojo project to sync in (see below)
  • Added unit tests for Knit-specific utility modules
  • Added simple integration tests
  • TableUtil fixes, additions, and improvements:
    • [BR] All functions (except FastRemove and FastRemoveFirstValue) no longer mutate table
    • Fix Filter bug introduced in v0.0.15-alpha
    • Fix behavior of Extend to extend arrays and not dictionaries (use Assign to extend a dictionary)
    • Add optional RNG override parameter for Shuffle
    • Add Flat, FlatMap, Keys, Find, Every, and Some functions
    • Add documentation page for TableUtil
  • Simplify Knit.OnStart() internally to use Promise.FromEvent
  • Update Rojo version used by CI/CD pipeline
  • Fix broken links in documentation pages

Knit Submodule

If desired, Knit can now be included into a project as a Git submodule.

git submodule add https://github.com/Sleitnick/Knit ./lib/Knit

Once added, include it in your Rojo's default.project.json file as such:

{
	"tree": {
		"$className": "DataModel",
		"ReplicatedStorage": {
			"$className": "ReplicatedStorage",
			"Knit": {
				"$path": "lib/Knit/default.project.json"
			}
		}
	}
}

TableUtil Breaking Changes

All TableUtil functions (except for FastRemove and FastRemoveFirstValue) have been modified to not mutate the given table. Specifically, this impacts Sync, Assign, Extend, and Shuffle.

Instead, the functions will create a copy of the table before running any operations. This helps push for further immutability. When upgrading to this version of Knit, check to make sure your code has been changed to capture these changes.

For instance, the following code worked before but will not work as expected now:

local t = {"A", "B", "C"}
TableUtil.Shuffle(t)

To fix it, either reassign t to the returned value or capture it in a new variable:

local t = {"A", "B", "C"}
local tShuffled = TableUtil.Shuffle(t)

Release v0.0.15-alpha

12 Apr 23:05
bde9e84
Compare
Choose a tag to compare
  • Memory leak fixed with Streamable when instance was immediately available
  • Knit.GetService(serviceName) added to server-side Knit
  • Minor improvements to TableUtil
  • Util documentation split across multiple pages

Release v0.0.14-alpha

15 Mar 13:42
56fd149
Compare
Choose a tag to compare
  • Fix Signal leak when firing with no connections
  • Change ._instance to .Instance in Component
  • Components will use attributes to store unique ID instead of StringValue
  • Add Signal.Proxy constructor to wrap built-in RBXScriptSignals
  • Add Maid:GivePromise method
  • Allow dictionary tables in StreamableUtil.Compound observers list

Note breaking changes from above:

  • When upgrading, make sure to change ._instance field accessors to .Instance for components
  • ServerID StringValue for components has been switched to use attributes: instance:GetAttribute("ComponentServerId")

Release v0.0.13-alpha

04 Mar 17:52
Compare
Choose a tag to compare
  • Component:WaitFor has been rewritten to utilize built-in promise features better, which also eliminated an existing event connection leak.
  • Streamable and StreamableUtil modules added to easily manage parts that may stream in & out during runtime when using StreamingEnabled.
  • Documentation improvements.

Release v0.0.12-alpha

10 Jan 19:37
Compare
Choose a tag to compare
  • Added new 'Add' functions to automatically load all modules in a folder. This is useful for quickly loading a bunch of service or controller modules:
    • KnitServer.AddServices(folder: Instance)
    • KnitServer.AddServicesDeep(folder: Instance)
    • KnitClient.AddControllers(folder: Instance)
    • KnitClient.AddControllersDeep(folder: Instance)
  • Split up remotes to server/client versions:
    • RemoteEvent -> RemoteSignal and ClientRemoteSignal
    • RemoteProperty -> RemoteProperty and ClientRemoteProperty
  • Knit module isn't required to live in ReplicatedStorage now
  • Added EnumList class which wraps Symbols to create pseudo-enums
  • Added style guide in documentation