create-avalon 0.1.7 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +26 -21
  2. 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 additional integrations would you like to include? (use space to toggle, enter to confirm)",
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";
@@ -1268,8 +1268,7 @@ function generateViteConfig(config) {
1268
1268
  if (hasAgentOptimization) {
1269
1269
  imports.push(`import { agentOptimization } from '@useavalon/agent-optimization';`);
1270
1270
  }
1271
- const allIntegrations = ["preact", ...config.integrations];
1272
- const integrationsList = allIntegrations.map((i) => `'${i}'`).join(", ");
1271
+ const integrationsList = config.integrations.map((i) => `'${i}'`).join(", ");
1273
1272
  const pluginEntries = [];
1274
1273
  if (hasAgentOptimization) {
1275
1274
  pluginEntries.push(` agentOptimization({
@@ -1696,11 +1695,11 @@ var STYLING_LABELS = {
1696
1695
  tailwind: "Tailwind CSS",
1697
1696
  shadcn: "shadcn"
1698
1697
  };
1699
- function formatSummary(config) {
1700
- const allIntegrations = ["preact", ...config.integrations];
1701
- const integrations = allIntegrations.join(", ");
1698
+ function formatSummary(config, scaffoldedInPlace = false) {
1699
+ const integrations = config.integrations.length > 0 ? config.integrations.join(", ") : "none";
1702
1700
  const styling = STYLING_LABELS[config.styling] ?? config.styling;
1703
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"];
1704
1703
  return [
1705
1704
  "",
1706
1705
  ` Project: ${config.projectName}`,
@@ -1710,15 +1709,13 @@ function formatSummary(config) {
1710
1709
  ` Middleware: ${config.middleware}`,
1711
1710
  "",
1712
1711
  " Next steps:",
1713
- ` cd ${config.projectName}`,
1714
- " bun install",
1715
- " bun run dev",
1712
+ ...nextSteps,
1716
1713
  ""
1717
1714
  ].join(`
1718
1715
  `);
1719
1716
  }
1720
- function printSummary(config) {
1721
- console.log(formatSummary(config));
1717
+ function printSummary(config, scaffoldedInPlace = false) {
1718
+ console.log(formatSummary(config, scaffoldedInPlace));
1722
1719
  }
1723
1720
 
1724
1721
  // src/cli.ts
@@ -1767,7 +1764,7 @@ Options:
1767
1764
  -h, --help Show help`);
1768
1765
  process.exit(0);
1769
1766
  }
1770
- if (args.projectName) {
1767
+ if (args.projectName && args.projectName !== ".") {
1771
1768
  const dirResult = validateDirectory(resolve(args.projectName));
1772
1769
  if (!dirResult.valid) {
1773
1770
  console.error(dirResult.error);
@@ -1775,18 +1772,26 @@ Options:
1775
1772
  }
1776
1773
  }
1777
1774
  const config = await collectProjectConfig(args.projectName);
1778
- if (!args.projectName) {
1775
+ if (!args.projectName && config.projectName !== ".") {
1779
1776
  const dirResult = validateDirectory(resolve(config.projectName));
1780
1777
  if (!dirResult.valid) {
1781
1778
  console.error(dirResult.error);
1782
1779
  process.exit(1);
1783
1780
  }
1784
1781
  }
1785
- await scaffoldProject(config, resolve(config.projectName));
1786
- printSummary(config);
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);
1787
1789
  process.exit(0);
1788
1790
  }
1789
- main();
1791
+ var entryPath = new URL(import.meta.url).pathname;
1792
+ if (process.argv[1] && entryPath === process.argv[1]) {
1793
+ main();
1794
+ }
1790
1795
  export {
1791
1796
  validateDirectory,
1792
1797
  parseCliArgs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-avalon",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Scaffold a new Avalon project with multi-framework islands architecture",
5
5
  "license": "MIT",
6
6
  "type": "module",