@celljs/cli 3.8.0 → 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 +442 -1
- package/agent/guide.md +39 -0
- package/bin/cell.js +2 -0
- package/lib/agent/agent-guide.d.ts +39 -0
- package/lib/agent/agent-guide.d.ts.map +1 -0
- package/lib/agent/agent-guide.js +67 -0
- package/lib/agent/agent-guide.js.map +1 -0
- package/lib/build/executable-compiler.d.ts +44 -0
- package/lib/build/executable-compiler.d.ts.map +1 -0
- package/lib/build/executable-compiler.js +145 -0
- package/lib/build/executable-compiler.js.map +1 -0
- package/lib/build/executable-compiler.spec.d.ts +2 -0
- package/lib/build/executable-compiler.spec.d.ts.map +1 -0
- package/lib/build/executable-compiler.spec.js +71 -0
- package/lib/build/executable-compiler.spec.js.map +1 -0
- package/lib/build/single-compile.spec.d.ts +2 -0
- package/lib/build/single-compile.spec.d.ts.map +1 -0
- package/lib/build/single-compile.spec.js +135 -0
- package/lib/build/single-compile.spec.js.map +1 -0
- package/lib/check/project-checker.d.ts +85 -0
- package/lib/check/project-checker.d.ts.map +1 -0
- package/lib/check/project-checker.js +332 -0
- package/lib/check/project-checker.js.map +1 -0
- package/lib/check/project-checker.spec.d.ts +2 -0
- package/lib/check/project-checker.spec.d.ts.map +1 -0
- package/lib/check/project-checker.spec.js +147 -0
- package/lib/check/project-checker.spec.js.map +1 -0
- package/lib/cli/agent-command.d.ts +15 -0
- package/lib/cli/agent-command.d.ts.map +1 -0
- package/lib/cli/agent-command.js +42 -0
- package/lib/cli/agent-command.js.map +1 -0
- package/lib/cli/build-command.d.ts +84 -0
- package/lib/cli/build-command.d.ts.map +1 -0
- package/lib/cli/build-command.js +170 -0
- package/lib/cli/build-command.js.map +1 -0
- package/lib/cli/cell-cli.d.ts +35 -0
- package/lib/cli/cell-cli.d.ts.map +1 -0
- package/lib/cli/cell-cli.js +159 -0
- package/lib/cli/cell-cli.js.map +1 -0
- package/lib/cli/cell-cli.spec.d.ts +2 -0
- package/lib/cli/cell-cli.spec.d.ts.map +1 -0
- package/lib/cli/cell-cli.spec.js +195 -0
- package/lib/cli/cell-cli.spec.js.map +1 -0
- package/lib/cli/check-command.d.ts +31 -0
- package/lib/cli/check-command.d.ts.map +1 -0
- package/lib/cli/check-command.js +67 -0
- package/lib/cli/check-command.js.map +1 -0
- package/lib/cli/command.d.ts +24 -0
- package/lib/cli/command.d.ts.map +1 -0
- package/lib/cli/command.js +10 -0
- package/lib/cli/command.js.map +1 -0
- package/lib/cli/config-command.d.ts +29 -0
- package/lib/cli/config-command.d.ts.map +1 -0
- package/lib/cli/config-command.js +71 -0
- package/lib/cli/config-command.js.map +1 -0
- package/lib/cli/config-command.spec.d.ts +2 -0
- package/lib/cli/config-command.spec.d.ts.map +1 -0
- package/lib/cli/config-command.spec.js +79 -0
- package/lib/cli/config-command.spec.js.map +1 -0
- package/lib/cli/deploy-command.d.ts +41 -0
- package/lib/cli/deploy-command.d.ts.map +1 -0
- package/lib/cli/deploy-command.js +114 -0
- package/lib/cli/deploy-command.js.map +1 -0
- package/lib/cli/dev-command.d.ts +47 -0
- package/lib/cli/dev-command.d.ts.map +1 -0
- package/lib/cli/dev-command.js +219 -0
- package/lib/cli/dev-command.js.map +1 -0
- package/lib/cli/dev-command.spec.d.ts +2 -0
- package/lib/cli/dev-command.spec.d.ts.map +1 -0
- package/lib/cli/dev-command.spec.js +149 -0
- package/lib/cli/dev-command.spec.js.map +1 -0
- package/lib/cli/docs-command.d.ts +19 -0
- package/lib/cli/docs-command.d.ts.map +1 -0
- package/lib/cli/docs-command.js +47 -0
- package/lib/cli/docs-command.js.map +1 -0
- package/lib/cli/info-command.d.ts +44 -0
- package/lib/cli/info-command.d.ts.map +1 -0
- package/lib/cli/info-command.js +39 -0
- package/lib/cli/info-command.js.map +1 -0
- package/lib/cli/info-command.spec.d.ts +2 -0
- package/lib/cli/info-command.spec.d.ts.map +1 -0
- package/lib/cli/info-command.spec.js +236 -0
- package/lib/cli/info-command.spec.js.map +1 -0
- package/lib/cli/init-command.d.ts +20 -0
- package/lib/cli/init-command.d.ts.map +1 -0
- package/lib/cli/init-command.js +43 -0
- package/lib/cli/init-command.js.map +1 -0
- package/lib/cli/main.d.ts +2 -0
- package/lib/cli/main.d.ts.map +1 -0
- package/lib/cli/main.js +3 -0
- package/lib/cli/main.js.map +1 -0
- package/lib/cli/mcp-command.d.ts +34 -0
- package/lib/cli/mcp-command.d.ts.map +1 -0
- package/lib/cli/mcp-command.js +85 -0
- package/lib/cli/mcp-command.js.map +1 -0
- package/lib/cli/mcp-command.spec.d.ts +2 -0
- package/lib/cli/mcp-command.spec.d.ts.map +1 -0
- package/lib/cli/mcp-command.spec.js +132 -0
- package/lib/cli/mcp-command.spec.js.map +1 -0
- package/lib/cli/preview-command.d.ts +24 -0
- package/lib/cli/preview-command.d.ts.map +1 -0
- package/lib/cli/preview-command.js +91 -0
- package/lib/cli/preview-command.js.map +1 -0
- package/lib/cli/reporter.d.ts +26 -0
- package/lib/cli/reporter.d.ts.map +1 -0
- package/lib/cli/reporter.js +58 -0
- package/lib/cli/reporter.js.map +1 -0
- package/lib/config/config-build.spec.d.ts +2 -0
- package/lib/config/config-build.spec.d.ts.map +1 -0
- package/lib/config/config-build.spec.js +111 -0
- package/lib/config/config-build.spec.js.map +1 -0
- package/lib/config/config-explainer.d.ts +48 -0
- package/lib/config/config-explainer.d.ts.map +1 -0
- package/lib/config/config-explainer.js +130 -0
- package/lib/config/config-explainer.js.map +1 -0
- package/lib/config/config-file-loader.d.ts +22 -0
- package/lib/config/config-file-loader.d.ts.map +1 -0
- package/lib/config/config-file-loader.js +63 -0
- package/lib/config/config-file-loader.js.map +1 -0
- package/lib/config/config-resolver.d.ts +111 -0
- package/lib/config/config-resolver.d.ts.map +1 -0
- package/lib/config/config-resolver.js +215 -0
- package/lib/config/config-resolver.js.map +1 -0
- package/lib/config/config-resolver.spec.d.ts +2 -0
- package/lib/config/config-resolver.spec.d.ts.map +1 -0
- package/lib/config/config-resolver.spec.js +159 -0
- package/lib/config/config-resolver.spec.js.map +1 -0
- package/lib/config/config-validator.d.ts +35 -0
- package/lib/config/config-validator.d.ts.map +1 -0
- package/lib/config/config-validator.js +160 -0
- package/lib/config/config-validator.js.map +1 -0
- package/lib/config/config-validator.spec.d.ts +2 -0
- package/lib/config/config-validator.spec.d.ts.map +1 -0
- package/lib/config/config-validator.spec.js +77 -0
- package/lib/config/config-validator.spec.js.map +1 -0
- package/lib/config/define-config.d.ts +4 -0
- package/lib/config/define-config.d.ts.map +1 -0
- package/lib/config/define-config.js +5 -0
- package/lib/config/define-config.js.map +1 -0
- package/lib/config/types.d.ts +53 -0
- package/lib/config/types.d.ts.map +1 -0
- package/lib/config/types.js +2 -0
- package/lib/config/types.js.map +1 -0
- package/lib/deploy/cloud-api.d.ts +58 -0
- package/lib/deploy/cloud-api.d.ts.map +1 -0
- package/lib/deploy/cloud-api.js +189 -0
- package/lib/deploy/cloud-api.js.map +1 -0
- package/lib/deploy/code-package.d.ts +15 -0
- package/lib/deploy/code-package.d.ts.map +1 -0
- package/lib/deploy/code-package.js +40 -0
- package/lib/deploy/code-package.js.map +1 -0
- package/lib/deploy/deploy-utils.spec.d.ts +2 -0
- package/lib/deploy/deploy-utils.spec.d.ts.map +1 -0
- package/lib/deploy/deploy-utils.spec.js +56 -0
- package/lib/deploy/deploy-utils.spec.js.map +1 -0
- package/lib/deploy/deployer-registry.d.ts +11 -0
- package/lib/deploy/deployer-registry.d.ts.map +1 -0
- package/lib/deploy/deployer-registry.js +40 -0
- package/lib/deploy/deployer-registry.js.map +1 -0
- package/lib/deploy/request-signer.d.ts +51 -0
- package/lib/deploy/request-signer.d.ts.map +1 -0
- package/lib/deploy/request-signer.js +109 -0
- package/lib/deploy/request-signer.js.map +1 -0
- package/lib/deploy/zip-writer.d.ts +32 -0
- package/lib/deploy/zip-writer.d.ts.map +1 -0
- package/lib/deploy/zip-writer.js +114 -0
- package/lib/deploy/zip-writer.js.map +1 -0
- package/lib/docs/docs-index.d.ts +54 -0
- package/lib/docs/docs-index.d.ts.map +1 -0
- package/lib/docs/docs-index.js +140 -0
- package/lib/docs/docs-index.js.map +1 -0
- package/lib/docs/docs-index.spec.d.ts +2 -0
- package/lib/docs/docs-index.spec.d.ts.map +1 -0
- package/lib/docs/docs-index.spec.js +52 -0
- package/lib/docs/docs-index.spec.js.map +1 -0
- package/lib/events/event-bus.d.ts +30 -0
- package/lib/events/event-bus.d.ts.map +1 -0
- package/lib/events/event-bus.js +81 -0
- package/lib/events/event-bus.js.map +1 -0
- package/lib/events/event-bus.spec.d.ts +2 -0
- package/lib/events/event-bus.spec.d.ts.map +1 -0
- package/lib/events/event-bus.spec.js +69 -0
- package/lib/events/event-bus.spec.js.map +1 -0
- package/lib/events/hook-runner.d.ts +27 -0
- package/lib/events/hook-runner.d.ts.map +1 -0
- package/lib/events/hook-runner.js +65 -0
- package/lib/events/hook-runner.js.map +1 -0
- package/lib/events/hook-runner.spec.d.ts +2 -0
- package/lib/events/hook-runner.spec.d.ts.map +1 -0
- package/lib/events/hook-runner.spec.js +36 -0
- package/lib/events/hook-runner.spec.js.map +1 -0
- package/lib/index.d.ts +57 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +57 -2
- package/lib/index.js.map +1 -1
- package/lib/info/project-inspector.d.ts +143 -0
- package/lib/info/project-inspector.d.ts.map +1 -0
- package/lib/info/project-inspector.js +244 -0
- package/lib/info/project-inspector.js.map +1 -0
- package/lib/init/project-initializer.d.ts +44 -0
- package/lib/init/project-initializer.d.ts.map +1 -0
- package/lib/init/project-initializer.js +90 -0
- package/lib/init/project-initializer.js.map +1 -0
- package/lib/init/project-initializer.spec.d.ts +2 -0
- package/lib/init/project-initializer.spec.d.ts.map +1 -0
- package/lib/init/project-initializer.spec.js +88 -0
- package/lib/init/project-initializer.spec.js.map +1 -0
- package/lib/mcp/dev-activity.d.ts +34 -0
- package/lib/mcp/dev-activity.d.ts.map +1 -0
- package/lib/mcp/dev-activity.js +46 -0
- package/lib/mcp/dev-activity.js.map +1 -0
- package/lib/mcp/dev-mcp-endpoint.d.ts +62 -0
- package/lib/mcp/dev-mcp-endpoint.d.ts.map +1 -0
- package/lib/mcp/dev-mcp-endpoint.js +280 -0
- package/lib/mcp/dev-mcp-endpoint.js.map +1 -0
- package/lib/mcp/dev-mcp-endpoint.spec.d.ts +2 -0
- package/lib/mcp/dev-mcp-endpoint.spec.d.ts.map +1 -0
- package/lib/mcp/dev-mcp-endpoint.spec.js +143 -0
- package/lib/mcp/dev-mcp-endpoint.spec.js.map +1 -0
- package/lib/mcp/mcp-server.d.ts +64 -0
- package/lib/mcp/mcp-server.d.ts.map +1 -0
- package/lib/mcp/mcp-server.js +201 -0
- package/lib/mcp/mcp-server.js.map +1 -0
- package/lib/mcp/mcp-server.spec.d.ts +2 -0
- package/lib/mcp/mcp-server.spec.d.ts.map +1 -0
- package/lib/mcp/mcp-server.spec.js +136 -0
- package/lib/mcp/mcp-server.spec.js.map +1 -0
- package/lib/mcp/project-mcp-tools.d.ts +35 -0
- package/lib/mcp/project-mcp-tools.d.ts.map +1 -0
- package/lib/mcp/project-mcp-tools.js +199 -0
- package/lib/mcp/project-mcp-tools.js.map +1 -0
- package/lib/modules/module-host.d.ts +118 -0
- package/lib/modules/module-host.d.ts.map +1 -0
- package/lib/modules/module-host.js +405 -0
- package/lib/modules/module-host.js.map +1 -0
- package/lib/modules/module-host.spec.d.ts +2 -0
- package/lib/modules/module-host.spec.d.ts.map +1 -0
- package/lib/modules/module-host.spec.js +220 -0
- package/lib/modules/module-host.spec.js.map +1 -0
- package/lib/preset/builtin-presets.d.ts +9 -0
- package/lib/preset/builtin-presets.d.ts.map +1 -0
- package/lib/preset/builtin-presets.js +24 -0
- package/lib/preset/builtin-presets.js.map +1 -0
- package/lib/preset/cloudflare/cloudflare-deployer.d.ts +26 -0
- package/lib/preset/cloudflare/cloudflare-deployer.d.ts.map +1 -0
- package/lib/preset/cloudflare/cloudflare-deployer.js +116 -0
- package/lib/preset/cloudflare/cloudflare-deployer.js.map +1 -0
- package/lib/preset/cloudflare/cloudflare-preset.d.ts +16 -0
- package/lib/preset/cloudflare/cloudflare-preset.d.ts.map +1 -0
- package/lib/preset/cloudflare/cloudflare-preset.js +97 -0
- package/lib/preset/cloudflare/cloudflare-preset.js.map +1 -0
- package/lib/preset/cloudflare/cloudflare.spec.d.ts +2 -0
- package/lib/preset/cloudflare/cloudflare.spec.d.ts.map +1 -0
- package/lib/preset/cloudflare/cloudflare.spec.js +212 -0
- package/lib/preset/cloudflare/cloudflare.spec.js.map +1 -0
- package/lib/preset/cloudflare/wrangler-config.d.ts +50 -0
- package/lib/preset/cloudflare/wrangler-config.d.ts.map +1 -0
- package/lib/preset/cloudflare/wrangler-config.js +160 -0
- package/lib/preset/cloudflare/wrangler-config.js.map +1 -0
- package/lib/preset/cloudflare/wrangler-config.spec.d.ts +2 -0
- package/lib/preset/cloudflare/wrangler-config.spec.d.ts.map +1 -0
- package/lib/preset/cloudflare/wrangler-config.spec.js +112 -0
- package/lib/preset/cloudflare/wrangler-config.spec.js.map +1 -0
- package/lib/preset/cloudflare/wrangler.d.ts +38 -0
- package/lib/preset/cloudflare/wrangler.d.ts.map +1 -0
- package/lib/preset/cloudflare/wrangler.js +90 -0
- package/lib/preset/cloudflare/wrangler.js.map +1 -0
- package/lib/preset/cloudflare/wrangler.spec.d.ts +2 -0
- package/lib/preset/cloudflare/wrangler.spec.d.ts.map +1 -0
- package/lib/preset/cloudflare/wrangler.spec.js +64 -0
- package/lib/preset/cloudflare/wrangler.spec.js.map +1 -0
- package/lib/preset/fc/fc-deployer.d.ts +50 -0
- package/lib/preset/fc/fc-deployer.d.ts.map +1 -0
- package/lib/preset/fc/fc-deployer.js +209 -0
- package/lib/preset/fc/fc-deployer.js.map +1 -0
- package/lib/preset/fc/fc-preset.d.ts +20 -0
- package/lib/preset/fc/fc-preset.d.ts.map +1 -0
- package/lib/preset/fc/fc-preset.js +46 -0
- package/lib/preset/fc/fc-preset.js.map +1 -0
- package/lib/preset/lambda/lambda-deployer.d.ts +50 -0
- package/lib/preset/lambda/lambda-deployer.d.ts.map +1 -0
- package/lib/preset/lambda/lambda-deployer.js +274 -0
- package/lib/preset/lambda/lambda-deployer.js.map +1 -0
- package/lib/preset/lambda/lambda-preset.d.ts +14 -0
- package/lib/preset/lambda/lambda-preset.d.ts.map +1 -0
- package/lib/preset/lambda/lambda-preset.js +44 -0
- package/lib/preset/lambda/lambda-preset.js.map +1 -0
- package/lib/preset/preset-output.d.ts +19 -0
- package/lib/preset/preset-output.d.ts.map +1 -0
- package/lib/preset/preset-output.js +45 -0
- package/lib/preset/preset-output.js.map +1 -0
- package/lib/preset/preset-registry.d.ts +16 -0
- package/lib/preset/preset-registry.d.ts.map +1 -0
- package/lib/preset/preset-registry.js +58 -0
- package/lib/preset/preset-registry.js.map +1 -0
- package/lib/preset/preset-registry.spec.d.ts +2 -0
- package/lib/preset/preset-registry.spec.d.ts.map +1 -0
- package/lib/preset/preset-registry.spec.js +28 -0
- package/lib/preset/preset-registry.spec.js.map +1 -0
- package/lib/preset/scf/scf-deployer.d.ts +54 -0
- package/lib/preset/scf/scf-deployer.d.ts.map +1 -0
- package/lib/preset/scf/scf-deployer.js +202 -0
- package/lib/preset/scf/scf-deployer.js.map +1 -0
- package/lib/preset/scf/scf-preset.d.ts +19 -0
- package/lib/preset/scf/scf-preset.d.ts.map +1 -0
- package/lib/preset/scf/scf-preset.js +43 -0
- package/lib/preset/scf/scf-preset.js.map +1 -0
- package/lib/preset/serverless-deployers.spec.d.ts +2 -0
- package/lib/preset/serverless-deployers.spec.d.ts.map +1 -0
- package/lib/preset/serverless-deployers.spec.js +307 -0
- package/lib/preset/serverless-deployers.spec.js.map +1 -0
- package/lib/preset/serverless-presets.spec.d.ts +2 -0
- package/lib/preset/serverless-presets.spec.d.ts.map +1 -0
- package/lib/preset/serverless-presets.spec.js +280 -0
- package/lib/preset/serverless-presets.spec.js.map +1 -0
- package/lib/preset/serverless-scripts.d.ts +29 -0
- package/lib/preset/serverless-scripts.d.ts.map +1 -0
- package/lib/preset/serverless-scripts.js +120 -0
- package/lib/preset/serverless-scripts.js.map +1 -0
- package/lib/preset/vercel/vercel-deployer.d.ts +38 -0
- package/lib/preset/vercel/vercel-deployer.d.ts.map +1 -0
- package/lib/preset/vercel/vercel-deployer.js +160 -0
- package/lib/preset/vercel/vercel-deployer.js.map +1 -0
- package/lib/preset/vercel/vercel-preset.d.ts +19 -0
- package/lib/preset/vercel/vercel-preset.d.ts.map +1 -0
- package/lib/preset/vercel/vercel-preset.js +102 -0
- package/lib/preset/vercel/vercel-preset.js.map +1 -0
- package/lib/test/fixture-project.d.ts +17 -0
- package/lib/test/fixture-project.d.ts.map +1 -0
- package/lib/test/fixture-project.js +43 -0
- package/lib/test/fixture-project.js.map +1 -0
- package/lib/testing/create-test-app.d.ts +27 -0
- package/lib/testing/create-test-app.d.ts.map +1 -0
- package/lib/testing/create-test-app.js +54 -0
- package/lib/testing/create-test-app.js.map +1 -0
- package/lib/testing/create-test-app.spec.d.ts +2 -0
- package/lib/testing/create-test-app.spec.d.ts.map +1 -0
- package/lib/testing/create-test-app.spec.js +66 -0
- package/lib/testing/create-test-app.spec.js.map +1 -0
- package/lib/toolchain/toolchain.d.ts +49 -0
- package/lib/toolchain/toolchain.d.ts.map +1 -0
- package/lib/toolchain/toolchain.js +100 -0
- package/lib/toolchain/toolchain.js.map +1 -0
- package/lib/utils/json-util.d.ts +11 -0
- package/lib/utils/json-util.d.ts.map +1 -0
- package/lib/utils/json-util.js +73 -0
- package/lib/utils/json-util.js.map +1 -0
- package/lib/utils/json-util.spec.d.ts +2 -0
- package/lib/utils/json-util.spec.d.ts.map +1 -0
- package/lib/utils/json-util.spec.js +18 -0
- package/lib/utils/json-util.spec.js.map +1 -0
- package/lib/utils/text-util.d.ts +19 -0
- package/lib/utils/text-util.d.ts.map +1 -0
- package/lib/utils/text-util.js +66 -0
- package/lib/utils/text-util.js.map +1 -0
- package/lib/utils/text-util.spec.d.ts +2 -0
- package/lib/utils/text-util.spec.d.ts.map +1 -0
- package/lib/utils/text-util.spec.js +22 -0
- package/lib/utils/text-util.spec.js.map +1 -0
- package/package.json +28 -30
- package/src/agent/agent-guide.ts +90 -0
- package/src/build/executable-compiler.ts +179 -0
- package/src/check/project-checker.ts +365 -0
- package/src/cli/agent-command.ts +46 -0
- package/src/cli/build-command.ts +189 -0
- package/src/cli/cell-cli.ts +174 -0
- package/src/cli/check-command.ts +74 -0
- package/src/cli/command.ts +29 -0
- package/src/cli/config-command.ts +73 -0
- package/src/cli/deploy-command.ts +122 -0
- package/src/cli/dev-command.ts +232 -0
- package/src/cli/docs-command.ts +53 -0
- package/src/cli/info-command.ts +40 -0
- package/src/cli/init-command.ts +53 -0
- package/src/cli/main.ts +3 -0
- package/src/cli/mcp-command.ts +98 -0
- package/src/cli/preview-command.ts +98 -0
- package/src/cli/reporter.ts +67 -0
- package/src/config/config-explainer.ts +158 -0
- package/src/config/config-file-loader.ts +76 -0
- package/src/config/config-resolver.ts +300 -0
- package/src/config/config-validator.ts +208 -0
- package/src/config/define-config.ts +6 -0
- package/src/config/types.ts +57 -0
- package/src/deploy/cloud-api.ts +194 -0
- package/src/deploy/code-package.ts +44 -0
- package/src/deploy/deployer-registry.ts +44 -0
- package/src/deploy/request-signer.ts +155 -0
- package/src/deploy/zip-writer.ts +132 -0
- package/src/docs/docs-index.ts +174 -0
- package/src/events/event-bus.ts +94 -0
- package/src/events/hook-runner.ts +78 -0
- package/src/index.ts +57 -0
- package/src/info/project-inspector.ts +352 -0
- package/src/init/project-initializer.ts +111 -0
- package/src/mcp/dev-activity.ts +71 -0
- package/src/mcp/dev-mcp-endpoint.ts +323 -0
- package/src/mcp/mcp-server.ts +251 -0
- package/src/mcp/project-mcp-tools.ts +216 -0
- package/src/modules/module-host.ts +489 -0
- package/src/preset/builtin-presets.ts +26 -0
- package/src/preset/cloudflare/cloudflare-deployer.ts +126 -0
- package/src/preset/cloudflare/cloudflare-preset.ts +97 -0
- package/src/preset/cloudflare/wrangler-config.ts +173 -0
- package/src/preset/cloudflare/wrangler.ts +113 -0
- package/src/preset/fc/fc-deployer.ts +237 -0
- package/src/preset/fc/fc-preset.ts +51 -0
- package/src/preset/lambda/lambda-deployer.ts +317 -0
- package/src/preset/lambda/lambda-preset.ts +45 -0
- package/src/preset/preset-output.ts +55 -0
- package/src/preset/preset-registry.ts +65 -0
- package/src/preset/scf/scf-deployer.ts +232 -0
- package/src/preset/scf/scf-preset.ts +45 -0
- package/src/preset/serverless-scripts.ts +132 -0
- package/src/preset/vercel/vercel-deployer.ts +168 -0
- package/src/preset/vercel/vercel-preset.ts +111 -0
- package/src/test/fixture-project.ts +50 -0
- package/src/testing/create-test-app.ts +73 -0
- package/src/toolchain/toolchain.ts +121 -0
- package/src/utils/json-util.ts +67 -0
- package/src/utils/text-util.ts +68 -0
- package/templates/backend/README.md +13 -0
- package/templates/backend/_gitignore +5 -0
- package/templates/backend/cell.yml +3 -0
- package/templates/backend/package.json +23 -0
- package/templates/{file-service/src → backend/src/node}/home-controller.ts +5 -2
- package/templates/{file-service/src → backend/src/node}/module.ts +0 -1
- package/templates/backend/template.json +3 -0
- package/templates/backend/test/app.spec.ts +19 -0
- package/templates/backend/tsconfig.json +25 -0
- package/templates/fullstack/README.md +13 -0
- package/templates/fullstack/_gitignore +5 -0
- package/templates/fullstack/cell.yml +6 -0
- package/templates/fullstack/package.json +27 -0
- package/templates/fullstack/src/browser/home.view.tsx +19 -0
- package/templates/{cell-component/src → fullstack/src/browser}/module.ts +1 -1
- package/templates/fullstack/src/common/greeting-protocol.ts +5 -0
- package/templates/fullstack/src/node/greeting-server.ts +13 -0
- package/templates/{admin-app/src/browser → fullstack/src/node}/module.ts +2 -1
- package/templates/fullstack/template.json +3 -0
- package/templates/fullstack/test/app.spec.ts +18 -0
- package/templates/fullstack/tsconfig.json +27 -0
- package/bin/cell +0 -2
- package/lib/build/build-manager.d.ts +0 -9
- package/lib/build/build-manager.d.ts.map +0 -1
- package/lib/build/build-manager.js +0 -41
- package/lib/build/build-manager.js.map +0 -1
- package/lib/build/build.d.ts +0 -6
- package/lib/build/build.d.ts.map +0 -1
- package/lib/build/build.js +0 -16
- package/lib/build/build.js.map +0 -1
- package/lib/cell-main.d.ts +0 -2
- package/lib/cell-main.d.ts.map +0 -1
- package/lib/cell-main.js +0 -110
- package/lib/cell-main.js.map +0 -1
- package/lib/cell.d.ts +0 -2
- package/lib/cell.d.ts.map +0 -1
- package/lib/cell.js +0 -194
- package/lib/cell.js.map +0 -1
- package/lib/config/config.d.ts +0 -12
- package/lib/config/config.d.ts.map +0 -1
- package/lib/config/config.js +0 -48
- package/lib/config/config.js.map +0 -1
- package/lib/deploy/deploy.d.ts +0 -7
- package/lib/deploy/deploy.d.ts.map +0 -1
- package/lib/deploy/deploy.js +0 -30
- package/lib/deploy/deploy.js.map +0 -1
- package/lib/info/info.d.ts +0 -6
- package/lib/info/info.d.ts.map +0 -1
- package/lib/info/info.js +0 -21
- package/lib/info/info.js.map +0 -1
- package/lib/init/init-manager.d.ts +0 -33
- package/lib/init/init-manager.d.ts.map +0 -1
- package/lib/init/init-manager.js +0 -141
- package/lib/init/init-manager.js.map +0 -1
- package/lib/init/init.d.ts +0 -4
- package/lib/init/init.d.ts.map +0 -1
- package/lib/init/init.js +0 -17
- package/lib/init/init.js.map +0 -1
- package/lib/init/templates.d.ts +0 -2
- package/lib/init/templates.d.ts.map +0 -1
- package/lib/init/templates.js +0 -23
- package/lib/init/templates.js.map +0 -1
- package/lib/package.spec.d.ts +0 -2
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -7
- package/lib/package.spec.js.map +0 -1
- package/lib/props/props.d.ts +0 -9
- package/lib/props/props.d.ts.map +0 -1
- package/lib/props/props.js +0 -49
- package/lib/props/props.js.map +0 -1
- package/lib/serve/serve-manager.d.ts +0 -8
- package/lib/serve/serve-manager.d.ts.map +0 -1
- package/lib/serve/serve-manager.js +0 -44
- package/lib/serve/serve-manager.js.map +0 -1
- package/lib/serve/serve.d.ts +0 -8
- package/lib/serve/serve.d.ts.map +0 -1
- package/lib/serve/serve.js +0 -25
- package/lib/serve/serve.js.map +0 -1
- package/lib/update/update.d.ts +0 -9
- package/lib/update/update.d.ts.map +0 -1
- package/lib/update/update.js +0 -56
- package/lib/update/update.js.map +0 -1
- package/lib/utils/banner-util.d.ts +0 -6
- package/lib/utils/banner-util.d.ts.map +0 -1
- package/lib/utils/banner-util.js +0 -44
- package/lib/utils/banner-util.js.map +0 -1
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/index.js +0 -18
- package/lib/utils/index.js.map +0 -1
- package/src/build/build-manager.ts +0 -50
- package/src/build/build.ts +0 -17
- package/src/cell-main.ts +0 -125
- package/src/cell.ts +0 -215
- package/src/config/config.ts +0 -56
- package/src/deploy/deploy.ts +0 -31
- package/src/info/info.ts +0 -23
- package/src/init/init-manager.ts +0 -163
- package/src/init/init.ts +0 -15
- package/src/init/templates.ts +0 -19
- package/src/package.spec.ts +0 -5
- package/src/props/props.ts +0 -48
- package/src/serve/serve-manager.ts +0 -51
- package/src/serve/serve.ts +0 -29
- package/src/update/update.ts +0 -61
- package/src/utils/banner-util.ts +0 -41
- package/src/utils/index.ts +0 -1
- package/templates/accounts/README.md +0 -92
- package/templates/accounts/cell-database.yml +0 -17
- package/templates/accounts/cell-locale.yml +0 -17
- package/templates/accounts/cell-oauth2.0.yml +0 -8
- package/templates/accounts/cell-theme.yml +0 -9
- package/templates/accounts/cell.yml +0 -10
- package/templates/accounts/favicon.ico +0 -0
- package/templates/accounts/package.json +0 -48
- package/templates/accounts/src/browser/home.view.tsx +0 -86
- package/templates/accounts/src/browser/index.ts +0 -3
- package/templates/accounts/src/browser/login.view.tsx +0 -78
- package/templates/accounts/src/browser/module.ts +0 -3
- package/templates/accounts/src/common/entity-protocol.ts +0 -7
- package/templates/accounts/src/common/index.ts +0 -1
- package/templates/accounts/src/node/authentication/authentication-success-handler.ts +0 -69
- package/templates/accounts/src/node/authentication/index.ts +0 -1
- package/templates/accounts/src/node/entity/base-entity.ts +0 -13
- package/templates/accounts/src/node/entity/connection.ts +0 -52
- package/templates/accounts/src/node/entity/index.ts +0 -1
- package/templates/accounts/src/node/entity/user.ts +0 -73
- package/templates/accounts/src/node/error/error.ts +0 -14
- package/templates/accounts/src/node/error/index.ts +0 -1
- package/templates/accounts/src/node/index.ts +0 -2
- package/templates/accounts/src/node/module.ts +0 -9
- package/templates/accounts/src/node/user/index.ts +0 -4
- package/templates/accounts/src/node/user/user-protocol.ts +0 -19
- package/templates/accounts/src/node/user/user-repository.ts +0 -72
- package/templates/accounts/src/node/user/user-service.ts +0 -36
- package/templates/accounts/tsconfig.json +0 -32
- package/templates/admin-app/.github/workflows/deploy.yml +0 -25
- package/templates/admin-app/.vscode/launch.json +0 -23
- package/templates/admin-app/README.md +0 -92
- package/templates/admin-app/cell-database.yml +0 -7
- package/templates/admin-app/cell.yml +0 -93
- package/templates/admin-app/package.json +0 -37
- package/templates/admin-app/src/browser/user.view.tsx +0 -40
- package/templates/admin-app/src/common/index.ts +0 -1
- package/templates/admin-app/src/common/user-protocol.ts +0 -23
- package/templates/admin-app/src/node/entity/index.ts +0 -1
- package/templates/admin-app/src/node/entity/user.ts +0 -15
- package/templates/admin-app/src/node/module.ts +0 -8
- package/templates/admin-app/src/node/user-service.ts +0 -41
- package/templates/admin-app/tsconfig.json +0 -32
- package/templates/backend-app/.github/workflows/deploy.yml +0 -25
- package/templates/backend-app/.vscode/launch.json +0 -23
- package/templates/backend-app/README.md +0 -92
- package/templates/backend-app/cell.yml +0 -0
- package/templates/backend-app/package.json +0 -33
- package/templates/backend-app/src/home-controller.ts +0 -11
- package/templates/backend-app/src/module.ts +0 -4
- package/templates/backend-app/src/user-controller.ts +0 -48
- package/templates/backend-app/test/home-controller.spec.ts +0 -19
- package/templates/backend-app/tsconfig.json +0 -32
- package/templates/cell-component/README.md +0 -27
- package/templates/cell-component/cell.yml +0 -0
- package/templates/cell-component/package.json +0 -29
- package/templates/cell-component/src/echo-service.ts +0 -16
- package/templates/cell-component/src/index.ts +0 -1
- package/templates/cell-component/src/package.spec.ts +0 -5
- package/templates/cell-component/tsconfig.json +0 -37
- package/templates/database-app/.github/workflows/deploy.yml +0 -25
- package/templates/database-app/.vscode/launch.json +0 -23
- package/templates/database-app/README.md +0 -92
- package/templates/database-app/cell.yml +0 -17
- package/templates/database-app/package.json +0 -31
- package/templates/database-app/src/entity/index.ts +0 -1
- package/templates/database-app/src/entity/user.ts +0 -13
- package/templates/database-app/src/home-controller.ts +0 -11
- package/templates/database-app/src/module.ts +0 -8
- package/templates/database-app/src/user-controller.ts +0 -43
- package/templates/database-app/tsconfig.json +0 -32
- package/templates/docker-app/.github/workflows/deploy.yml +0 -25
- package/templates/docker-app/.vscode/launch.json +0 -23
- package/templates/docker-app/Dockerfile +0 -27
- package/templates/docker-app/README.md +0 -93
- package/templates/docker-app/cell.yml +0 -0
- package/templates/docker-app/package.json +0 -31
- package/templates/docker-app/src/browser/assets/logo.png +0 -0
- package/templates/docker-app/src/browser/css-shims.d.ts +0 -30
- package/templates/docker-app/src/browser/hello.view.tsx +0 -31
- package/templates/docker-app/src/browser/module.ts +0 -3
- package/templates/docker-app/src/browser/style/hello.module.scss +0 -4
- package/templates/docker-app/src/common/welcome-protocol.ts +0 -5
- package/templates/docker-app/src/node/module.ts +0 -3
- package/templates/docker-app/src/node/welcome-server.ts +0 -9
- package/templates/docker-app/tsconfig.json +0 -33
- package/templates/file-service/.github/workflows/deploy.yml +0 -25
- package/templates/file-service/.vscode/launch.json +0 -23
- package/templates/file-service/README.md +0 -92
- package/templates/file-service/cell.yml +0 -12
- package/templates/file-service/package.json +0 -34
- package/templates/file-service/src/file-controller.ts +0 -47
- package/templates/file-service/tsconfig.json +0 -32
- package/templates/jwt-app/.github/workflows/deploy.yml +0 -25
- package/templates/jwt-app/.vscode/launch.json +0 -23
- package/templates/jwt-app/README.md +0 -92
- package/templates/jwt-app/cell.yml +0 -4
- package/templates/jwt-app/package.json +0 -36
- package/templates/jwt-app/src/context.ts +0 -16
- package/templates/jwt-app/src/error-handler.ts +0 -30
- package/templates/jwt-app/src/error.ts +0 -4
- package/templates/jwt-app/src/home-controller.ts +0 -23
- package/templates/jwt-app/src/index.ts +0 -5
- package/templates/jwt-app/src/jwt-middleware.ts +0 -36
- package/templates/jwt-app/src/module.ts +0 -3
- package/templates/jwt-app/test/home-controller.spec.ts +0 -19
- package/templates/jwt-app/tsconfig.json +0 -32
- package/templates/koa-app/app.js +0 -8
- package/templates/koa-app/package.json +0 -9
- package/templates/microservice/.github/workflows/deploy.yml +0 -28
- package/templates/microservice/.vscode/launch.json +0 -24
- package/templates/microservice/README.md +0 -92
- package/templates/microservice/examples/backend-app/README.md +0 -92
- package/templates/microservice/examples/backend-app/cell-remote.yml +0 -4
- package/templates/microservice/examples/backend-app/cell.yml +0 -3
- package/templates/microservice/examples/backend-app/package.json +0 -32
- package/templates/microservice/examples/backend-app/src/api-controller.ts +0 -31
- package/templates/microservice/examples/backend-app/src/module.ts +0 -3
- package/templates/microservice/examples/backend-app/tsconfig.json +0 -32
- package/templates/microservice/package.json +0 -20
- package/templates/microservice/packages/api/README.md +0 -92
- package/templates/microservice/packages/api/cell.yml +0 -0
- package/templates/microservice/packages/api/package.json +0 -25
- package/templates/microservice/packages/api/src/common/api-protocol.ts +0 -10
- package/templates/microservice/packages/api/src/common/index.ts +0 -1
- package/templates/microservice/packages/api/tsconfig.json +0 -30
- package/templates/microservice/packages/serviceA/.vscode/launch.json +0 -23
- package/templates/microservice/packages/serviceA/README.md +0 -92
- package/templates/microservice/packages/serviceA/cell.yml +0 -6
- package/templates/microservice/packages/serviceA/package.json +0 -29
- package/templates/microservice/packages/serviceA/src/node/module.ts +0 -3
- package/templates/microservice/packages/serviceA/src/node/service-a.ts +0 -9
- package/templates/microservice/packages/serviceA/tsconfig.json +0 -30
- package/templates/microservice/packages/serviceB/README.md +0 -92
- package/templates/microservice/packages/serviceB/cell.yml +0 -5
- package/templates/microservice/packages/serviceB/package.json +0 -29
- package/templates/microservice/packages/serviceB/src/node/module.ts +0 -3
- package/templates/microservice/packages/serviceB/src/node/service-b.ts +0 -9
- package/templates/microservice/packages/serviceB/tsconfig.json +0 -30
- package/templates/microservice/tsconfig.json +0 -32
- package/templates/mycli/.vscode/launch.json +0 -33
- package/templates/mycli/bin/mycli +0 -2
- package/templates/mycli/bin/mycli-deploy +0 -2
- package/templates/mycli/bin/mycli-init +0 -2
- package/templates/mycli/package.json +0 -33
- package/templates/mycli/src/bootstrap.ts +0 -7
- package/templates/mycli/src/constants.ts +0 -1
- package/templates/mycli/src/deploy/deploy-manager.ts +0 -12
- package/templates/mycli/src/deploy/deploy.ts +0 -16
- package/templates/mycli/src/deploy/index.ts +0 -1
- package/templates/mycli/src/index.ts +0 -2
- package/templates/mycli/src/init/index.ts +0 -1
- package/templates/mycli/src/init/init-manager.ts +0 -85
- package/templates/mycli/src/init/init.ts +0 -25
- package/templates/mycli/src/init/templates.ts +0 -3
- package/templates/mycli/src/module.ts +0 -3
- package/templates/mycli/src/mycli.ts +0 -13
- package/templates/mycli/templates/application-template/README.md +0 -0
- package/templates/mycli/tsconfig.json +0 -32
- package/templates/nest-app/.eslintrc.js +0 -25
- package/templates/nest-app/.prettierrc +0 -4
- package/templates/nest-app/README.md +0 -73
- package/templates/nest-app/nest-cli.json +0 -8
- package/templates/nest-app/package.json +0 -69
- package/templates/nest-app/src/app.controller.spec.ts +0 -22
- package/templates/nest-app/src/app.controller.ts +0 -12
- package/templates/nest-app/src/app.module.ts +0 -10
- package/templates/nest-app/src/app.service.ts +0 -8
- package/templates/nest-app/src/main.ts +0 -8
- package/templates/nest-app/test/app.e2e-spec.ts +0 -24
- package/templates/nest-app/test/jest-e2e.json +0 -9
- package/templates/nest-app/tsconfig.build.json +0 -12
- package/templates/nest-app/tsconfig.json +0 -25
- package/templates/nextjs-app/.eslintrc.json +0 -3
- package/templates/nextjs-app/README.md +0 -34
- package/templates/nextjs-app/next.config.js +0 -6
- package/templates/nextjs-app/package.json +0 -20
- package/templates/nextjs-app/pages/_app.js +0 -7
- package/templates/nextjs-app/pages/api/hello.js +0 -5
- package/templates/nextjs-app/pages/index.js +0 -69
- package/templates/nextjs-app/public/favicon.ico +0 -0
- package/templates/nextjs-app/public/vercel.svg +0 -4
- package/templates/nextjs-app/styles/Home.module.css +0 -116
- package/templates/nextjs-app/styles/globals.css +0 -16
- package/templates/sample-app/.github/workflows/deploy.yml +0 -25
- package/templates/sample-app/.vscode/launch.json +0 -23
- package/templates/sample-app/README.md +0 -92
- package/templates/sample-app/cell.yml +0 -0
- package/templates/sample-app/package.json +0 -31
- package/templates/sample-app/src/browser/assets/logo.png +0 -0
- package/templates/sample-app/src/browser/css-shims.d.ts +0 -30
- package/templates/sample-app/src/browser/hello.view.tsx +0 -31
- package/templates/sample-app/src/browser/module.ts +0 -3
- package/templates/sample-app/src/browser/style/hello.module.scss +0 -4
- package/templates/sample-app/src/common/welcome-protocol.ts +0 -5
- package/templates/sample-app/src/node/module.ts +0 -3
- package/templates/sample-app/src/node/welcome-server.ts +0 -9
- package/templates/sample-app/tsconfig.json +0 -32
- package/templates/schedule/.github/workflows/deploy.yml +0 -25
- package/templates/schedule/.vscode/launch.json +0 -23
- package/templates/schedule/README.md +0 -92
- package/templates/schedule/cell.yml +0 -1
- package/templates/schedule/package.json +0 -29
- package/templates/schedule/src/module.ts +0 -3
- package/templates/schedule/src/scheduler.ts +0 -10
- package/templates/schedule/tsconfig.json +0 -32
- package/templates/standalone-app/package.json +0 -17
- package/templates/standalone-app/src/app.service.ts +0 -10
- package/templates/standalone-app/src/main.ts +0 -14
- package/templates/standalone-app/src/module.ts +0 -3
- package/templates/standalone-app/tsconfig.json +0 -30
- package/templates/vue-app/.github/workflows/deploy.yml +0 -25
- package/templates/vue-app/.vscode/launch.json +0 -23
- package/templates/vue-app/README.md +0 -92
- package/templates/vue-app/cell.yml +0 -0
- package/templates/vue-app/package.json +0 -32
- package/templates/vue-app/src/browser/App.vue +0 -32
- package/templates/vue-app/src/browser/app.ts +0 -7
- package/templates/vue-app/src/browser/components/HelloWorld.vue +0 -42
- package/templates/vue-app/src/browser/declare.d.ts +0 -7
- package/templates/vue-app/src/browser/images/logo.png +0 -0
- package/templates/vue-app/src/browser/module.ts +0 -3
- package/templates/vue-app/src/browser/router.ts +0 -13
- package/templates/vue-app/src/browser/shims-vue.d.ts +0 -5
- package/templates/vue-app/src/browser/views/About.vue +0 -5
- package/templates/vue-app/src/browser/views/Root.vue +0 -37
- package/templates/vue-app/src/common/welcome-protocol.ts +0 -5
- package/templates/vue-app/src/node/module.ts +0 -3
- package/templates/vue-app/src/node/welcome-server.ts +0 -9
- package/templates/vue-app/tsconfig.json +0 -32
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, renameSync, rmSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { definePreset, type PresetOutputContext, type PresetPreviewContext, type PreviewProcess } from '@celljs/kit';
|
|
4
|
+
import { PresetOptionsSchema } from '../../deploy/cloud-api.js';
|
|
5
|
+
import { ServerlessScripts } from '../serverless-scripts.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Vercel through the Build Output API (v3): the frontend in `static/` on Vercel's CDN, the Cell
|
|
9
|
+
* server as one Node.js function `functions/index.func` that gets every request no static file
|
|
10
|
+
* answers. The output goes to `.vercel/output`, where `vercel deploy --prebuilt` looks for it.
|
|
11
|
+
*/
|
|
12
|
+
export namespace VercelPreset {
|
|
13
|
+
export const OUT_DIR = '.vercel/output';
|
|
14
|
+
export const FUNCTION = 'functions/index.func';
|
|
15
|
+
export const RUNTIMES = ['nodejs22.x', 'nodejs20.x'] as const;
|
|
16
|
+
|
|
17
|
+
export const OPTIONS = PresetOptionsSchema.of({
|
|
18
|
+
project: 'string',
|
|
19
|
+
scope: 'string',
|
|
20
|
+
environment: ['production', 'preview'],
|
|
21
|
+
runtime: RUNTIMES,
|
|
22
|
+
memory: 'number',
|
|
23
|
+
maxDuration: 'number',
|
|
24
|
+
regions: 'string',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/** What `vercel build` writes into .vercel/output; a deployment would mix it with Cell's output. */
|
|
28
|
+
export const FOREIGN = ['static', 'functions', 'config.json', 'builds.json', 'diagnostics'];
|
|
29
|
+
|
|
30
|
+
export function output(context: PresetOutputContext): void {
|
|
31
|
+
const { manifest, outDir, options } = context;
|
|
32
|
+
for (const entry of FOREIGN) {
|
|
33
|
+
rmSync(join(outDir, entry), { recursive: true, force: true });
|
|
34
|
+
}
|
|
35
|
+
if (manifest.public) {
|
|
36
|
+
renameSync(join(outDir, manifest.public), join(outDir, 'static'));
|
|
37
|
+
manifest.public = 'static';
|
|
38
|
+
}
|
|
39
|
+
const routes: Record<string, unknown>[] = [
|
|
40
|
+
// Vite's hashed files never change.
|
|
41
|
+
{ src: '^/assets/(.*)$', headers: { 'cache-control': 'public, max-age=31536000, immutable' }, continue: true },
|
|
42
|
+
{ handle: 'filesystem' },
|
|
43
|
+
];
|
|
44
|
+
if (manifest.server) {
|
|
45
|
+
const fn = join(outDir, FUNCTION);
|
|
46
|
+
mkdirSync(fn, { recursive: true });
|
|
47
|
+
renameSync(join(outDir, dirname(manifest.server)), join(fn, 'server'));
|
|
48
|
+
manifest.server = `${FUNCTION}/server/${manifest.server.split('/').pop()}`;
|
|
49
|
+
// The single-page fallback of serve-static, inside the function.
|
|
50
|
+
const index = join(outDir, 'static', 'index.html');
|
|
51
|
+
if (existsSync(index)) {
|
|
52
|
+
mkdirSync(join(fn, 'public'), { recursive: true });
|
|
53
|
+
cpSync(index, join(fn, 'public', 'index.html'));
|
|
54
|
+
}
|
|
55
|
+
context.write(`${FUNCTION}/vercel.mjs`, ServerlessScripts.VERCEL_FUNCTION);
|
|
56
|
+
context.write(
|
|
57
|
+
`${FUNCTION}/.vc-config.json`,
|
|
58
|
+
`${JSON.stringify(
|
|
59
|
+
{
|
|
60
|
+
runtime: (options.runtime as string | undefined) ?? RUNTIMES[0],
|
|
61
|
+
handler: 'vercel.mjs',
|
|
62
|
+
launcherType: 'Nodejs',
|
|
63
|
+
shouldAddHelpers: false,
|
|
64
|
+
supportsResponseStreaming: true,
|
|
65
|
+
...(options.memory ? { memory: options.memory } : {}),
|
|
66
|
+
...(options.maxDuration ? { maxDuration: options.maxDuration } : {}),
|
|
67
|
+
...(options.regions
|
|
68
|
+
? {
|
|
69
|
+
regions: String(options.regions)
|
|
70
|
+
.split(',')
|
|
71
|
+
.map(r => r.trim()),
|
|
72
|
+
}
|
|
73
|
+
: {}),
|
|
74
|
+
},
|
|
75
|
+
null,
|
|
76
|
+
2,
|
|
77
|
+
)}\n`,
|
|
78
|
+
);
|
|
79
|
+
routes.push({ src: '^/(.*)$', dest: '/index' });
|
|
80
|
+
}
|
|
81
|
+
context.write('config.json', `${JSON.stringify({ version: 3, routes }, null, 2)}\n`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Node.js on the function's server bundle, with the frontend from `static/`. */
|
|
85
|
+
export function preview({ outDir, manifest, port }: PresetPreviewContext): PreviewProcess {
|
|
86
|
+
return {
|
|
87
|
+
command: process.execPath.includes('bun') ? 'node' : process.execPath,
|
|
88
|
+
args: [join(outDir, manifest.server ?? `${FUNCTION}/server/index.mjs`)],
|
|
89
|
+
env: {
|
|
90
|
+
NODE_ENV: 'production',
|
|
91
|
+
CELL_BACKEND__PATHS__PUBLIC: join(outDir, 'static'),
|
|
92
|
+
...(port === undefined ? {} : { CELL_BACKEND__SERVER__PORT: String(port) }),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const vercelPreset = definePreset({
|
|
99
|
+
name: 'vercel',
|
|
100
|
+
description: 'Vercel (Build Output API): static frontend on the CDN, the server as a function',
|
|
101
|
+
entry: 'http',
|
|
102
|
+
format: 'esm',
|
|
103
|
+
outDir: VercelPreset.OUT_DIR,
|
|
104
|
+
staticHosting: true,
|
|
105
|
+
// Vercel's build machines set VERCEL=1.
|
|
106
|
+
detect: env => env.VERCEL === '1',
|
|
107
|
+
options: VercelPreset.OPTIONS,
|
|
108
|
+
output: context => VercelPreset.output(context),
|
|
109
|
+
preview: context => VercelPreset.preview(context),
|
|
110
|
+
deployer: 'vercel',
|
|
111
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A throw-away project on disk for tests. It lives under this package's `.fixtures/` directory so
|
|
7
|
+
* that the repository's node_modules (and therefore @celljs/core) are resolvable from it.
|
|
8
|
+
*/
|
|
9
|
+
export class FixtureProject {
|
|
10
|
+
/** Created eagerly: Bun's resolver caches a missing directory, which would break later lookups from it. */
|
|
11
|
+
static readonly BASE = FixtureProject.createBase();
|
|
12
|
+
|
|
13
|
+
protected static createBase(): string {
|
|
14
|
+
const base = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '.fixtures');
|
|
15
|
+
mkdirSync(base, { recursive: true });
|
|
16
|
+
return base;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
readonly root: string;
|
|
20
|
+
|
|
21
|
+
constructor(name: string) {
|
|
22
|
+
this.root = join(FixtureProject.BASE, `${name}-${process.pid}-${Math.random().toString(36).slice(2, 8)}`);
|
|
23
|
+
mkdirSync(this.root, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
file(path: string, content: string | object): this {
|
|
27
|
+
const file = join(this.root, path);
|
|
28
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
29
|
+
writeFileSync(file, typeof content === 'string' ? content : `${JSON.stringify(content, null, 2)}\n`);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Adds a package under `node_modules` (or nested under `under`). */
|
|
34
|
+
dependency(name: string, pkg: Record<string, unknown> = {}, files: Record<string, string> = {}, under = ''): this {
|
|
35
|
+
const dir = join(under, 'node_modules', name);
|
|
36
|
+
this.file(join(dir, 'package.json'), { name, version: '1.0.0', ...pkg });
|
|
37
|
+
for (const [path, content] of Object.entries(files)) {
|
|
38
|
+
this.file(join(dir, path), content);
|
|
39
|
+
}
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
path(...parts: string[]): string {
|
|
44
|
+
return join(this.root, ...parts);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
dispose(): void {
|
|
48
|
+
rmSync(this.root, { recursive: true, force: true });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type TestApp as BaseTestApp, TestApp as ViteTestApp } from '@celljs/vite';
|
|
2
|
+
|
|
3
|
+
export type { TestApp, TestContainer } from '@celljs/vite';
|
|
4
|
+
|
|
5
|
+
import { Toolchain } from '../toolchain/toolchain.js';
|
|
6
|
+
|
|
7
|
+
export interface CreateTestAppOptions {
|
|
8
|
+
/** Project root. Default: the current directory. */
|
|
9
|
+
root?: string;
|
|
10
|
+
/** Modes after `test`, which is always on (cell.test.yml). */
|
|
11
|
+
mode?: string[];
|
|
12
|
+
/** Preset whose entry runs the backend. Default as for `cell build`. */
|
|
13
|
+
preset?: string;
|
|
14
|
+
/** Environment for `${env.*}` and `CELL_*__` overrides of the frontend. Default: `process.env`. */
|
|
15
|
+
env?: NodeJS.ProcessEnv;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** A test application that also closes the toolchain it was created with. */
|
|
19
|
+
class ToolchainTestApp extends ViteTestApp {
|
|
20
|
+
constructor(
|
|
21
|
+
options: ConstructorParameters<typeof ViteTestApp>[0],
|
|
22
|
+
protected readonly toolchain: Toolchain,
|
|
23
|
+
) {
|
|
24
|
+
super(options);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override async close(): Promise<void> {
|
|
28
|
+
await super.close();
|
|
29
|
+
await this.toolchain.close();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The application of the project in the test process (docs/design/agent-first.md R11): cell.config.ts,
|
|
35
|
+
* toolchain modules and the preset's entry apply as for `cell dev`, in the `test` mode, without a
|
|
36
|
+
* port. Requests go through `app.fetch(path, init)`, which returns a standard `Response`.
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { createTestApp } from '@celljs/cli';
|
|
40
|
+
*
|
|
41
|
+
* const app = await createTestApp();
|
|
42
|
+
* expect(await (await app.fetch('/users')).json()).toEqual([]);
|
|
43
|
+
* await app.close();
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export async function createTestApp(options: CreateTestAppOptions = {}): Promise<BaseTestApp> {
|
|
47
|
+
const toolchain = await Toolchain.create({
|
|
48
|
+
root: options.root,
|
|
49
|
+
command: 'test',
|
|
50
|
+
flags: { mode: options.mode, preset: options.preset },
|
|
51
|
+
env: options.env,
|
|
52
|
+
runHooks: false,
|
|
53
|
+
logger: { info: () => undefined, warn: message => process.stderr.write(`warning: ${message}\n`) },
|
|
54
|
+
});
|
|
55
|
+
const { config } = toolchain;
|
|
56
|
+
const app = new ToolchainTestApp(
|
|
57
|
+
{
|
|
58
|
+
...toolchain.projectOptions(),
|
|
59
|
+
mode: config.mode,
|
|
60
|
+
env: options.env,
|
|
61
|
+
vite: config.vite,
|
|
62
|
+
plugins: toolchain.modules.vitePlugins(),
|
|
63
|
+
outDir: config.build.outDir,
|
|
64
|
+
},
|
|
65
|
+
toolchain,
|
|
66
|
+
);
|
|
67
|
+
try {
|
|
68
|
+
return await app.start();
|
|
69
|
+
} catch (error) {
|
|
70
|
+
await toolchain.close();
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import type { CellError, Preset } from '@celljs/kit';
|
|
3
|
+
import { type CellBuilderOptions, ComponentCollector, type ProjectLoaderOptions } from '@celljs/vite';
|
|
4
|
+
import { type CellCommand, type ConfigFlags, ConfigResolver, type ResolvedConfig } from '../config/config-resolver.js';
|
|
5
|
+
import { EventBus } from '../events/event-bus.js';
|
|
6
|
+
import { HookRunner } from '../events/hook-runner.js';
|
|
7
|
+
import { ModuleHost } from '../modules/module-host.js';
|
|
8
|
+
import { BUILTIN_PRESETS } from '../preset/builtin-presets.js';
|
|
9
|
+
import { PresetRegistry } from '../preset/preset-registry.js';
|
|
10
|
+
|
|
11
|
+
export interface ToolchainOptions {
|
|
12
|
+
root?: string;
|
|
13
|
+
command: CellCommand;
|
|
14
|
+
flags?: ConfigFlags;
|
|
15
|
+
env?: NodeJS.ProcessEnv;
|
|
16
|
+
/** Send hook output to stderr (`--json`). */
|
|
17
|
+
quiet?: boolean;
|
|
18
|
+
/** Run the project's `hooks` commands; read-only commands such as `cell info` turn this off. Default `true`. */
|
|
19
|
+
runHooks?: boolean;
|
|
20
|
+
/** Messages of modules. Default: stderr. */
|
|
21
|
+
logger?: { info(message: string): void; warn(message: string): void };
|
|
22
|
+
/** Report failing notification handlers here instead of failing (`cell dev`). */
|
|
23
|
+
onNotifyError?: (error: CellError) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The toolchain of one command run: resolved configuration, toolchain modules, the preset and the
|
|
28
|
+
* event bus with the project's hooks. Startup order follows docs/design/modules.md §3.3: read
|
|
29
|
+
* cell.config.ts → find components → run module factories → resolve the preset → modules:done →
|
|
30
|
+
* config:resolved.
|
|
31
|
+
*/
|
|
32
|
+
export class Toolchain {
|
|
33
|
+
protected constructor(
|
|
34
|
+
readonly config: ResolvedConfig,
|
|
35
|
+
readonly preset: Preset,
|
|
36
|
+
readonly events: EventBus,
|
|
37
|
+
readonly presets: PresetRegistry,
|
|
38
|
+
readonly modules: ModuleHost,
|
|
39
|
+
) {}
|
|
40
|
+
|
|
41
|
+
static async create(options: ToolchainOptions): Promise<Toolchain> {
|
|
42
|
+
const presets = new PresetRegistry();
|
|
43
|
+
for (const preset of BUILTIN_PRESETS) {
|
|
44
|
+
presets.register(preset);
|
|
45
|
+
}
|
|
46
|
+
const config = await new ConfigResolver({ ...options, detectors: presets.detectors }).resolve();
|
|
47
|
+
const events = new EventBus(options.onNotifyError);
|
|
48
|
+
const disabled = new Set(config.modules.flatMap(spec => (spec.kind === 'disabled' ? [spec.name] : [])));
|
|
49
|
+
const components = new ComponentCollector(config.root, disabled).collect();
|
|
50
|
+
const logger = options.logger ?? { info: (m: string) => process.stderr.write(`${m}\n`), warn: (m: string) => process.stderr.write(`warning: ${m}\n`) };
|
|
51
|
+
const modules = new ModuleHost({
|
|
52
|
+
config,
|
|
53
|
+
events,
|
|
54
|
+
presets,
|
|
55
|
+
logger,
|
|
56
|
+
components: components.map(({ name, version, dir, root }) => ({ name, version, dir, root })),
|
|
57
|
+
});
|
|
58
|
+
await modules.load(ModuleHost.sources(config, components));
|
|
59
|
+
Toolchain.detectModulePreset(config, presets, options.env ?? process.env);
|
|
60
|
+
const preset = presets.resolve(config.preset.name, config.preset.source === 'config' ? config.file : undefined);
|
|
61
|
+
// The options of every preset are accepted, so switching presets does not break cell.config.ts.
|
|
62
|
+
for (const { name, options: schema } of presets.all) {
|
|
63
|
+
if (schema) {
|
|
64
|
+
modules.claimOption(name, `the ${name} preset`, schema);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (preset.outDir && config.build.outDir === ConfigResolver.DEFAULT_OUT_DIR) {
|
|
68
|
+
config.build.outDir = preset.outDir;
|
|
69
|
+
}
|
|
70
|
+
await modules.checkOptions();
|
|
71
|
+
if (options.runHooks ?? true) {
|
|
72
|
+
const outDir = resolve(config.root, config.build.outDir);
|
|
73
|
+
new HookRunner({ root: config.root, preset: preset.name, mode: config.mode, outDir, quiet: options.quiet, env: options.env }).register(
|
|
74
|
+
events,
|
|
75
|
+
config.hooks,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
const toolchain = new Toolchain(config, preset, events, presets, modules);
|
|
79
|
+
await events.emit('modules:done', { modules: modules.loaded.map(m => m.name) });
|
|
80
|
+
await events.emit('config:resolved', { config, preset });
|
|
81
|
+
return toolchain;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Presets added by modules take part in CI detection like the built-in ones. */
|
|
85
|
+
protected static detectModulePreset(config: ResolvedConfig, presets: PresetRegistry, env: NodeJS.ProcessEnv): void {
|
|
86
|
+
if (config.preset.source !== 'default' || !config.ci) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const detected = presets.detectors.find(detector => detector.detect(env));
|
|
90
|
+
if (detected) {
|
|
91
|
+
config.preset = { name: detected.name, source: 'ci' };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** What decides the component graph, with what modules added (DI modules, entries). */
|
|
96
|
+
projectOptions(): ProjectLoaderOptions {
|
|
97
|
+
return { ...ConfigResolver.toProjectOptions(this.config, this.preset), ...this.moduleProjectOptions() };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Options of the build: the configuration, the preset and the modules' plugins. */
|
|
101
|
+
builderOptions(): CellBuilderOptions {
|
|
102
|
+
return { ...ConfigResolver.toBuilderOptions(this.config, this.preset), ...this.moduleProjectOptions(), plugins: this.modules.vitePlugins() };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
protected moduleProjectOptions(): Pick<ProjectLoaderOptions, 'extraModules' | 'entry'> {
|
|
106
|
+
const entry = this.modules.entries;
|
|
107
|
+
return {
|
|
108
|
+
...(this.modules.extraModules.length > 0 ? { extraModules: this.modules.extraModules } : {}),
|
|
109
|
+
...(Object.keys(entry).length > 0 ? { entry } : {}),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The options of a preset: its field of cell.config.ts, `{}` when absent. */
|
|
114
|
+
presetOptions(name = this.preset.name): Record<string, unknown> {
|
|
115
|
+
return this.config.options[name] ?? {};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async close(reason: 'exit' | 'restart' = 'exit'): Promise<void> {
|
|
119
|
+
await this.events.emit('close', { reason });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export namespace JsonUtil {
|
|
2
|
+
/**
|
|
3
|
+
* Parses JSON with comments and trailing commas (JSONC, as in wrangler.jsonc and tsconfig.json).
|
|
4
|
+
* Comments become spaces, so positions in error messages still match the text.
|
|
5
|
+
*/
|
|
6
|
+
export function parseJsonc(text: string): unknown {
|
|
7
|
+
return JSON.parse(withoutTrailingCommas(withoutComments(text)));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function withoutComments(text: string): string {
|
|
11
|
+
let result = '';
|
|
12
|
+
let i = 0;
|
|
13
|
+
while (i < text.length) {
|
|
14
|
+
const char = text[i];
|
|
15
|
+
if (char === '"') {
|
|
16
|
+
const end = stringEnd(text, i);
|
|
17
|
+
result += text.slice(i, end);
|
|
18
|
+
i = end;
|
|
19
|
+
} else if (char === '/' && text[i + 1] === '/') {
|
|
20
|
+
const end = text.indexOf('\n', i);
|
|
21
|
+
const stop = end === -1 ? text.length : end;
|
|
22
|
+
result += ' '.repeat(stop - i);
|
|
23
|
+
i = stop;
|
|
24
|
+
} else if (char === '/' && text[i + 1] === '*') {
|
|
25
|
+
const end = text.indexOf('*/', i + 2);
|
|
26
|
+
const stop = end === -1 ? text.length : end + 2;
|
|
27
|
+
result += text.slice(i, stop).replace(/[^\n]/g, ' ');
|
|
28
|
+
i = stop;
|
|
29
|
+
} else {
|
|
30
|
+
result += char;
|
|
31
|
+
i++;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Drops a comma that is followed only by whitespace and a closing bracket. */
|
|
38
|
+
export function withoutTrailingCommas(text: string): string {
|
|
39
|
+
let result = '';
|
|
40
|
+
let i = 0;
|
|
41
|
+
while (i < text.length) {
|
|
42
|
+
const char = text[i];
|
|
43
|
+
if (char === '"') {
|
|
44
|
+
const end = stringEnd(text, i);
|
|
45
|
+
result += text.slice(i, end);
|
|
46
|
+
i = end;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (char === ',' && /^\s*[}\]]/.test(text.slice(i + 1))) {
|
|
50
|
+
result += ' ';
|
|
51
|
+
} else {
|
|
52
|
+
result += char;
|
|
53
|
+
}
|
|
54
|
+
i++;
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Index just after the string literal that starts at `start` (or the end of the text). */
|
|
60
|
+
function stringEnd(text: string, start: number): number {
|
|
61
|
+
let i = start + 1;
|
|
62
|
+
while (i < text.length && text[i] !== '"') {
|
|
63
|
+
i += text[i] === '\\' ? 2 : 1;
|
|
64
|
+
}
|
|
65
|
+
return Math.min(i + 1, text.length);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface SourcePosition {
|
|
2
|
+
line: number;
|
|
3
|
+
column: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export namespace TextUtil {
|
|
7
|
+
/** Edit distance between two strings (insertions, deletions and substitutions). */
|
|
8
|
+
export function distance(a: string, b: string): number {
|
|
9
|
+
let previous = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
10
|
+
for (let i = 1; i <= a.length; i++) {
|
|
11
|
+
const current = [i];
|
|
12
|
+
for (let j = 1; j <= b.length; j++) {
|
|
13
|
+
current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
14
|
+
}
|
|
15
|
+
previous = current;
|
|
16
|
+
}
|
|
17
|
+
return previous[b.length];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The candidate closest to `word`, if it is a likely typo (at most `max` edits away). */
|
|
21
|
+
export function closest(word: string, candidates: readonly string[], max = 2): string | undefined {
|
|
22
|
+
let best: string | undefined;
|
|
23
|
+
let bestDistance = max + 1;
|
|
24
|
+
for (const candidate of candidates) {
|
|
25
|
+
const d = distance(word, candidate);
|
|
26
|
+
if (d < bestDistance) {
|
|
27
|
+
best = candidate;
|
|
28
|
+
bestDistance = d;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return best;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Line and column of the first occurrence of `text` in `source`. */
|
|
35
|
+
export function find(source: string, text: string): SourcePosition | undefined {
|
|
36
|
+
const offset = source.indexOf(text);
|
|
37
|
+
return offset < 0 ? undefined : position(source, offset);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function position(source: string, offset: number): SourcePosition {
|
|
41
|
+
const before = source.slice(0, offset).split('\n');
|
|
42
|
+
return { line: before.length, column: before[before.length - 1].length + 1 };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Where the property at `path` is written in an object-literal source file, found by searching each
|
|
47
|
+
* key after the previous one. Good enough to point a reader at the line; undefined when not found.
|
|
48
|
+
*/
|
|
49
|
+
export function locate(source: string, path: readonly (string | number)[]): SourcePosition | undefined {
|
|
50
|
+
let offset = 0;
|
|
51
|
+
let found = false;
|
|
52
|
+
for (const key of path) {
|
|
53
|
+
if (typeof key === 'number') {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
57
|
+
const pattern = new RegExp(`(^|[\\s{,])(['"\`]?)${escaped}\\2\\s*:`, 'mg');
|
|
58
|
+
pattern.lastIndex = offset;
|
|
59
|
+
const match = pattern.exec(source);
|
|
60
|
+
if (!match) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
offset = match.index + match[1].length;
|
|
64
|
+
found = true;
|
|
65
|
+
}
|
|
66
|
+
return found ? position(source, offset) : undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
A [Cell](https://github.com/cellbang/cell) backend.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install
|
|
7
|
+
npx cell dev # http://127.0.0.1:3000, reloads on save
|
|
8
|
+
bun test # tests with createTestApp()
|
|
9
|
+
npx cell check # types, configuration and DI bindings
|
|
10
|
+
npx cell build # .cell/output; npx cell preview runs it
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Coding agents: see AGENTS.md; `npx cell mcp` is configured in .mcp.json.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "cell dev",
|
|
7
|
+
"build": "cell build",
|
|
8
|
+
"preview": "cell preview",
|
|
9
|
+
"check": "cell check",
|
|
10
|
+
"test": "bun test ./test"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@celljs/core": "^{{cellVersion}}",
|
|
14
|
+
"@celljs/express-adapter": "^{{cellVersion}}",
|
|
15
|
+
"@celljs/mvc": "^{{cellVersion}}"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@celljs/cli": "^{{cellVersion}}",
|
|
19
|
+
"@types/bun": "^1.3.0",
|
|
20
|
+
"@types/node": "^22.0.0",
|
|
21
|
+
"typescript": "^7.0.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { Value } from '@celljs/core';
|
|
1
2
|
import { Controller, Get, Text } from '@celljs/mvc/lib/node';
|
|
2
3
|
|
|
3
4
|
@Controller()
|
|
4
5
|
export class HomeController {
|
|
5
|
-
|
|
6
|
+
@Value('cell.greeting')
|
|
7
|
+
protected readonly greeting: string;
|
|
8
|
+
|
|
6
9
|
@Get()
|
|
7
10
|
@Text()
|
|
8
11
|
home(): string {
|
|
9
|
-
return
|
|
12
|
+
return this.greeting;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, it } from 'bun:test';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { createTestApp, type TestApp } from '@celljs/cli';
|
|
4
|
+
|
|
5
|
+
describe('{{name}}', () => {
|
|
6
|
+
let app: TestApp;
|
|
7
|
+
|
|
8
|
+
beforeAll(async () => {
|
|
9
|
+
app = await createTestApp({ root: join(__dirname, '..') });
|
|
10
|
+
}, 60000);
|
|
11
|
+
|
|
12
|
+
afterAll(() => app?.close());
|
|
13
|
+
|
|
14
|
+
it('GET /', async () => {
|
|
15
|
+
const res = await app.fetch('/');
|
|
16
|
+
expect(res.status).toBe(200);
|
|
17
|
+
expect(await res.text()).toBe('Hello from {{name}}');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"moduleResolution": "nodenext",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2022"
|
|
8
|
+
],
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"emitDecoratorMetadata": true,
|
|
11
|
+
"strict": false,
|
|
12
|
+
"strictNullChecks": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"types": [
|
|
17
|
+
"node",
|
|
18
|
+
"bun"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"include": [
|
|
22
|
+
"src",
|
|
23
|
+
"test"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
A [Cell](https://github.com/cellbang/cell) application: React frontend and backend on one port, calling the backend over RPC.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install
|
|
7
|
+
npx cell dev # http://127.0.0.1:3000, reloads on save
|
|
8
|
+
bun test # tests with createTestApp()
|
|
9
|
+
npx cell check # types, configuration and DI bindings
|
|
10
|
+
npx cell build # .cell/output; npx cell preview runs it
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Coding agents: see AGENTS.md; `npx cell mcp` is configured in .mcp.json.
|