miqro 5.0.4 → 6.0.3
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/.eslintrc +15 -0
- package/README.md +618 -20
- package/build/editor.bundle.js +61154 -0
- package/build/esm/editor/auth.d.ts +6 -0
- package/build/esm/editor/auth.js +42 -0
- package/build/esm/editor/auth.js.map +1 -0
- package/build/esm/editor/common/admin-interface.d.ts +36 -0
- package/build/esm/editor/common/admin-interface.js +45 -0
- package/build/esm/editor/common/admin-interface.js.map +1 -0
- package/build/esm/editor/common/constants.d.ts +4 -0
- package/build/esm/editor/common/constants.js +21 -0
- package/build/esm/editor/common/constants.js.map +1 -0
- package/build/esm/editor/common/constants.server.d.ts +2 -0
- package/build/esm/editor/common/constants.server.js +5 -0
- package/build/esm/editor/common/constants.server.js.map +1 -0
- package/build/esm/editor/common/editor-index.d.ts +2 -0
- package/build/esm/editor/common/editor-index.js +15 -0
- package/build/esm/editor/common/editor-index.js.map +1 -0
- package/build/esm/editor/common/html-encode.d.ts +1 -0
- package/build/esm/editor/common/html-encode.js +15 -0
- package/build/esm/editor/common/html-encode.js.map +1 -0
- package/build/esm/editor/common/log-socket.d.ts +13 -0
- package/build/esm/editor/common/log-socket.js +68 -0
- package/build/esm/editor/common/log-socket.js.map +1 -0
- package/build/esm/editor/common/templates.d.ts +11 -0
- package/build/esm/editor/common/templates.js +444 -0
- package/build/esm/editor/common/templates.js.map +1 -0
- package/build/esm/editor/components/api-preview.d.ts +11 -0
- package/build/esm/editor/components/api-preview.js +91 -0
- package/build/esm/editor/components/api-preview.js.map +1 -0
- package/build/esm/editor/components/editor.d.ts +16 -0
- package/build/esm/editor/components/editor.js +355 -0
- package/build/esm/editor/components/editor.js.map +1 -0
- package/build/esm/editor/components/file-browser.d.ts +37 -0
- package/build/esm/editor/components/file-browser.js +122 -0
- package/build/esm/editor/components/file-browser.js.map +1 -0
- package/build/esm/editor/components/file-editor-toolbar.d.ts +22 -0
- package/build/esm/editor/components/file-editor-toolbar.js +94 -0
- package/build/esm/editor/components/file-editor-toolbar.js.map +1 -0
- package/build/esm/editor/components/file-editor.d.ts +32 -0
- package/build/esm/editor/components/file-editor.js +60 -0
- package/build/esm/editor/components/file-editor.js.map +1 -0
- package/build/esm/editor/components/filter-query.d.ts +1 -0
- package/build/esm/editor/components/filter-query.js +23 -0
- package/build/esm/editor/components/filter-query.js.map +1 -0
- package/build/esm/editor/components/highlight-text-area.d.ts +11 -0
- package/build/esm/editor/components/highlight-text-area.js +139 -0
- package/build/esm/editor/components/highlight-text-area.js.map +1 -0
- package/build/esm/editor/components/log-viewer.d.ts +6 -0
- package/build/esm/editor/components/log-viewer.js +70 -0
- package/build/esm/editor/components/log-viewer.js.map +1 -0
- package/build/esm/editor/components/new-file.d.ts +10 -0
- package/build/esm/editor/components/new-file.js +118 -0
- package/build/esm/editor/components/new-file.js.map +1 -0
- package/build/esm/editor/components/scroll-query.d.ts +7 -0
- package/build/esm/editor/components/scroll-query.js +22 -0
- package/build/esm/editor/components/scroll-query.js.map +1 -0
- package/build/esm/editor/components/start-page.d.ts +13 -0
- package/build/esm/editor/components/start-page.js +31 -0
- package/build/esm/editor/components/start-page.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.d.ts +3 -0
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +30 -0
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/read.api.d.ts +5 -0
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js +50 -0
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.d.ts +4 -0
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +40 -0
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.d.ts +26 -0
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +150 -0
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/write.api.d.ts +3 -0
- package/build/esm/editor/http/admin/editor/api/fs/write.api.js +39 -0
- package/build/esm/editor/http/admin/editor/api/fs/write.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/server/reload.api.d.ts +10 -0
- package/build/esm/editor/http/admin/editor/api/server/reload.api.js +46 -0
- package/build/esm/editor/http/admin/editor/api/server/reload.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/server/restart.api.d.ts +10 -0
- package/build/esm/editor/http/admin/editor/api/server/restart.api.js +46 -0
- package/build/esm/editor/http/admin/editor/api/server/restart.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/editor.js +8 -0
- package/build/esm/editor/http/admin/editor/editor.js.map +1 -0
- package/build/esm/editor/http/admin/editor/index.api.d.ts +3 -0
- package/build/esm/editor/http/admin/editor/index.api.js +22 -0
- package/build/esm/editor/http/admin/editor/index.api.js.map +1 -0
- package/build/esm/editor/server.d.ts +3 -0
- package/build/esm/editor/server.js +50 -0
- package/build/esm/editor/server.js.map +1 -0
- package/build/esm/editor/ws.d.ts +3 -0
- package/build/esm/editor/ws.js +12 -0
- package/build/esm/editor/ws.js.map +1 -0
- package/build/esm/src/cluster.js +11 -0
- package/build/esm/src/cluster.js.map +1 -0
- package/build/esm/src/common/arguments.d.ts +22 -0
- package/build/esm/src/common/arguments.js +310 -0
- package/build/esm/src/common/arguments.js.map +1 -0
- package/build/esm/src/common/assets.d.ts +11 -0
- package/build/esm/src/common/assets.js +121 -0
- package/build/esm/src/common/assets.js.map +1 -0
- package/build/esm/src/common/checksum.d.ts +19 -0
- package/build/esm/src/common/checksum.js +57 -0
- package/build/esm/src/common/checksum.js.map +1 -0
- package/build/esm/src/common/constants.d.ts +10 -0
- package/build/esm/src/common/constants.js +14 -0
- package/build/esm/src/common/constants.js.map +1 -0
- package/build/esm/src/common/content-type.d.ts +4 -0
- package/build/esm/src/common/content-type.js +82 -0
- package/build/esm/src/common/content-type.js.map +1 -0
- package/build/esm/src/common/esbuild.d.ts +17 -0
- package/build/esm/src/common/esbuild.js +79 -0
- package/build/esm/src/common/esbuild.js.map +1 -0
- package/build/esm/src/common/exit.d.ts +2 -0
- package/build/esm/src/common/exit.js +84 -0
- package/build/esm/src/common/exit.js.map +1 -0
- package/build/esm/src/common/fs.d.ts +8 -0
- package/build/esm/src/common/fs.js +17 -0
- package/build/esm/src/common/fs.js.map +1 -0
- package/build/esm/src/common/help.d.ts +3 -0
- package/build/esm/src/common/help.js +44 -0
- package/build/esm/src/common/help.js.map +1 -0
- package/build/esm/src/common/jsx.d.ts +52 -0
- package/build/esm/src/common/jsx.js +365 -0
- package/build/esm/src/common/jsx.js.map +1 -0
- package/build/esm/src/common/paths.d.ts +14 -0
- package/build/esm/src/common/paths.js +110 -0
- package/build/esm/src/common/paths.js.map +1 -0
- package/build/esm/src/common/watch.d.ts +3 -0
- package/build/esm/src/common/watch.js +74 -0
- package/build/esm/src/common/watch.js.map +1 -0
- package/build/esm/src/inflate/inflate-sea.d.ts +5 -0
- package/build/esm/src/inflate/inflate-sea.js +175 -0
- package/build/esm/src/inflate/inflate-sea.js.map +1 -0
- package/build/esm/src/inflate/inflate.d.ts +14 -0
- package/build/esm/src/inflate/inflate.js +65 -0
- package/build/esm/src/inflate/inflate.js.map +1 -0
- package/build/esm/src/inflate/md.d.ts +2 -0
- package/build/esm/src/inflate/md.js +19 -0
- package/build/esm/src/inflate/md.js.map +1 -0
- package/build/esm/src/inflate/setup-auth.d.ts +3 -0
- package/build/esm/src/inflate/setup-auth.js +38 -0
- package/build/esm/src/inflate/setup-auth.js.map +1 -0
- package/build/esm/src/inflate/setup-cors.d.ts +3 -0
- package/build/esm/src/inflate/setup-cors.js +38 -0
- package/build/esm/src/inflate/setup-cors.js.map +1 -0
- package/build/esm/src/inflate/setup-db.d.ts +8 -0
- package/build/esm/src/inflate/setup-db.js +99 -0
- package/build/esm/src/inflate/setup-db.js.map +1 -0
- package/build/esm/src/inflate/setup-http.d.ts +37 -0
- package/build/esm/src/inflate/setup-http.js +543 -0
- package/build/esm/src/inflate/setup-http.js.map +1 -0
- package/build/esm/src/inflate/setup-log.d.ts +7 -0
- package/build/esm/src/inflate/setup-log.js +37 -0
- package/build/esm/src/inflate/setup-log.js.map +1 -0
- package/build/esm/src/inflate/setup-server-config.d.ts +7 -0
- package/build/esm/src/inflate/setup-server-config.js +37 -0
- package/build/esm/src/inflate/setup-server-config.js.map +1 -0
- package/build/esm/src/inflate/setup-test.d.ts +2 -0
- package/build/esm/src/inflate/setup-test.js +22 -0
- package/build/esm/src/inflate/setup-test.js.map +1 -0
- package/build/esm/src/inflate/setup-ws.d.ts +4 -0
- package/build/esm/src/inflate/setup-ws.js +46 -0
- package/build/esm/src/inflate/setup-ws.js.map +1 -0
- package/build/esm/src/inflate/utils/sea-utils.d.ts +2 -0
- package/build/esm/src/inflate/utils/sea-utils.js +13 -0
- package/build/esm/src/inflate/utils/sea-utils.js.map +1 -0
- package/build/esm/src/lib.d.ts +13 -0
- package/build/esm/src/lib.js +17 -0
- package/build/esm/src/lib.js.map +1 -0
- package/build/esm/src/main.d.ts +2 -0
- package/build/esm/src/main.js +92 -0
- package/build/esm/src/main.js.map +1 -0
- package/build/esm/src/services/app.d.ts +88 -0
- package/build/esm/src/services/app.js +619 -0
- package/build/esm/src/services/app.js.map +1 -0
- package/build/esm/src/services/editor.d.ts +3 -0
- package/build/esm/src/services/editor.js +61 -0
- package/build/esm/src/services/editor.js.map +1 -0
- package/build/esm/src/services/globals.d.ts +3 -0
- package/build/esm/src/services/globals.js +139 -0
- package/build/esm/src/services/globals.js.map +1 -0
- package/build/esm/src/services/hot-reload.d.ts +1 -0
- package/build/esm/src/services/hot-reload.js +45 -0
- package/build/esm/src/services/hot-reload.js.map +1 -0
- package/build/esm/src/services/migrations.d.ts +4 -0
- package/build/esm/src/services/migrations.js +61 -0
- package/build/esm/src/services/migrations.js.map +1 -0
- package/build/esm/src/services/utils/cache.d.ts +19 -0
- package/build/esm/src/services/utils/cache.js +85 -0
- package/build/esm/src/services/utils/cache.js.map +1 -0
- package/build/esm/src/services/utils/cluster-cache.d.ts +20 -0
- package/build/esm/src/services/utils/cluster-cache.js +211 -0
- package/build/esm/src/services/utils/cluster-cache.js.map +1 -0
- package/build/esm/src/services/utils/cluster-ws.d.ts +24 -0
- package/build/esm/src/services/utils/cluster-ws.js +176 -0
- package/build/esm/src/services/utils/cluster-ws.js.map +1 -0
- package/build/esm/src/services/utils/db-manager.d.ts +20 -0
- package/build/esm/src/services/utils/db-manager.js +59 -0
- package/build/esm/src/services/utils/db-manager.js.map +1 -0
- package/build/esm/src/services/utils/get-route.d.ts +9 -0
- package/build/esm/src/services/utils/get-route.js +58 -0
- package/build/esm/src/services/utils/get-route.js.map +1 -0
- package/build/esm/src/services/utils/log.d.ts +17 -0
- package/build/esm/src/services/utils/log.js +74 -0
- package/build/esm/src/services/utils/log.js.map +1 -0
- package/build/esm/src/services/utils/server-interface.d.ts +41 -0
- package/build/esm/src/services/utils/server-interface.js +74 -0
- package/build/esm/src/services/utils/server-interface.js.map +1 -0
- package/build/esm/src/services/utils/websocketmanager.d.ts +23 -0
- package/build/esm/src/services/utils/websocketmanager.js +128 -0
- package/build/esm/src/services/utils/websocketmanager.js.map +1 -0
- package/build/esm/src/types.d.ts +166 -0
- package/build/esm/src/types.js +2 -0
- package/build/esm/src/types.js.map +1 -0
- package/build/jsx.dom.js +1585 -0
- package/build/lib.cjs +14009 -0
- package/build/postject.base64.cjs +1 -0
- package/editor/auth.ts +51 -0
- package/editor/common/admin-interface.ts +84 -0
- package/editor/common/constants.server.ts +5 -0
- package/editor/common/constants.ts +21 -0
- package/editor/common/editor-index.tsx +17 -0
- package/editor/common/html-encode.ts +14 -0
- package/editor/common/log-socket.tsx +82 -0
- package/editor/common/templates.ts +448 -0
- package/editor/components/api-preview.tsx +116 -0
- package/editor/components/editor.tsx +483 -0
- package/editor/components/file-browser.tsx +295 -0
- package/editor/components/file-editor-toolbar.tsx +187 -0
- package/editor/components/file-editor.tsx +122 -0
- package/editor/components/filter-query.tsx +22 -0
- package/editor/components/highlight-text-area.tsx +159 -0
- package/editor/components/log-viewer.tsx +110 -0
- package/editor/components/new-file.tsx +169 -0
- package/editor/components/scroll-query.tsx +22 -0
- package/editor/components/start-page.tsx +49 -0
- package/editor/http/admin/editor/api/fs/delete.api.tsx +32 -0
- package/editor/http/admin/editor/api/fs/read.api.tsx +55 -0
- package/editor/http/admin/editor/api/fs/rename.api.tsx +41 -0
- package/editor/http/admin/editor/api/fs/scan.api.tsx +181 -0
- package/editor/http/admin/editor/api/fs/write.api.tsx +41 -0
- package/editor/http/admin/editor/api/server/reload.api.ts +52 -0
- package/editor/http/admin/editor/api/server/restart.api.tsx +52 -0
- package/editor/http/admin/editor/editor.tsx +8 -0
- package/editor/http/admin/editor/font.ttf +0 -0
- package/editor/http/admin/editor/index.api.tsx +39 -0
- package/editor/http/admin/editor/style.css +620 -0
- package/editor/server.ts +57 -0
- package/editor/static/android-chrome-192x192.png +0 -0
- package/editor/static/android-chrome-512x512.png +0 -0
- package/editor/static/apple-touch-icon.png +0 -0
- package/editor/static/editor.bundle.in.mjs +20 -0
- package/editor/static/favicon-16x16.png +0 -0
- package/editor/static/favicon-32x32.png +0 -0
- package/editor/static/favicon.ico +0 -0
- package/editor/static/site.webmanifest +19 -0
- package/editor/ws.ts +15 -0
- package/package.json +43 -24
- package/package.json--OLD +36 -0
- package/sea/app.sh +33 -0
- package/sea/base64.js +3 -0
- package/sea/basic-compile.base64.sh +1 -0
- package/sea/basic-compile.sh +73 -0
- package/sea/basic-config.json +9 -0
- package/sea/compile.sh +124 -0
- package/sea/copy-types.sh +46 -0
- package/sea/editor-assets/editor.bundle.in.mjs +19 -0
- package/sea/esbuild.sh +31 -0
- package/sea/generate-global-types-asset-json.js +34 -0
- package/sea/install-esbuild.sh +53 -0
- package/sea/install-nodejs.sh +49 -0
- package/sea/main.sh +34 -0
- package/sea/node.sh +33 -0
- package/sea/node.version.tag +1 -0
- package/sea/precompile.sh +7 -0
- package/sea/release-tar.sh +5 -0
- package/sea/sign-add.sh +22 -0
- package/sea/sign-remove.sh +22 -0
- package/sea/tsc.sh +1 -0
- package/sea/types.json +1 -0
- package/src/cluster.ts +16 -0
- package/src/common/arguments.ts +366 -0
- package/src/common/assets.ts +124 -0
- package/src/common/checksum.ts +58 -0
- package/src/common/constants.ts +18 -0
- package/src/common/content-type.ts +84 -0
- package/src/common/esbuild.ts +94 -0
- package/src/common/exit.ts +91 -0
- package/src/common/fs.ts +17 -0
- package/src/common/help.ts +46 -0
- package/src/common/jsx.ts +414 -0
- package/src/common/paths.ts +117 -0
- package/src/common/watch.ts +80 -0
- package/src/inflate/inflate-sea.ts +193 -0
- package/src/inflate/inflate.ts +96 -0
- package/src/inflate/md.ts +20 -0
- package/src/inflate/setup-auth.ts +40 -0
- package/src/inflate/setup-cors.ts +40 -0
- package/src/inflate/setup-db.ts +113 -0
- package/src/inflate/setup-http.ts +643 -0
- package/src/inflate/setup-log.ts +44 -0
- package/src/inflate/setup-server-config.ts +47 -0
- package/src/inflate/setup-test.ts +23 -0
- package/src/inflate/setup-ws.ts +48 -0
- package/src/inflate/utils/sea-utils.ts +14 -0
- package/src/lib.ts +19 -0
- package/src/main.ts +87 -0
- package/src/services/app.ts +718 -0
- package/src/services/editor.tsx +93 -0
- package/src/services/globals.ts +143 -0
- package/src/services/hot-reload.ts +46 -0
- package/src/services/migrations.ts +66 -0
- package/src/services/utils/cache.ts +88 -0
- package/src/services/utils/cluster-cache.ts +225 -0
- package/src/services/utils/cluster-ws.ts +192 -0
- package/src/services/utils/db-manager.ts +79 -0
- package/src/services/utils/get-route.ts +70 -0
- package/src/services/utils/log.ts +91 -0
- package/src/services/utils/server-interface.ts +166 -0
- package/src/services/utils/websocketmanager.ts +139 -0
- package/src/types/@esbuild.d.ts +1 -0
- package/src/types/@miqro/core.d.ts +2 -0
- package/src/types/@miqro/jsx.d.ts +2 -0
- package/src/types/@miqro/parser.d.ts +2 -0
- package/src/types/@miqro/query.d.ts +2 -0
- package/src/types/@miqro/request.d.ts +2 -0
- package/src/types/@miqro/test.d.ts +2 -0
- package/src/types/@miqro.d.ts +1 -0
- package/src/types/@types.d.ts +1 -0
- package/src/types/browser.globals.d.ts +9 -0
- package/src/types/globals.d.ts +2 -0
- package/src/types/jsx.globals.d.ts +37 -0
- package/src/types/miqro.d.ts +109 -0
- package/src/types/postject.d.ts +1 -0
- package/src/types/server.globals.d.ts +72 -0
- package/src/types.ts +199 -0
- package/tsconfig.json +35 -0
- package/build/cli.js +0 -4
- package/build/cmd-map.d.ts +0 -90
- package/build/cmd-map.js +0 -460
- package/build/index.js +0 -2
- package/build/utils/doc/json.d.ts +0 -7
- package/build/utils/doc/json.js +0 -12
- package/build/utils/doc/md.d.ts +0 -19
- package/build/utils/doc/md.js +0 -173
- package/build/utils/exec.d.ts +0 -32
- package/build/utils/exec.js +0 -102
- package/build/utils/templates.d.ts +0 -33
- package/build/utils/templates.js +0 -302
- package/build/utils/watch.d.ts +0 -1
- package/build/utils/watch.js +0 -35
- /package/build/{index.d.ts → esm/editor/http/admin/editor/editor.d.ts} +0 -0
- /package/build/{cli.d.ts → esm/src/cluster.d.ts} +0 -0
package/.eslintrc
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parser": "@typescript-eslint/parser",
|
|
3
|
+
"extends": [
|
|
4
|
+
"plugin:@typescript-eslint/recommended"
|
|
5
|
+
],
|
|
6
|
+
"parserOptions": {
|
|
7
|
+
"ecmaVersion": 2018,
|
|
8
|
+
"sourceType": "module"
|
|
9
|
+
},
|
|
10
|
+
"rules": {
|
|
11
|
+
// Aca puedes modificar alguna regla específica, por ejemplo:
|
|
12
|
+
// "@typescript-eslint/explicit-function-return-type": "off",
|
|
13
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
14
|
+
}
|
|
15
|
+
}
|
package/README.md
CHANGED
|
@@ -1,31 +1,629 @@
|
|
|
1
|
-
# miqro
|
|
1
|
+
# miqro
|
|
2
2
|
|
|
3
|
+
**experimental** development cli for **static web site generation** using JSX.
|
|
4
|
+
|
|
5
|
+
it uses ```esbuild``` for faster transpilation.
|
|
6
|
+
|
|
7
|
+
but also can
|
|
8
|
+
|
|
9
|
+
- can create **javascript native** ```WebComponents``` using ```JSX``` with ```@miqro/jsx```.
|
|
10
|
+
|
|
11
|
+
- can transform ```markdown``` to **html** using ```showdown```.
|
|
12
|
+
|
|
13
|
+
- can also host custom **API** endpoints with a complete web framework if more than a static web site generator is needed.
|
|
14
|
+
|
|
15
|
+
- can provide a database connection to ```sqlite3```, ```postgres``` and ```sql server``` using ```@miqro/query```. by default it uses the native ```node:sqlite3``` **experimental** module for ```Node.js >=20.x``` but can also use ```sqlite3```, ```pg``` and others.
|
|
16
|
+
|
|
17
|
+
- can manage **database migrations** for your **app** or **static site** build using a database as source.
|
|
18
|
+
|
|
19
|
+
- provide built-in ```editor``` for **development** using ```highlight.js``` for **code highlight**.
|
|
20
|
+
|
|
21
|
+
- can run generate **API documentation** using **markdown** or **json**.
|
|
22
|
+
|
|
23
|
+
- can run **tests** on your **app** or **static site**.
|
|
24
|
+
|
|
25
|
+
- can be installed and run **without Node.js** installed as a standalone ```NODE:SEA``` binary for ```linux-x64```, ```linux-arm64```, ```darwin-x64``` and ```darwin-arm64```.
|
|
26
|
+
|
|
27
|
+
- can create a standalone ```NODE:SEA``` ```binary``` of your webapp for ```linux-x64```, ```linux-arm64```, ```darwin-x64``` and ```darwin-arm64```.
|
|
28
|
+
|
|
29
|
+
## installation
|
|
30
|
+
|
|
31
|
+
### without Node.js installed as a NODE:SEA binary.
|
|
32
|
+
|
|
33
|
+
download the standalone binary from the [releases](https://github.com/claukers/miqro/releases) page.
|
|
34
|
+
|
|
35
|
+
### npm dependency for Node.js project
|
|
36
|
+
|
|
37
|
+
or use it as a dependecy on your Node.js project.
|
|
38
|
+
|
|
39
|
+
```npm install miqro```
|
|
40
|
+
|
|
41
|
+
## getting started basic example static site generated with jsx
|
|
42
|
+
|
|
43
|
+
project structure
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
example/
|
|
47
|
+
http/
|
|
48
|
+
about/
|
|
49
|
+
...
|
|
50
|
+
index.html.tsx
|
|
51
|
+
static/
|
|
52
|
+
...
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 1. create an empty folder to contain the example service and files
|
|
56
|
+
|
|
57
|
+
```mkdir -p example/http```
|
|
58
|
+
|
|
59
|
+
### 2. create a basic ```.html.tsx``` file.
|
|
60
|
+
|
|
61
|
+
```example/http/index.html.tsx```
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
export default (req, res) => {
|
|
65
|
+
return <html>
|
|
66
|
+
<body>
|
|
67
|
+
<h1>Hello World!</h1>
|
|
68
|
+
</body>
|
|
69
|
+
</html>
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
to host a watch server with the example run the following command.
|
|
74
|
+
|
|
75
|
+
```miqro --watch --service example/```
|
|
76
|
+
|
|
77
|
+
then open a browser and go to ```http://localhost:8080/index.html``` to watch the changes you make into the file.
|
|
78
|
+
|
|
79
|
+
### 3. generate static files to host with a web server
|
|
80
|
+
|
|
81
|
+
to generate the static files just run the command.
|
|
82
|
+
|
|
83
|
+
```miqro --inflate --inflate-dir build/ --service example/```
|
|
84
|
+
|
|
85
|
+
the generated static files will be written in ```build/example/http/static````
|
|
86
|
+
|
|
87
|
+
and can be served like this.
|
|
88
|
+
|
|
89
|
+
```python3 -m http.server 8080 build/example/http/static```
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Documentation
|
|
93
|
+
|
|
94
|
+
### usage as a module
|
|
95
|
+
|
|
96
|
+
first install as a dependency
|
|
97
|
+
|
|
98
|
+
```npm install miqro --save```
|
|
99
|
+
|
|
100
|
+
example loading the service created in the getting started above.
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { Miqro } from "miqro";
|
|
104
|
+
|
|
105
|
+
const app = new Miqro({
|
|
106
|
+
services: ["example/"],
|
|
107
|
+
//name: "SOME NAME", // if running inside node:cluster worker you MUST set this value to allow worker syncronization
|
|
108
|
+
//port: "3000",
|
|
109
|
+
//hotreload: false,
|
|
110
|
+
//editor: false,
|
|
111
|
+
//editor: false,
|
|
112
|
+
});
|
|
113
|
+
// to inflate to a dir
|
|
114
|
+
await app.inflate({
|
|
115
|
+
inflateDir: "build/";
|
|
116
|
+
inflateSea: false;
|
|
117
|
+
});
|
|
118
|
+
// or to inflate to memory
|
|
119
|
+
// await app.inflate();
|
|
120
|
+
// to start the server
|
|
121
|
+
// await app.start();
|
|
122
|
+
// to stop the server
|
|
123
|
+
// await app.stop();
|
|
124
|
+
// to dispose the server and disconnect all node:cluster worker syncronization for safe exiting
|
|
125
|
+
// await app.dispose();
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### usage as cli
|
|
129
|
+
|
|
130
|
+
#### inflate static files with the cli
|
|
131
|
+
|
|
132
|
+
```miqro --service example/ --inflate --inflate-dir build/```
|
|
133
|
+
|
|
134
|
+
#### watch and reload server to see the changes to the files in real-time
|
|
135
|
+
|
|
136
|
+
```miqro --watch --service example/```
|
|
137
|
+
|
|
138
|
+
#### start multiple services
|
|
139
|
+
|
|
140
|
+
```miqro --service example/ --service api/```
|
|
141
|
+
|
|
142
|
+
#### start multiple services in a node:cluster
|
|
143
|
+
|
|
144
|
+
```npx miqro-cluster --service example/ --service api/```
|
|
145
|
+
|
|
146
|
+
## basic service folder structure
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
app/
|
|
150
|
+
http/
|
|
151
|
+
...
|
|
152
|
+
static/
|
|
153
|
+
...
|
|
154
|
+
migration/
|
|
155
|
+
...
|
|
156
|
+
test/
|
|
157
|
+
....
|
|
158
|
+
db.ts
|
|
159
|
+
ws.ts
|
|
160
|
+
auth.ts
|
|
161
|
+
server.ts
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
all files and folders are ***optional***.
|
|
165
|
+
|
|
166
|
+
to start the development server run
|
|
167
|
+
|
|
168
|
+
```miqro --service app/```
|
|
169
|
+
|
|
170
|
+
and with the included editor
|
|
171
|
+
|
|
172
|
+
```miqro --service app/ --editor```
|
|
173
|
+
|
|
174
|
+
### http folder
|
|
175
|
+
|
|
176
|
+
the http folder will be recursivly scan for files to serve.
|
|
177
|
+
the files will be server acording to the location in the directory.
|
|
178
|
+
|
|
179
|
+
for example.
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
http/
|
|
183
|
+
index.html.tsx
|
|
184
|
+
css/
|
|
185
|
+
style.css
|
|
186
|
+
js/
|
|
187
|
+
script.min.js
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
this will create the routes
|
|
191
|
+
|
|
192
|
+
1. /index.html
|
|
193
|
+
2. /css/style.css
|
|
194
|
+
3. /js/script.min.js
|
|
195
|
+
|
|
196
|
+
#### .html.tsx
|
|
197
|
+
|
|
198
|
+
a file with the extension ```.html.tsx``` will be rendered as an html created by a JSX expression. for example.
|
|
199
|
+
|
|
200
|
+
```ìndex.html.tsx```
|
|
201
|
+
```tsx
|
|
202
|
+
import { MyComponent } from "./component.js";
|
|
203
|
+
|
|
204
|
+
export default <html>
|
|
205
|
+
<body>
|
|
206
|
+
<MyComponent />
|
|
207
|
+
</body>
|
|
208
|
+
</html>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
you can also export a request function and customize the route by exporting a ```apiOptions``` object.
|
|
212
|
+
|
|
213
|
+
```ìndex.html.tsx```
|
|
214
|
+
```tsx
|
|
215
|
+
import { ServerRequest, ServerResponse, APIOptions } from "miqro";
|
|
216
|
+
import { MyComponent } from "./component.js";
|
|
217
|
+
|
|
218
|
+
// export the object apiOptions to customize the paths and methods
|
|
219
|
+
export const apiOptions: APIOptions = {
|
|
220
|
+
path: ["/", "/index.html"],
|
|
221
|
+
method: ["GET", "POST"]
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export default (req: ServerRequest, res: ServerResponse) => {
|
|
225
|
+
return <html>
|
|
226
|
+
<body>
|
|
227
|
+
<MyComponent />
|
|
228
|
+
</body>
|
|
229
|
+
</html>
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### .min.tsx
|
|
234
|
+
|
|
235
|
+
a file with the extension ```.min.tsx``` will be rendered as a **minified** javascript script that bundles the ```@miqro/jsx``` module.
|
|
236
|
+
|
|
237
|
+
to avoid minification just use the ```.tsx``` extension inside the ```http``` folder.
|
|
238
|
+
|
|
239
|
+
example defining a ```WebComponent``` with ```JSX``` using ```@miqro/jsx```.
|
|
240
|
+
|
|
241
|
+
```script.min.tsx```
|
|
242
|
+
```typescript
|
|
243
|
+
/*
|
|
244
|
+
basic dynamic component example
|
|
245
|
+
*/
|
|
246
|
+
export function TickerComponent() {
|
|
247
|
+
// create a state variable count
|
|
248
|
+
const [count, setCount] = jsx.useState(0);
|
|
249
|
+
// create a effect with a setTimeout that updates count after 1000ms
|
|
250
|
+
jsx.useEffect(() => {
|
|
251
|
+
// create the timeout
|
|
252
|
+
const timeout = setTimeout(() => {
|
|
253
|
+
setCount(count + 1);
|
|
254
|
+
}, 1000);
|
|
255
|
+
// return a clean up function to clear the timeout if it's running when the component is removed from the DOM.
|
|
256
|
+
return () => {
|
|
257
|
+
// clear the timeout if the effect is canceled.
|
|
258
|
+
clearTimeout(timeout);
|
|
259
|
+
}
|
|
260
|
+
}, [count]);
|
|
261
|
+
// return the jsx to be rendered
|
|
262
|
+
return <p>Count: {count}</p>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
window.addEventListener("load", async (event) => {
|
|
266
|
+
/* this will define a custom element called ticker-tag with the tag
|
|
267
|
+
|
|
268
|
+
<ticker-tag></ticker-tag>
|
|
269
|
+
|
|
270
|
+
as a standard web component.
|
|
271
|
+
|
|
272
|
+
just include this script in the page with a script tag like
|
|
273
|
+
<script src="..."></script>
|
|
274
|
+
|
|
275
|
+
*/
|
|
276
|
+
jsx.define("ticker-tag", TickerComponent, {
|
|
277
|
+
shadowInit: false, // or { mode: "closed" | "closed" }
|
|
278
|
+
//extends: "p";
|
|
279
|
+
//observedAttributes: ["width", "height", "some-attr"]; // attribues that are observed for changes to re-render the JSX component
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### .api.ts
|
|
285
|
+
|
|
286
|
+
a file with the extension ```.api.ts``` will be use as a custom REST API endpoint.
|
|
287
|
+
|
|
288
|
+
for example
|
|
289
|
+
|
|
290
|
+
```/posts/post.api.tsx```
|
|
291
|
+
```typescript
|
|
292
|
+
export default (req, res) => {
|
|
293
|
+
return res.json({
|
|
294
|
+
someValue: 1
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
to costumize the route and middleware used and parse the request input before your function use export an ```APIRoute```object.
|
|
300
|
+
this example uses the ```server.middleware.json()``` to parse the request body as a json.
|
|
301
|
+
|
|
302
|
+
```/posts/post.api.tsx```
|
|
303
|
+
```typescript
|
|
304
|
+
import { ServerRequest, ServerResponse } from "miqro";
|
|
305
|
+
import { APIRoute } from "@miqro/core";
|
|
306
|
+
|
|
307
|
+
export default {
|
|
308
|
+
name: "post api",
|
|
309
|
+
description: "to do posts",
|
|
310
|
+
path: ["/", "/do"],
|
|
311
|
+
method: ["POST"],
|
|
312
|
+
middleware: [server.middleware.json()],
|
|
313
|
+
request: {
|
|
314
|
+
headers: {
|
|
315
|
+
auth: "string"
|
|
316
|
+
},
|
|
317
|
+
query: {
|
|
318
|
+
pagination: "number"
|
|
319
|
+
},
|
|
320
|
+
body: {
|
|
321
|
+
inputValue: "string"
|
|
322
|
+
otherInputValues: "number[]?"
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
response: {
|
|
326
|
+
status: [200, 400],
|
|
327
|
+
body: {
|
|
328
|
+
someValue: "number"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
handler: (req: ServerRequest, res: ServerResponse) => {
|
|
332
|
+
// with req?.server?.db.get(..)? you can query the database MyDB if it's configured with a db.ts file
|
|
333
|
+
// const rows = await req?.server?.db.get("MyDB")?.select().from("....
|
|
334
|
+
return res.json({
|
|
335
|
+
someValue: 1
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
} as APIRoute;
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
```req.server```
|
|
342
|
+
|
|
343
|
+
all request's have a property called ```server``` that it can be used to access server shared content.
|
|
344
|
+
|
|
345
|
+
this is necesary because every ```service``` file is imported ```isolated``` from the others using an ```esbuild``` ```bundle``` to **force state-less coding**.
|
|
346
|
+
|
|
347
|
+
```ServerRequest```
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
import { Request } from "@miqro/core";
|
|
351
|
+
|
|
352
|
+
interface ServerRequest extends Request {
|
|
353
|
+
server?: {
|
|
354
|
+
// null values are if the feature has been disabled
|
|
355
|
+
// database connections interface
|
|
356
|
+
db: {
|
|
357
|
+
get(name: string): Database | null;
|
|
358
|
+
getMigrations(): NamedMigration[];
|
|
359
|
+
migrate(options: MigrateOptions): Promise<void>;
|
|
360
|
+
},
|
|
361
|
+
// websocket server interface
|
|
362
|
+
ws: {
|
|
363
|
+
get(path: string): WebSocketServer | undefined;
|
|
364
|
+
disconnectAll(path: string): void;
|
|
365
|
+
};
|
|
366
|
+
cache: CacheInterface; // this cache will be syncronized between all node:cluster workers
|
|
367
|
+
localCache: CacheInterface; // this cache will local to the node:cluster worker
|
|
368
|
+
logger?: Logger;
|
|
369
|
+
isPrimaryWorker: () => boolean;
|
|
370
|
+
openBrowser: (path: string) => void;
|
|
371
|
+
getLogger: (identifier: string, options?: { level?: any; transports?: any[]; formatter?: any; }) => Logger;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
3
374
|
```
|
|
4
|
-
|
|
375
|
+
|
|
376
|
+
example using ```req.server``` to access a key in the cache.
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
import { ServerRequest, ServerResponse } from "miqro";
|
|
380
|
+
|
|
381
|
+
export default (req: ServerRequest, res: ServerResponse) => {
|
|
382
|
+
const value = req?.cache?.get("some_key");
|
|
383
|
+
// req?.cache?.set("some_key", "value");
|
|
384
|
+
return {
|
|
385
|
+
status: 200,
|
|
386
|
+
body: {
|
|
387
|
+
some_key: value
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
5
391
|
```
|
|
6
392
|
|
|
7
|
-
|
|
393
|
+
#### .html.md
|
|
394
|
+
|
|
395
|
+
TODO
|
|
396
|
+
|
|
397
|
+
#### .min.js
|
|
398
|
+
|
|
399
|
+
TODO
|
|
400
|
+
|
|
401
|
+
#### .bundle.js
|
|
402
|
+
|
|
403
|
+
TODO
|
|
404
|
+
|
|
405
|
+
#### .css.bundle
|
|
406
|
+
|
|
407
|
+
TODO
|
|
408
|
+
|
|
409
|
+
### static folder
|
|
410
|
+
|
|
411
|
+
the static folder will act the same as the http folder but will treath every file **as is**.
|
|
412
|
+
|
|
413
|
+
the files will be server acording to the location in the directory.
|
|
414
|
+
|
|
415
|
+
for example.
|
|
8
416
|
|
|
9
417
|
```
|
|
10
|
-
|
|
418
|
+
static/
|
|
419
|
+
index.html
|
|
420
|
+
css/
|
|
421
|
+
style.css
|
|
422
|
+
js/
|
|
423
|
+
script.min.js
|
|
11
424
|
```
|
|
12
425
|
|
|
426
|
+
this will create the routes
|
|
427
|
+
|
|
428
|
+
1. /index.html
|
|
429
|
+
2. /css/style.css
|
|
430
|
+
3. /js/script.min.js
|
|
431
|
+
|
|
432
|
+
### migration folder
|
|
433
|
+
|
|
434
|
+
TODO
|
|
435
|
+
|
|
436
|
+
### test folder
|
|
437
|
+
|
|
438
|
+
TODO
|
|
439
|
+
|
|
440
|
+
### db.ts
|
|
441
|
+
|
|
442
|
+
TODO
|
|
443
|
+
|
|
444
|
+
### ws.ts
|
|
445
|
+
|
|
446
|
+
TODO
|
|
447
|
+
|
|
448
|
+
### auth.ts
|
|
449
|
+
|
|
450
|
+
TODO
|
|
451
|
+
|
|
452
|
+
### server.ts
|
|
453
|
+
|
|
454
|
+
TODO
|
|
455
|
+
|
|
456
|
+
### log.ts
|
|
457
|
+
|
|
458
|
+
TODO
|
|
459
|
+
|
|
460
|
+
### Globals
|
|
461
|
+
|
|
462
|
+
TODO
|
|
463
|
+
|
|
464
|
+
#### jsx global
|
|
465
|
+
|
|
466
|
+
TODO
|
|
467
|
+
|
|
468
|
+
#### JSX global
|
|
469
|
+
|
|
470
|
+
TODO
|
|
471
|
+
|
|
472
|
+
#### test global
|
|
473
|
+
|
|
474
|
+
TODO
|
|
475
|
+
|
|
476
|
+
#### server global
|
|
477
|
+
|
|
478
|
+
TODO
|
|
479
|
+
|
|
480
|
+
## static web site generator
|
|
481
|
+
|
|
482
|
+
you can also inflate your project to avoid rendering ```http/**/*.html.tsx``` and other files per request. this can be done pre-rendereding with the ```--inflate``` flag.
|
|
483
|
+
|
|
484
|
+
```miqro --service app/ --inflate --inflate-dir build/```
|
|
485
|
+
|
|
486
|
+
this will create the ```build/``` folder with the inflated app static files.
|
|
487
|
+
|
|
488
|
+
you can host only the generated static ```*.html.tsx``` files with other http servers.
|
|
489
|
+
|
|
490
|
+
```python3 -m http.server 8080 build/app/static/```
|
|
491
|
+
|
|
492
|
+
## cluster
|
|
493
|
+
|
|
494
|
+
for this you will need to install miqro as a dependency of your project.
|
|
495
|
+
|
|
496
|
+
```npm install miqro --save```
|
|
497
|
+
|
|
498
|
+
```npx miqro-cluster --service app/```
|
|
499
|
+
|
|
500
|
+
this will launch your app in a cluster mode.
|
|
501
|
+
|
|
502
|
+
to change the number of nodes use ```CLUSTER_COUNT=10```for example to set the count to 10 nodes.
|
|
503
|
+
|
|
504
|
+
```CLUSTER_COUNT=10 npx miqro-cluster --service app/```
|
|
505
|
+
|
|
506
|
+
## cli usage
|
|
507
|
+
|
|
508
|
+
### start a project
|
|
509
|
+
|
|
510
|
+
```miqro --service app/```
|
|
511
|
+
|
|
512
|
+
by default the project will be hosted on ```http://localhost:8080```.
|
|
513
|
+
|
|
514
|
+
start with hot-reload disabled
|
|
515
|
+
|
|
516
|
+
```miqro --watch --service app/```
|
|
517
|
+
|
|
518
|
+
start on custom port
|
|
519
|
+
|
|
520
|
+
```PORT=8181 miqro app/```
|
|
521
|
+
|
|
522
|
+
### run migrations on the project
|
|
523
|
+
|
|
524
|
+
TODO
|
|
525
|
+
|
|
526
|
+
### run the project tests
|
|
527
|
+
|
|
528
|
+
TODO
|
|
529
|
+
|
|
530
|
+
### generate API documentation
|
|
531
|
+
|
|
532
|
+
TODO
|
|
533
|
+
|
|
534
|
+
### inflate project or eject from miqro
|
|
535
|
+
|
|
536
|
+
to inflate all http files into static files use the ```--inflate``` with the ```--inflate-dir``` arguments.
|
|
537
|
+
|
|
538
|
+
```miqro --inflate --inflate-dir build/ --service app/```
|
|
539
|
+
|
|
540
|
+
this will render the ```.html.tsx``` and other files in the ```http/``` folder and the ```static/``` folder into the ```build``` folder for static serving.
|
|
541
|
+
|
|
542
|
+
for example.
|
|
543
|
+
|
|
544
|
+
```
|
|
545
|
+
miqro --inflate --inflate-dir build/ --service app/
|
|
546
|
+
cd build/
|
|
547
|
+
python3 -m http.server 8080
|
|
13
548
|
```
|
|
14
|
-
npx miqro <command> [args]Available commands:
|
|
15
549
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
config print config as a json.
|
|
21
|
-
config:bash print config as a bash script.
|
|
22
|
-
config:env print config as a env file.
|
|
23
|
-
config:init inits your config folder.
|
|
24
|
-
doc api folder auto doc as a json.
|
|
25
|
-
doc:md api folder auto doc as a markdown.
|
|
26
|
-
start start script in cluster mode.
|
|
27
|
-
cluster alias for start command.
|
|
28
|
-
watch watch folder for changes.
|
|
29
|
-
serve serve static files.
|
|
30
|
-
help prints this page
|
|
550
|
+
### more cli usages
|
|
551
|
+
|
|
552
|
+
```miqro --help```
|
|
553
|
+
|
|
31
554
|
```
|
|
555
|
+
usage: miqro [...FLAGS] --service app/
|
|
556
|
+
|
|
557
|
+
==examples==
|
|
558
|
+
|
|
559
|
+
miqro --watch --service front/
|
|
560
|
+
PORT=8181 miqro --service api/ --service front/
|
|
561
|
+
miqro --test --service front/
|
|
562
|
+
miqro --inflate --service front/
|
|
563
|
+
miqro --generate-doc --generate-doc-out API.md --service front/
|
|
564
|
+
CLUSTER_COUNT=10 miqro-cluster --service api/
|
|
565
|
+
|
|
566
|
+
==flags==
|
|
567
|
+
|
|
568
|
+
-v, --version outputs the version number
|
|
569
|
+
-h, --help outputs this page.
|
|
570
|
+
--watch use to enable the hot-reload functionality.
|
|
571
|
+
--test run the tests for a service.
|
|
572
|
+
--migrate-up migrations up.
|
|
573
|
+
--migrate-down migrations down.
|
|
574
|
+
--inflate inflates the application.
|
|
575
|
+
--inflate-dir to set the output directory of the --inflate command. default value is inflated/.
|
|
576
|
+
--editor runs the application with a built-in editor.
|
|
577
|
+
--generate-doc generates a documentation for the api endpoints of the service.
|
|
578
|
+
--generate-doc-out the output file for the generated documentation. default value is API.md.
|
|
579
|
+
--generate-doc-type the format of the generated documentation. it can be JSON or MD. default value is MD.
|
|
580
|
+
--compile inflates the application and tries to create a NODE SEA binary.
|
|
581
|
+
--inflate-sea inflates the application with sea compilation scripts.
|
|
582
|
+
--install-tsconfig creates a tsconfig.json configured to use with --install-types.
|
|
583
|
+
--install-types creates and updates the .types/ folder use together with --install-tsconfig.
|
|
584
|
+
|
|
585
|
+
==environment variables==
|
|
586
|
+
|
|
587
|
+
PORT override the default 8080 port.
|
|
588
|
+
LOG_FILE override the default ./server.log file
|
|
589
|
+
DB enable the server.db features
|
|
590
|
+
DB_STORAGE override the default local db location ./db.sqlite3
|
|
591
|
+
DB_DIALECT override the default node:sqlite
|
|
592
|
+
DB_CONNECTION override the default connection url
|
|
593
|
+
CLEAR_JSX_CACHE set to 1 or 0 to enable or disable the clearing of the esbuild cache defaults to 1.
|
|
594
|
+
JSX_TMP set custom location of esbuild builds defaults to /tmp/jsx_tmp.
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
## development
|
|
598
|
+
|
|
599
|
+
### build node package
|
|
600
|
+
|
|
601
|
+
1. install dependencies
|
|
602
|
+
|
|
603
|
+
```npm install```
|
|
604
|
+
|
|
605
|
+
2. build
|
|
606
|
+
|
|
607
|
+
```npm build```
|
|
608
|
+
|
|
609
|
+
### build binary for running as standalone binary
|
|
610
|
+
|
|
611
|
+
1. install dependencies
|
|
612
|
+
|
|
613
|
+
```npm install```
|
|
614
|
+
|
|
615
|
+
2. install sea deps (esbuild and nodejs binaries)
|
|
616
|
+
|
|
617
|
+
```npm run precompile``` or ```sh ./sea/precompile.sh```
|
|
618
|
+
|
|
619
|
+
3. compile
|
|
620
|
+
|
|
621
|
+
```npm run compile``` or ```sh ./compile.sh```
|
|
622
|
+
|
|
623
|
+
to binaries will be produced in the ```bin/``` folder.
|
|
624
|
+
|
|
625
|
+
example
|
|
626
|
+
|
|
627
|
+
```./bin/linux-x64/miqro --help```
|
|
628
|
+
|
|
629
|
+
you can copy this binary to a computer without Node.js installed and run it to try.
|