miolo 3.0.0-beta.184 → 3.0.0-beta.186

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.
@@ -45,7 +45,8 @@ export default async function (
45
45
  )
46
46
 
47
47
  // 4. Build Backend: Node server
48
- await miolo_build_server(appName, pkgPath, config, srvEntry, srvDest, srvExt)
48
+ const srvName = appName
49
+ await miolo_build_server(appName, pkgPath, config, srvEntry, srvDest, srvName, srvExt)
49
50
 
50
51
  console.log(`[${appName}][build] Build process completed successfully!`)
51
52
  process.exit(0)
@@ -0,0 +1,17 @@
1
+ // import { cleanFolder } from "../util.mjs"
2
+ import { miolo_build_server } from "./server/index.mjs"
3
+
4
+ export default async function (appName, binEntry, binDest, binName, binExt) {
5
+ console.log(`[${appName}][build-bin] Starting full build process...`)
6
+
7
+ const pkgPath = process.cwd()
8
+
9
+ // 1. Clean destination folder
10
+ // cleanFolder(binDest)
11
+
12
+ // 2. Build Backend script
13
+ await miolo_build_server(appName, pkgPath, {}, binEntry, binDest, binName, binExt)
14
+
15
+ console.log(`[${appName}][build-bin] Build process completed successfully!`)
16
+ process.exit(0)
17
+ }
@@ -4,23 +4,40 @@ import { miolo_bundle } from "./bundle.mjs"
4
4
  import { miolo_fix_prod_build } from "./fix.mjs"
5
5
  import { miolo_build_options_for_server } from "./options.mjs"
6
6
 
7
- async function _miolo_build_server(appName, pkgPath, srvEntry, srvDest, srvExt, watch = false) {
7
+ async function _miolo_build_server(
8
+ appName,
9
+ pkgPath,
10
+ srvEntry,
11
+ srvDest,
12
+ srvName,
13
+ srvExt,
14
+ watch = false
15
+ ) {
8
16
  const [esmnInputOptions, esmnOutputs, outputFile] = await miolo_build_options_for_server(
9
17
  appName,
10
18
  pkgPath,
11
19
  srvEntry,
12
20
  srvDest,
21
+ srvName,
13
22
  srvExt
14
23
  )
15
24
  await miolo_bundle(appName, pkgPath, esmnInputOptions, esmnOutputs, watch)
16
25
  await miolo_fix_prod_build(appName, outputFile)
17
26
  }
18
27
 
19
- export async function miolo_build_server(appName, pkgPath, _config, srvEntry, srvDest, srvExt) {
28
+ export async function miolo_build_server(
29
+ appName,
30
+ pkgPath,
31
+ _config,
32
+ srvEntry,
33
+ srvDest,
34
+ srvName,
35
+ srvExt
36
+ ) {
20
37
  // const watch = config.build.dev.watcher?.enabled === true
21
38
  const watch = false
22
39
 
23
- await _miolo_build_server(appName, pkgPath, srvEntry, srvDest, srvExt, watch)
40
+ await _miolo_build_server(appName, pkgPath, srvEntry, srvDest, srvName, srvExt, watch)
24
41
 
25
42
  if (watch) {
26
43
  const srcFolder = path.join(pkgPath, "src")
@@ -16,15 +16,16 @@ import { miolo_build_banner } from "./banner.mjs"
16
16
  const NODE_ENV = process.env?.NODE_ENV || "production"
17
17
 
18
18
  export async function miolo_build_options_for_server(
19
- appName,
19
+ _appName,
20
20
  pkgPath,
21
21
  srvEntry,
22
22
  srvDest,
23
+ srvName,
23
24
  srvExt,
24
25
  bundleDeps = true
25
26
  ) {
26
27
  const input = path.join(pkgPath, srvEntry)
27
- const outputFile = path.join(pkgPath, srvDest, `${appName}.${srvExt}`)
28
+ const outputFile = path.join(pkgPath, srvDest, `${srvName}.${srvExt}`)
28
29
 
29
30
  const inputOptions = {
30
31
  input,
package/bin/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import path from "node:path"
2
3
  import yargs from "yargs-parser"
3
4
  import { init_env_config } from "../src/config/env.mjs"
4
5
 
@@ -42,6 +43,11 @@ async function main() {
42
43
  const srvExt = args["server-ext"] || process.env.MIOLO_BUILD_SERVER_EXT || "node.bundle.mjs"
43
44
  const ssrEntry = args["ssr-entry"] || process.env.MIOLO_BUILD_SERVER_SSR_ENTRY
44
45
  const ssrDest = args["ssr-dest"] || process.env.MIOLO_BUILD_SERVER_DEST || "./build/server"
46
+ const binDest = args["bin-dest"] || "./build/bin"
47
+ const binEntry = args["bin-entry"]
48
+ const binName =
49
+ args["bin-name"] || (binEntry ? path.basename(binEntry, path.extname(binEntry)) : "")
50
+ const binExt = args["bin-ext"] || "node.bundle.mjs"
45
51
 
46
52
  switch (command) {
47
53
  case "dev": {
@@ -76,6 +82,12 @@ async function main() {
76
82
  break
77
83
  }
78
84
 
85
+ case "build-bin": {
86
+ const buildHandler = (await import("./build/build_bin.mjs")).default
87
+ await buildHandler(appName, binEntry, binDest, binName, binExt)
88
+ break
89
+ }
90
+
79
91
  case "start": {
80
92
  const startHandler = (await import("./run/start.mjs")).default
81
93
  await startHandler(appName, srvDest, srvExt)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miolo",
3
- "version": "3.0.0-beta.184",
3
+ "version": "3.0.0-beta.186",
4
4
  "description": "all-in-one koa-based server",
5
5
  "author": "Donato Lorenzo <donato@afialapis.com>",
6
6
  "contributors": [
@@ -13,6 +13,7 @@
13
13
  "deb": "npx miolo deb",
14
14
  "create-bin": "npx miolo create-bin",
15
15
  "build": "rm -fr build/cli/* build/server/* &&npx miolo build && npm run create-bin",
16
+ "build-bin": "npx miolo build-bin --bin-entry=src/server/console/check_today.mjs",
16
17
  "start": "node ./build/server/run.mjs start 1>> /var/log/miolo-sample.log 2>&1",
17
18
  "stop": "node ./build/server/run.mjs stop 1>> /var/log/miolo-sample.log 2>&1",
18
19
  "restart": "node ./build/server/run.mjs restart 1>> /var/log/miolo-sample.log 2>&1"
@@ -44,9 +45,9 @@
44
45
  "intre": "^3.0.0-beta.4",
45
46
  "joi": "^18.1.2",
46
47
  "lucide-react": "^1.14.0",
47
- "miolo-cli": "^3.0.0-beta.184",
48
+ "miolo-cli": "^3.0.0-beta.186",
48
49
  "miolo-model": "file:../miolo-model",
49
- "miolo-react": "^3.0.0-beta.184",
50
+ "miolo-react": "^3.0.0-beta.186",
50
51
  "next-themes": "^0.4.6",
51
52
  "radix-ui": "^1.4.3",
52
53
  "react": "^19.2.5",
@@ -61,7 +62,7 @@
61
62
  },
62
63
  "devDependencies": {
63
64
  "@biomejs/biome": "2.4.14",
64
- "miolo": "^3.0.0-beta.184",
65
+ "miolo": "^3.0.0-beta.186",
65
66
  "sass-embedded": "^1.99.0"
66
67
  },
67
68
  "overrides": {
@@ -0,0 +1,10 @@
1
+ import { intre_now, intre_pretty_long } from "intre"
2
+
3
+ function check_today() {
4
+ const now = intre_now()
5
+ const today = intre_pretty_long(now)
6
+ console.log(`[miolo-sample][check_today] Today is ${today}`)
7
+ return today
8
+ }
9
+
10
+ check_today()