create-jay 0.22.2 → 0.23.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/dist/index.js +55 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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": "
|
|
88
|
-
"@jay-framework/jay-stack-cli": "
|
|
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": "
|
|
92
|
-
"@jay-framework/jay-cli": "
|
|
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",
|
|
@@ -143,6 +159,7 @@ async function runPrompts() {
|
|
|
143
159
|
import fs from "node:fs";
|
|
144
160
|
import path from "node:path";
|
|
145
161
|
import { fileURLToPath } from "node:url";
|
|
162
|
+
import { execFile } from "node:child_process";
|
|
146
163
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
147
164
|
function templatesDir() {
|
|
148
165
|
const fromDist = path.join(__dirname, "..", "templates");
|
|
@@ -158,7 +175,7 @@ function writeFile(projectDir, relativePath, content) {
|
|
|
158
175
|
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
159
176
|
fs.writeFileSync(fullPath, content, "utf-8");
|
|
160
177
|
}
|
|
161
|
-
function generatePackageJson(name, selectedPlugins) {
|
|
178
|
+
async function generatePackageJson(name, selectedPlugins) {
|
|
162
179
|
const deps = { ...CORE_DEPS };
|
|
163
180
|
for (const plugin of selectedPlugins) {
|
|
164
181
|
if (plugin.isDep)
|
|
@@ -175,6 +192,10 @@ function generatePackageJson(name, selectedPlugins) {
|
|
|
175
192
|
if (!plugin.isDep)
|
|
176
193
|
devDeps[plugin.name] = "latest";
|
|
177
194
|
}
|
|
195
|
+
const [resolvedDeps, resolvedDevDeps] = await Promise.all([
|
|
196
|
+
resolveLatestVersions(deps),
|
|
197
|
+
resolveLatestVersions(devDeps)
|
|
198
|
+
]);
|
|
178
199
|
const hasWixDeploy = selectedPlugins.some((p) => p.name === "@jay-framework/wix-deploy");
|
|
179
200
|
const hasAiditor = true;
|
|
180
201
|
const pkg = {
|
|
@@ -183,7 +204,7 @@ function generatePackageJson(name, selectedPlugins) {
|
|
|
183
204
|
type: "module",
|
|
184
205
|
private: true,
|
|
185
206
|
scripts: {
|
|
186
|
-
setup: "jay-stack-cli setup",
|
|
207
|
+
setup: "jay-stack-cli setup --interactive",
|
|
187
208
|
dev: "jay-stack-cli dev",
|
|
188
209
|
"agent-kit": "jay-stack-cli agent-kit",
|
|
189
210
|
validate: "jay-stack-cli validate",
|
|
@@ -201,8 +222,8 @@ function generatePackageJson(name, selectedPlugins) {
|
|
|
201
222
|
"aiditor:publish": hasWixDeploy ? "npm run build:production && npm run wix:deploy" : "npm run build:production && echo 'add your deploy command here'"
|
|
202
223
|
}
|
|
203
224
|
},
|
|
204
|
-
dependencies: sortKeys(
|
|
205
|
-
devDependencies: sortKeys(
|
|
225
|
+
dependencies: sortKeys(resolvedDeps),
|
|
226
|
+
devDependencies: sortKeys(resolvedDevDeps)
|
|
206
227
|
};
|
|
207
228
|
return JSON.stringify(pkg, null, 2) + "\n";
|
|
208
229
|
}
|
|
@@ -213,9 +234,32 @@ function sortKeys(obj) {
|
|
|
213
234
|
}
|
|
214
235
|
return sorted;
|
|
215
236
|
}
|
|
216
|
-
function
|
|
237
|
+
function resolveLatestVersion(pkg) {
|
|
238
|
+
return new Promise((resolve) => {
|
|
239
|
+
execFile("npm", ["view", pkg, "version"], { encoding: "utf-8" }, (err, stdout) => {
|
|
240
|
+
if (err || !stdout.trim()) {
|
|
241
|
+
resolve("latest");
|
|
242
|
+
} else {
|
|
243
|
+
resolve(`^${stdout.trim()}`);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
async function resolveLatestVersions(deps) {
|
|
249
|
+
const entries = Object.entries(deps);
|
|
250
|
+
const resolved = await Promise.all(
|
|
251
|
+
entries.map(async ([name, version]) => {
|
|
252
|
+
if (version === "latest") {
|
|
253
|
+
return [name, await resolveLatestVersion(name)];
|
|
254
|
+
}
|
|
255
|
+
return [name, version];
|
|
256
|
+
})
|
|
257
|
+
);
|
|
258
|
+
return Object.fromEntries(resolved);
|
|
259
|
+
}
|
|
260
|
+
async function scaffoldProject(projectDir, name, selectedPlugins) {
|
|
217
261
|
fs.mkdirSync(projectDir, { recursive: true });
|
|
218
|
-
writeFile(projectDir, "package.json", generatePackageJson(name, selectedPlugins));
|
|
262
|
+
writeFile(projectDir, "package.json", await generatePackageJson(name, selectedPlugins));
|
|
219
263
|
writeFile(
|
|
220
264
|
projectDir,
|
|
221
265
|
"src/pages/page.jay-html",
|
|
@@ -298,7 +342,7 @@ async function main() {
|
|
|
298
342
|
const projectDir = path2.resolve(process.cwd(), name);
|
|
299
343
|
console.log("");
|
|
300
344
|
console.log(`Creating project in ${chalk.cyan(`./${name}`)}...`);
|
|
301
|
-
scaffoldProject(projectDir, name, selectedPlugins);
|
|
345
|
+
await scaffoldProject(projectDir, name, selectedPlugins);
|
|
302
346
|
console.log(chalk.green(" \u2713 Created project structure"));
|
|
303
347
|
console.log(chalk.dim(" Installing dependencies..."));
|
|
304
348
|
run(pm === "yarn" ? "yarn install" : "npm install", projectDir);
|