create-avalon 0.1.6 → 0.1.8
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/cli.js +28 -28
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -78,7 +78,7 @@ var require_src = __commonJS((exports, module) => {
|
|
|
78
78
|
// src/cli.ts
|
|
79
79
|
import { parseArgs } from "node:util";
|
|
80
80
|
import { existsSync, readdirSync } from "node:fs";
|
|
81
|
-
import { resolve } from "node:path";
|
|
81
|
+
import { basename, resolve } from "node:path";
|
|
82
82
|
import { createRequire } from "node:module";
|
|
83
83
|
|
|
84
84
|
// ../../node_modules/.bun/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
|
|
@@ -1082,7 +1082,7 @@ async function collectProjectConfig(initialName) {
|
|
|
1082
1082
|
const nameResult = await Zt({
|
|
1083
1083
|
message: "What is your project name?",
|
|
1084
1084
|
placeholder: "my-avalon-app",
|
|
1085
|
-
validate(value) {
|
|
1085
|
+
validate(value = "") {
|
|
1086
1086
|
if (!value.trim())
|
|
1087
1087
|
return "Project name is required.";
|
|
1088
1088
|
}
|
|
@@ -1094,8 +1094,9 @@ async function collectProjectConfig(initialName) {
|
|
|
1094
1094
|
projectName = nameResult;
|
|
1095
1095
|
}
|
|
1096
1096
|
const integrationsResult = await Lt2({
|
|
1097
|
-
message: "Which
|
|
1097
|
+
message: "Which integrations would you like to include? (use space to toggle, enter to confirm)",
|
|
1098
1098
|
options: [
|
|
1099
|
+
{ value: "preact", label: "preact", hint: "Preact 10" },
|
|
1099
1100
|
{ value: "react", label: "react", hint: "React 19" },
|
|
1100
1101
|
{ value: "vue", label: "vue", hint: "Vue 3" },
|
|
1101
1102
|
{ value: "svelte", label: "svelte", hint: "Svelte 5" },
|
|
@@ -1158,8 +1159,8 @@ import { mkdir, writeFile } from "node:fs/promises";
|
|
|
1158
1159
|
import { join } from "node:path";
|
|
1159
1160
|
|
|
1160
1161
|
// src/types.ts
|
|
1161
|
-
var DEFAULT_INTEGRATION_PACKAGE = "@useavalon/preact";
|
|
1162
1162
|
var INTEGRATION_PACKAGES = {
|
|
1163
|
+
preact: "@useavalon/preact",
|
|
1163
1164
|
react: "@useavalon/react",
|
|
1164
1165
|
vue: "@useavalon/vue",
|
|
1165
1166
|
svelte: "@useavalon/svelte",
|
|
@@ -1183,8 +1184,7 @@ var BASE_DIRS = [
|
|
|
1183
1184
|
// src/templates/package-json.ts
|
|
1184
1185
|
function generatePackageJson(config) {
|
|
1185
1186
|
const dependencies = {
|
|
1186
|
-
"@useavalon/avalon": "latest"
|
|
1187
|
-
[DEFAULT_INTEGRATION_PACKAGE]: "latest"
|
|
1187
|
+
"@useavalon/avalon": "latest"
|
|
1188
1188
|
};
|
|
1189
1189
|
for (const integration of config.integrations) {
|
|
1190
1190
|
dependencies[INTEGRATION_PACKAGES[integration]] = "latest";
|
|
@@ -1242,19 +1242,14 @@ function generateTsConfig() {
|
|
|
1242
1242
|
strict: true,
|
|
1243
1243
|
esModuleInterop: true,
|
|
1244
1244
|
skipLibCheck: true,
|
|
1245
|
+
allowArbitraryExtensions: true,
|
|
1245
1246
|
jsx: "react-jsx",
|
|
1246
1247
|
paths: {
|
|
1247
1248
|
"@shared/*": ["./app/shared/*"],
|
|
1248
1249
|
"@modules/*": ["./app/modules/*"]
|
|
1249
1250
|
}
|
|
1250
1251
|
},
|
|
1251
|
-
include: [
|
|
1252
|
-
"app/**/*.ts",
|
|
1253
|
-
"app/**/*.tsx",
|
|
1254
|
-
"server/**/*.ts",
|
|
1255
|
-
"routes/**/*.ts",
|
|
1256
|
-
"middleware/**/*.ts"
|
|
1257
|
-
]
|
|
1252
|
+
include: ["app/**/*.ts", "app/**/*.tsx", "server/**/*.ts", "routes/**/*.ts", "middleware/**/*.ts"]
|
|
1258
1253
|
};
|
|
1259
1254
|
return JSON.stringify(tsconfig, null, 2);
|
|
1260
1255
|
}
|
|
@@ -1273,8 +1268,7 @@ function generateViteConfig(config) {
|
|
|
1273
1268
|
if (hasAgentOptimization) {
|
|
1274
1269
|
imports.push(`import { agentOptimization } from '@useavalon/agent-optimization';`);
|
|
1275
1270
|
}
|
|
1276
|
-
const
|
|
1277
|
-
const integrationsList = allIntegrations.map((i) => `'${i}'`).join(", ");
|
|
1271
|
+
const integrationsList = config.integrations.map((i) => `'${i}'`).join(", ");
|
|
1278
1272
|
const pluginEntries = [];
|
|
1279
1273
|
if (hasAgentOptimization) {
|
|
1280
1274
|
pluginEntries.push(` agentOptimization({
|
|
@@ -1701,11 +1695,11 @@ var STYLING_LABELS = {
|
|
|
1701
1695
|
tailwind: "Tailwind CSS",
|
|
1702
1696
|
shadcn: "shadcn"
|
|
1703
1697
|
};
|
|
1704
|
-
function formatSummary(config) {
|
|
1705
|
-
const
|
|
1706
|
-
const integrations = allIntegrations.join(", ");
|
|
1698
|
+
function formatSummary(config, scaffoldedInPlace = false) {
|
|
1699
|
+
const integrations = config.integrations.length > 0 ? config.integrations.join(", ") : "none";
|
|
1707
1700
|
const styling = STYLING_LABELS[config.styling] ?? config.styling;
|
|
1708
1701
|
const plugins = config.plugins.length > 0 ? config.plugins.join(", ") : "none";
|
|
1702
|
+
const nextSteps = scaffoldedInPlace ? [" bun install", " bun run dev"] : [` cd ${config.projectName}`, " bun install", " bun run dev"];
|
|
1709
1703
|
return [
|
|
1710
1704
|
"",
|
|
1711
1705
|
` Project: ${config.projectName}`,
|
|
@@ -1715,15 +1709,13 @@ function formatSummary(config) {
|
|
|
1715
1709
|
` Middleware: ${config.middleware}`,
|
|
1716
1710
|
"",
|
|
1717
1711
|
" Next steps:",
|
|
1718
|
-
|
|
1719
|
-
" bun install",
|
|
1720
|
-
" bun run dev",
|
|
1712
|
+
...nextSteps,
|
|
1721
1713
|
""
|
|
1722
1714
|
].join(`
|
|
1723
1715
|
`);
|
|
1724
1716
|
}
|
|
1725
|
-
function printSummary(config) {
|
|
1726
|
-
console.log(formatSummary(config));
|
|
1717
|
+
function printSummary(config, scaffoldedInPlace = false) {
|
|
1718
|
+
console.log(formatSummary(config, scaffoldedInPlace));
|
|
1727
1719
|
}
|
|
1728
1720
|
|
|
1729
1721
|
// src/cli.ts
|
|
@@ -1772,7 +1764,7 @@ Options:
|
|
|
1772
1764
|
-h, --help Show help`);
|
|
1773
1765
|
process.exit(0);
|
|
1774
1766
|
}
|
|
1775
|
-
if (args.projectName) {
|
|
1767
|
+
if (args.projectName && args.projectName !== ".") {
|
|
1776
1768
|
const dirResult = validateDirectory(resolve(args.projectName));
|
|
1777
1769
|
if (!dirResult.valid) {
|
|
1778
1770
|
console.error(dirResult.error);
|
|
@@ -1780,18 +1772,26 @@ Options:
|
|
|
1780
1772
|
}
|
|
1781
1773
|
}
|
|
1782
1774
|
const config = await collectProjectConfig(args.projectName);
|
|
1783
|
-
if (!args.projectName) {
|
|
1775
|
+
if (!args.projectName && config.projectName !== ".") {
|
|
1784
1776
|
const dirResult = validateDirectory(resolve(config.projectName));
|
|
1785
1777
|
if (!dirResult.valid) {
|
|
1786
1778
|
console.error(dirResult.error);
|
|
1787
1779
|
process.exit(1);
|
|
1788
1780
|
}
|
|
1789
1781
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1782
|
+
const targetDir = resolve(config.projectName);
|
|
1783
|
+
const scaffoldedInPlace = config.projectName === ".";
|
|
1784
|
+
if (scaffoldedInPlace) {
|
|
1785
|
+
config.projectName = basename(targetDir);
|
|
1786
|
+
}
|
|
1787
|
+
await scaffoldProject(config, targetDir);
|
|
1788
|
+
printSummary(config, scaffoldedInPlace);
|
|
1792
1789
|
process.exit(0);
|
|
1793
1790
|
}
|
|
1794
|
-
|
|
1791
|
+
var entryPath = new URL(import.meta.url).pathname;
|
|
1792
|
+
if (process.argv[1] && entryPath === process.argv[1]) {
|
|
1793
|
+
main();
|
|
1794
|
+
}
|
|
1795
1795
|
export {
|
|
1796
1796
|
validateDirectory,
|
|
1797
1797
|
parseCliArgs,
|