bhooai-nexus 0.1.6 → 2.0.2
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/LICENSE +1 -1
- package/README.md +105 -294
- package/bin/nexus.js +5 -13
- package/docs/ARCHITECTURE.md +134 -121
- package/docs/CLI.md +147 -0
- package/docs/CONVENTIONS.md +193 -0
- package/docs/MULTI_APP.md +107 -0
- package/docs/STORAGE.md +118 -0
- package/package.json +62 -57
- package/packages/nexus-admin/package.json +7 -6
- package/packages/nexus-admin/src/App.tsx +51 -4860
- package/packages/nexus-admin/src/api.ts +65 -576
- package/packages/nexus-admin/src/components/components.tsx +51 -0
- package/packages/nexus-admin/src/index.css +75 -3632
- package/packages/nexus-admin/src/tabs/Ai.tsx +70 -0
- package/packages/nexus-admin/src/tabs/Apps.tsx +53 -0
- package/packages/nexus-admin/src/tabs/Config.tsx +31 -0
- package/packages/nexus-admin/src/tabs/Health.tsx +38 -0
- package/packages/nexus-admin/src/tabs/Logs.tsx +52 -0
- package/packages/nexus-admin/src/tabs/Overview.tsx +43 -0
- package/packages/nexus-admin/src/tabs/Payments.tsx +62 -0
- package/packages/nexus-admin/src/tabs/Users.tsx +45 -0
- package/packages/nexus-ads/package.json +22 -22
- package/packages/nexus-ai-client/package.json +22 -20
- package/packages/nexus-auth/package.json +24 -24
- package/packages/nexus-cache/package.json +23 -23
- package/packages/nexus-cli/package.json +17 -12
- package/packages/nexus-cli/src/commands/add.ts +274 -0
- package/packages/nexus-cli/src/commands/build.ts +91 -0
- package/packages/nexus-cli/src/commands/db.ts +241 -0
- package/packages/nexus-cli/src/commands/dev.ts +96 -184
- package/packages/nexus-cli/src/commands/doctor.ts +102 -184
- package/packages/nexus-cli/src/commands/init.ts +232 -955
- package/packages/nexus-cli/src/commands/maintenance-commands.ts +40 -0
- package/packages/nexus-cli/src/commands/plugin.ts +233 -0
- package/packages/nexus-cli/src/commands/queue.ts +145 -0
- package/packages/nexus-cli/src/commands/test.ts +34 -0
- package/packages/nexus-cli/src/devPanel.ts +440 -0
- package/packages/nexus-cli/src/devServiceManager.ts +183 -0
- package/packages/nexus-cli/src/dispatcher.ts +113 -0
- package/packages/nexus-cli/src/generators.ts +102 -0
- package/packages/nexus-cli/src/index.ts +32 -90
- package/packages/nexus-cli/src/make/generators.ts +431 -0
- package/packages/nexus-cli/src/ports.ts +85 -0
- package/packages/nexus-cli/src/prompts.ts +68 -0
- package/packages/nexus-cli/src/templating/render.ts +109 -0
- package/packages/nexus-cli/src/util.ts +74 -112
- package/packages/nexus-cli/templates/base/Dockerfile.ejs +68 -0
- package/packages/nexus-cli/templates/base/README.md.ejs +62 -0
- package/packages/nexus-cli/templates/base/apps/admin/index.html.ejs +12 -0
- package/packages/nexus-cli/templates/base/apps/admin/nginx.conf.ejs +16 -0
- package/packages/nexus-cli/templates/base/apps/admin/package.json.ejs +15 -0
- package/packages/nexus-cli/templates/base/apps/admin/src/main.tsx.ejs +7 -0
- package/packages/nexus-cli/templates/base/apps/admin/vite.config.ts.ejs +22 -0
- package/packages/nexus-cli/templates/base/apps/ai-server/main.py.ejs +30 -0
- package/packages/nexus-cli/templates/base/apps/ai-server/requirements.txt +4 -0
- package/packages/nexus-cli/templates/base/apps/backend/src/main.ts +14 -0
- package/packages/nexus-cli/templates/base/apps/backend/src/routes/index.ts.ejs +11 -0
- package/packages/nexus-cli/templates/base/apps/frontend/index.html.ejs +12 -0
- package/packages/nexus-cli/templates/base/apps/frontend/nginx.conf.ejs +33 -0
- package/packages/nexus-cli/templates/base/apps/frontend/package.json.ejs +11 -0
- package/packages/nexus-cli/templates/base/apps/frontend/src/main.tsx.ejs +16 -0
- package/packages/nexus-cli/templates/base/apps/frontend/vite.config.ts.ejs +22 -0
- package/packages/nexus-cli/templates/base/docker-compose.yml.ejs +93 -0
- package/packages/nexus-cli/templates/base/dockerignore +21 -0
- package/packages/nexus-cli/templates/base/gitignore +43 -0
- package/packages/nexus-cli/templates/base/nexus.config.ts.ejs +97 -0
- package/packages/nexus-cli/templates/base/package.json.ejs +41 -0
- package/packages/nexus-cli/templates/{tsconfig.json → base/tsconfig.json} +2 -3
- package/packages/nexus-core/package.json +28 -40
- package/packages/nexus-core/src/app/ErrorHandler.ts +65 -0
- package/packages/nexus-core/src/app/FormRequest.ts +43 -0
- package/packages/nexus-core/src/app/Job.ts +98 -0
- package/packages/nexus-core/src/app/Mailable.ts +114 -0
- package/packages/nexus-core/src/app/Resource.ts +37 -0
- package/packages/nexus-core/src/app/Seeder.ts +17 -0
- package/packages/nexus-core/src/app/ServiceProvider.ts +16 -0
- package/packages/nexus-core/src/app/Storage.ts +366 -0
- package/packages/nexus-core/src/app/adminModule.ts +365 -0
- package/packages/nexus-core/src/app/createNexusApp.ts +356 -0
- package/packages/nexus-core/src/app/defineRoutes.ts +48 -0
- package/packages/nexus-core/src/app/discover.ts +144 -0
- package/packages/nexus-core/src/app/errorPages/_base.html +121 -0
- package/packages/nexus-core/src/app/errorPages.ts +117 -0
- package/packages/nexus-core/src/app/events.ts +81 -0
- package/packages/nexus-core/src/app/index.ts +15 -0
- package/packages/nexus-core/src/app/maintenance.ts +80 -0
- package/packages/nexus-core/src/app/policies.ts +53 -0
- package/packages/nexus-core/src/config/defaults.ts +0 -20
- package/packages/nexus-core/src/config/schema.ts +1 -27
- package/packages/nexus-core/src/config/types.ts +3 -86
- package/packages/nexus-core/src/index.ts +2 -1
- package/packages/nexus-crypto/package.json +22 -20
- package/packages/nexus-data/package.json +26 -29
- package/packages/nexus-data/src/index.ts +0 -6
- package/packages/nexus-data/src/projects.ts +0 -66
- package/packages/nexus-email/package.json +24 -24
- package/packages/nexus-examples/examples/ai-chat/README.md +37 -0
- package/packages/nexus-examples/examples/ai-chat/apps/backend/src/routes/chat.ts +40 -0
- package/packages/nexus-examples/examples/ai-chat/apps/frontend/src/main.tsx +105 -0
- package/packages/nexus-examples/examples/blog-crud/README.md +45 -0
- package/packages/nexus-examples/examples/blog-crud/apps/backend/src/graphql/post.graph.ts +99 -0
- package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Author.ts +10 -0
- package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Comment.ts +10 -0
- package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Post.ts +13 -0
- package/packages/nexus-examples/examples/blog-crud/apps/backend/src/routes/posts.ts +119 -0
- package/packages/nexus-examples/examples/blog-crud/apps/frontend/src/main.tsx +102 -0
- package/packages/nexus-examples/examples/chat/README.md +20 -0
- package/packages/nexus-examples/examples/chat/apps/backend/src/models/Message.ts +11 -0
- package/packages/nexus-examples/examples/chat/apps/backend/src/routes/chat.ts +17 -0
- package/packages/nexus-examples/examples/chat/apps/backend/src/ws/chat.room.ts +56 -0
- package/packages/nexus-examples/examples/chat/apps/frontend/src/main.tsx +97 -0
- package/packages/nexus-examples/examples/checkout/README.md +40 -0
- package/packages/nexus-examples/examples/checkout/apps/backend/src/mail/mailables/OrderConfirmationMail.ts +27 -0
- package/packages/nexus-examples/examples/checkout/apps/backend/src/mail/templates/order-confirmation.ejs +28 -0
- package/packages/nexus-examples/examples/checkout/apps/backend/src/models/Order.ts +14 -0
- package/packages/nexus-examples/examples/checkout/apps/backend/src/routes/checkout.ts +74 -0
- package/packages/nexus-examples/examples/checkout/apps/frontend/src/main.tsx +85 -0
- package/packages/nexus-examples/examples/dashboard/README.md +26 -0
- package/packages/nexus-examples/examples/dashboard/apps/backend/src/routes/metrics.ts +76 -0
- package/packages/nexus-examples/examples/dashboard/apps/frontend/src/main.tsx +100 -0
- package/packages/nexus-examples/examples/file-storage/README.md +48 -0
- package/packages/nexus-examples/examples/file-storage/apps/backend/src/routes/files.ts +86 -0
- package/packages/nexus-examples/examples/file-storage/apps/frontend/src/main.tsx +111 -0
- package/packages/nexus-examples/examples/livestream/README.md +34 -0
- package/packages/nexus-examples/examples/livestream/apps/backend/src/routes/list.ts +21 -0
- package/packages/nexus-examples/examples/livestream/apps/backend/src/ws/stream.room.ts +53 -0
- package/packages/nexus-examples/examples/livestream/apps/frontend/src/main.tsx +148 -0
- package/packages/nexus-examples/examples/multi-app/README.md +51 -0
- package/packages/nexus-examples/examples/multi-app/apps/backend-api/src/routes/users.ts +26 -0
- package/packages/nexus-examples/examples/multi-app/apps/backend-shop/src/routes/products.ts +27 -0
- package/packages/nexus-examples/examples/saas-starter/README.md +37 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/events/TeamCreated.ts +11 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/events/UserRegistered.ts +10 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/listeners/OnTeamCreated.ts +11 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/listeners/OnUserRegistered.ts +10 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/middleware/auth.ts +14 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/Membership.ts +20 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/Team.ts +10 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/User.ts +17 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/policies/TeamPolicy.ts +35 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/routes/projects.ts +52 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/routes/teams.ts +112 -0
- package/packages/nexus-examples/examples/saas-starter/apps/frontend/src/main.tsx +95 -0
- package/packages/nexus-examples/examples/video-call/README.md +30 -0
- package/packages/nexus-examples/examples/video-call/apps/backend/src/ws/signaling.room.ts +47 -0
- package/packages/nexus-examples/examples/video-call/apps/frontend/src/main.tsx +116 -0
- package/packages/nexus-examples/package.json +14 -0
- package/packages/nexus-examples/src/index.ts +99 -0
- package/packages/nexus-graphql/package.json +26 -26
- package/packages/nexus-payments/package.json +22 -22
- package/packages/nexus-plugins/package.json +22 -22
- package/packages/nexus-postcss/package.json +44 -41
- package/packages/nexus-realtime/package.json +28 -28
- package/packages/nexus-safe-goto/package.json +16 -0
- package/packages/nexus-safe-goto/src/index.tsx +173 -0
- package/packages/nexus-telemetry/package.json +22 -22
- package/src/index.ts +53 -0
- package/apps/admin/index.html +0 -12
- package/apps/admin/package.json +0 -23
- package/apps/admin/postcss.config.js +0 -5
- package/apps/admin/public/anime-girl.svg +0 -84
- package/apps/admin/public/bhooai-nexus-logo.png +0 -0
- package/apps/admin/public/bhooai-nexus-logo.svg +0 -135
- package/apps/admin/public/favicon.ico +0 -0
- package/apps/admin/src/main.tsx +0 -10
- package/apps/admin/src/vite-env.d.ts +0 -18
- package/apps/admin/tailwind.config.js +0 -10
- package/apps/admin/tsconfig.json +0 -17
- package/apps/admin/vite.config.ts +0 -68
- package/docs/IMPROVEMENTS.md +0 -105
- package/docs/api/admin.html +0 -651
- package/docs/api/ads.html +0 -314
- package/docs/api/ai-client.html +0 -336
- package/docs/api/auth.html +0 -697
- package/docs/api/cache.html +0 -331
- package/docs/api/cli.html +0 -612
- package/docs/api/cluster.html +0 -489
- package/docs/api/core.html +0 -796
- package/docs/api/crypto.html +0 -310
- package/docs/api/data.html +0 -811
- package/docs/api/email.html +0 -345
- package/docs/api/graphql.html +0 -697
- package/docs/api/http-endpoints.html +0 -221
- package/docs/api/node-agent.html +0 -155
- package/docs/api/payments.html +0 -558
- package/docs/api/plugins.html +0 -522
- package/docs/api/postcss.html +0 -241
- package/docs/api/realtime.html +0 -324
- package/docs/api/safe-goto.html +0 -215
- package/docs/api/supervisor.html +0 -312
- package/docs/api/telemetry.html +0 -264
- package/docs/api/websockets.html +0 -163
- package/docs/architecture.html +0 -211
- package/docs/assets/bhooai-nexus-cluster-link.postman_collection.json +0 -185
- package/docs/assets/bhooai-nexus-local.postman_environment.json +0 -47
- package/docs/assets/bhooai-nexus-logo.png +0 -0
- package/docs/assets/bhooai-nexus-logo.svg +0 -135
- package/docs/assets/docs.js +0 -368
- package/docs/assets/favicon.ico +0 -0
- package/docs/assets/favicon.zip +0 -0
- package/docs/assets/nav.js +0 -91
- package/docs/assets/playground.js +0 -283
- package/docs/assets/screenshots/01-collection.png +0 -0
- package/docs/assets/screenshots/02-step1-csrf.png +0 -0
- package/docs/assets/screenshots/03-step2-login.png +0 -0
- package/docs/assets/screenshots/04-step3-link.png +0 -0
- package/docs/assets/screenshots/05-error-fetch-failed.png +0 -0
- package/docs/assets/screenshots/06-error-agent-401.png +0 -0
- package/docs/assets/screenshots/07-error-401-csrf.png +0 -0
- package/docs/assets/screenshots/08-env-runner.png +0 -0
- package/docs/assets/screenshots/visual-flow.png +0 -0
- package/docs/assets/style.css +0 -1140
- package/docs/examples.html +0 -248
- package/docs/favicon.ico +0 -0
- package/docs/getting-started.html +0 -155
- package/docs/guides/guide-ai-chat.html +0 -202
- package/docs/guides/guide-auth.html +0 -328
- package/docs/guides/guide-cluster.html +0 -325
- package/docs/guides/guide-email.html +0 -234
- package/docs/guides/guide-empty-project.html +0 -279
- package/docs/guides/guide-frontend-styling.html +0 -235
- package/docs/guides/guide-graphql.html +0 -214
- package/docs/guides/guide-mongodb.html +0 -220
- package/docs/guides/guide-payments.html +0 -321
- package/docs/guides/guide-uploads.html +0 -170
- package/docs/guides/guide-websocket.html +0 -263
- package/docs/improvements.html +0 -146
- package/docs/index.html +0 -101
- package/docs/learn/01-foundation.html +0 -129
- package/docs/learn/02-security.html +0 -104
- package/docs/learn/03-data.html +0 -99
- package/docs/learn/04-graphql.html +0 -86
- package/docs/learn/05-realtime.html +0 -76
- package/docs/learn/06-payments-email-crypto.html +0 -93
- package/docs/learn/07-cache-ads.html +0 -85
- package/docs/learn/08-ai.html +0 -93
- package/docs/learn/09-plugins.html +0 -81
- package/docs/learn/10-cluster.html +0 -83
- package/docs/learn/11-cli.html +0 -183
- package/docs/learn/12-apps.html +0 -123
- package/docs/learn/13-tests.html +0 -79
- package/docs/learn/14-postman-testing.html +0 -580
- package/docs/learn/PLAN.md +0 -59
- package/docs/learn/index.html +0 -87
- package/docs/screenshots/README.md +0 -23
- package/docs/screenshots/ai-agents-playground.png +0 -0
- package/docs/screenshots/ai-agents-providers.png +0 -0
- package/docs/screenshots/ai-agents.png +0 -0
- package/docs/screenshots/appearance.png +0 -0
- package/docs/screenshots/cluster-master.png +0 -0
- package/docs/screenshots/cluster-nodes.png +0 -0
- package/docs/screenshots/cluster-slave.png +0 -0
- package/docs/screenshots/login.png +0 -0
- package/docs/screenshots/logs-ai-summary.png +0 -0
- package/docs/screenshots/monitoring.png +0 -0
- package/docs/screenshots/nexus-dev.png +0 -0
- package/docs/screenshots/nexus-init.png +0 -0
- package/docs/screenshots/notification.png +0 -0
- package/docs/screenshots/overview.png +0 -0
- package/docs/screenshots/search-bar.png +0 -0
- package/docs/screenshots/settings.png +0 -0
- package/docs/screenshots/themes.png +0 -0
- package/docs/troubleshooting.html +0 -400
- package/packages/nexus-admin/src/alertCenter.tsx +0 -150
- package/packages/nexus-admin/src/assets/bhooai-nexus-logo.svg +0 -25
- package/packages/nexus-admin/src/vite-env.d.ts +0 -19
- package/packages/nexus-cli/src/commands/cluster.ts +0 -133
- package/packages/nexus-cli/src/commands/node.ts +0 -106
- package/packages/nexus-cli/src/commands/pysetup.ts +0 -142
- package/packages/nexus-cli/src/commands/sync.ts +0 -116
- package/packages/nexus-cli/src/commands/uninstall.ts +0 -287
- package/packages/nexus-cli/src/config-sync.ts +0 -384
- package/packages/nexus-cli/src/dotenv.ts +0 -39
- package/packages/nexus-cli/src/supervisor.ts +0 -394
- package/packages/nexus-cli/src/wizard.ts +0 -149
- package/packages/nexus-cli/templates/Dockerfile +0 -60
- package/packages/nexus-cli/templates/README.md +0 -69
- package/packages/nexus-cli/templates/apps/admin/index.html +0 -12
- package/packages/nexus-cli/templates/apps/admin/package.json +0 -22
- package/packages/nexus-cli/templates/apps/admin/postcss.config.js +0 -3
- package/packages/nexus-cli/templates/apps/admin/src/main.tsx +0 -10
- package/packages/nexus-cli/templates/apps/admin/src/vite-env.d.ts +0 -18
- package/packages/nexus-cli/templates/apps/admin/tailwind.config.js +0 -9
- package/packages/nexus-cli/templates/apps/admin/tsconfig.json +0 -17
- package/packages/nexus-cli/templates/apps/admin/vite.config.ts +0 -64
- package/packages/nexus-cli/templates/apps/ai-server/main.py +0 -43
- package/packages/nexus-cli/templates/apps/ai-server/providers/__init__.py +0 -3
- package/packages/nexus-cli/templates/apps/ai-server/providers/base.py +0 -111
- package/packages/nexus-cli/templates/apps/ai-server/requirements.txt +0 -3
- package/packages/nexus-cli/templates/apps/ai-server/routers/__init__.py +0 -3
- package/packages/nexus-cli/templates/apps/ai-server/routers/chat.py +0 -47
- package/packages/nexus-cli/templates/apps/ai-server/routers/embeddings.py +0 -30
- package/packages/nexus-cli/templates/apps/ai-server/routers/lint.py +0 -167
- package/packages/nexus-cli/templates/apps/ai-server/routers/models.py +0 -23
- package/packages/nexus-cli/templates/apps/ai-server/routers/preflight.py +0 -169
- package/packages/nexus-cli/templates/apps/ai-server/settings.py +0 -48
- package/packages/nexus-cli/templates/apps/backend/package.json +0 -34
- package/packages/nexus-cli/templates/apps/backend/src/main.ts +0 -375
- package/packages/nexus-cli/templates/apps/backend/src/modules/admin/adminRoutes.ts +0 -732
- package/packages/nexus-cli/templates/apps/backend/src/modules/admin/clusterRoutes.ts +0 -391
- package/packages/nexus-cli/templates/apps/backend/src/modules/admin/databaseRoutes.ts +0 -161
- package/packages/nexus-cli/templates/apps/backend/src/modules/admin/lintProxy.ts +0 -89
- package/packages/nexus-cli/templates/apps/backend/src/modules/admin/preflightProxy.ts +0 -242
- package/packages/nexus-cli/templates/apps/backend/src/modules/admin/roleCatalog.ts +0 -78
- package/packages/nexus-cli/templates/apps/backend/src/modules/admin/schemaRoutes.ts +0 -449
- package/packages/nexus-cli/templates/apps/backend/src/modules/ai/aiProxy.ts +0 -265
- package/packages/nexus-cli/templates/apps/backend/src/modules/auth/authRoutes.ts +0 -220
- package/packages/nexus-cli/templates/apps/backend/src/modules/payments/paymentRoutes.ts +0 -100
- package/packages/nexus-cli/templates/apps/backend/src/modules/payments/paymentStore.ts +0 -172
- package/packages/nexus-cli/templates/apps/backend/src/modules/requests/requestLog.ts +0 -175
- package/packages/nexus-cli/templates/apps/backend/src/modules/users/userGraph.ts +0 -83
- package/packages/nexus-cli/templates/apps/backend/src/modules/users/userModel.ts +0 -88
- package/packages/nexus-cli/templates/apps/backend/src/plugins/CronScheduler.ts +0 -69
- package/packages/nexus-cli/templates/apps/backend/src/plugins/loadPlugins.ts +0 -107
- package/packages/nexus-cli/templates/apps/backend/tsconfig.json +0 -14
- package/packages/nexus-cli/templates/apps/frontend/index.html +0 -12
- package/packages/nexus-cli/templates/apps/frontend/package.json +0 -20
- package/packages/nexus-cli/templates/apps/frontend/postcss.config.js +0 -3
- package/packages/nexus-cli/templates/apps/frontend/src/index.css +0 -44
- package/packages/nexus-cli/templates/apps/frontend/src/main.tsx +0 -65
- package/packages/nexus-cli/templates/apps/frontend/tailwind.config.js +0 -9
- package/packages/nexus-cli/templates/apps/frontend/vite.config.ts +0 -72
- package/packages/nexus-cli/templates/bin/nexus.js +0 -35
- package/packages/nexus-cli/templates/bin/serve-all.mjs +0 -45
- package/packages/nexus-cli/templates/dockerignore +0 -15
- package/packages/nexus-cli/templates/gitignore +0 -12
- package/packages/nexus-cli/templates/nexus.config.ts +0 -69
- package/packages/nexus-cli/templates/package.json +0 -47
- /package/packages/nexus-cli/templates/{uploads → base/apps/backend/storage}/.gitkeep +0 -0
package/LICENSE
CHANGED
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,357 +1,168 @@
|
|
|
1
|
-
# BhooAI Nexus
|
|
1
|
+
# BhooAI Nexus v2
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A production-ready Node.js full-stack framework. One config file, one CLI, multi-app monorepo.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> v2 is a fresh workspace at `C:\server\PACKAGES\bhooai-nexus\` — reuses v1's packages, removes the
|
|
6
|
+
> cluster subsystem (Docker handles scaling), rewrites the CLI, and adds a Laravel-style
|
|
7
|
+
> convention layer on top.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
- MongoDB ODM with schemas, hooks, indexes, populate, and transactions
|
|
9
|
-
- JWT access tokens, refresh tokens, sessions, Google OAuth, Facebook OAuth, and role-based access control
|
|
10
|
-
- WebSockets, Redis adapters, WebRTC signaling, and mediasoup SFU integration
|
|
11
|
-
- GraphQL subscriptions, federation composition, entity joins, `@provides`, and `@requires`
|
|
12
|
-
- Razorpay, PayPal, PayU, Skrill, and Payoneer integrations
|
|
13
|
-
- Email, certificate generation, Redis cache, Google Ads, and plugin extensions
|
|
14
|
-
- Python FastAPI AI server with OpenAI-compatible chat, embeddings, Ollama, and SSE streaming
|
|
15
|
-
- Admin console with configuration, environment, process, monitoring, database, AI, and cluster management
|
|
16
|
-
- Master/slave cluster mesh with load balancing, node agents, request allocation, health checks, and upload path pinning
|
|
17
|
-
- Tailwind CSS + `@bhooai/nexus-postcss` preset with PostCSS pipeline, design tokens, light/dark theme, and CSS playground
|
|
9
|
+
## Quick start
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- Node.js `>=22`
|
|
22
|
-
- npm, included with Node.js
|
|
23
|
-
- MongoDB 6 or newer, running locally or reachable through `MONGODB_URI`
|
|
24
|
-
- Redis 6 or newer, running locally or reachable through `REDIS_URL`
|
|
25
|
-
- Python 3.13 or newer for the optional AI server
|
|
26
|
-
- A virtual environment is recommended for Python dependencies
|
|
27
|
-
|
|
28
|
-
The Python service dependencies are listed in [`apps/ai-server/requirements.txt`](apps/ai-server/requirements.txt): FastAPI, Uvicorn, HTTPX, pytest, and pytest-asyncio.
|
|
29
|
-
|
|
30
|
-
MongoDB and Redis can be started with Docker, system services, or managed cloud providers. The AI server is optional when AI features are not used.
|
|
31
|
-
|
|
32
|
-
## Install
|
|
11
|
+
`nexus init` scaffolds the project **and installs its dependencies** in one step.
|
|
33
12
|
|
|
34
13
|
```bash
|
|
35
|
-
|
|
36
|
-
|
|
14
|
+
# One-time: install the CLI (or use npx without installing)
|
|
15
|
+
npm install -g bhooai-nexus
|
|
16
|
+
|
|
17
|
+
# New project (zero prompts — opinionated defaults)
|
|
18
|
+
nexus init my-app
|
|
37
19
|
cd my-app
|
|
38
|
-
npm run doctor
|
|
39
20
|
npm run dev
|
|
40
21
|
```
|
|
41
22
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## Quick Start
|
|
23
|
+
Prefer `npx` over a global install? `nexus init` auto-installs deps either way:
|
|
45
24
|
|
|
46
25
|
```bash
|
|
47
|
-
npm install bhooai-nexus
|
|
48
26
|
npx nexus init my-app
|
|
49
27
|
cd my-app
|
|
50
|
-
npm run doctor
|
|
51
28
|
npm run dev
|
|
52
29
|
```
|
|
53
30
|
|
|
54
|
-
Default development services:
|
|
55
|
-
|
|
56
|
-
| Service | Default port |
|
|
57
|
-
| --- | ---: |
|
|
58
|
-
| Backend API | `4000` |
|
|
59
|
-
| Frontend | `3000` |
|
|
60
|
-
| Admin console | `3300` |
|
|
61
|
-
| Python AI server | `8000` |
|
|
62
|
-
| Cluster load balancer | `8080` |
|
|
63
|
-
| Node agent | `7575` |
|
|
64
|
-
|
|
65
|
-
`nexus dev` automatically moves a configured port to the next available port, allowing master and slave projects to run side by side on one machine.
|
|
66
|
-
|
|
67
|
-
## Screenshots
|
|
68
|
-
|
|
69
|
-
### Admin login
|
|
70
|
-
|
|
71
|
-

|
|
72
|
-
|
|
73
|
-
### Overview dashboard
|
|
74
|
-
|
|
75
|
-

|
|
76
|
-
|
|
77
|
-
### Master cluster management
|
|
78
|
-
|
|
79
|
-

|
|
80
|
-
|
|
81
|
-
### Slave node agent and roles
|
|
82
|
-
|
|
83
|
-

|
|
84
|
-
|
|
85
|
-
### Connected cluster nodes
|
|
86
|
-
|
|
87
|
-

|
|
88
|
-
|
|
89
|
-
### AI agents
|
|
90
|
-
|
|
91
|
-

|
|
92
|
-
|
|
93
|
-
### AI providers
|
|
94
|
-
|
|
95
|
-

|
|
96
|
-
|
|
97
|
-
### AI playground
|
|
98
|
-
|
|
99
|
-

|
|
100
|
-
|
|
101
|
-
### Monitoring
|
|
102
|
-
|
|
103
|
-

|
|
104
|
-
|
|
105
|
-
### Settings
|
|
106
|
-
|
|
107
|
-

|
|
108
|
-
|
|
109
|
-
### Themes
|
|
110
|
-
|
|
111
|
-

|
|
112
|
-
|
|
113
|
-
### Appearance
|
|
114
|
-
|
|
115
|
-

|
|
116
|
-
|
|
117
|
-
### Search
|
|
118
|
-
|
|
119
|
-

|
|
120
|
-
|
|
121
|
-
### Notifications
|
|
122
|
-
|
|
123
|
-

|
|
124
|
-
|
|
125
|
-
### AI log summary
|
|
126
|
-
|
|
127
|
-

|
|
128
|
-
|
|
129
|
-
### Nexus development services
|
|
130
|
-
|
|
131
|
-

|
|
132
|
-
|
|
133
|
-
### Nexus initialization
|
|
134
|
-
|
|
135
|
-

|
|
136
|
-
|
|
137
|
-
## Cluster Mesh
|
|
138
|
-
|
|
139
|
-
BhooAI Nexus supports a central master and one or more slave nodes.
|
|
140
|
-
|
|
141
|
-
Initialize a master:
|
|
142
|
-
|
|
143
31
|
```bash
|
|
144
|
-
|
|
32
|
+
# Wizard with example picker
|
|
33
|
+
nexus init my-app --interactive
|
|
34
|
+
# or, named example:
|
|
35
|
+
nexus init my-app --example chat
|
|
145
36
|
```
|
|
146
37
|
|
|
147
|
-
|
|
38
|
+
Skip dependency install for CI/offline use:
|
|
148
39
|
|
|
149
40
|
```bash
|
|
150
|
-
|
|
151
|
-
npx nexus init slave-2 --as=node --role=files --port=7576
|
|
41
|
+
nexus init my-app --no-install
|
|
152
42
|
```
|
|
153
43
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
After `npm run dev`, a node project automatically starts its node agent. The agent exposes the control API and advertises the node's development backend without starting a duplicate backend process.
|
|
157
|
-
|
|
158
|
-
The master load balancer listens on port `8080` and distributes traffic across ready backend nodes. Authentication routes are pinned to the master:
|
|
44
|
+
## Architecture at a glance
|
|
159
45
|
|
|
160
|
-
- `/auth/*`
|
|
161
|
-
- `/csrf-token`
|
|
162
|
-
|
|
163
|
-
Use the same `NEXUS_AUTH_JWT_SECRET` on all nodes so slaves can verify master-issued access tokens.
|
|
164
|
-
|
|
165
|
-
### Upload path allocation
|
|
166
|
-
|
|
167
|
-
The master admin console includes **Cluster → Path routing**. Pin URL prefixes to specific nodes:
|
|
168
|
-
|
|
169
|
-
```text
|
|
170
|
-
/uploads/images -> slave-1
|
|
171
|
-
/uploads/files -> slave-2
|
|
172
46
|
```
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
The Cluster tab includes connected-node cards with request allocation percentage, CPU, memory, freshness, service health, test, enable, restart, and unlink controls. Slave mode includes role selection, node-agent status, pairing tokens, node IDs, and copyable serve/link commands. Master mode includes path-prefix routing for uploads and other services.
|
|
185
|
-
|
|
186
|
-
## Configuration
|
|
187
|
-
|
|
188
|
-
Edit `nexus.config.ts`. Configuration precedence is:
|
|
189
|
-
|
|
190
|
-
```text
|
|
191
|
-
code defaults < nexus.config.ts < nexus.runtime.json < NEXUS_* environment variables < CLI flags
|
|
47
|
+
┌──────────────── Multi-app monorepo ─────────────────┐
|
|
48
|
+
│ apps/backend/ ← Node.js, auto-discovery │
|
|
49
|
+
│ apps/backend-shop/ ← add via `nexus add backend` │
|
|
50
|
+
│ apps/frontend/ ← Vite + React │
|
|
51
|
+
│ apps/frontend-shop/ ← add via `nexus add frontend` │
|
|
52
|
+
│ apps/admin/ ← wraps @bhooai/nexus-admin │
|
|
53
|
+
│ apps/ai-server/ ← FastAPI (optional) │
|
|
54
|
+
│ .nexus-ports.json ← stable port registry │
|
|
55
|
+
│ nexus.config.ts │
|
|
56
|
+
│ docker-compose.yml │
|
|
57
|
+
└──────────────────────────────────────────────────────┘
|
|
192
58
|
```
|
|
193
59
|
|
|
194
|
-
|
|
60
|
+
Each backend follows a Laravel-style convention under `src/`:
|
|
195
61
|
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
62
|
+
```
|
|
63
|
+
src/
|
|
64
|
+
├── main.ts # 20-line createNexusApp()
|
|
65
|
+
├── routes/ # HTTP endpoints (auto-discovered)
|
|
66
|
+
├── graphql/ # *.graph.ts (federation)
|
|
67
|
+
├── ws/ # *.room.ts (WebSocket rooms)
|
|
68
|
+
├── mail/templates/ # *.ejs
|
|
69
|
+
├── mail/mailables/ # classes
|
|
70
|
+
├── errors/pages/ # 404.html / 500.html / ...
|
|
71
|
+
├── errors/Handler.ts
|
|
72
|
+
├── models/ services/ repositories/ controllers/
|
|
73
|
+
├── middleware/ validators/ jobs/ listeners/ events/
|
|
74
|
+
├── policies/ resources/ requests/ helpers/ config/
|
|
75
|
+
├── database/{seeds,migrations}/ providers/ plugins/ types/ constants/
|
|
200
76
|
```
|
|
201
77
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
## CSS Pipeline
|
|
205
|
-
|
|
206
|
-
Every scaffolded frontend and admin app ships with Tailwind CSS and the framework-owned `@bhooai/nexus-postcss` preset. The preset loads six PostCSS plugins in one curated pipeline:
|
|
207
|
-
|
|
208
|
-
1. `postcss-import` — `@import` resolution
|
|
209
|
-
2. `postcss-nested` (or `postcss-nesting` with `nestingMode: 'modern'`) — CSS nesting
|
|
210
|
-
3. `tailwindcss` — base/components/utilities + content scanning
|
|
211
|
-
4. `postcss-preset-env` (stage 2) — future CSS features today
|
|
212
|
-
5. `autoprefixer` — vendor prefixes
|
|
213
|
-
6. `cssnano` — minification (production only)
|
|
78
|
+
## CLI
|
|
214
79
|
|
|
215
|
-
|
|
80
|
+
```
|
|
81
|
+
Project init · dev · build · test · doctor · sync · uninstall · down · up
|
|
82
|
+
Multi-app add backend <name>
|
|
83
|
+
add frontend <name> [--for <backend>]
|
|
84
|
+
add route <name> --app <backend>
|
|
85
|
+
add module <payments|ai|admin|uploads|graphql-subgraph>
|
|
216
86
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
import typography from '@tailwindcss/typography';
|
|
87
|
+
Data db:seed · db:migrate · db:rollback
|
|
88
|
+
Queue queue:work · queue:retry
|
|
89
|
+
Plugins plugin new · install · remove · list
|
|
221
90
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
sourcemap: true, // inline source maps
|
|
227
|
-
engine: 'lightningcss', // ~100x faster (experimental)
|
|
228
|
-
});
|
|
91
|
+
Generators (make:*) — 21 total:
|
|
92
|
+
route · controller · model · service · repository · middleware · validator ·
|
|
93
|
+
job · event · listener · policy · resource · request · mail · room · subgraph ·
|
|
94
|
+
seeder · migration · provider · plugin
|
|
229
95
|
```
|
|
230
96
|
|
|
231
|
-
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
10 examples ship in `packages/nexus-examples/` and are overlayable via `nexus init --example`:
|
|
232
100
|
|
|
233
|
-
|
|
101
|
+
| Example | Demos |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `empty` | bare scaffold |
|
|
104
|
+
| `chat` | realtime rooms, presence, typing |
|
|
105
|
+
| `video-call` | WebRTC signaling, 1:1 RTCPeerConnection |
|
|
106
|
+
| `checkout` | payments + mailables + HMAC webhook verify |
|
|
107
|
+
| `livestream` | broadcaster/viewer roles, streaming |
|
|
108
|
+
| `ai-chat` | streaming LLM via SSE |
|
|
109
|
+
| `saas-starter` | auth + teams + projects + policies + events |
|
|
110
|
+
| `blog-crud` | ODM models, GraphQL federation subgraph |
|
|
111
|
+
| `dashboard` | admin-metrics demo, CSS-only viz |
|
|
112
|
+
| `file-storage` | local + S3 storage, signed private URLs |
|
|
113
|
+
| `multi-app` | two backends, two frontends, one admin |
|
|
234
114
|
|
|
235
|
-
|
|
236
|
-
- `@bhooai/nexus-postcss/theme-light-dark.css` — dual-theme variant using CSS `light-dark()` for automatic light/dark switching
|
|
115
|
+
## Storage
|
|
237
116
|
|
|
238
|
-
|
|
239
|
-
@import '@bhooai/nexus-postcss/theme.css';
|
|
117
|
+
Per-backend `storage/` folder with `local` + `s3` drivers shipped:
|
|
240
118
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
119
|
+
```ts
|
|
120
|
+
import { storage } from 'bhooai-nexus';
|
|
121
|
+
await storage.disk('uploads').put('avatars', file);
|
|
122
|
+
const url = await storage.disk('private').signedUrl('invoices/1.pdf');
|
|
244
123
|
```
|
|
245
124
|
|
|
246
|
-
|
|
125
|
+
UUID filenames + `YYYY/MM` sharding. EXIF-stripped. sharp-driven image transforms.
|
|
247
126
|
|
|
248
|
-
##
|
|
127
|
+
## Importing the framework
|
|
249
128
|
|
|
250
|
-
|
|
129
|
+
`bhooai-nexus` is the umbrella package — one import surfaces the whole API:
|
|
251
130
|
|
|
252
|
-
```
|
|
253
|
-
|
|
131
|
+
```ts
|
|
132
|
+
import { createNexusApp, storage, model, Schema, AiClient, defineRoutes } from 'bhooai-nexus';
|
|
254
133
|
```
|
|
255
134
|
|
|
256
|
-
|
|
135
|
+
Prefer narrower imports for smaller bundles? Use the sub-path exports
|
|
136
|
+
(`bhooai-nexus/core`, `bhooai-nexus/data`, `bhooai-nexus/ai-client`, …) or the
|
|
137
|
+
scoped packages (`@bhooai/nexus-core`, `@bhooai/nexus-data`, …) directly.
|
|
257
138
|
|
|
258
|
-
|
|
259
|
-
npx nexus uninstall
|
|
260
|
-
```
|
|
139
|
+
## Maintenance mode
|
|
261
140
|
|
|
262
|
-
Remove the database, registration, and project directory:
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
npx nexus uninstall --purge
|
|
266
141
|
```
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
npx nexus uninstall --purge --force
|
|
272
|
-
npx nexus uninstall --keep-db
|
|
142
|
+
nexus down --message "Quick upgrade"
|
|
143
|
+
nexus up
|
|
273
144
|
```
|
|
274
145
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
## Project Layout
|
|
278
|
-
|
|
279
|
-
```text
|
|
280
|
-
packages/ 17 framework packages (@bhooai/nexus-*)
|
|
281
|
-
apps/backend/ Node.js backend
|
|
282
|
-
apps/frontend/ React + Vite frontend
|
|
283
|
-
apps/admin/ React + Vite admin host
|
|
284
|
-
apps/ai-server/ Python FastAPI AI service
|
|
285
|
-
bin/ CLI entry point
|
|
286
|
-
contracts/ Node-to-Python API contracts
|
|
287
|
-
plugins/ Project plugins
|
|
288
|
-
tests/ Cross-service tests
|
|
289
|
-
docs/ Architecture, guides, API reference, and screenshots
|
|
290
|
-
```
|
|
146
|
+
All requests return 503 + Retry-After except `/health`.
|
|
291
147
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
| Package | Description |
|
|
295
|
-
| --- | --- |
|
|
296
|
-
| `@bhooai/nexus-core` | HTTP server, trie router, config stack, DI container |
|
|
297
|
-
| `@bhooai/nexus-auth` | CSRF, CORS, security headers, rate limit, JWT, OAuth2, sessions, RBAC |
|
|
298
|
-
| `@bhooai/nexus-data` | Custom ODM on the native mongodb driver |
|
|
299
|
-
| `@bhooai/nexus-graphql` | Federation, supergraph, subscriptions — no Apollo |
|
|
300
|
-
| `@bhooai/nexus-realtime` | WebSocket rooms, WebRTC signaling, mediasoup SFU |
|
|
301
|
-
| `@bhooai/nexus-payments` | Razorpay, PayPal, PayU, Skrill, Payoneer + webhooks |
|
|
302
|
-
| `@bhooai/nexus-email` | SMTP, templates, Redis-backed outbound queue |
|
|
303
|
-
| `@bhooai/nexus-crypto` | RSA/ECDSA keys, X.509 certs, CSRs, HTTPS/mTLS |
|
|
304
|
-
| `@bhooai/nexus-cache` | Redis cache-aside, rate limiter, pub/sub |
|
|
305
|
-
| `@bhooai/nexus-ads` | Google Ads client with GAQL query builder |
|
|
306
|
-
| `@bhooai/nexus-plugins` | In-process + sandboxed worker-thread plugins |
|
|
307
|
-
| `@bhooai/nexus-ai-client` | Node client for the Python AI server — SSE, retries, timeouts |
|
|
308
|
-
| `@bhooai/nexus-cluster` | Node agent, mesh registry, load balancer, autoscaler |
|
|
309
|
-
| `@bhooai/nexus-telemetry` | Structured logger, metrics, trace/request-ID propagation |
|
|
310
|
-
| `@bhooai/nexus-safe-goto` | Safe external-link dialog — anti tab-nabbing/phishing |
|
|
311
|
-
| `@bhooai/nexus-postcss` | PostCSS preset — Tailwind, nesting, preset-env, autoprefixer, cssnano |
|
|
312
|
-
| `@bhooai/nexus-cli` | init wizard, doctor, dev supervisor |
|
|
313
|
-
|
|
314
|
-
## Testing
|
|
148
|
+
## Tests
|
|
315
149
|
|
|
316
150
|
```bash
|
|
317
151
|
npx vitest run
|
|
318
|
-
cd apps/ai-server
|
|
319
|
-
python -m pip install -r requirements.txt
|
|
320
|
-
pytest
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
Run Playwright end-to-end tests from the framework root:
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
npx playwright test --config=playwright.config.ts
|
|
327
152
|
```
|
|
328
153
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
```powershell
|
|
332
|
-
.\docker.ps1 build
|
|
333
|
-
.\docker.ps1 run
|
|
334
|
-
.\docker.ps1 logs
|
|
335
|
-
.\docker.ps1 stop
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
Development endpoints are frontend `http://localhost:3000`, admin `http://localhost:3300`, and backend `http://localhost:4000/health`.
|
|
339
|
-
|
|
340
|
-
## Documentation
|
|
341
|
-
|
|
342
|
-
- [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — architecture and data flow
|
|
343
|
-
- [`docs/IMPROVEMENTS.md`](docs/IMPROVEMENTS.md) — improvement history and next steps
|
|
344
|
-
- [`docs/troubleshooting.html`](docs/troubleshooting.html) — common errors and fixes
|
|
345
|
-
- [`docs/api/postcss.html`](docs/api/postcss.html) — PostCSS preset API reference + CSS playground
|
|
346
|
-
- [`docs/guides/guide-frontend-styling.html`](docs/guides/guide-frontend-styling.html) — frontend styling guide with live preview
|
|
347
|
-
- [`docs/screenshots/README.md`](docs/screenshots/README.md) — screenshot catalog
|
|
348
|
-
- [`apps/ai-server/README.md`](apps/ai-server/README.md) — Python AI service
|
|
349
|
-
- Package documentation under `packages/nexus-*/README.md`
|
|
154
|
+
Current suite covers: app factory, event bus, policies, generators name normalization,
|
|
155
|
+
EJS templating. 27 tests, all green.
|
|
350
156
|
|
|
351
|
-
##
|
|
157
|
+
## Status
|
|
352
158
|
|
|
353
|
-
|
|
159
|
+
- P0–P12 shipped (skeleton, app factory, abstractions, storage, CLI, plugins, db, queue,
|
|
160
|
+
generators, port registry, examples, docker, admin strip + Apps tab)
|
|
161
|
+
- Admin rebuilt as a fresh Apps-tab-first SPA with live backend endpoints
|
|
162
|
+
(registry, health, request logs, config, users, payments, AI proxy)
|
|
163
|
+
- `bhooai-nexus` is the publishable main package — umbrella import + auto-installing init
|
|
164
|
+
- v1's test suite has 97 pre-existing tsc errors (unrelated to v2 src; tracked separately)
|
|
354
165
|
|
|
355
166
|
## License
|
|
356
167
|
|
|
357
|
-
|
|
168
|
+
MIT
|
package/bin/nexus.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* BhooAI Nexus CLI entry.
|
|
3
|
+
* BhooAI Nexus v2 CLI entry.
|
|
4
4
|
*
|
|
5
|
-
* Thin ESM shim: loads
|
|
6
|
-
* otherwise runs the TypeScript source via tsx
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Thin ESM shim: loads compiled `packages/nexus-cli/dist/index.js` if
|
|
6
|
+
* present, otherwise runs the TypeScript source via tsx (which rewrites .js
|
|
7
|
+
* import specifiers to .ts). Keeps `node bin/nexus.js ...` working with
|
|
8
|
+
* no build step.
|
|
9
9
|
*/
|
|
10
10
|
import { pathToFileURL } from 'node:url';
|
|
11
11
|
import { existsSync } from 'node:fs';
|
|
@@ -20,13 +20,8 @@ async function main() {
|
|
|
20
20
|
const { tsImport } = await import('tsx/esm/api');
|
|
21
21
|
let mod;
|
|
22
22
|
if (existsSync(srcEntry)) {
|
|
23
|
-
// Prefer source in the monorepo and in the published package so the CLI
|
|
24
|
-
// does not depend on a stale or omitted build artifact.
|
|
25
23
|
mod = await tsImport(pathToFileURL(srcEntry).href, import.meta.url);
|
|
26
24
|
} else if (existsSync(distEntry)) {
|
|
27
|
-
// Workspace packages export TypeScript sources with `.js` specifiers.
|
|
28
|
-
// Keep tsx in the chain even when the CLI dist exists so Node can resolve
|
|
29
|
-
// those source imports during development and after partial builds.
|
|
30
25
|
mod = await tsImport(pathToFileURL(distEntry).href, import.meta.url);
|
|
31
26
|
} else {
|
|
32
27
|
mod = await tsImport(pathToFileURL(srcEntry).href, import.meta.url);
|
|
@@ -36,9 +31,6 @@ async function main() {
|
|
|
36
31
|
await mod.run(cmd, rest);
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
/** True when a rejected promise was the user pressing Ctrl+C during an
|
|
40
|
-
* interactive prompt (node:readline/promises rejects the open question with an
|
|
41
|
-
* AbortError). A cancelled wizard is not a failure — no error dump. */
|
|
42
34
|
function isUserCancel(err) {
|
|
43
35
|
if (!err) return false;
|
|
44
36
|
if (err.name === 'AbortError') return true;
|