create-nexwire 4.0.0
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/README.md +233 -0
- package/express/.dockerignore +14 -0
- package/express/.env +44 -0
- package/express/.env.example +42 -0
- package/express/.vscode/settings.json +26 -0
- package/express/LICENSE +21 -0
- package/express/README.md +211 -0
- package/express/biome.json +66 -0
- package/express/drizzle.config.ts +25 -0
- package/express/gitignore-stub +24 -0
- package/express/package.json +108 -0
- package/express/public/.gitkeep +0 -0
- package/express/src/config/app.ts +41 -0
- package/express/src/config/auth.ts +12 -0
- package/express/src/config/cache.ts +16 -0
- package/express/src/config/cookie.ts +15 -0
- package/express/src/config/cors.ts +12 -0
- package/express/src/config/database.ts +29 -0
- package/express/src/config/index.ts +83 -0
- package/express/src/config/jwt.ts +19 -0
- package/express/src/config/logging.ts +13 -0
- package/express/src/config/mail.ts +24 -0
- package/express/src/config/openapi.ts +54 -0
- package/express/src/config/queue.ts +30 -0
- package/express/src/config/rateLimit.ts +17 -0
- package/express/src/config/realtime.ts +15 -0
- package/express/src/config/redis.ts +18 -0
- package/express/src/config/security.ts +44 -0
- package/express/src/config/session.ts +17 -0
- package/express/src/config/storage.ts +22 -0
- package/express/src/config/validate.ts +40 -0
- package/express/src/database/migrations/sqlite/0000_init.sql +61 -0
- package/express/src/database/migrations/sqlite/meta/0000_snapshot.json +412 -0
- package/express/src/database/migrations/sqlite/meta/_journal.json +13 -0
- package/express/src/database/schema.ts +3 -0
- package/express/src/env.ts +76 -0
- package/express/src/framework/cache/cache.ts +81 -0
- package/express/src/framework/circuit-breaker/cb.ts +60 -0
- package/express/src/framework/database/connection.ts +196 -0
- package/express/src/framework/database/migrate-hooks.ts +87 -0
- package/express/src/framework/database/paginate.ts +227 -0
- package/express/src/framework/database/schema.ts +20 -0
- package/express/src/framework/database/seed.ts +139 -0
- package/express/src/framework/events/dispatcher.ts +49 -0
- package/express/src/framework/facade.ts +48 -0
- package/express/src/framework/http/app.ts +107 -0
- package/express/src/framework/http/cors.ts +7 -0
- package/express/src/framework/http/logger.ts +69 -0
- package/express/src/framework/http/metrics.ts +22 -0
- package/express/src/framework/http/openapi.ts +54 -0
- package/express/src/framework/http/ratelimiter.ts +16 -0
- package/express/src/framework/http/router.ts +178 -0
- package/express/src/framework/http/security.ts +23 -0
- package/express/src/framework/http/static.ts +23 -0
- package/express/src/framework/http/validation.ts +18 -0
- package/express/src/framework/kernel.ts +52 -0
- package/express/src/framework/maker-cli/db/core.mjs +288 -0
- package/express/src/framework/maker-cli/db/index.mjs +204 -0
- package/express/src/framework/maker-cli/deploy/core.mjs +1047 -0
- package/express/src/framework/maker-cli/deploy/index.mjs +91 -0
- package/express/src/framework/maker-cli/index.mjs +53 -0
- package/express/src/framework/maker-cli/middleware/core.mjs +47 -0
- package/express/src/framework/maker-cli/middleware/index.mjs +17 -0
- package/express/src/framework/maker-cli/module/core.mjs +684 -0
- package/express/src/framework/maker-cli/module/index.mjs +140 -0
- package/express/src/framework/maker-cli/runtime/build-ui.mjs +16 -0
- package/express/src/framework/maker-cli/runtime/core.mjs +543 -0
- package/express/src/framework/maker-cli/runtime/index.mjs +104 -0
- package/express/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
- package/express/src/framework/maker-cli/stubs/controller/openapi.ts.stub +47 -0
- package/express/src/framework/maker-cli/stubs/controller/openapi.with-model.ts.stub +48 -0
- package/express/src/framework/maker-cli/stubs/controller/plain.ts.stub +54 -0
- package/express/src/framework/maker-cli/stubs/controller/schema.plain.ts.stub +14 -0
- package/express/src/framework/maker-cli/stubs/controller/schema.ts.stub +33 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
- package/express/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
- package/express/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
- package/express/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
- package/express/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
- package/express/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
- package/express/src/framework/maker-cli/stubs/example/console.ts.stub +34 -0
- package/express/src/framework/maker-cli/stubs/example/controller.ts.stub +418 -0
- package/express/src/framework/maker-cli/stubs/example/job.ts.stub +75 -0
- package/express/src/framework/maker-cli/stubs/example/route.api.ts.stub +207 -0
- package/express/src/framework/maker-cli/stubs/example/route.plain.ts.stub +18 -0
- package/express/src/framework/maker-cli/stubs/example/schema.plain.ts.stub +42 -0
- package/express/src/framework/maker-cli/stubs/example/schema.ts.stub +42 -0
- package/express/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
- package/express/src/framework/maker-cli/stubs/middleware/name.ts.stub +14 -0
- package/express/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/notification/controller.ts.stub +77 -0
- package/express/src/framework/maker-cli/stubs/notification/job.ts.stub +13 -0
- package/express/src/framework/maker-cli/stubs/notification/route.api.ts.stub +50 -0
- package/express/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +12 -0
- package/express/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
- package/express/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
- package/express/src/framework/maker-cli/stubs/route/api.ts.stub +80 -0
- package/express/src/framework/maker-cli/stubs/route/plain.ts.stub +11 -0
- package/express/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
- package/express/src/framework/maker-cli/stubs/seeder/name.ts.stub +20 -0
- package/express/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
- package/express/src/framework/maker-cli/utils/env-config.mjs +44 -0
- package/express/src/framework/maker-cli/utils/env-db.mjs +61 -0
- package/express/src/framework/maker-cli/utils/file-ops.mjs +30 -0
- package/express/src/framework/maker-cli/utils/flags.mjs +14 -0
- package/express/src/framework/maker-cli/utils/help.mjs +50 -0
- package/express/src/framework/maker-cli/utils/naming.mjs +13 -0
- package/express/src/framework/maker-cli/utils/process.mjs +52 -0
- package/express/src/framework/modules/discover.ts +54 -0
- package/express/src/framework/modules/routes.ts +21 -0
- package/express/src/framework/notification/index.ts +116 -0
- package/express/src/framework/queue/clear.ts +22 -0
- package/express/src/framework/queue/queue.ts +342 -0
- package/express/src/framework/queue/ui.ts +187 -0
- package/express/src/framework/queue/worker.ts +61 -0
- package/express/src/framework/realtime/broadcast.ts +46 -0
- package/express/src/framework/realtime/index.ts +2 -0
- package/express/src/framework/realtime/socket-cookie.ts +71 -0
- package/express/src/framework/realtime/socket.ts +119 -0
- package/express/src/framework/realtime/types.ts +6 -0
- package/express/src/framework/realtime/ui.ts +16 -0
- package/express/src/framework/redis/client.ts +151 -0
- package/express/src/framework/runtime/runtime.ts +23 -0
- package/express/src/framework/runtime/server-adapter.ts +34 -0
- package/express/src/framework/scheduler/lock.ts +116 -0
- package/express/src/framework/scheduler/run.ts +48 -0
- package/express/src/framework/scheduler/scheduler.ts +155 -0
- package/express/src/framework/server.ts +177 -0
- package/express/src/framework/session/session.ts +98 -0
- package/express/src/framework/storage/storage.ts +785 -0
- package/express/src/framework/support/cookie.ts +62 -0
- package/express/src/framework/support/jwt.ts +33 -0
- package/express/src/framework/support/lifecycle.ts +35 -0
- package/express/src/framework/support/logger.ts +148 -0
- package/express/src/framework/support/mail.ts +48 -0
- package/express/src/framework/support/password.ts +23 -0
- package/express/src/framework/support/upload.ts +160 -0
- package/express/src/framework/support/url.ts +41 -0
- package/express/src/middlewares/auth-middleware.ts +98 -0
- package/express/src/middlewares/role-middleware.ts +25 -0
- package/express/src/modules/auth/controllers/auth.controller.ts +358 -0
- package/express/src/modules/auth/controllers/auth.helpers.ts +104 -0
- package/express/src/modules/auth/controllers/auth.schema.ts +102 -0
- package/express/src/modules/auth/controllers/role.controller.ts +15 -0
- package/express/src/modules/auth/database/models/notifications.ts +24 -0
- package/express/src/modules/auth/database/models/role.ts +14 -0
- package/express/src/modules/auth/database/models/user.ts +46 -0
- package/express/src/modules/auth/database/seeders/role.ts +18 -0
- package/express/src/modules/auth/database/seeders/user.ts +35 -0
- package/express/src/modules/auth/jobs/forgetpass.ts +20 -0
- package/express/src/modules/auth/jobs/registeruser.ts +23 -0
- package/express/src/modules/auth/jobs/verifyemail.ts +18 -0
- package/express/src/modules/auth/routes/api.ts +150 -0
- package/express/src/modules/auth/routes/role.ts +33 -0
- package/express/src/resources/index.html +17 -0
- package/express/src/resources/src/App.vue +5 -0
- package/express/src/resources/src/assets/css/styles.css +14761 -0
- package/express/src/resources/src/assets/css/styles.css.map +1 -0
- package/express/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
- package/express/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
- package/express/src/resources/src/assets/images/favicon/favicon.ico +0 -0
- package/express/src/resources/src/assets/images/logo.png +0 -0
- package/express/src/resources/src/assets/scss/custom.css +217 -0
- package/express/src/resources/src/assets/scss/custom.css.map +1 -0
- package/express/src/resources/src/assets/scss/custom.scss +1346 -0
- package/express/src/resources/src/components/Button.vue +32 -0
- package/express/src/resources/src/components/Checkbox.vue +29 -0
- package/express/src/resources/src/components/Datepicker.vue +106 -0
- package/express/src/resources/src/components/FeatureButton.vue +53 -0
- package/express/src/resources/src/components/FloatButton.vue +33 -0
- package/express/src/resources/src/components/Href.vue +32 -0
- package/express/src/resources/src/components/Input.vue +223 -0
- package/express/src/resources/src/components/InputGroup.vue +145 -0
- package/express/src/resources/src/components/InputPasswordToggle.vue +213 -0
- package/express/src/resources/src/components/Modal.vue +55 -0
- package/express/src/resources/src/components/Pagebar.vue +26 -0
- package/express/src/resources/src/components/Select.vue +384 -0
- package/express/src/resources/src/components/Spinner.vue +42 -0
- package/express/src/resources/src/components/Switch.vue +65 -0
- package/express/src/resources/src/components/TextArea.vue +117 -0
- package/express/src/resources/src/components/Toast.vue +56 -0
- package/express/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
- package/express/src/resources/src/components/datatable/Pagination.vue +147 -0
- package/express/src/resources/src/components/datatable/SelectOpption.vue +64 -0
- package/express/src/resources/src/components/datatable/index.vue +199 -0
- package/express/src/resources/src/composables/useAuth.ts +52 -0
- package/express/src/resources/src/helpers/nformatter.ts +10 -0
- package/express/src/resources/src/helpers/utils.ts +75 -0
- package/express/src/resources/src/layouts/AuthLayout.vue +20 -0
- package/express/src/resources/src/layouts/Layout/Footer.vue +23 -0
- package/express/src/resources/src/layouts/Layout/Header.vue +105 -0
- package/express/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
- package/express/src/resources/src/layouts/Layout/index.vue +87 -0
- package/express/src/resources/src/main.ts +26 -0
- package/express/src/resources/src/pages/auth/forgetPassword.vue +82 -0
- package/express/src/resources/src/pages/auth/login.vue +99 -0
- package/express/src/resources/src/pages/auth/register.vue +133 -0
- package/express/src/resources/src/pages/auth/resetPassword.vue +118 -0
- package/express/src/resources/src/pages/auth/verifyEmail.vue +68 -0
- package/express/src/resources/src/pages/dashboard/index.vue +66 -0
- package/express/src/resources/src/plugins/axios.ts +31 -0
- package/express/src/resources/src/plugins/browserDetect.ts +55 -0
- package/express/src/resources/src/plugins/dialog.ts +216 -0
- package/express/src/resources/src/plugins/gum.ts +367 -0
- package/express/src/resources/src/plugins/pulse.ts +147 -0
- package/express/src/resources/src/plugins/routeProgress.ts +87 -0
- package/express/src/resources/src/router/index.ts +85 -0
- package/express/src/resources/src/stores/admin-ui.ts +148 -0
- package/express/src/resources/src/stores/auth.ts +164 -0
- package/express/src/resources/tsconfig.json +19 -0
- package/express/src/resources/vite.config.ts +46 -0
- package/express/src/storage/app/private/.gitkeep +0 -0
- package/express/src/storage/app/public/.gitkeep +0 -0
- package/express/src/storage/app/tmp/generated/.gitkeep +0 -0
- package/express/src/storage/database/nexwire.sqlite +0 -0
- package/express/src/storage/logs/.gitkeep +0 -0
- package/express/src/storage/tmp/.gitkeep +0 -0
- package/express/src/storage/trash/modules/.gitkeep +0 -0
- package/express/src/types/global.d.ts +26 -0
- package/express/tsconfig.json +19 -0
- package/express/vitest.config.ts +23 -0
- package/hono/.dockerignore +14 -0
- package/hono/.env +44 -0
- package/hono/.env.example +42 -0
- package/hono/.vscode/settings.json +26 -0
- package/hono/LICENSE +21 -0
- package/hono/README.md +211 -0
- package/hono/biome.json +76 -0
- package/hono/drizzle.config.ts +25 -0
- package/hono/gitignore-stub +24 -0
- package/hono/package.json +99 -0
- package/hono/public/.gitkeep +0 -0
- package/hono/src/config/app.ts +41 -0
- package/hono/src/config/auth.ts +12 -0
- package/hono/src/config/cache.ts +16 -0
- package/hono/src/config/cookie.ts +15 -0
- package/hono/src/config/cors.ts +12 -0
- package/hono/src/config/database.ts +29 -0
- package/hono/src/config/index.ts +83 -0
- package/hono/src/config/jwt.ts +19 -0
- package/hono/src/config/logging.ts +13 -0
- package/hono/src/config/mail.ts +24 -0
- package/hono/src/config/openapi.ts +54 -0
- package/hono/src/config/queue.ts +30 -0
- package/hono/src/config/rateLimit.ts +17 -0
- package/hono/src/config/realtime.ts +15 -0
- package/hono/src/config/redis.ts +18 -0
- package/hono/src/config/security.ts +44 -0
- package/hono/src/config/session.ts +17 -0
- package/hono/src/config/storage.ts +22 -0
- package/hono/src/config/validate.ts +40 -0
- package/hono/src/database/migrations/sqlite/0000_init.sql +61 -0
- package/hono/src/database/migrations/sqlite/meta/0000_snapshot.json +412 -0
- package/hono/src/database/migrations/sqlite/meta/_journal.json +13 -0
- package/hono/src/database/schema.ts +3 -0
- package/hono/src/env.ts +76 -0
- package/hono/src/framework/cache/cache.ts +81 -0
- package/hono/src/framework/circuit-breaker/cb.ts +60 -0
- package/hono/src/framework/database/connection.ts +196 -0
- package/hono/src/framework/database/migrate-hooks.ts +87 -0
- package/hono/src/framework/database/paginate.ts +253 -0
- package/hono/src/framework/database/schema.ts +20 -0
- package/hono/src/framework/database/seed.ts +139 -0
- package/hono/src/framework/events/dispatcher.ts +49 -0
- package/hono/src/framework/facade.ts +29 -0
- package/hono/src/framework/http/app.ts +109 -0
- package/hono/src/framework/http/cors.ts +19 -0
- package/hono/src/framework/http/logger.ts +81 -0
- package/hono/src/framework/http/metrics.ts +22 -0
- package/hono/src/framework/http/openapi.ts +42 -0
- package/hono/src/framework/http/ratelimiter.ts +172 -0
- package/hono/src/framework/http/router.ts +76 -0
- package/hono/src/framework/http/security.ts +23 -0
- package/hono/src/framework/http/static.ts +70 -0
- package/hono/src/framework/http/validation.ts +21 -0
- package/hono/src/framework/kernel.ts +48 -0
- package/hono/src/framework/maker-cli/db/core.mjs +288 -0
- package/hono/src/framework/maker-cli/db/index.mjs +204 -0
- package/hono/src/framework/maker-cli/deploy/core.mjs +1038 -0
- package/hono/src/framework/maker-cli/deploy/index.mjs +91 -0
- package/hono/src/framework/maker-cli/index.mjs +53 -0
- package/hono/src/framework/maker-cli/middleware/core.mjs +47 -0
- package/hono/src/framework/maker-cli/middleware/index.mjs +12 -0
- package/hono/src/framework/maker-cli/module/core.mjs +684 -0
- package/hono/src/framework/maker-cli/module/index.mjs +140 -0
- package/hono/src/framework/maker-cli/runtime/build-ui.mjs +17 -0
- package/hono/src/framework/maker-cli/runtime/core.mjs +543 -0
- package/hono/src/framework/maker-cli/runtime/index.mjs +104 -0
- package/hono/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
- package/hono/src/framework/maker-cli/stubs/controller/openapi.ts.stub +57 -0
- package/hono/src/framework/maker-cli/stubs/controller/openapi.with-model.ts.stub +58 -0
- package/hono/src/framework/maker-cli/stubs/controller/plain.ts.stub +59 -0
- package/hono/src/framework/maker-cli/stubs/controller/schema.plain.ts.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/controller/schema.ts.stub +33 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
- package/hono/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
- package/hono/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
- package/hono/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
- package/hono/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
- package/hono/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
- package/hono/src/framework/maker-cli/stubs/example/console.ts.stub +34 -0
- package/hono/src/framework/maker-cli/stubs/example/controller.ts.stub +505 -0
- package/hono/src/framework/maker-cli/stubs/example/job.ts.stub +75 -0
- package/hono/src/framework/maker-cli/stubs/example/route.api.ts.stub +207 -0
- package/hono/src/framework/maker-cli/stubs/example/route.plain.ts.stub +18 -0
- package/hono/src/framework/maker-cli/stubs/example/schema.plain.ts.stub +42 -0
- package/hono/src/framework/maker-cli/stubs/example/schema.ts.stub +42 -0
- package/hono/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/middleware/name.ts.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/notification/controller.ts.stub +86 -0
- package/hono/src/framework/maker-cli/stubs/notification/job.ts.stub +13 -0
- package/hono/src/framework/maker-cli/stubs/notification/route.api.ts.stub +50 -0
- package/hono/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +12 -0
- package/hono/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
- package/hono/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
- package/hono/src/framework/maker-cli/stubs/route/api.ts.stub +80 -0
- package/hono/src/framework/maker-cli/stubs/route/plain.ts.stub +11 -0
- package/hono/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
- package/hono/src/framework/maker-cli/stubs/seeder/name.ts.stub +20 -0
- package/hono/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
- package/hono/src/framework/maker-cli/utils/env-config.mjs +44 -0
- package/hono/src/framework/maker-cli/utils/env-db.mjs +61 -0
- package/hono/src/framework/maker-cli/utils/file-ops.mjs +30 -0
- package/hono/src/framework/maker-cli/utils/flags.mjs +14 -0
- package/hono/src/framework/maker-cli/utils/help.mjs +50 -0
- package/hono/src/framework/maker-cli/utils/naming.mjs +13 -0
- package/hono/src/framework/maker-cli/utils/process.mjs +52 -0
- package/hono/src/framework/modules/discover.ts +54 -0
- package/hono/src/framework/modules/routes.ts +24 -0
- package/hono/src/framework/notification/index.ts +116 -0
- package/hono/src/framework/queue/clear.ts +22 -0
- package/hono/src/framework/queue/queue.ts +342 -0
- package/hono/src/framework/queue/ui.ts +214 -0
- package/hono/src/framework/queue/worker.ts +61 -0
- package/hono/src/framework/realtime/broadcast.ts +46 -0
- package/hono/src/framework/realtime/index.ts +2 -0
- package/hono/src/framework/realtime/socket-cookie.ts +68 -0
- package/hono/src/framework/realtime/socket.ts +196 -0
- package/hono/src/framework/realtime/types.ts +6 -0
- package/hono/src/framework/realtime/ui.ts +16 -0
- package/hono/src/framework/redis/client.ts +151 -0
- package/hono/src/framework/runtime/runtime.ts +23 -0
- package/hono/src/framework/runtime/server-adapter.ts +94 -0
- package/hono/src/framework/scheduler/lock.ts +116 -0
- package/hono/src/framework/scheduler/run.ts +48 -0
- package/hono/src/framework/scheduler/scheduler.ts +155 -0
- package/hono/src/framework/server.ts +183 -0
- package/hono/src/framework/session/session.ts +116 -0
- package/hono/src/framework/storage/storage.ts +785 -0
- package/hono/src/framework/support/cookie.ts +99 -0
- package/hono/src/framework/support/jwt.ts +45 -0
- package/hono/src/framework/support/lifecycle.ts +35 -0
- package/hono/src/framework/support/logger.ts +148 -0
- package/hono/src/framework/support/mail.ts +48 -0
- package/hono/src/framework/support/password.ts +23 -0
- package/hono/src/framework/support/url.ts +41 -0
- package/hono/src/middlewares/auth-middleware.ts +98 -0
- package/hono/src/middlewares/role-middleware.ts +25 -0
- package/hono/src/modules/auth/controllers/auth.controller.ts +413 -0
- package/hono/src/modules/auth/controllers/auth.helpers.ts +128 -0
- package/hono/src/modules/auth/controllers/auth.schema.ts +102 -0
- package/hono/src/modules/auth/controllers/role.controller.ts +25 -0
- package/hono/src/modules/auth/database/models/notifications.ts +24 -0
- package/hono/src/modules/auth/database/models/role.ts +14 -0
- package/hono/src/modules/auth/database/models/user.ts +46 -0
- package/hono/src/modules/auth/database/seeders/role.ts +18 -0
- package/hono/src/modules/auth/database/seeders/user.ts +35 -0
- package/hono/src/modules/auth/jobs/forgetpass.ts +20 -0
- package/hono/src/modules/auth/jobs/registeruser.ts +23 -0
- package/hono/src/modules/auth/jobs/verifyemail.ts +18 -0
- package/hono/src/modules/auth/routes/api.ts +150 -0
- package/hono/src/modules/auth/routes/role.ts +33 -0
- package/hono/src/resources/index.html +17 -0
- package/hono/src/resources/src/App.vue +5 -0
- package/hono/src/resources/src/assets/css/styles.css +14913 -0
- package/hono/src/resources/src/assets/css/styles.css.map +1 -0
- package/hono/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
- package/hono/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
- package/hono/src/resources/src/assets/images/favicon/favicon.ico +0 -0
- package/hono/src/resources/src/assets/images/logo.png +0 -0
- package/hono/src/resources/src/assets/scss/custom.css +217 -0
- package/hono/src/resources/src/assets/scss/custom.css.map +1 -0
- package/hono/src/resources/src/assets/scss/custom.scss +1346 -0
- package/hono/src/resources/src/components/Button.vue +32 -0
- package/hono/src/resources/src/components/Checkbox.vue +29 -0
- package/hono/src/resources/src/components/Datepicker.vue +106 -0
- package/hono/src/resources/src/components/FeatureButton.vue +53 -0
- package/hono/src/resources/src/components/FloatButton.vue +33 -0
- package/hono/src/resources/src/components/Href.vue +32 -0
- package/hono/src/resources/src/components/Input.vue +234 -0
- package/hono/src/resources/src/components/InputGroup.vue +149 -0
- package/hono/src/resources/src/components/InputPasswordToggle.vue +222 -0
- package/hono/src/resources/src/components/Modal.vue +55 -0
- package/hono/src/resources/src/components/Pagebar.vue +26 -0
- package/hono/src/resources/src/components/Select.vue +415 -0
- package/hono/src/resources/src/components/Spinner.vue +42 -0
- package/hono/src/resources/src/components/Switch.vue +65 -0
- package/hono/src/resources/src/components/TextArea.vue +121 -0
- package/hono/src/resources/src/components/Toast.vue +56 -0
- package/hono/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
- package/hono/src/resources/src/components/datatable/Pagination.vue +147 -0
- package/hono/src/resources/src/components/datatable/SelectOpption.vue +64 -0
- package/hono/src/resources/src/components/datatable/index.vue +199 -0
- package/hono/src/resources/src/composables/useAuth.ts +52 -0
- package/hono/src/resources/src/helpers/nformatter.ts +10 -0
- package/hono/src/resources/src/helpers/utils.ts +75 -0
- package/hono/src/resources/src/layouts/AuthLayout.vue +20 -0
- package/hono/src/resources/src/layouts/Layout/Footer.vue +23 -0
- package/hono/src/resources/src/layouts/Layout/Header.vue +105 -0
- package/hono/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
- package/hono/src/resources/src/layouts/Layout/index.vue +87 -0
- package/hono/src/resources/src/main.ts +26 -0
- package/hono/src/resources/src/pages/auth/forgetPassword.vue +82 -0
- package/hono/src/resources/src/pages/auth/login.vue +99 -0
- package/hono/src/resources/src/pages/auth/register.vue +133 -0
- package/hono/src/resources/src/pages/auth/resetPassword.vue +118 -0
- package/hono/src/resources/src/pages/auth/verifyEmail.vue +68 -0
- package/hono/src/resources/src/pages/dashboard/index.vue +66 -0
- package/hono/src/resources/src/plugins/axios.ts +31 -0
- package/hono/src/resources/src/plugins/browserDetect.ts +55 -0
- package/hono/src/resources/src/plugins/dialog.ts +216 -0
- package/hono/src/resources/src/plugins/gum.ts +367 -0
- package/hono/src/resources/src/plugins/pulse.ts +147 -0
- package/hono/src/resources/src/plugins/routeProgress.ts +87 -0
- package/hono/src/resources/src/router/index.ts +85 -0
- package/hono/src/resources/src/stores/admin-ui.ts +148 -0
- package/hono/src/resources/src/stores/auth.ts +164 -0
- package/hono/src/resources/tsconfig.json +19 -0
- package/hono/src/resources/vite.config.ts +46 -0
- package/hono/src/storage/app/private/.gitkeep +0 -0
- package/hono/src/storage/app/public/.gitkeep +0 -0
- package/hono/src/storage/app/tmp/generated/.gitkeep +0 -0
- package/hono/src/storage/database/nexwire.sqlite +0 -0
- package/hono/src/storage/logs/.gitkeep +0 -0
- package/hono/src/storage/tmp/.gitkeep +0 -0
- package/hono/src/storage/trash/modules/.gitkeep +0 -0
- package/hono/src/types/global.d.ts +26 -0
- package/hono/tsconfig.json +20 -0
- package/hono/vitest.config.ts +23 -0
- package/package.json +238 -0
- package/src/index.js +204 -0
package/package.json
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-nexwire",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Scaffold a new nexwire project",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-nexwire": "src/index.js",
|
|
8
|
+
"nexwire": "src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"hono",
|
|
13
|
+
"express"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"prepublishOnly": "node ../../scripts/sync-template.mjs"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.12.0",
|
|
20
|
+
"bun": ">=1.3",
|
|
21
|
+
"pnpm": ">=11",
|
|
22
|
+
"yarn": ">=4"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"nexwire",
|
|
26
|
+
"scaffold",
|
|
27
|
+
"cli",
|
|
28
|
+
"full-stack",
|
|
29
|
+
"hono",
|
|
30
|
+
"vue",
|
|
31
|
+
"drizzle"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/niyamulahsan/nexwire.git"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://niyamulahsan.github.io/nexwire",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/niyamulahsan/nexwire/issues"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@aws-sdk/client-s3": "^3",
|
|
44
|
+
"@aws-sdk/s3-request-presigner": "^3",
|
|
45
|
+
"@bull-board/api": "^8",
|
|
46
|
+
"@bull-board/hono": "^8",
|
|
47
|
+
"@hono/node-server": "^2",
|
|
48
|
+
"@hono/zod-openapi": "^1",
|
|
49
|
+
"@libsql/client": "^0.17",
|
|
50
|
+
"@scalar/hono-api-reference": "^0.10",
|
|
51
|
+
"@socket.io/admin-ui": "^0.5",
|
|
52
|
+
"@socket.io/bun-engine": "^0.1",
|
|
53
|
+
"@socket.io/redis-adapter": "^8",
|
|
54
|
+
"@vitejs/plugin-vue": "^6",
|
|
55
|
+
"@vueuse/core": "^14",
|
|
56
|
+
"@vueuse/head": "^2",
|
|
57
|
+
"axios": "^1",
|
|
58
|
+
"bcryptjs": "^3",
|
|
59
|
+
"bootstrap": "^5",
|
|
60
|
+
"bootstrap-icons": "^1",
|
|
61
|
+
"bullmq": "^5",
|
|
62
|
+
"bullmq-durable": "^0.2",
|
|
63
|
+
"chalk": "^5",
|
|
64
|
+
"commander": "^14",
|
|
65
|
+
"croner": "^10",
|
|
66
|
+
"dotenv": "^17",
|
|
67
|
+
"dotenv-expand": "^13",
|
|
68
|
+
"drizzle-orm": "^0.45",
|
|
69
|
+
"glob": "^13",
|
|
70
|
+
"hono": "^4",
|
|
71
|
+
"hono-rate-limiter": "^0.5",
|
|
72
|
+
"ioredis": "^5",
|
|
73
|
+
"lodash-es": "^4",
|
|
74
|
+
"luxon": "^3",
|
|
75
|
+
"maildev": "^2",
|
|
76
|
+
"mysql2": "^3",
|
|
77
|
+
"nodemailer": "^9",
|
|
78
|
+
"pinia": "^3",
|
|
79
|
+
"pino": "^10",
|
|
80
|
+
"postgres": "^3",
|
|
81
|
+
"redis-commander": "^0.9.0",
|
|
82
|
+
"sass-embedded": "^1",
|
|
83
|
+
"socket.io": "^4",
|
|
84
|
+
"socket.io-client": "^4",
|
|
85
|
+
"stoker": "^2",
|
|
86
|
+
"vite": "^8",
|
|
87
|
+
"vue": "^3",
|
|
88
|
+
"vue-router": "^5",
|
|
89
|
+
"vue-select": "^4",
|
|
90
|
+
"zod": "^4"
|
|
91
|
+
},
|
|
92
|
+
"peerDependenciesMeta": {
|
|
93
|
+
"@aws-sdk/client-s3": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"@aws-sdk/s3-request-presigner": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"@bull-board/api": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"@bull-board/hono": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"@hono/node-server": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"@hono/zod-openapi": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"@libsql/client": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"@scalar/hono-api-reference": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
117
|
+
"@socket.io/admin-ui": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
120
|
+
"@socket.io/bun-engine": {
|
|
121
|
+
"optional": true
|
|
122
|
+
},
|
|
123
|
+
"@socket.io/redis-adapter": {
|
|
124
|
+
"optional": true
|
|
125
|
+
},
|
|
126
|
+
"@vitejs/plugin-vue": {
|
|
127
|
+
"optional": true
|
|
128
|
+
},
|
|
129
|
+
"@vueuse/core": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
132
|
+
"@vueuse/head": {
|
|
133
|
+
"optional": true
|
|
134
|
+
},
|
|
135
|
+
"axios": {
|
|
136
|
+
"optional": true
|
|
137
|
+
},
|
|
138
|
+
"bcryptjs": {
|
|
139
|
+
"optional": true
|
|
140
|
+
},
|
|
141
|
+
"bootstrap": {
|
|
142
|
+
"optional": true
|
|
143
|
+
},
|
|
144
|
+
"bootstrap-icons": {
|
|
145
|
+
"optional": true
|
|
146
|
+
},
|
|
147
|
+
"bullmq": {
|
|
148
|
+
"optional": true
|
|
149
|
+
},
|
|
150
|
+
"bullmq-durable": {
|
|
151
|
+
"optional": true
|
|
152
|
+
},
|
|
153
|
+
"chalk": {
|
|
154
|
+
"optional": true
|
|
155
|
+
},
|
|
156
|
+
"commander": {
|
|
157
|
+
"optional": true
|
|
158
|
+
},
|
|
159
|
+
"croner": {
|
|
160
|
+
"optional": true
|
|
161
|
+
},
|
|
162
|
+
"dotenv": {
|
|
163
|
+
"optional": true
|
|
164
|
+
},
|
|
165
|
+
"dotenv-expand": {
|
|
166
|
+
"optional": true
|
|
167
|
+
},
|
|
168
|
+
"drizzle-orm": {
|
|
169
|
+
"optional": true
|
|
170
|
+
},
|
|
171
|
+
"glob": {
|
|
172
|
+
"optional": true
|
|
173
|
+
},
|
|
174
|
+
"hono": {
|
|
175
|
+
"optional": true
|
|
176
|
+
},
|
|
177
|
+
"hono-rate-limiter": {
|
|
178
|
+
"optional": true
|
|
179
|
+
},
|
|
180
|
+
"ioredis": {
|
|
181
|
+
"optional": true
|
|
182
|
+
},
|
|
183
|
+
"lodash-es": {
|
|
184
|
+
"optional": true
|
|
185
|
+
},
|
|
186
|
+
"luxon": {
|
|
187
|
+
"optional": true
|
|
188
|
+
},
|
|
189
|
+
"maildev": {
|
|
190
|
+
"optional": true
|
|
191
|
+
},
|
|
192
|
+
"mysql2": {
|
|
193
|
+
"optional": true
|
|
194
|
+
},
|
|
195
|
+
"nodemailer": {
|
|
196
|
+
"optional": true
|
|
197
|
+
},
|
|
198
|
+
"pinia": {
|
|
199
|
+
"optional": true
|
|
200
|
+
},
|
|
201
|
+
"pino": {
|
|
202
|
+
"optional": true
|
|
203
|
+
},
|
|
204
|
+
"postgres": {
|
|
205
|
+
"optional": true
|
|
206
|
+
},
|
|
207
|
+
"redis-commander": {
|
|
208
|
+
"optional": true
|
|
209
|
+
},
|
|
210
|
+
"sass-embedded": {
|
|
211
|
+
"optional": true
|
|
212
|
+
},
|
|
213
|
+
"socket.io": {
|
|
214
|
+
"optional": true
|
|
215
|
+
},
|
|
216
|
+
"socket.io-client": {
|
|
217
|
+
"optional": true
|
|
218
|
+
},
|
|
219
|
+
"stoker": {
|
|
220
|
+
"optional": true
|
|
221
|
+
},
|
|
222
|
+
"vite": {
|
|
223
|
+
"optional": true
|
|
224
|
+
},
|
|
225
|
+
"vue": {
|
|
226
|
+
"optional": true
|
|
227
|
+
},
|
|
228
|
+
"vue-router": {
|
|
229
|
+
"optional": true
|
|
230
|
+
},
|
|
231
|
+
"vue-select": {
|
|
232
|
+
"optional": true
|
|
233
|
+
},
|
|
234
|
+
"zod": {
|
|
235
|
+
"optional": true
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync, existsSync, cpSync, mkdirSync, writeFileSync, renameSync, readdirSync, rmSync } from "node:fs";
|
|
4
|
+
import { join, dirname, basename } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { createInterface } from "node:readline";
|
|
7
|
+
import { gunzipSync } from "node:zlib";
|
|
8
|
+
import https from "node:https";
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const PKG_PATH = join(__dirname, "..", "package.json");
|
|
12
|
+
|
|
13
|
+
const pkg = JSON.parse(readFileSync(PKG_PATH, "utf-8"));
|
|
14
|
+
const version = pkg.version;
|
|
15
|
+
|
|
16
|
+
function ask(query) {
|
|
17
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
18
|
+
return new Promise((resolve) => rl.question(query, (a) => { rl.close(); resolve(a.trim()); }));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function detectPackageManager() {
|
|
22
|
+
if (typeof process !== "undefined" && process.isBun) return "bun";
|
|
23
|
+
const ua = process.env.npm_config_user_agent || "";
|
|
24
|
+
if (ua.includes("bun")) return "bun";
|
|
25
|
+
if (ua.includes("pnpm")) return "pnpm";
|
|
26
|
+
if (ua.includes("yarn")) return "yarn";
|
|
27
|
+
return "npm";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function isValidProjectName(name) {
|
|
31
|
+
return /^[a-z0-9@][a-z0-9._-]*$/i.test(name);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function resolveTargetDir(name) {
|
|
35
|
+
const cwd = process.cwd();
|
|
36
|
+
if (name === ".") {
|
|
37
|
+
const entries = readdirSync(cwd);
|
|
38
|
+
if (entries.length > 0) {
|
|
39
|
+
console.error(`Error: Current directory "${basename(cwd)}" is not empty.`);
|
|
40
|
+
console.error(" Scaffolding into '.' requires an empty directory so existing files are not overwritten.");
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
return cwd;
|
|
44
|
+
}
|
|
45
|
+
const dir = join(cwd, name);
|
|
46
|
+
if (existsSync(dir)) {
|
|
47
|
+
console.error(`Error: Directory "${name}" already exists.`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
return dir;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function octalToInt(str) {
|
|
54
|
+
return parseInt(str.replace(/\0.*$/, "").trim(), 8) || 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const ENGINE_PREFIXES = {
|
|
58
|
+
hono: "package/hono/",
|
|
59
|
+
express: "package/express/"
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function extractTarGz(tgzBuffer, destDir, engine) {
|
|
63
|
+
const buf = gunzipSync(tgzBuffer);
|
|
64
|
+
const prefix = ENGINE_PREFIXES[engine] || ENGINE_PREFIXES.hono;
|
|
65
|
+
let offset = 0;
|
|
66
|
+
|
|
67
|
+
while (offset < buf.length - 512) {
|
|
68
|
+
const header = buf.slice(offset, offset + 512);
|
|
69
|
+
if (header.every((b) => b === 0)) break;
|
|
70
|
+
|
|
71
|
+
const name = header.slice(0, 100).toString("utf-8").replace(/\0.*$/, "");
|
|
72
|
+
const size = octalToInt(header.slice(124, 136).toString("utf-8"));
|
|
73
|
+
const type = header[156];
|
|
74
|
+
|
|
75
|
+
offset += 512;
|
|
76
|
+
|
|
77
|
+
if (name && name.startsWith(prefix)) {
|
|
78
|
+
const relativePath = name.slice(prefix.length);
|
|
79
|
+
if (relativePath) {
|
|
80
|
+
const fullPath = join(destDir, relativePath);
|
|
81
|
+
if (type === 48 || type === 0) {
|
|
82
|
+
const dir = dirname(fullPath);
|
|
83
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
84
|
+
writeFileSync(fullPath, buf.slice(offset, offset + size));
|
|
85
|
+
} else if (type === 53) {
|
|
86
|
+
if (!existsSync(fullPath)) mkdirSync(fullPath, { recursive: true });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
offset += Math.ceil(size / 512) * 512;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function fetchTarball(pkgName, pkgVersion) {
|
|
96
|
+
return new Promise((resolve, reject) => {
|
|
97
|
+
const url = `https://registry.npmjs.org/${pkgName}/-/${pkgName}-${pkgVersion}.tgz`;
|
|
98
|
+
https.get(url, { headers: { Accept: "application/octet-stream" } }, (res) => {
|
|
99
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
100
|
+
https.get(res.headers.location, (res2) => {
|
|
101
|
+
const chunks = [];
|
|
102
|
+
res2.on("data", (c) => chunks.push(c));
|
|
103
|
+
res2.on("end", () => resolve(Buffer.concat(chunks)));
|
|
104
|
+
res2.on("error", reject);
|
|
105
|
+
}).on("error", reject);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (res.statusCode !== 200) return reject(new Error(`HTTP ${res.statusCode}`));
|
|
109
|
+
const chunks = [];
|
|
110
|
+
res.on("data", (c) => chunks.push(c));
|
|
111
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
112
|
+
res.on("error", reject);
|
|
113
|
+
}).on("error", reject);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function main() {
|
|
118
|
+
const args = process.argv.slice(2);
|
|
119
|
+
let projectName = args.find((a) => !a.startsWith("--"));
|
|
120
|
+
|
|
121
|
+
const engineArg = args.find((a) => a.startsWith("--engine="));
|
|
122
|
+
let engine = engineArg ? engineArg.split("=")[1] : "hono";
|
|
123
|
+
|
|
124
|
+
if (!ENGINE_PREFIXES[engine]) {
|
|
125
|
+
console.error(`Error: Unknown engine "${engine}". Supported engines: hono, express.`);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
130
|
+
console.log(`create-nexwire v${version}`);
|
|
131
|
+
console.log();
|
|
132
|
+
console.log("Usage:");
|
|
133
|
+
console.log(" npm create nexwire@latest <project-name> [--engine=<hono|express>]");
|
|
134
|
+
console.log(" pnpm create nexwire@latest <project-name> [--engine=<hono|express>]");
|
|
135
|
+
console.log(" bun create nexwire@latest <project-name> [--engine=<hono|express>]");
|
|
136
|
+
console.log(" npx create-nexwire@latest <project-name> [--engine=<hono|express>]");
|
|
137
|
+
console.log();
|
|
138
|
+
console.log("Engines:");
|
|
139
|
+
console.log(" hono (default) Hono-based HTTP layer and OpenAPI");
|
|
140
|
+
console.log(" express Express-based HTTP layer and OpenAPI");
|
|
141
|
+
process.exit(0);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!projectName) {
|
|
145
|
+
projectName = await ask("Project name: ");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (!projectName || (projectName !== "." && !isValidProjectName(projectName))) {
|
|
149
|
+
console.error("Error: Invalid project name. Use alphanumeric, dashes, or underscores, or '.' for the current directory.");
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const targetDir = resolveTargetDir(projectName);
|
|
154
|
+
const isCurrentDir = targetDir === process.cwd();
|
|
155
|
+
|
|
156
|
+
console.log(`\nCreating project "${projectName}" (engine: ${engine})...\n`);
|
|
157
|
+
|
|
158
|
+
mkdirSync(targetDir, { recursive: true });
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
console.log(" Downloading template from npm...");
|
|
162
|
+
const tgz = await fetchTarball("create-nexwire", version);
|
|
163
|
+
extractTarGz(tgz, targetDir, engine);
|
|
164
|
+
} catch (err) {
|
|
165
|
+
console.error("Error: Failed to download template from npm registry.");
|
|
166
|
+
console.error(" " + err.message);
|
|
167
|
+
if (isCurrentDir) {
|
|
168
|
+
console.error(" Leaving the current directory in place; nothing was removed.");
|
|
169
|
+
} else {
|
|
170
|
+
rmSync(targetDir, { recursive: true, force: true });
|
|
171
|
+
}
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const gitignoreStub = join(targetDir, "gitignore-stub");
|
|
176
|
+
if (existsSync(gitignoreStub)) {
|
|
177
|
+
renameSync(gitignoreStub, join(targetDir, ".gitignore"));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const targetPkgPath = join(targetDir, "package.json");
|
|
181
|
+
if (existsSync(targetPkgPath)) {
|
|
182
|
+
const targetPkg = JSON.parse(readFileSync(targetPkgPath, "utf-8"));
|
|
183
|
+
targetPkg.name = projectName === "." ? basename(targetDir) : projectName;
|
|
184
|
+
writeFileSync(targetPkgPath, JSON.stringify(targetPkg, null, 2) + "\n");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const pm = detectPackageManager();
|
|
188
|
+
|
|
189
|
+
const cdName = projectName === "." ? basename(targetDir) : projectName;
|
|
190
|
+
console.log(`Done! Created "${cdName}" (engine: ${engine}) at ${targetDir}`);
|
|
191
|
+
console.log();
|
|
192
|
+
if (projectName !== ".") {
|
|
193
|
+
console.log(" cd " + cdName);
|
|
194
|
+
}
|
|
195
|
+
console.log(" " + pm + " install");
|
|
196
|
+
console.log(" " + (existsSync(join(targetDir, ".env")) ? ".env ready - no copy needed" : process.platform === "win32" ? "copy .env.example .env" : "cp .env.example .env"));
|
|
197
|
+
console.log();
|
|
198
|
+
console.log("Enjoy building with nexwire!");
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
main().catch((err) => {
|
|
202
|
+
console.error(err);
|
|
203
|
+
process.exit(1);
|
|
204
|
+
});
|