@docyrus/cli 0.2.0 → 0.3.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/README.md CHANGED
@@ -109,7 +109,7 @@ npx @docyrus/cli create my-app --nextjs --shadcn --zustand --eslint --pnpm # Fu
109
109
  | `--local` | Use local templates (development only) |
110
110
 
111
111
  Each template includes:
112
- - Pre-configured OAuth2 authentication via `@docyrus/app-auth-ui`
112
+ - Pre-configured OAuth2 authentication via `@docyrus/signin`
113
113
  - Docyrus API client integration
114
114
  - Modern TypeScript setup
115
115
  - Linter configuration (ESLint or Biome)
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import { homedir, arch, release, platform, hostname, userInfo } from 'os';
11
11
  import Conf from 'conf';
12
12
  import chalk4 from 'chalk';
13
13
  import ora from 'ora';
14
- import { select, input, password } from '@inquirer/prompts';
14
+ import { select, input, password, confirm } from '@inquirer/prompts';
15
15
  import { exec } from 'child_process';
16
16
  import { promisify } from 'util';
17
17
  import { access, constants, writeFile, readFile, mkdir, cp, rm, readdir } from 'fs/promises';
@@ -19,7 +19,7 @@ import { downloadTemplate } from 'giget';
19
19
  import { generateFromOpenAPI } from '@docyrus/tanstack-db-generator';
20
20
 
21
21
  // src/config/constants.ts
22
- var DOCYRUS_API_URL = "https://alpha-api.docyrus.com";
22
+ var DOCYRUS_API_URL = "https://api.docyrus.com";
23
23
  var OAUTH_CLIENT_ID = "90565525-8283-4881-82a9-8613eb82ae27";
24
24
  var OAUTH_SCOPES = "offline_access Read.All Users.Read Users.Read.All DS.Read.All".split(" ");
25
25
  var OAUTH_CALLBACK_PORT_MIN = 9876;
@@ -991,6 +991,11 @@ var MESSAGES = {
991
991
  CREATE_DOWNLOAD_OPENAPI: "Download OpenAPI spec for code generation?",
992
992
  CREATE_DOWNLOADING_OPENAPI: "Downloading OpenAPI specification...",
993
993
  CREATE_OPENAPI_SUCCESS: (path) => `OpenAPI spec saved to ${path}`,
994
+ // TanStack DB Generator
995
+ TANSTACK_GENERATOR_PROMPT: "Generate TanStack Query collections from OpenAPI spec?",
996
+ TANSTACK_GENERATOR_RUNNING: "Generating TanStack Query collections...",
997
+ TANSTACK_GENERATOR_SUCCESS: "TanStack Query collections generated",
998
+ TANSTACK_GENERATOR_FAILED: "Failed to generate TanStack Query collections",
994
999
  // Linter Setup
995
1000
  LINTER_SETUP_TITLE: "Setting up Linter...",
996
1001
  // State Management
@@ -1454,15 +1459,7 @@ async function applyUIVariants(targetDir, uiLibrary) {
1454
1459
  await rm(variantsDir, { recursive: true, force: true });
1455
1460
  }
1456
1461
  var execAsync = promisify(exec);
1457
- function parseEnvArray(value) {
1458
- if (!value) {
1459
- throw new Error("Missing environment variable");
1460
- }
1461
- return value.split(",").map((s) => s.trim());
1462
- }
1463
- var SHADCN_BASE_COLORS = parseEnvArray("zinc,slate,neutral,stone,gray");
1464
- parseEnvArray("vega,nova,maia,lyra,mira");
1465
- var DICEUI_COMPONENTS = parseEnvArray("action-bar,avatar-group,badge-overflow,checkbox-group,circular-progress,color-picker,color-swatch,combobox,compare-slider,cropper,editable,file-upload,gauge,kanban,key-value,listbox,mask-input,media-player,mention,phone-input,qr-code,rating,relative-time-card,responsive-dialog,scroll-spy,scroller,segmented-input,sortable,speed-dial,stack,stat,status,stepper,swap,tags-input,time-picker,timeline,tour");
1462
+ var DICEUI_COMPONENTS = "action-bar,avatar-group,badge-overflow,checkbox-group,circular-progress,color-picker,color-swatch,combobox,compare-slider,cropper,editable,file-upload,gauge,kanban,key-value,listbox,mask-input,media-player,mention,phone-input,qr-code,rating,relative-time-card,responsive-dialog,scroll-spy,scroller,segmented-input,sortable,speed-dial,stack,stat,status,stepper,swap,tags-input,time-picker,timeline,tour".split(",");
1466
1463
  var UI_LIBRARY_COMPATIBILITY = {
1467
1464
  nextjs: [
1468
1465
  "shadcn",
@@ -1904,6 +1901,7 @@ import { vueQueryOptions } from './lib/query-client';
1904
1901
 
1905
1902
  // src/commands/create.ts
1906
1903
  var execAsync2 = promisify(exec);
1904
+ var SHADCN_BASE_COLORS = "zinc,slate,neutral,stone,gray".split(",");
1907
1905
  function validateConflictingFlags(options) {
1908
1906
  const frameworkFlags = [
1909
1907
  options.nextjs,
@@ -2033,8 +2031,8 @@ function getUiLibrariesForFramework(framework) {
2033
2031
  }
2034
2032
  }
2035
2033
  var STATE_MGMT_REACT = [
2036
- { name: "zustand", label: "Zustand (Recommended)", description: "Lightweight client state" },
2037
- { name: "tanstack-query", label: "TanStack Query", description: "Server state & data fetching" },
2034
+ { name: "tanstack-query", label: "TanStack Query (Recommended)", description: "Server state & data fetching" },
2035
+ { name: "zustand", label: "Zustand", description: "Lightweight client state" },
2038
2036
  { name: "none", label: "None", description: "No state management" }
2039
2037
  ];
2040
2038
  var STATE_MGMT_VUE = [{ name: "tanstack-vue-query", label: "TanStack Vue Query (Recommended)", description: "Server state & data fetching" }, { name: "none", label: "None", description: "No state management" }];
@@ -2071,7 +2069,7 @@ var PACKAGE_MANAGERS = [
2071
2069
  { name: "yarn", label: "yarn", description: "Fast, reliable, and secure" },
2072
2070
  { name: "bun", label: "bun", description: "All-in-one JavaScript runtime" }
2073
2071
  ];
2074
- var TEMPLATE_REPO_BASE = "Docyrus/docyrus-devkit/packages/cli-templates";
2072
+ var TEMPLATE_REPO_BASE = "Docyrus/docyrus-devkit/templates";
2075
2073
  function getTemplateRepo(framework) {
2076
2074
  return `${TEMPLATE_REPO_BASE}/${framework}`;
2077
2075
  }
@@ -2158,12 +2156,11 @@ Examples:
2158
2156
  }))
2159
2157
  });
2160
2158
  } else {
2161
- const validColors = SHADCN_BASE_COLORS;
2162
2159
  if (options?.baseColor) {
2163
- if (!validColors.includes(options.baseColor)) {
2164
- throw new ConflictingFlagsError("--base-color", `must be one of: ${validColors.join(", ")}`);
2160
+ if (!SHADCN_BASE_COLORS.includes(options.baseColor)) {
2161
+ throw new ConflictingFlagsError("--base-color", `must be one of: ${SHADCN_BASE_COLORS.join(", ")}`);
2165
2162
  }
2166
- baseColor = options.baseColor;
2163
+ ({ baseColor } = options);
2167
2164
  }
2168
2165
  }
2169
2166
  }
@@ -2258,7 +2255,7 @@ Examples:
2258
2255
  MESSAGES.CREATE_COPYING_LOCAL,
2259
2256
  async () => {
2260
2257
  const cliPackageDir = dirname(dirname(fileURLToPath(import.meta.url)));
2261
- const localTemplateDir = resolve(cliPackageDir, "..", "cli-templates", framework);
2258
+ const localTemplateDir = resolve(cliPackageDir, "..", "..", "templates", framework);
2262
2259
  try {
2263
2260
  await access(localTemplateDir, constants.F_OK);
2264
2261
  } catch {
@@ -2419,6 +2416,7 @@ ${errorMessage}`
2419
2416
  );
2420
2417
  logger.newline();
2421
2418
  logger.log(MESSAGES.OPENAPI_SETUP_TITLE);
2419
+ let openApiDownloaded = false;
2422
2420
  try {
2423
2421
  const savedPath = await withSpinner(
2424
2422
  "Downloading OpenAPI spec...",
@@ -2426,9 +2424,28 @@ ${errorMessage}`
2426
2424
  { successText: "OpenAPI spec downloaded" }
2427
2425
  );
2428
2426
  logger.dim(MESSAGES.CREATE_OPENAPI_SUCCESS(savedPath));
2427
+ openApiDownloaded = true;
2429
2428
  } catch (error) {
2430
2429
  logger.warn(`Failed to download OpenAPI spec: ${error instanceof Error ? error.message : "Unknown error"}`);
2431
2430
  }
2431
+ if (openApiDownloaded) {
2432
+ try {
2433
+ logger.newline();
2434
+ const runGenerator = await confirm({
2435
+ message: MESSAGES.TANSTACK_GENERATOR_PROMPT,
2436
+ default: true
2437
+ });
2438
+ if (runGenerator) {
2439
+ await withSpinner(
2440
+ MESSAGES.TANSTACK_GENERATOR_RUNNING,
2441
+ async () => execAsync2("npx @docyrus/tanstack-db-generator openapi-spec.json", { cwd: targetDir }),
2442
+ { successText: MESSAGES.TANSTACK_GENERATOR_SUCCESS }
2443
+ );
2444
+ }
2445
+ } catch (genError) {
2446
+ logger.warn(`${MESSAGES.TANSTACK_GENERATOR_FAILED}: ${genError instanceof Error ? genError.message : "Unknown error"}`);
2447
+ }
2448
+ }
2432
2449
  logger.newline();
2433
2450
  logger.success(MESSAGES.CREATE_SUCCESS);
2434
2451
  logger.newline();