milkio 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/c.ts CHANGED
@@ -30,23 +30,13 @@ const commands = {
30
30
  async test(files?: string, reserved?: string) {
31
31
  const run = async () => {
32
32
  const packageJson = await JSON.parse((await readFile(join(rootPath, "package.json"))).toString());
33
- // A bug has appeared in the new version of bun: https://github.com/oven-sh/bun/issues/9428
34
- // Therefore, temporarily switch to another implementation.
35
- // await $`${{ raw: packageJson.scripts.start }}`.env({
36
- // ...env,
37
- // milkio_RUN_MODE: "API_TEST",
38
- // milkio_TEST: files ?? "1"
39
- // });
40
- //
41
- await exec(rootPath, ["bash", "-c", packageJson.scripts.start as string], {
42
- env: {
43
- ...env,
44
- milkio_RUN_MODE: "API_TEST",
45
- milkio_TEST: files ?? "1"
46
- }
33
+ await $`${{ raw: packageJson.scripts.start }}`.env({
34
+ ...env,
35
+ MILKIO_RUN_MODE: "API_TEST",
36
+ MILKIO_TEST: files ?? "1"
47
37
  });
48
38
  };
49
- if (!env.milkio_TEST_RESERVED && reserved !== "1") {
39
+ if (!env.MILKIO_TEST_RESERVED && reserved !== "1") {
50
40
  // Normal test
51
41
  await run();
52
42
  } else {
package/kernel/config.ts CHANGED
@@ -4,8 +4,8 @@ import { envToBoolean, envToNumber, envToString } from "..";
4
4
  export const configMilkio = {
5
5
  cwd: cwd(),
6
6
  port: envToNumber(env.PORT, 9000),
7
- milkioRunMode: envToString(env.milkio_RUN_MODE, "DEFAULT"),
8
- milkioTest: envToString(env.milkio_TEST, ""),
7
+ milkioRunMode: envToString(env.MILKIO_RUN_MODE, "DEFAULT"),
8
+ milkioTest: envToString(env.MILKIO_TEST, ""),
9
9
  debug: envToBoolean(env.DEBUG, false),
10
10
  ignorePathLevel: envToNumber(env.IGNORE_PATH_LEVEL, 0),
11
11
  corsAllowMethods: envToString(env.CORS_ALLOW_METHODS, "*"),
package/package.json CHANGED
@@ -2,20 +2,19 @@
2
2
  "name": "milkio",
3
3
  "type": "module",
4
4
  "module": "index.ts",
5
- "version": "0.0.4",
5
+ "version": "0.0.6",
6
6
  "peerDependencies": {
7
7
  "typescript": "^5.4.2"
8
8
  },
9
9
  "dependencies": {
10
10
  "@poech/camel-hump-under": "^1.1.0",
11
11
  "@southern-aurora/tson": "2.0.2",
12
- "ulidx": "^2.3.0"
12
+ "ulidx": "^2.3.0",
13
+ "typia": "5.5.5",
14
+ "ejs": "^3.1.9"
13
15
  },
14
16
  "devDependencies": {
15
17
  "@types/bun": "latest",
16
- "walk-sync": "^3.0.0",
17
- "typia": "5.5.5",
18
- "ejs": "^3.1.9",
19
18
  "@types/ejs": "^3.1.5",
20
19
  "@types/js-beautify": "^1.14.3",
21
20
  "ts-patch": "^3.1.2",
@@ -6,7 +6,7 @@ import { join } from "node:path";
6
6
  import { copyFile, mkdir } from "node:fs/promises";
7
7
 
8
8
  export async function buildDTO() {
9
- console.log("🧊 milkio DTO Building..");
9
+ console.log("🧊 Milkio DTO Building..");
10
10
 
11
11
  removeDir(join(cwd(), "packages", "dto", "dist"));
12
12
  removeDir(join(cwd(), "packages", "dto", "generate"));
@@ -36,7 +36,7 @@ export async function buildDTO() {
36
36
 
37
37
  const root = join(cwd(), "packages", "dto");
38
38
 
39
- console.log("🧊 milkio DTO Build Finished");
39
+ console.log("🧊 Milkio DTO Build Finished");
40
40
  console.log("\x1B[2m");
41
41
  console.log("Now, your latest code (including changes to your interface) is built to the latest version and waiting for your release!");
42
42
  console.log("");
@@ -2,12 +2,12 @@
2
2
 
3
3
  import ejs from "ejs";
4
4
  import { join } from "node:path";
5
- import walkSync from "walk-sync";
6
5
  import { existsSync, mkdirSync } from "node:fs";
7
6
  import { cwd, exit } from "node:process";
8
7
  import { unlink, writeFile } from "node:fs/promises";
9
8
  import { exec as nodeExec } from "node:child_process";
10
9
  import { camel, hyphen } from "@poech/camel-hump-under";
10
+ import { Glob } from "bun";
11
11
 
12
12
  const utils = {
13
13
  camel: (str: string) => camel(str).replaceAll("-", "").replaceAll("_", ""),
@@ -41,9 +41,8 @@ export async function generateApp() {
41
41
  apiTestPaths: [] as Array<string>
42
42
  };
43
43
 
44
- const appFiles = walkSync(join(cwd(), "src", "apps"), {
45
- directories: false
46
- });
44
+ const glob = new Glob("**/*.ts");
45
+ const appFiles = await Array.fromAsync(glob.scan({ cwd: join(cwd(), "src", "apps") }));
47
46
 
48
47
  for (const path of appFiles) {
49
48
  if (!path.endsWith(".ts")) continue;
@@ -2,10 +2,10 @@
2
2
 
3
3
  import ejs from "ejs";
4
4
  import { join } from "node:path";
5
- import walkSync from "walk-sync";
6
5
  import { existsSync } from "node:fs";
7
6
  import { cwd } from "node:process";
8
7
  import { writeFile } from "node:fs/promises";
8
+ import { Glob } from "bun";
9
9
 
10
10
  export async function generateDatabase() {
11
11
  if (existsSync(join(cwd(), "src", "databases"))) {
@@ -13,9 +13,8 @@ export async function generateDatabase() {
13
13
  await writeFile(join("generate", "database-schema.ts"), ``);
14
14
  }
15
15
  const filePath = join(cwd(), "generate", "database-schema.ts");
16
- const databaseFiles = walkSync(join(cwd(), "src", "databases"), {
17
- directories: false
18
- }).filter((file) => file.endsWith(".ts"));
16
+ const glob = new Glob("**/*.ts");
17
+ const databaseFiles = await Array.fromAsync(glob.scan({ cwd: join(cwd(), "src", "databases") }));
19
18
  const template = `<% for (const path of ${"databaseFiles"}) { %>export * from '${"../src/databases"}/<%= path.slice(0, -3) %>'
20
19
  <% } %>`;
21
20
  await writeFile(filePath, ejs.render(template, { databaseFiles }));
@@ -14,10 +14,10 @@ export async function generate() {
14
14
  await generateDatabase();
15
15
  }
16
16
 
17
- console.log("milkio Database Generating..");
17
+ console.log("Milkio Database Generating..");
18
18
 
19
19
  await generate();
20
20
 
21
- console.log("\nāœ… milkio Database Generated!\n");
21
+ console.log("\nāœ… Milkio Database Generated!\n");
22
22
 
23
23
  exit(0);
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { argv, exit } from "node:process";
4
4
  import { generateApp } from "./generate/generate-app";
5
- console.log("milkio Quick Generating..");
5
+ console.log("Milkio Quick Generating..");
6
6
 
7
7
  export async function generatePartial(path?: string) {
8
8
  await generateApp();
@@ -10,6 +10,6 @@ export async function generatePartial(path?: string) {
10
10
 
11
11
  await generatePartial(...(argv.slice(3) as any));
12
12
 
13
- console.log("\nāœ… milkio Generated!");
13
+ console.log("\nāœ… Milkio Generated!");
14
14
 
15
15
  exit(0);
@@ -14,10 +14,10 @@ export async function generate() {
14
14
  await generateApp();
15
15
  }
16
16
 
17
- console.log("milkio Generating..");
17
+ console.log("Milkio Generating..");
18
18
 
19
19
  await generate();
20
20
 
21
- console.log("\nāœ… milkio Generated!");
21
+ console.log("\nāœ… Milkio Generated!");
22
22
 
23
23
  exit(0);
package/types.ts CHANGED
@@ -35,8 +35,6 @@ export type CookbookItem = {
35
35
  }>;
36
36
  };
37
37
 
38
- export type DatabaseType<Table extends { findFirst: () => unknown }, Override = {}> = Mixin<NonNullable<Awaited<ReturnType<Table["findFirst"]>>>, Override>;
39
-
40
38
  export type Override<P, S> = Omit<P, keyof S> & S;
41
39
 
42
40
  export type Mixin<T, U> = U & Omit<T, keyof U>;