@jay-framework/jay-stack-cli 0.6.9 → 0.6.10

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.
Files changed (3) hide show
  1. package/README.md +57 -12
  2. package/dist/index.js +15 -2
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -32,6 +32,7 @@ The CLI uses a `.jay` configuration file (YAML format) to customize port ranges
32
32
  devServer:
33
33
  portRange: [3000, 3100]
34
34
  pagesBase: './src/pages' # Directory containing your Jay pages
35
+ componentsBase: './src/components' # Directory containing your Jay components
35
36
  publicFolder: './public' # Directory for static files (CSS, JS, images, etc.)
36
37
  editorServer:
37
38
  portRange: [3101, 3200]
@@ -42,6 +43,7 @@ If no `.jay` file is found, the CLI will use default values:
42
43
 
43
44
  - **Dev Server Port Range**: `3000-3100`
44
45
  - **Pages Directory**: `./src/pages`
46
+ - **Components Directory**: `./src/components`
45
47
  - **Public Folder**: `./public`
46
48
  - **Editor Server Port Range**: `3101-3200`
47
49
 
@@ -54,6 +56,7 @@ The CLI automatically finds available ports within these ranges using the `get-p
54
56
  The CLI uses the following default configuration:
55
57
 
56
58
  - **Pages Directory**: `./src/pages` - All Jay pages should be placed in this directory
59
+ - **Components Directory**: `./src/components` - All Jay components should be placed in this directory
57
60
  - **Public Folder**: `./public` - Static files (CSS, JS, images) are served from this directory
58
61
  - **TypeScript Config**: `./tsconfig.json` - Uses the project's TypeScript configuration
59
62
  - **Output Directory**: `build/@jay-framework/runtime` - Compiled Jay runtime files
@@ -68,18 +71,25 @@ Your project should have the following structure:
68
71
  ```
69
72
  your-project/
70
73
  ├── src/
71
- └── pages/ # Your Jay pages go here
72
- ├── page.jay-html # homepage
73
- ├── page.ts # optional logic for the page
74
- └── page2/
75
- ├── page.jay-html # a page with the url /page2
76
- └── page.ts # optional logic for page2
77
- └── segment/
78
- ├── page.jay-html # the root page for the url subdirectory /segment
79
- ├── page.ts # optional logic for the segment root page
80
- └── [slug]/ # parameterized segment
81
- ├── page.jay-html # a page with url parameters
82
- ├── page.ts # optional logic for the segment parameterized page
74
+ ├── pages/ # Your Jay pages go here
75
+ ├── page.jay-html # homepage
76
+ ├── page.jay-contract # optional contract for homepage (headless pages)
77
+ │ ├── page.ts # optional logic for the page
78
+ │ └── page2/
79
+ │ ├── page.jay-html # a page with the url /page2
80
+ ├── page.jay-contract # optional contract for page2
81
+ │ └── page.ts # optional logic for page2
82
+ │ └── segment/
83
+ │ ├── page.jay-html # the root page for the url subdirectory /segment
84
+ ├── page.ts # optional logic for the segment root page
85
+ │ └── [slug]/ # parameterized segment
86
+ │ │ ├── page.jay-html # a page with url parameters
87
+ │ │ ├── page.ts # optional logic for the segment parameterized page
88
+ │ └── components/ # Your Jay components go here
89
+ │ ├── Button.jay-html # reusable button component
90
+ │ ├── Button.jay-contract # optional contract for headless components
91
+ │ ├── Button.ts # optional logic for the button
92
+ │ └── Counter.jay-html # another component
83
93
  ├── public/ # Static files (CSS, JS, images, etc.)
84
94
  │ ├── styles.css
85
95
  │ ├── script.js
@@ -88,6 +98,41 @@ your-project/
88
98
  └── package.json
89
99
  ```
90
100
 
101
+ ## Editor Integration & Contract Publishing
102
+
103
+ The Jay Stack CLI supports publishing both pages and components through editor integrations. This includes support for **jay-contract files** which enable headless component functionality:
104
+
105
+ ### Contract Files
106
+
107
+ Contract files (`.jay-contract`) define the interface for headless components:
108
+
109
+ - **Data Structure**: Defines what data the component expects
110
+ - **Refs Interface**: Specifies interactive elements and their types
111
+ - **Component Name**: Identifies the component for imports
112
+
113
+ ### Publishing Support
114
+
115
+ When using design tools or editor integrations, you can publish:
116
+
117
+ 1. **Pages**: `page.jay-html` + optional `page.jay-contract`
118
+ 2. **Components**: `{name}.jay-html` + optional `{name}.jay-contract`
119
+
120
+ Contract files are automatically placed alongside their corresponding jay-html files and can be referenced in headless imports:
121
+
122
+ ```html
123
+ <script
124
+ type="application/jay-headless"
125
+ contract="./Button.jay-contract"
126
+ src="./Button"
127
+ name="button"
128
+ key="button"
129
+ ></script>
130
+ ```
131
+
132
+ ### Backward Compatibility
133
+
134
+ Contract publishing is completely optional and maintains full backward compatibility with existing Jay Stack projects.
135
+
91
136
  ## Development
92
137
 
93
138
  The CLI is built using:
package/dist/index.js CHANGED
@@ -15934,6 +15934,12 @@ async function handlePagePublish(resolvedConfig2, page) {
15934
15934
  const fullPath = path.join(dirname, PAGE_FILENAME);
15935
15935
  await fs.promises.mkdir(dirname, { recursive: true });
15936
15936
  await fs.promises.writeFile(fullPath, page.jayHtml, "utf-8");
15937
+ let contractPath;
15938
+ if (page.contract) {
15939
+ contractPath = path.join(dirname, `page${JAY_CONTRACT_EXTENSION}`);
15940
+ await fs.promises.writeFile(contractPath, page.contract, "utf-8");
15941
+ console.log(`📄 Published page contract: ${contractPath}`);
15942
+ }
15937
15943
  const createdJayHtml = {
15938
15944
  jayHtml: page.jayHtml,
15939
15945
  filename: PAGE_FILENAME,
@@ -15944,7 +15950,8 @@ async function handlePagePublish(resolvedConfig2, page) {
15944
15950
  return [
15945
15951
  {
15946
15952
  success: true,
15947
- filePath: fullPath
15953
+ filePath: fullPath,
15954
+ contractPath
15948
15955
  },
15949
15956
  createdJayHtml
15950
15957
  ];
@@ -15966,6 +15973,11 @@ async function handleComponentPublish(resolvedConfig2, component) {
15966
15973
  const fullPath = path.join(dirname, filename);
15967
15974
  await fs.promises.mkdir(dirname, { recursive: true });
15968
15975
  await fs.promises.writeFile(fullPath, component.jayHtml, "utf-8");
15976
+ let contractPath;
15977
+ if (component.contract) {
15978
+ contractPath = path.join(dirname, `${component.name}${JAY_CONTRACT_EXTENSION}`);
15979
+ await fs.promises.writeFile(contractPath, component.contract, "utf-8");
15980
+ }
15969
15981
  const createdJayHtml = {
15970
15982
  jayHtml: component.jayHtml,
15971
15983
  filename,
@@ -15976,7 +15988,8 @@ async function handleComponentPublish(resolvedConfig2, component) {
15976
15988
  return [
15977
15989
  {
15978
15990
  success: true,
15979
- filePath: fullPath
15991
+ filePath: fullPath,
15992
+ contractPath
15980
15993
  },
15981
15994
  createdJayHtml
15982
15995
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/jay-stack-cli",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,13 +23,13 @@
23
23
  "test:watch": "vitest"
24
24
  },
25
25
  "dependencies": {
26
- "@jay-framework/dev-server": "^0.6.9",
27
- "@jay-framework/editor-server": "^0.6.9",
26
+ "@jay-framework/dev-server": "^0.6.10",
27
+ "@jay-framework/editor-server": "^0.6.10",
28
28
  "express": "^5.0.1",
29
29
  "vite": "^5.0.11"
30
30
  },
31
31
  "devDependencies": {
32
- "@jay-framework/dev-environment": "^0.6.9",
32
+ "@jay-framework/dev-environment": "^0.6.10",
33
33
  "@types/express": "^5.0.2",
34
34
  "@types/node": "^22.15.21",
35
35
  "nodemon": "^3.0.3",