@jay-framework/jay-stack-cli 0.5.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 ADDED
@@ -0,0 +1,96 @@
1
+ # Jay Stack CLI
2
+
3
+ A command-line interface for running Jay stack applications in development mode.
4
+
5
+ ## Overview
6
+
7
+ The Jay Stack CLI provides a simple way to start a development server for Jay applications. It automatically configures and runs the Jay development server with sensible defaults, making it easy to get started with Jay stack development.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @jay-framework/stack-cli
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### Basic Usage
18
+
19
+ Simply run the CLI from your project root:
20
+
21
+ ```bash
22
+ @jay-framework/@jay-framework/jay-cli
23
+ ```
24
+
25
+ This will start the development server with default configuration.
26
+
27
+ ### Environment Variables
28
+
29
+ The CLI supports the following environment variables:
30
+
31
+ - `PORT` - The port to run the server on (default: `5173`)
32
+ - `BASE` - The base path for the server (default: `/`)
33
+
34
+ Example:
35
+
36
+ ```bash
37
+ PORT=3000 BASE=/app @jay-framework/@jay-framework/jay-cli
38
+ ```
39
+
40
+ ## Default Configuration
41
+
42
+ The CLI uses the following default configuration:
43
+
44
+ - **Pages Directory**: `./src/pages` - All Jay pages should be placed in this directory
45
+ - **TypeScript Config**: `./tsconfig.json` - Uses the project's TypeScript configuration
46
+ - **Output Directory**: `build/@jay-framework/runtime` - Compiled Jay runtime files
47
+ - **Server Port**: `5173` (or `PORT` environment variable)
48
+ - **Base Path**: `/` (or `BASE` environment variable)
49
+
50
+ ## Project Structure
51
+
52
+ Your project should have the following structure:
53
+
54
+ ```
55
+ your-project/
56
+ ├── src/
57
+ │ └── pages/ # Your Jay pages go here
58
+ │ ├── page.jay-html # homepage
59
+ │ ├── page.ts # optional logic for the page
60
+ │ └── page2/
61
+ │ ├── page.jay-html # a page with the url /page2
62
+ │ └── page.ts # optional logic for page2
63
+ │ └── segment/
64
+ │ ├── page.jay-html # the root page for the url subdirectory /segment
65
+ │ ├── page.ts # optional logic for the segment root page
66
+ │ └── [slug]/ # parameterized segment
67
+ │ ├── page.jay-html # a page with url parameters
68
+ │ ├── page.ts # optional logic for the segment parameterized page
69
+ ├── tsconfig.json # TypeScript configuration
70
+ └── package.json
71
+ ```
72
+
73
+ ## Development
74
+
75
+ The CLI is built using:
76
+
77
+ - **Express.js** - HTTP server
78
+ - **Jay Dev Server** - Core development server functionality
79
+ - **Vite** - Build tool integration
80
+
81
+ ## Future Enhancements
82
+
83
+ **Note**: The CLI currently does not accept command-line parameters. This will change in future versions to support:
84
+
85
+ - Custom pages directory path
86
+ - Custom TypeScript configuration file
87
+ - Custom output directory
88
+ - Additional server configuration options
89
+ - Development vs production modes
90
+
91
+ ## Related Packages
92
+
93
+ - `@jay-framework/dev-server` - Core development server functionality
94
+ - `@jay-framework/stack-client-runtime` - Client-side runtime
95
+ - `@jay-framework/stack-server-runtime` - Server-side runtime
96
+ - `@jay-framework/fullstack-component` - Full-stack component system
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ const express = require("express");
4
+ const devServer = require("@jay-framework/dev-server");
5
+ const path = require("path");
6
+ const port = process.env.PORT || 5173;
7
+ const base = process.env.BASE || "/";
8
+ const jayOptions = {
9
+ tsConfigFilePath: "./tsconfig.json",
10
+ outputDir: "build/jay-runtime"
11
+ };
12
+ const app = express();
13
+ async function initApp() {
14
+ const { server, viteServer, routes } = await devServer.mkDevServer({
15
+ pagesBase: path.resolve("./src/pages"),
16
+ serverBase: base,
17
+ dontCacheSlowly: false,
18
+ jayRollupConfig: jayOptions
19
+ });
20
+ app.use(server);
21
+ routes.forEach((route) => {
22
+ app.get(route.path, route.handler);
23
+ });
24
+ app.listen(port, () => {
25
+ console.log(`Server started at http://localhost:${port}`);
26
+ });
27
+ }
28
+ initApp();
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@jay-framework/jay-stack-cli",
3
+ "version": "0.5.0",
4
+ "license": "Apache-2.0",
5
+ "main": "dist/index.js",
6
+ "bin": "dist/index.js",
7
+ "files": [
8
+ "dist",
9
+ "readme.md"
10
+ ],
11
+ "scripts": {
12
+ "build": "npm run build:js && npm run build:types",
13
+ "build:watch": "npm run build:js -- --watch & npm run build:types -- --watch",
14
+ "build:js": "vite build",
15
+ "build:types": "tsup lib/index.ts --dts-only --format esm",
16
+ "build:check-types": "tsc",
17
+ "test-definitions": "jay-cli definitions test",
18
+ "test-runtime": "jay-cli runtime test",
19
+ "clean": "rimraf dist",
20
+ "confirm": "npm run clean && npm run build && npm run build:check-types && npm run test",
21
+ "test": ":",
22
+ "test:watch": ":"
23
+ },
24
+ "dependencies": {
25
+ "@jay-framework/dev-server": "workspace:^",
26
+ "express": "^5.0.1",
27
+ "vite": "^5.0.11"
28
+ },
29
+ "devDependencies": {
30
+ "@jay-framework/dev-environment": "workspace:^",
31
+ "@types/express": "^5.0.2",
32
+ "@types/node": "^22.15.21",
33
+ "nodemon": "^3.0.3",
34
+ "replace-in-file": "^7.1.0",
35
+ "rimraf": "^5.0.5",
36
+ "tsup": "^8.0.1",
37
+ "typescript": "^5.3.3",
38
+ "vitest": "^1.2.1"
39
+ }
40
+ }