create-jay 0.22.2 → 0.23.1

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/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // lib/index.ts
4
- import path2 from "node:path";
5
- import { execSync } from "node:child_process";
4
+ import path2 from "path";
5
+ import { execSync } from "child_process";
6
6
  import chalk from "chalk";
7
7
 
8
8
  // lib/prompts.ts
@@ -42,6 +42,22 @@ var PLUGINS = [
42
42
  checked: true,
43
43
  isDep: false
44
44
  },
45
+ {
46
+ name: "@jay-framework/markdown",
47
+ label: "Markdown",
48
+ description: "Render markdown files as pages \u2014 documentation, blogs, changelogs",
49
+ group: "Jay Framework",
50
+ checked: false,
51
+ isDep: true
52
+ },
53
+ {
54
+ name: "@jay-framework/data-files",
55
+ label: "Data Files",
56
+ description: "CSV/YAML/JSON data sources \u2014 team pages, FAQ, feature lists, changelogs",
57
+ group: "Jay Framework",
58
+ checked: false,
59
+ isDep: true
60
+ },
45
61
  {
46
62
  name: "@jay-framework/wix-stores",
47
63
  label: "Wix Stores",
@@ -84,12 +100,12 @@ var PLUGINS = [
84
100
  }
85
101
  ];
86
102
  var CORE_DEPS = {
87
- "@jay-framework/fullstack-component": "^0.21.0",
88
- "@jay-framework/jay-stack-cli": "^0.21.0"
103
+ "@jay-framework/fullstack-component": "latest",
104
+ "@jay-framework/jay-stack-cli": "latest"
89
105
  };
90
106
  var CORE_DEV_DEPS = {
91
- "@jay-framework/aiditor": "^0.21.0",
92
- "@jay-framework/jay-cli": "^0.21.0",
107
+ "@jay-framework/aiditor": "latest",
108
+ "@jay-framework/jay-cli": "latest",
93
109
  "@types/node": "^22.10.0",
94
110
  rimraf: "^6.0.0",
95
111
  typescript: "~5.7.2",
@@ -99,10 +115,8 @@ var CORE_DEV_DEPS = {
99
115
  // lib/prompts.ts
100
116
  function validateProjectName(value) {
101
117
  const name = value.trim();
102
- if (!name)
103
- return "Project name is required";
104
- if (name.length < 3)
105
- return "Project name must be at least 3 characters";
118
+ if (!name) return "Project name is required";
119
+ if (name.length < 3) return "Project name must be at least 3 characters";
106
120
  if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(name)) {
107
121
  return "Use lowercase letters, numbers, and hyphens \u2014 must start and end with a letter or number (e.g., my-store)";
108
122
  }
@@ -140,14 +154,14 @@ async function runPrompts() {
140
154
  }
141
155
 
142
156
  // lib/scaffold.ts
143
- import fs from "node:fs";
144
- import path from "node:path";
145
- import { fileURLToPath } from "node:url";
157
+ import fs from "fs";
158
+ import path from "path";
159
+ import { fileURLToPath } from "url";
160
+ import { execFile } from "child_process";
146
161
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
147
162
  function templatesDir() {
148
163
  const fromDist = path.join(__dirname, "..", "templates");
149
- if (fs.existsSync(fromDist))
150
- return fromDist;
164
+ if (fs.existsSync(fromDist)) return fromDist;
151
165
  return path.join(__dirname, "templates");
152
166
  }
153
167
  function readTemplate(name) {
@@ -158,23 +172,23 @@ function writeFile(projectDir, relativePath, content) {
158
172
  fs.mkdirSync(path.dirname(fullPath), { recursive: true });
159
173
  fs.writeFileSync(fullPath, content, "utf-8");
160
174
  }
161
- function generatePackageJson(name, selectedPlugins) {
175
+ async function generatePackageJson(name, selectedPlugins) {
162
176
  const deps = { ...CORE_DEPS };
163
177
  for (const plugin of selectedPlugins) {
164
- if (plugin.isDep)
165
- deps[plugin.name] = "latest";
178
+ if (plugin.isDep) deps[plugin.name] = "latest";
166
179
  }
167
180
  const hasWixPlugins = selectedPlugins.some((p) => p.name.startsWith("@jay-framework/wix-"));
168
181
  const hasWixStores = selectedPlugins.some((p) => p.name === "@jay-framework/wix-stores");
169
- if (hasWixPlugins)
170
- deps["@jay-framework/wix-server-client"] = "latest";
171
- if (hasWixStores)
172
- deps["@jay-framework/wix-cart"] = "latest";
182
+ if (hasWixPlugins) deps["@jay-framework/wix-server-client"] = "latest";
183
+ if (hasWixStores) deps["@jay-framework/wix-cart"] = "latest";
173
184
  const devDeps = { ...CORE_DEV_DEPS };
174
185
  for (const plugin of selectedPlugins) {
175
- if (!plugin.isDep)
176
- devDeps[plugin.name] = "latest";
186
+ if (!plugin.isDep) devDeps[plugin.name] = "latest";
177
187
  }
188
+ const [resolvedDeps, resolvedDevDeps] = await Promise.all([
189
+ resolveLatestVersions(deps),
190
+ resolveLatestVersions(devDeps)
191
+ ]);
178
192
  const hasWixDeploy = selectedPlugins.some((p) => p.name === "@jay-framework/wix-deploy");
179
193
  const hasAiditor = true;
180
194
  const pkg = {
@@ -183,7 +197,7 @@ function generatePackageJson(name, selectedPlugins) {
183
197
  type: "module",
184
198
  private: true,
185
199
  scripts: {
186
- setup: "jay-stack-cli setup",
200
+ setup: "jay-stack-cli setup --interactive",
187
201
  dev: "jay-stack-cli dev",
188
202
  "agent-kit": "jay-stack-cli agent-kit",
189
203
  validate: "jay-stack-cli validate",
@@ -201,8 +215,8 @@ function generatePackageJson(name, selectedPlugins) {
201
215
  "aiditor:publish": hasWixDeploy ? "npm run build:production && npm run wix:deploy" : "npm run build:production && echo 'add your deploy command here'"
202
216
  }
203
217
  },
204
- dependencies: sortKeys(deps),
205
- devDependencies: sortKeys(devDeps)
218
+ dependencies: sortKeys(resolvedDeps),
219
+ devDependencies: sortKeys(resolvedDevDeps)
206
220
  };
207
221
  return JSON.stringify(pkg, null, 2) + "\n";
208
222
  }
@@ -213,9 +227,32 @@ function sortKeys(obj) {
213
227
  }
214
228
  return sorted;
215
229
  }
216
- function scaffoldProject(projectDir, name, selectedPlugins) {
230
+ function resolveLatestVersion(pkg) {
231
+ return new Promise((resolve) => {
232
+ execFile("npm", ["view", pkg, "version"], { encoding: "utf-8" }, (err, stdout) => {
233
+ if (err || !stdout.trim()) {
234
+ resolve("latest");
235
+ } else {
236
+ resolve(`^${stdout.trim()}`);
237
+ }
238
+ });
239
+ });
240
+ }
241
+ async function resolveLatestVersions(deps) {
242
+ const entries = Object.entries(deps);
243
+ const resolved = await Promise.all(
244
+ entries.map(async ([name, version]) => {
245
+ if (version === "latest") {
246
+ return [name, await resolveLatestVersion(name)];
247
+ }
248
+ return [name, version];
249
+ })
250
+ );
251
+ return Object.fromEntries(resolved);
252
+ }
253
+ async function scaffoldProject(projectDir, name, selectedPlugins) {
217
254
  fs.mkdirSync(projectDir, { recursive: true });
218
- writeFile(projectDir, "package.json", generatePackageJson(name, selectedPlugins));
255
+ writeFile(projectDir, "package.json", await generatePackageJson(name, selectedPlugins));
219
256
  writeFile(
220
257
  projectDir,
221
258
  "src/pages/page.jay-html",
@@ -251,8 +288,7 @@ function scaffoldProject(projectDir, name, selectedPlugins) {
251
288
  // lib/index.ts
252
289
  function detectPackageManager() {
253
290
  const agent = process.env.npm_config_user_agent || "";
254
- if (agent.startsWith("yarn"))
255
- return "yarn";
291
+ if (agent.startsWith("yarn")) return "yarn";
256
292
  return "npm";
257
293
  }
258
294
  function run(cmd, cwd) {
@@ -298,7 +334,7 @@ async function main() {
298
334
  const projectDir = path2.resolve(process.cwd(), name);
299
335
  console.log("");
300
336
  console.log(`Creating project in ${chalk.cyan(`./${name}`)}...`);
301
- scaffoldProject(projectDir, name, selectedPlugins);
337
+ await scaffoldProject(projectDir, name, selectedPlugins);
302
338
  console.log(chalk.green(" \u2713 Created project structure"));
303
339
  console.log(chalk.dim(" Installing dependencies..."));
304
340
  run(pm === "yarn" ? "yarn install" : "npm install", projectDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-jay",
3
- "version": "0.22.2",
3
+ "version": "0.23.1",
4
4
  "type": "module",
5
5
  "description": "Create a new Jay Stack project",
6
6
  "license": "Apache-2.0",
@@ -12,7 +12,7 @@
12
12
  "isolatedModules": true,
13
13
  "noEmit": true,
14
14
  "outDir": "dist",
15
- "types": [],
15
+ "types": []
16
16
  },
17
- "include": ["src"],
17
+ "include": ["src"]
18
18
  }