create-jay 0.23.0 → 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 +14 -22
- package/package.json +1 -1
- package/templates/tsconfig.json +2 -2
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 "
|
|
5
|
-
import { execSync } from "
|
|
4
|
+
import path2 from "path";
|
|
5
|
+
import { execSync } from "child_process";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
|
|
8
8
|
// lib/prompts.ts
|
|
@@ -115,10 +115,8 @@ var CORE_DEV_DEPS = {
|
|
|
115
115
|
// lib/prompts.ts
|
|
116
116
|
function validateProjectName(value) {
|
|
117
117
|
const name = value.trim();
|
|
118
|
-
if (!name)
|
|
119
|
-
|
|
120
|
-
if (name.length < 3)
|
|
121
|
-
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";
|
|
122
120
|
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(name)) {
|
|
123
121
|
return "Use lowercase letters, numbers, and hyphens \u2014 must start and end with a letter or number (e.g., my-store)";
|
|
124
122
|
}
|
|
@@ -156,15 +154,14 @@ async function runPrompts() {
|
|
|
156
154
|
}
|
|
157
155
|
|
|
158
156
|
// lib/scaffold.ts
|
|
159
|
-
import fs from "
|
|
160
|
-
import path from "
|
|
161
|
-
import { fileURLToPath } from "
|
|
162
|
-
import { execFile } from "
|
|
157
|
+
import fs from "fs";
|
|
158
|
+
import path from "path";
|
|
159
|
+
import { fileURLToPath } from "url";
|
|
160
|
+
import { execFile } from "child_process";
|
|
163
161
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
164
162
|
function templatesDir() {
|
|
165
163
|
const fromDist = path.join(__dirname, "..", "templates");
|
|
166
|
-
if (fs.existsSync(fromDist))
|
|
167
|
-
return fromDist;
|
|
164
|
+
if (fs.existsSync(fromDist)) return fromDist;
|
|
168
165
|
return path.join(__dirname, "templates");
|
|
169
166
|
}
|
|
170
167
|
function readTemplate(name) {
|
|
@@ -178,19 +175,15 @@ function writeFile(projectDir, relativePath, content) {
|
|
|
178
175
|
async function generatePackageJson(name, selectedPlugins) {
|
|
179
176
|
const deps = { ...CORE_DEPS };
|
|
180
177
|
for (const plugin of selectedPlugins) {
|
|
181
|
-
if (plugin.isDep)
|
|
182
|
-
deps[plugin.name] = "latest";
|
|
178
|
+
if (plugin.isDep) deps[plugin.name] = "latest";
|
|
183
179
|
}
|
|
184
180
|
const hasWixPlugins = selectedPlugins.some((p) => p.name.startsWith("@jay-framework/wix-"));
|
|
185
181
|
const hasWixStores = selectedPlugins.some((p) => p.name === "@jay-framework/wix-stores");
|
|
186
|
-
if (hasWixPlugins)
|
|
187
|
-
|
|
188
|
-
if (hasWixStores)
|
|
189
|
-
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";
|
|
190
184
|
const devDeps = { ...CORE_DEV_DEPS };
|
|
191
185
|
for (const plugin of selectedPlugins) {
|
|
192
|
-
if (!plugin.isDep)
|
|
193
|
-
devDeps[plugin.name] = "latest";
|
|
186
|
+
if (!plugin.isDep) devDeps[plugin.name] = "latest";
|
|
194
187
|
}
|
|
195
188
|
const [resolvedDeps, resolvedDevDeps] = await Promise.all([
|
|
196
189
|
resolveLatestVersions(deps),
|
|
@@ -295,8 +288,7 @@ async function scaffoldProject(projectDir, name, selectedPlugins) {
|
|
|
295
288
|
// lib/index.ts
|
|
296
289
|
function detectPackageManager() {
|
|
297
290
|
const agent = process.env.npm_config_user_agent || "";
|
|
298
|
-
if (agent.startsWith("yarn"))
|
|
299
|
-
return "yarn";
|
|
291
|
+
if (agent.startsWith("yarn")) return "yarn";
|
|
300
292
|
return "npm";
|
|
301
293
|
}
|
|
302
294
|
function run(cmd, cwd) {
|
package/package.json
CHANGED