diff --git a/.eslintrc.json b/.eslintrc.json index abc909e3..23afc21f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -49,7 +49,18 @@ } ], "@typescript-eslint/member-ordering": 0, - "@typescript-eslint/explicit-function-return-type": "warn", + "@typescript-eslint/explicit-function-return-type": [ + "warn", + { + "allowExpressions": true, + "allowTypedFunctionExpressions": true, + "allowDirectConstAssertionInArrowFunctions": true, + "allowHigherOrderFunctions": true, + "allowedNames": [], + "enforceForGetters": true, + "enforceForSetters": false + } + ], "@typescript-eslint/typedef": [ "warn", { diff --git a/.vscode/settings.json b/.vscode/settings.json index 515a725c..8bfe9423 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -49,10 +49,6 @@ "**/devDependencies.json": true, "**/package.json": true, "**/logo.svg": true, - ".firedev": true, - ".taon": true, - ".tnp": true, - ".": true, "**/*.filetemplate": true, "**/tsconfig.*": true, "**/tslint.*": true, @@ -164,4 +160,4 @@ "url": "./docs-config.schema.json" } ] -} +} \ No newline at end of file diff --git a/FRAMEWORK.md b/FRAMEWORK.md index 3021f5e4..11d276c5 100644 --- a/FRAMEWORK.md +++ b/FRAMEWORK.md @@ -1,3 +1,21 @@ +## Files structure + +Taon has very flexible structure for build apps and libraries. Each project +can be at the same time library and app. +There 2 types of project app and libraries: + +- **standalone** (simple project with that has /src for for all source code) +- **organization** (contains multiple standalone projects that can be build together) + + +### Standalone project + +Standalone + +### Organization project + +Organization + ## Taon config Config of application diff --git a/TODO.md b/TODO.md index ec6e1e48..c31f8a80 100644 --- a/TODO.md +++ b/TODO.md @@ -7,7 +7,7 @@ ## Taon v19.X.X - 🔲 angular v19 support -- 🔲 2FA authentication +- 🔲 2FA authentication keycloak - 🔲 simple online payments - 🔲 fast/stable packeges installer solution - 🔲 organization build based on standalone (single process with multiple entrypoints build) @@ -19,7 +19,7 @@ - ✅ angular v18 support - ✅ firedev -> taon (rebranding) - 🔲 docs for new framework api -- 🔲 docs update for new cli +- ✅ docs update for new cli - 🔲 docs examples for better understranding - 🔲 relaltime development FE/BE and BE/BE - 🔲 basic authentication diff --git a/projects/container-v18/examples-v18/single-file/.eslintrc.json b/projects/container-v18/examples-v18/single-file/.eslintrc.json index abc909e3..23afc21f 100644 --- a/projects/container-v18/examples-v18/single-file/.eslintrc.json +++ b/projects/container-v18/examples-v18/single-file/.eslintrc.json @@ -49,7 +49,18 @@ } ], "@typescript-eslint/member-ordering": 0, - "@typescript-eslint/explicit-function-return-type": "warn", + "@typescript-eslint/explicit-function-return-type": [ + "warn", + { + "allowExpressions": true, + "allowTypedFunctionExpressions": true, + "allowDirectConstAssertionInArrowFunctions": true, + "allowHigherOrderFunctions": true, + "allowedNames": [], + "enforceForGetters": true, + "enforceForSetters": false + } + ], "@typescript-eslint/typedef": [ "warn", { diff --git a/projects/container-v18/examples-v18/single-file/.gitignore b/projects/container-v18/examples-v18/single-file/.gitignore index bbcceccf..238132fa 100644 --- a/projects/container-v18/examples-v18/single-file/.gitignore +++ b/projects/container-v18/examples-v18/single-file/.gitignore @@ -13,6 +13,14 @@ yarn-error.log testem.log /typings app.hosts.ts +/.firedev +/.taon +/.tnp +/. + .map(c => '/' + c) + .join(' +')} +/docs-config.schema.json /**/*._auto-generated_.ts /**/BUILD-INFO.md /linked-repos @@ -54,7 +62,6 @@ Thumbs.db /run.js /run-org.js # ===================== -!taon.json !taon.jsonc *.filetemplate diff --git a/projects/container-v18/examples-v18/single-file/.prettierignore b/projects/container-v18/examples-v18/single-file/.prettierignore index a89e1fe3..19353d3c 100644 --- a/projects/container-v18/examples-v18/single-file/.prettierignore +++ b/projects/container-v18/examples-v18/single-file/.prettierignore @@ -1,5 +1,5 @@ -# This file is generated by taon +# This file is generated by taon.dev /build /coverage /e2e @@ -25,3 +25,4 @@ tmp-* /module /www + \ No newline at end of file diff --git a/projects/container-v18/examples-v18/single-file/.tnp/temp-docs-folder/mkdocs.yml b/projects/container-v18/examples-v18/single-file/.tnp/temp-docs-folder/mkdocs.yml new file mode 100644 index 00000000..8d9c943a --- /dev/null +++ b/projects/container-v18/examples-v18/single-file/.tnp/temp-docs-folder/mkdocs.yml @@ -0,0 +1,71 @@ +site_name: single-file +# site_url: undefined +nav: + - Introduction: README.md + - TEST: TEST.md +docs_dir: ./allmdfiles +theme: + name: material + features: + - navigation.tabs + - navigation.sections + - toc.integrate + - navigation.top + - search.suggest + - search.highlight + - content.tabs.link + - content.code.annotation + - content.code.copy + language: en + palette: + primary: custom + accent: custom + # - scheme: default + # toggle: + # icon: material/toggle-switch-off-outline + # name: Switch to dark mode + # primary: red + # accent: red + # - scheme: slate + # toggle: + # icon: material/toggle-switch + # name: Switch to light mode + # primary: red + # accent: red + +extra_css: + - custom.css + +extra_javascript: + - custom.js + +# plugins: +# - social + +# extra: +# social: +# - icon: fontawesome/brands/github-alt +# link: https://github.com/james-willett +# - icon: fontawesome/brands/twitter +# link: https://twitter.com/TheJamesWillett +# - icon: fontawesome/brands/linkedin +# link: https://www.linkedin.com/in/willettjames/ + +markdown_extensions: + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.snippets + - admonition + - pymdownx.arithmatex: + generic: true + - footnotes + - pymdownx.details + - pymdownx.superfences + - pymdownx.mark + - attr_list + # - pymdownx.emoji: + # emoji_index: !!python/name:materialx.emoji.twemoji + # emoji_generator: !!python/name:materialx.emoji.to_svg + + \ No newline at end of file diff --git a/projects/container-v18/examples-v18/single-file/.vscode/extensions.json b/projects/container-v18/examples-v18/single-file/.vscode/extensions.json index cd013603..17d3bb43 100644 --- a/projects/container-v18/examples-v18/single-file/.vscode/extensions.json +++ b/projects/container-v18/examples-v18/single-file/.vscode/extensions.json @@ -10,7 +10,6 @@ "aeschli.vscode-css-formatter", "alefragnani.Bookmarks", "alexdima.copy-relative-path", - "alexiv.vscode-angular2-files", "amodio.toggle-excluded-files", "cg-cnu.vscode-path-tools", "chrisdias.vscode-opennewinstance", @@ -48,7 +47,7 @@ "stepanog.angular1-inline", "taddison.gitlazy", "unifiedjs.vscode-mdx", - "vespa-dev-works.jestrunit", + "firsttris.vscode-jest-runner", "waderyan.gitblame", "wcwhitehead.bootstrap-3-snippets", "wenfangdu.snippet-generator", diff --git a/projects/container-v18/examples-v18/single-file/.vscode/settings.json b/projects/container-v18/examples-v18/single-file/.vscode/settings.json index 64a337b7..b778fc0e 100644 --- a/projects/container-v18/examples-v18/single-file/.vscode/settings.json +++ b/projects/container-v18/examples-v18/single-file/.vscode/settings.json @@ -2,52 +2,66 @@ "files.exclude": { "**/*____ORIGINAL____.ts": true, "_changelog": true, - "tsconfig.backend.dist.json": true, - "tsconfig.backend.dist.json.filetemplate": true, "webpack.backend-dist-build.js": true, - "node_modules": true, - "tmp*": true, - "dist*": true, - "bundle*": true, - "browser": true, - "browser*": true, - "websql": true, - "websql*": true, - "module*": true, - "backup": true, - "module": true, - "www": true, - "Thumbs.db": true, - ".DS_Store": true, + "**/node_modules": true, + "**/tmp*": true, + "**/dist*": true, + "**/bundle*": true, + "**/browser": true, + "**/browser*": true, + "**/websql": true, + "**/websql*": true, + "**/module*": true, + "**/backup": true, + "**/module": true, + "**/www": true, + "**/Thumbs.db": true, "**/.DS_Store": true, - "npm-debug.log*": true, - ".sass-cache": true, - ".sourcemaps": true, - "tsconfig.isomorphic.json": true, - "tsconfig.isomorphic-flat-dist.json": true, - "tsconfig.browser.json": true, - "tsconfig.json": true, - "index.js": true, - "index.d.ts": true, - "index.js.map": true, - "webpack.config.js": true, - "run.js": true, - "run-org.js": true, - "tsconfig.isomorphic.json.filetemplate": true, - "tsconfig.isomorphic-flat-dist.json.filetemplate": true, - "tsconfig.browser.json.filetemplate": true, - "tsconfig.json.filetemplate": true, - ".gitignore": true, - ".npmignore": true, - ".babelrc": true, - ".npmrc": true, - ".eslintrc.json": true, - ".prettierignore": true, - ".prettierrc": true, - ".editorconfig": true, - "devDependencies.json": true, - "package.json": true, - "logo.svg": true + "**/**/.DS_Store": true, + "**/npm-debug.log*": true, + "**/.sass-cache": true, + "**/.sourcemaps": true, + "**/tsconfig.isomorphic.json": true, + "**/tsconfig.isomorphic-flat-dist.json": true, + "**/tsconfig.browser.json": true, + "**/tsconfig.json": true, + "**/tsconfig.backend.dist.json": true, + "**/index.js": true, + "**/index.d.ts": true, + "**/index.js.map": true, + "**/webpack.config.js": true, + "**/webpack.backend-dist-build.js": true, + "**/run.js": true, + "**/run-org.js": true, + "**/tsconfig.isomorphic.json.filetemplate": true, + "**/tsconfig.isomorphic-flat-dist.json.filetemplate": true, + "**/tsconfig.browser.json.filetemplate": true, + "**/tsconfig.json.filetemplate": true, + "**/tsconfig.backend.dist.json.filetemplate": true, + "**/.gitignore": true, + "**/.npmignore": true, + "**/.babelrc": true, + "**/.npmrc": true, + "**/.eslintrc.json": true, + "**/.prettierignore": true, + "**/.prettierrc": true, + "**/.editorconfig": true, + "**/devDependencies.json": true, + "**/package.json": true, + "**/logo.svg": true, + "**/*.filetemplate": true, + "**/tsconfig.*": true, + "**/tslint.*": true, + "**/recent.json": true, + "**/angular.json": true, + "**/webpack*": true, + "**/docs/**/*": true, + "**/run-*": true, + "**/run.*": true, + "**/package-lock.json": true, + "**/protractor.conf.js": true, + "**/karma.conf.js": true, + "**/docs-config.schema.json": true }, "workbench.colorCustomizations": { "activityBar.background": "#3186d4" @@ -64,8 +78,30 @@ "projects": true, "bin": true, "local_release": true, + "node_modules": true, + ".build": true, + ".vscode": true, + "browser": true, + "dist": true, + "package-lock.json": true, + ".firedev": true, + ".taon": true, + ".tnp": true, + ".": true, + "**/docs": true, + "**/projects": true, + "**/bin": true, + "**/local_release": true, + "**/node_modules": true, + "**/.build": true, + "**/.vscode": true, + "**/browser": true, + "**/dist": true, "**/package-lock.json": true, - "package-lock.json": true + "**/.firedev": true, + "**/.taon": true, + "**/.tnp": true, + "**/.": true }, "[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode", @@ -105,5 +141,18 @@ "editor.suggest.snippetsPreventQuickSuggestions": false, "editor.inlineSuggest.enabled": true, "prettier.prettierPath": "./node_modules/prettier", - "prettier.endOfLine": "auto" + "prettier.endOfLine": "auto", + "json.schemas": [ + { + "fileMatch": [ + "/docs-config.jsonc" + ], + "url": "./docs-config.schema.json" + } + ], + "window.title": "container-v18/examples/single-file [ ${activeEditorShort} ]", + "search.useIgnoreFiles": false, + "search.include": [ + "**/src/**" + ] } \ No newline at end of file diff --git a/projects/container-v18/examples-v18/single-file/README.md b/projects/container-v18/examples-v18/single-file/README.md index a1166372..976758e6 100644 --- a/projects/container-v18/examples-v18/single-file/README.md +++ b/projects/container-v18/examples-v18/single-file/README.md @@ -1 +1,7 @@ -# Most basic app +# Single file backend/frontend app + +Proof of **taon** framework simplicity. +Backend with frontend inside one file. + +![preview]() + \ No newline at end of file diff --git a/projects/container-v18/examples-v18/single-file/Screenshot 2024-10-28 at 13.15.27.png b/projects/container-v18/examples-v18/single-file/Screenshot 2024-10-28 at 13.15.27.png new file mode 100644 index 00000000..3653eac0 Binary files /dev/null and b/projects/container-v18/examples-v18/single-file/Screenshot 2024-10-28 at 13.15.27.png differ diff --git a/projects/container-v18/examples-v18/single-file/docs-config.jsonc b/projects/container-v18/examples-v18/single-file/docs-config.jsonc new file mode 100644 index 00000000..84b1a066 --- /dev/null +++ b/projects/container-v18/examples-v18/single-file/docs-config.jsonc @@ -0,0 +1,14 @@ +{ + "site_name": "single-file", + "externalDocs": { + "mdfiles": [], + "projects": [] + }, + "omitFilesPatters": [], + "priorityOrder": [], + "mapTitlesNames": { + "README.md": "Introduction" + }, + "customCssPath": "custom.css", + "customJsPath": "custom.js" +} diff --git a/projects/container-v18/examples-v18/single-file/docs-config.schema.json b/projects/container-v18/examples-v18/single-file/docs-config.schema.json new file mode 120000 index 00000000..9fcec052 --- /dev/null +++ b/projects/container-v18/examples-v18/single-file/docs-config.schema.json @@ -0,0 +1 @@ +/Users/dfilipiak/npm/taon-dev/taon/projects/container-v18/isomorphic-lib-v18/docs-config.schema.json \ No newline at end of file diff --git a/projects/container-v18/examples-v18/single-file/linked-projects.json b/projects/container-v18/examples-v18/single-file/linked-projects.json index ab71844d..6a600b3a 100644 --- a/projects/container-v18/examples-v18/single-file/linked-projects.json +++ b/projects/container-v18/examples-v18/single-file/linked-projects.json @@ -1,3 +1,3 @@ -{ - "projects": [] -} +{ + "projects": [] +} diff --git a/projects/container-v18/examples-v18/single-file/package.json b/projects/container-v18/examples-v18/single-file/package.json index 7424fc4d..fe7e62fb 100644 --- a/projects/container-v18/examples-v18/single-file/package.json +++ b/projects/container-v18/examples-v18/single-file/package.json @@ -80,11 +80,11 @@ "@testdeck/mocha": "0.3.3", "@types/chai": "4.3.17", "@types/chokidar": "2.1.3", - "@types/dateformat": "5.0.2", + "@types/dateformat": "1.0.1", "@types/diff": "5.2.1", "@types/express": "4.17.21", "@types/express-fileupload": "1.5.0", - "@types/fs-extra": "11.0.4", + "@types/fs-extra": "7.0.0", "@types/glob": "5.0.35", "@types/http-proxy": "1.17.15", "@types/http-proxy-middleware": "1.0.0", @@ -94,13 +94,13 @@ "@types/lockfile": "1.0.4", "@types/lodash": "4.14.92", "@types/mocha": "10.0.7", - "@types/node": "22.2.0", + "@types/node": "16.18.21", "@types/node-notifier": "8.0.5", "@types/oauth2orize": "1.11.5", "@types/password-hash": "1.2.24", "@types/progress": "2.0.7", "@types/q": "1.5.8", - "@types/rimraf": "4.0.5", + "@types/rimraf": "2.0.2", "@types/semver": "7.5.8", "@types/systeminformation": "3.54.1", "@types/vinyl": "2.0.12", @@ -113,10 +113,8 @@ "angular-material-css-vars": "7.0.0", "angular-resize-event": "3.2.0", "animate.css": "4.1.1", - "any-project-cli": "~16.444.12", "app-root-path": "3.1.0", "axios": "1.7.3", - "background-worker-process": "~16.100.10", "base32": "0.0.7", "bcryptjs": "2.4.3", "body-parser": "1.20.2", @@ -125,10 +123,10 @@ "bun": "1.1.22", "callsite-record": "4.1.5", "chai": "4.5.0", - "chalk": "1.1.3", + "chalk": "2.3.2", "check-node-version": "3.2.0", "cheerio": "1.0.0", - "chokidar": "2.1.8", + "chokidar": "3.5.3", "circular-json": "0.5.1", "class-transformer": "0.5.1", "class-validator": "0.14.1", @@ -144,12 +142,12 @@ "cpr": "3.0.1", "cross-env": "7.0.2", "cross-spawn": "7.0.3", - "dateformat": "4.6.3", + "dateformat": "3.0.3", "detect-mocha": "0.1.0", "diff": "4.0.2", - "electron": "31.3.1", - "electron-builder": "24.13.3", - "electron-debug": "4.0.0", + "electron": "25.2.0", + "electron-builder": "24.4.0", + "electron-debug": "3.2.0", "electron-reloader": "1.2.3", "element-resize-detector": "1.2.4", "enquirer": "2.4.1", @@ -168,18 +166,10 @@ "file-loader": "1.1.11", "file-saver": "2.0.5", "file-type": "19.1.1", - "taon": "^18", - "taon-crud": "~16.444.15", - "taon-crud-deamon": "~16.444.15", - "taon-ports": "~16.444.15", - "taon-storage": "~16.444.11", - "taon-type-sql": "~16.444.15", - "taon-typeorm": "~16.444.11", - "taon-ui": "~16.444.1", "fkill": "6.1.0", "font-awesome": "4.7.0", "form-data": "4.0.0", - "fs-extra": "11.1.1", + "fs-extra": "8.1.0", "fuzzy": "0.1.3", "glob": "7.1.2", "google-libphonenumber": "3.2.38", @@ -193,11 +183,13 @@ "image-focus": "1.2.1", "immer": "10.0.2", "immutable": "4.3.7", - "incremental-compiler": "~16.444.16", + "incremental-compiler": "~18.0.12", "inquirer": "7.3.3", - "inquirer-autocomplete-prompt": "1.3.0", + "inquirer-autocomplete-prompt": "1.4.0", + "inquirer-autocomplete-standalone": "0.8.1", + "inquirer-select-pro": "1.0.0-alpha.7", "is-elevated": "3.0.0", - "isomorphic-region-loader": "~16.444.15", + "isomorphic-region-loader": "~18.0.12", "istanbul-instrumenter-loader": "3.0.1", "jest": "29.7.0", "jest-date-mock": "1.0.10", @@ -208,19 +200,19 @@ "joi": "17.13.3", "jscodeshift": "0.6.3", "json-stringify-safe": "5.0.1", - "json10": "~16.444.15", - "json10-writer": "~16.444.15", + "json10": "~18.0.12", + "json10-writer": "~18.0.12", "json5": "2.2.3", "json5-writer": "0.2.0", "jszip": "3.10.1", - "karma-cli": "0.1.2", + "karma-cli": "1.0.1", "lnk": "1.0.1", "localforage": "1.10.0", "lockfile": "1.0.4", "lodash": "4.17.21", - "lodash-walk-object": "~16.444.14", + "lodash-walk-object": "~18.0.12", "lowdb": "7.0.1", - "magic-renamer": "~16.444.14", + "magic-renamer": "~18.0.12", "material-design-icons": "3.0.1", "method-override": "2.3.10", "minimist": "1.2.8", @@ -231,13 +223,15 @@ "ng-in-viewport": "16.1.0", "ng-lock": "18.0.1", "ng-packagr": "18.1.0", - "ng-talkback": "~16.444.7", - "ng2-logger": "~16.444.15", + "ng-talkback": "~18.0.11", + "ng2-logger": "~18.0.14", "ng2-pdfjs-viewer": "18.0.0", - "ng2-rest": "~16.444.14", + "ng2-rest": "~18.0.12", + "ng2-rest-swagger-generator": "18.0.9", "ngx-ace-wrapper": "17.0.0", "ngx-editor": "17.5.4", "ngx-highlightjs": "12.0.0", + "ngx-infinite-scroll": "18.0.0", "ngx-moment": "6.0.2", "ngx-monaco-editor": "12.0.0", "ngx-photo-editor": "0.4.4", @@ -247,21 +241,22 @@ "ngx-scrolltop": "18.0.0", "ngx-store": "3.1.1", "ngx-typed-js": "2.1.1", - "node-cli-tester": "~16.444.7", + "node-cli-tester": "~18.0.11", "node-localstorage": "2.1.6", "node-notifier": "10.0.1", - "node-polyfill-webpack-plugin": "1.1.4", + "node-polyfill-webpack-plugin": "2.0.1", "nodemon": "2.0.22", "npm-get-dependents": "1.0.1", "npm-run": "4.1.2", "omelette": "0.4.17", - "open": "10.0.4", - "ora": "8.0.1", + "open": "7.2.1", + "ora": "3.4.0", "passport": "0.7.0", "passport-http-bearer": "1.0.1", "password-hash": "1.2.2", "path-to-regexp": "6.2.2", "pica": "9.0.1", + "playwright": "1.43.1", "portfinder": "1.0.21", "prettier": "3.3.3", "prettier-eslint": "16.3.0", @@ -276,7 +271,7 @@ "q": "1.5.1", "rallax.js": "2.0.4", "randomcolor": "0.5.3", - "record-replay-req-res-scenario": "~16.444.7", + "record-replay-req-res-scenario": "~18.0.11", "reflect-metadata": "0.2.2", "rimraf": "2.6.2", "rxjs": "~7.8.1", @@ -288,20 +283,23 @@ "socket.io-client": "4.7.5", "sort-package-json": "1.11.0", "sql.js": "1.8.0", - "static-columns": "~16.444.10", + "static-columns": "~18.0.13", "string-similarity": "4.0.4", "sudo-block": "3.0.0", "supertest": "7.0.0", "sweetalert2": "11.7.32", "systeminformation": "3.45.7", + "taon": "^18", + "taon-storage": "18.0.11", + "taon-type-sql": "18.0.12", + "taon-typeorm": "18.0.11", "task.js": "0.1.5", "threads": "1.7.0", - "tnp-cli": "~16.444.7", - "tnp-config": "~16.444.15", - "tnp-core": "~16.444.18", - "tnp-db": "~16.444.14", - "tnp-helpers": "~16.444.25", - "tnp-models": "~16.444.15", + "tnp": "~18.0.12", + "tnp-config": "~18.0.14", + "tnp-core": "~18.0.36", + "tnp-helpers": "~18.0.12", + "tnp-models": "~18.0.13", "ts-debug": "1.3.0", "ts-json-schema-generator": "2.3.0-next.5", "ts-loader": "2.3.1", @@ -309,18 +307,20 @@ "tslib": "~2.6.3", "tslint": "6.1.3", "turndown": "7.2.0", + "type-fest": "4.25.0", "typedoc": "0.26.5", "typedoc-plugin-markdown": "4.2.3", "typescript": "~5.5.4", - "typescript-class-helpers": "~16.444.15", + "typescript-class-helpers": "~18.0.13", "typescript-formatter": "~7.2.2", + "typescript-string-enums": "~1.0.0", "underscore": "1.13.7", "uuid": "10.0.0", "validator": "13.5.2", "video.js": "8.3.0", - "vpn-split": "~16.444.7", + "vpn-split": "~18.0.11", "vscode": "1.1.37", - "wait-on": "5.2.2", + "wait-on": "7.0.1", "watch": "1.0.2", "webpack": "~5.80", "webpack-dev-middleware": "~6.1.3", @@ -328,5 +328,8 @@ "yup": "1.3.3", "zone.js": "~0.13.0" }, - "devDependencies": {} -} + "devDependencies": {}, + "scripts": { + "mkdocs": "python3 -m mkdocs" + } +} \ No newline at end of file diff --git a/projects/container-v18/examples-v18/single-file/preview.png b/projects/container-v18/examples-v18/single-file/preview.png new file mode 100644 index 00000000..3653eac0 Binary files /dev/null and b/projects/container-v18/examples-v18/single-file/preview.png differ diff --git a/projects/container-v18/examples-v18/single-file/src/app.ts b/projects/container-v18/examples-v18/single-file/src/app.ts index 2d85f1ec..f9a71f0f 100644 --- a/projects/container-v18/examples-v18/single-file/src/app.ts +++ b/projects/container-v18/examples-v18/single-file/src/app.ts @@ -11,22 +11,27 @@ import { VERSION } from '@angular/core'; //#endregion console.log('hello world'); -console.log('Your server will start on port '+ HOST_BACKEND_PORT); +console.log('Your server will start on port ' + HOST_BACKEND_PORT); const host = 'http://localhost:' + HOST_BACKEND_PORT; -//#region isomorphic-lib component +//#region single file example component //#region @browser @Component({ - selector: 'app-isomorphic-lib', - template: `hello from isomorphic-lib
- Angular version: {{ angularVersion }}
-
+ selector: 'app-single-file', + template: `hello from single file example
+ Angular version: {{ angularVersion }}
+
users from backend - `, - styles: [` body { margin: 0px !important; } `], +
  • {{ user | json }}
  • + `, + styles: [ + ` + body { + margin: 0px !important; + } + `, + ], }) export class IsomorphicLibComponent { angularVersion = VERSION.full; @@ -36,35 +41,34 @@ export class IsomorphicLibComponent { //#endregion //#endregion -//#region isomorphic-lib api service +//#region single file example api service //#region @browser @Injectable({ - providedIn:'root' + providedIn: 'root', }) export class UserApiService { - userControlller = Taon.inject(()=> MainContext.getClass(UserController)) + userControlller = Taon.inject(() => MainContext.getClass(UserController)); getAll() { - return this.userControlller.getAll() - .received - .observable - .pipe(map(r => r.body.json)); + return this.userControlller + .getAll() + .received.observable.pipe(map(r => r.body.json)); } } //#endregion //#endregion -//#region isomorphic-lib module +//#region single file example module //#region @browser @NgModule({ exports: [IsomorphicLibComponent], imports: [CommonModule], declarations: [IsomorphicLibComponent], }) -export class IsomorphicLibModule { } +export class SingleFileModule {} //#endregion //#endregion -//#region isomorphic-lib entity +//#region single file example entity @Taon.Entity({ className: 'User' }) class User extends Taon.Base.AbstractEntity { //#region @websql @@ -74,10 +78,10 @@ class User extends Taon.Base.AbstractEntity { } //#endregion -//#region isomorphic-lib controller +//#region single file example controller @Taon.Controller({ className: 'UserController' }) class UserController extends Taon.Base.CrudController { - entityClassResolveFn = ()=> User; + entityClassResolveFn = () => User; //#region @websql async initExampleDbData(): Promise { const superAdmin = new User(); @@ -88,11 +92,12 @@ class UserController extends Taon.Base.CrudController { } //#endregion -//#region isomorphic-lib context -const MainContext = Taon.createContext(()=>({ +//#region single file example context +const MainContext = Taon.createContext(() => ({ host, + disabledRealtime: true, contextName: 'MainContext', - contexts:{ BaseContext }, + contexts: { BaseContext }, controllers: { UserController, // PUT FIREDEV CONTORLLERS HERE @@ -102,17 +107,17 @@ const MainContext = Taon.createContext(()=>({ // PUT FIREDEV ENTITIES HERE }, database: true, - // disabledRealtime: true, + // logs: true, })); //#endregion async function start() { - await MainContext.initialize(); if (Taon.isBrowser) { - const users = (await MainContext.getClassInstance(UserController).getAll().received) - .body?.json; + const users = ( + await MainContext.getClassInstance(UserController).getAll().received + ).body?.json; console.log({ 'users from backend': users, }); diff --git a/projects/container-v18/examples-v18/single-file/firedev.jsonc b/projects/container-v18/examples-v18/single-file/taon.jsonc similarity index 99% rename from projects/container-v18/examples-v18/single-file/firedev.jsonc rename to projects/container-v18/examples-v18/single-file/taon.jsonc index bac39e87..519c56cb 100644 --- a/projects/container-v18/examples-v18/single-file/firedev.jsonc +++ b/projects/container-v18/examples-v18/single-file/taon.jsonc @@ -21,4 +21,4 @@ "cliBuildUglify": false, "cliBuildIncludeNodeModules": false } -} +} \ No newline at end of file diff --git a/projects/container-v18/examples-v18/single-file/tsconfig.json b/projects/container-v18/examples-v18/single-file/tsconfig.json index 2e3933d0..33832133 100644 --- a/projects/container-v18/examples-v18/single-file/tsconfig.json +++ b/projects/container-v18/examples-v18/single-file/tsconfig.json @@ -4,10 +4,10 @@ "strictNullChecks": false, "rootDir": "./src", "paths": { - "isomorphic-lib": [ + "single-file": [ "./src/lib" ], - "isomorphic-lib/*": [ + "single-file/*": [ "./src/lib/*" ] } diff --git a/src/lib/models.ts b/src/lib/models.ts index 0a244d0f..a20abfcf 100644 --- a/src/lib/models.ts +++ b/src/lib/models.ts @@ -99,13 +99,21 @@ export namespace Models { SUBSCRIBERS, > { contextName: string; + /** + * host/port for initing backend server + */ host?: string; /** - * frontend host only needed when we are using - * withCredentials for axios - * and session cookie - */ + * frontend host only needed when we are + * using withCredentials for axios + * and session cookie + * or realtime communication + */ frontendHost?: string; + /** + * backend way of communication + * between taon backends/processes + */ remoteHost?: string; useIpcWhenElectron?: boolean; contexts?: CONTEXTS; diff --git a/src/lib/realtime/realtime-server.ts b/src/lib/realtime/realtime-server.ts index 9d09e256..93b1ebfa 100644 --- a/src/lib/realtime/realtime-server.ts +++ b/src/lib/realtime/realtime-server.ts @@ -23,6 +23,17 @@ export class RealtimeServer { private init() { //#region @websql + if(!this.core.ctx.config.frontendHost) { + console.warn(`[Taon][Realtime] + + Frontend host is not defined + REALTIME COUMMUNICATION WILL NOT WORK + + provide "frontendHost" property in your taon config + + `); + } + //#region prepare namespaces pathes const nspPath = { global: this.core.pathFor(),