Releases: akirarika/milkio
v0.8.0
0.8.0 - A Promise Kept
Kurokawa hated himself, hated the cowardly version of himself that acted out of fear.
Alice treated herself as the only one, it was him who showed her this colorful world, only to abandon her a few days later.
Whenever Kurokawa closed his eyes, the image of Alice leaning on his arm would appear in his mind, laughing so happily, with traces of ice cream still on the corners of her mouth.
Finally, trembling, Kurokawa pressed the elevator button leading to the top floor.
"No matter what... I won't abandon you..." Kurokawa took a deep breath, and as the elevator doors slowly opened, his eyes gradually hardened like steel.
Feature: Milkio Steps
In Milkio, a new mental model for writing APIs has been introduced: Steps. It allows you to break down long API code into several small steps, which can enhance the readability of complex API code.
async action(
params: {
by: string & typia.tags.MinLength<2> & typia.tags.MaxLength<16>;
},
context,
) {
const result = await context
/**
* Step 1
*/
.step(async (stages) => {
const message1 = `Step 1`;
return { message1 };
})
/**
* Step 2
*/
.step(async (stage) => {
const $message2 = `Step 2`;
return { $message2 };
})
/**
* Step 3
*/
.step(async (stage) => {
if (!stage.message1) throw reject("INTERNAL_SERVER_ERROR", undefined);
if (!stage.$message2) throw reject("INTERNAL_SERVER_ERROR", undefined);
return {};
})
.run();
return result;
}
Each step
is a function that returns an object, which will be merged into the next stage
.
If an attribute in the object starts with $
, Milkio treats it as a private property. Although it is always accessible in stage
, it will be removed in result
.
To avoid modifying attributes in stage
, making it difficult to know when certain values are changed, the properties are designed to be immutable.
VS Code: Milkio Structure
Note: Ensure your Milkio VS Code Extension is up to date
Now, the bottom of your VS Code Explorer will display the structure of your Milkio API. You can use it to navigate through longer API codes.
⬇️ Meta
⬇️ Action
step: Step 1
step: Step 2
step: Step 3
⬇️ Tests
test: Basic
VS Code: Simultaneously Launch Frontend Projects
Note: Ensure your Milkio VS Code Extension is up to date
Milkio now supports associating with your frontend projects and synchronously launching them when starting Milkio. Configure it in milkio.toml
as shown below.
[link]
projects = [
{ name = 'YourViteProject', cwd = '../your-project-path', script = 'bun run dev' },
]
VS Code: Workspace Optimization
Note: Ensure your Milkio VS Code Extension is up to date
Previously, when using a workspace, the Milkio menu bar would only appear if the files open on the screen were part of a Milkio project.
Now, if there is only one Milkio project in the workspace, the Milkio menu bar will always appear, assuming that you want to operate on that specific Milkio project.
Configuration: Automatic Environment-Based Switching
Now, the configuration supports automatically reading different configurations based on different environments.
https://milkio.fun/essentials/config
Testing: Support for Testing with Real Requests
Testing now includes a client
object that allows you to use a real client package to send actual requests.
https://milkio.fun/essentials/api-test
Templates: Cloudflare Workers Support
Milkio now supports Cloudflare Workers. You can create a Cloudflare Workers project by selecting the cloudflare
option when running bun create milkio
.
Documentation: Runtime Documentation Improvements
I have written documentation for each runtime, detailing important points and deployment procedures.
Bun: https://milkio.fun/runtime/bun/
Node.js: https://milkio.fun/runtime/node/
Cloudflare: https://milkio.fun/runtime/cloudflare/
Electron: https://milkio.fun/runtime/electron/
Upgrading
When using the new version, make sure to also upgrade your client package version.
bun i [email protected]
cd packages/client && bun i milkio-client
v0.6.0
0.6.0 - A Normal World
Alice's cries for help echoed in Kurokawa's ears, but he pretended not to hear, stepping into the elevator like a numb statue. The elevator descended slowly, floors passing one by one, and Alice's voice was gradually drowned out by the melody playing inside the elevator, like raindrops merging into the ocean, creating faint ripples at first, but ultimately falling silent. "Welcome back to the real world," Kurokawa said to himself, his voice trembling slightly, "a world where superpowers only exist in fantasy novels."
Electron
Now, Milkio can be used to create desktop applications and can be packaged into applications for macOS, Windows, and Linux platforms.
This has been achieved using Electron, and the communication between the main process and the rendering process in Electron can be quite troublesome. By introducing Milkio, this issue has been effectively resolved.
For front-end developers, we assume that you have installed Astro, which supports mainstream front-end frameworks (such as Vue3, React, Svelte, etc.), and defaults to SSG, which can make your application run faster.
You can experience this by running bun create milkio
and choosing the electron (alpha)
template.
However, please note that this is still in the alpha stage, and there may be many issues. Future updates may also include incompatible changes.
Node
For users concerned about the stability of Bun, you can now use Node.js to create Milkio applications.
Whether you are developing locally or running tests, it is all done using Node.js. However, during development, you still need Bun because Milkio relies on Bun to perform automatic generation and many auxiliary operations.
You can experience this by running bun create milkio
and choosing the node (beta)
template.
VS Code Template
The compatibility issue on Windows has been fixed, and now it works properly on Windows as well.
Client
The issue where the client type did not automatically update on Windows has been resolved, and now it works properly on Windows as well.
Performance Improvements
Now, the startup speed of Milkio on Windows has become very fast.
Upgrade
bun i [email protected]
v0.5.0
0.5.0 - Sky Tree
The golden sunset gradually fades from the city, street lights and signs are lit up one after another. Gazing down from the Sky Tree, the entire Tokyo looks like a gradually brightening starry sky, bustling and dazzling. "Only you would buy me ice cream," Alice clings tightly to Kurokawa's sleeve, as if she might lose him at any moment, "you would stay with me, be gentle, and... never treat me like a monster. I... might have fallen for you!"
Testing
Milkio has primarily improved its testing procedures:
-
Tests now have colorful, attractive output
-
Previously, tests would terminate upon encountering a failure; now they will not, and will instead complete all tests
-
For streams, when a test fails, it will not hang but will be correctly identified as a failure
Upgrade
bun i [email protected]
v0.4.0
0.4.0 - Anonymous Call
"Seventy-five thousand yen, for a university student like you, should be enough." A cold mechanical voice came from the phone, apparently to avoid revealing the speaker's identity. "Although I don't know why she calms down when she's with you, it saves us a lot of trouble. Take her to the top of Tokyo Skytree, the highest place in the whole of Tokyo. The high altitude is a natural barrier, that's her cage. Bring her here, wait until exactly 10 o'clock at night, find a reason to quietly leave, and we will take care of the rest."
🚨 Destructive Usage Changes: execute Related Methods
We will strive to maintain compatibility, but there may be some destructive usage changes before the 1.0 version of Milkio is released.
Previously, the usage of execute-related methods was as follows:
app.execute('foo/bar/baz', 'some-params', { 'Content-Type': 'application/json' }, { ... })
Now, the parameters have been changed to a fetch-like usage:
app.execute('foo/bar/baz', {
params: 'some-params',
headers: { 'Content-Type': 'application/json' },
...
})
Improved Failure Types
Now, the TYPE_SAFE_ERROR
failure return value type in Milkio Client is more accurate, and we can even use editor auto-completion for code like foo.fail.data.path === "$input.password"
. Yes, strings like "$input.password"
can also be auto-completed and errors can be detected.
Update command: cd ./packages/client && bun i [email protected]
Upgrade
bun i [email protected]
v0.3.0
0.3.0 - Amusement Park
"It's simple, just imagine the ice cream in my hand," Alice said while licking her ice cream, "but... it gets very tiring after a while, and I'll fall asleep right away. And it only works for things I remember in detail. When I tried to escape, I wanted to create a hat to cover my face, but instead, I created a snake that swallowed an elephant. Scary."
Brand New Creation Tool
Now, Milkio offers a tool to help you create new projects easily.
bun create milkio
By running the command and answering a series of questions, you can get a brand new Milkio project.
Windows Support
Bun has officially completed support for the Windows platform. After a series of adjustments, Milkio now supports the Windows platform as well.
Support for Stream API (Server-Sent Events)
Documentation: Stream
Now Milkio supports sending API responses in a streaming manner. This will be useful when your application includes chatting with a large language model or when you need real-time notifications when someone comments on your blog.
export const api = defineApi({
meta: {},
action: async function* (params: undefined, context) {
yield "hello";
yield "world";
},
});
Client Package Now Based on Fetch
The client package now defaults to using Fetch. Previously, you had to manually tell the client package how to send requests and how to store data through the handler
:
import { createClient } from "client";
export const client = createClient({
baseUrl: "http://localhost:9000/",
storage: localStorage,
async handler(url, body, headers) {
return await (await fetch(url, { method: "POST", body, headers })).text();
},
});
Now, by default, the client package will use Fetch to send requests and localStorage
to store data.
import { createClient } from "client";
export const client = createClient({
baseUrl: "http://localhost:9000/",
});
In some environments, you might be missing some required objects. You can provide polyfills for storage
, fetch
, and abort
in the options. For storage
, it even supports asynchronous operations.
Static Server
Documentation: Static
Milkio now supports a static server, which means you can deploy the static assets packaged by the frontend with Milkio.
VS Code Menubar
Documentation: VS Code Menubar
Now, you can freely configure the VS Code menubar for Milkio. You can place your frequently used scripts in the menubar, so you don't have to manually enter commands and can call them quickly.
Drizzle
Documentation: Drizzle
Now, Drizzle is Milkio's preferred ORM. It is the only ORM that has both a relational query API and a SQL-like query API, providing a comprehensive service when accessing relational data.
Although Drizzle might be a bit cumbersome to use, Milkio provides a series of features to simplify the use of Drizzle. The documentation for Milkio's Drizzle is written from the perspective of someone with zero SQL knowledge, allowing even those without SQL experience to quickly get started through the documentation.
Optimizing Generate Phase Performance
In the past, the generate phase would load TypeScript files to obtain information about the API. Now, it has been changed to directly analyze the TypeScript files as strings.
v0.2.0
0.2.0 - First Encounter
The television was reporting the news, and Alice was the superpowered individual who had escaped from the lab. Kurokawa muttered to himself, wondering what kind of trouble he had gotten himself into by taking pity on her and bringing her home. She may have lost her memory, having no knowledge of her past experiences, and would only cling to Kurokawa, tugging at his sleeve and saying, "I'm hungry."
Commands
Now, Milkio can also be used to develop small tools that run in the terminal! Documentation
At /apps/$/
directory will be treated as a command. For commands, usage is similar to regular APIs, with the exception of the parameter format.
You now have two parameters: commands
and options
. These parameters are automatically parsed by Milkio from argv
. Take a look at the examples below, which show the executed command and the obtained params
.
./app say hello world --foo=bar --enable
params: {
commands: ["hello", "world"],
options: {
foo: "bar",
enable: true,
},
}
To learn more about usage, please read the documentation
Upgrade
bun i [email protected]
v0.1.0
0.1.0 - Prologue
At the end of the world, Kurokawa remembered the first time he saw Alice. At that time, Kurokawa was walking along the busiest street in Tokyo, where a girl was sitting there, dirty and disheveled. Hugging her knees, her eyes were filled with confusion and helplessness, as if she were a lonely kitten, abandoned by the world.
Happy Birthday
This is the first version of Milkio!
In fact, before the release, I have spent nearly a year polishing it. So, despite being just released, Milkio is quite complete, with beautiful documentation and comprehensive tools. I hope you like it!
You might be wondering what the opening paragraph is about. Many open-source projects like to give each version a somewhat melodramatic name, and I find this tradition quite interesting! I wanted to use chapters of a novel as version names, and use paragraphs from the novel as the opening of the release notes. The novel itself is fictional, and the paragraphs are also fabricated by me, but if given the chance, I might turn it into a real novel and publish it (just a thought).
Anyway! I hope you like Milkio!