@stdout-design/cli 0.2.0 → 0.2.2

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
@@ -46,14 +46,14 @@ bun add -g @stdout-design/cli
46
46
 
47
47
  ## Commands
48
48
 
49
- | Command | Description |
50
- |---------|-------------|
51
- | `studio init` | Scaffold a new studio project |
52
- | `studio dev` | Start the live preview studio |
49
+ | Command | Description |
50
+ | -------------------------- | --------------------------------- |
51
+ | `studio init` | Scaffold a new studio project |
52
+ | `studio dev` | Start the live preview studio |
53
53
  | `studio render <template>` | Render a single template or batch |
54
- | `studio cache stats` | Show cache statistics |
55
- | `studio cache clean` | Clear the render cache |
56
- | `studio lint` | Check templates for compatibility |
54
+ | `studio cache stats` | Show cache statistics |
55
+ | `studio cache clean` | Clear the render cache |
56
+ | `studio lint` | Check templates for compatibility |
57
57
 
58
58
  Run commands with `npx @stdout-design/cli <command>`, or install globally with `bun add -g @stdout-design/cli` to use `studio <command>` directly.
59
59
 
@@ -63,18 +63,19 @@ Run commands with `npx @stdout-design/cli <command>`, or install globally with `
63
63
  studio render <template> [options]
64
64
  ```
65
65
 
66
- | Option | Description |
67
- |--------|-------------|
68
- | `--key value` | Pass props to the template |
69
- | `--data file.csv` | Batch render from CSV or JSON |
70
- | `--preset name` | Output preset (default: og) |
71
- | `--locale lang` | Locale for i18n |
72
- | `--out-dir path` | Output directory (default: ./out/) |
73
- | `--out file.png` | Single output file |
66
+ | Option | Description |
67
+ | ----------------- | ---------------------------------- |
68
+ | `--key value` | Pass props to the template |
69
+ | `--data file.csv` | Batch render from CSV or JSON |
70
+ | `--preset name` | Output preset (default: og) |
71
+ | `--locale lang` | Locale for i18n |
72
+ | `--out-dir path` | Output directory (default: ./out/) |
73
+ | `--out file.png` | Single output file |
74
74
 
75
75
  ### studio dev
76
76
 
77
77
  Starts a dev server on `localhost:3000` with:
78
+
78
79
  - Hot-reload when templates change
79
80
  - Auto-generated prop panel
80
81
  - Side-by-side preview across presets
@@ -83,6 +84,7 @@ Starts a dev server on `localhost:3000` with:
83
84
  ### studio init
84
85
 
85
86
  Scaffolds a new studio project with:
87
+
86
88
  - TypeScript configuration
87
89
  - Example templates to get started
88
90
  - Sample data files for batch rendering
@@ -154,15 +156,15 @@ export default {
154
156
 
155
157
  ## Platform presets
156
158
 
157
- | Preset | Size | Use |
158
- |--------|------|-----|
159
- | og | 1200×630 | Open Graph / social cards |
160
- | x-card | 1200×675 | X (Twitter) cards |
161
- | linkedin | 1200×627 | LinkedIn link previews |
162
- | instagram | 1080×1080 | Instagram feed posts |
163
- | instagram-story | 1080×1920 | Instagram stories |
164
- | appstore | 1290×2796 | App Store screenshots |
165
- | playstore | 1080×1920 | Play Store screenshots |
159
+ | Preset | Size | Use |
160
+ | --------------- | --------- | ------------------------- |
161
+ | og | 1200×630 | Open Graph / social cards |
162
+ | x-card | 1200×675 | X (Twitter) cards |
163
+ | linkedin | 1200×627 | LinkedIn link previews |
164
+ | instagram | 1080×1080 | Instagram feed posts |
165
+ | instagram-story | 1080×1920 | Instagram stories |
166
+ | appstore | 1290×2796 | App Store screenshots |
167
+ | playstore | 1080×1920 | Play Store screenshots |
166
168
 
167
169
  ## License
168
170
 
@@ -0,0 +1,2 @@
1
+ import { StudioConfig } from "@stdout-design/core";
2
+ export type { StudioConfig };
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import path from "node:path";
6
6
  import { execSync, spawnSync } from "node:child_process";
7
7
  import { existsSync } from "node:fs";
8
8
  import { resolveCommand } from "package-manager-detector/commands";
9
- import { detect, getUserAgent } from "package-manager-detector/detect";
9
+ import { detect } from "package-manager-detector/detect";
10
10
  import { cp, mkdir, writeFile } from "node:fs/promises";
11
11
  //#region src/lib/display.ts
12
12
  const formatBytes = (bytes) => {
@@ -3244,7 +3244,7 @@ export default config;
3244
3244
  const getPkgJson = (name, version) => ({
3245
3245
  dependencies: {
3246
3246
  "@stdout-design/cli": `^${version}`,
3247
- "takumi-js": "^2.0.2"
3247
+ "@types/react": "^19.2.17"
3248
3248
  },
3249
3249
  name,
3250
3250
  private: true,
@@ -3255,12 +3255,19 @@ const getPkgJson = (name, version) => ({
3255
3255
  },
3256
3256
  type: "module"
3257
3257
  });
3258
- const templateDir = () => path.resolve(import.meta.dirname, "../template");
3259
- const templatesDir = () => path.resolve(import.meta.dirname, "../template/templates");
3258
+ const resolveTemplateDir = () => {
3259
+ const fromDist = path.resolve(import.meta.dirname, "../template");
3260
+ if (existsSync(path.resolve(fromDist, "tsconfig.json"))) return fromDist;
3261
+ return path.resolve(import.meta.dirname, "../../../template");
3262
+ };
3263
+ const resolveTemplatesDir = () => path.resolve(resolveTemplateDir(), "templates");
3260
3264
  const copyStaticAssets = async (dir) => {
3261
- const base = templateDir();
3262
- await cp(path.resolve(base, "tsconfig.json"), path.resolve(dir, "tsconfig.json"));
3263
- await cp(path.resolve(base, ".gitignore"), path.resolve(dir, ".gitignore"));
3265
+ const base = resolveTemplateDir();
3266
+ await Promise.all([
3267
+ cp(path.resolve(base, "tsconfig.json"), path.resolve(dir, "tsconfig.json")),
3268
+ cp(path.resolve(base, "gitignore"), path.resolve(dir, ".gitignore")),
3269
+ cp(path.resolve(base, "types.d.ts"), path.resolve(dir, "types.d.ts"))
3270
+ ]);
3264
3271
  };
3265
3272
  const generateConfig = async (dir, version) => {
3266
3273
  await writeFile(path.resolve(dir, "studio.config.ts"), getConfigTemplate(version));
@@ -3272,7 +3279,7 @@ const copyTemplateFiles = async (dir, templates) => {
3272
3279
  if (templates.length === 0) return;
3273
3280
  const dstTemplatesDir = path.resolve(dir, "templates");
3274
3281
  await mkdir(dstTemplatesDir, { recursive: true });
3275
- const srcTemplatesDir = templatesDir();
3282
+ const srcTemplatesDir = resolveTemplatesDir();
3276
3283
  for (const template of templates) if (!existsSync(path.resolve(srcTemplatesDir, `${template}.tsx`))) throw new Error(`Template "${template}" not found at templates/${template}.tsx`);
3277
3284
  await Promise.all(templates.map((template) => cp(path.resolve(srcTemplatesDir, `${template}.tsx`), path.resolve(dstTemplatesDir, `${template}.tsx`))));
3278
3285
  };
@@ -3298,10 +3305,8 @@ const scaffold = async (dir, options) => {
3298
3305
  };
3299
3306
  //#endregion
3300
3307
  //#region src/commands/init.ts
3301
- const detectPackageManager = async () => {
3302
- const userAgent = getUserAgent();
3303
- if (userAgent) return userAgent;
3304
- const detected = await detect();
3308
+ const detectPackageManager = async (cwd) => {
3309
+ const detected = await detect({ cwd });
3305
3310
  if (detected) return detected.name;
3306
3311
  return "npm";
3307
3312
  };
@@ -3340,7 +3345,7 @@ const init = async (projectDir, options) => {
3340
3345
  const initialized = tryGitInit(collected.resolvedDir);
3341
3346
  gitSpinner.stop(initialized ? "Git initialized" : "Git repo already exists or git is not available");
3342
3347
  }
3343
- const pm = await detectPackageManager();
3348
+ const pm = await detectPackageManager(cwd);
3344
3349
  if (collected.shouldInstall) {
3345
3350
  const installSpinner = spinner();
3346
3351
  installSpinner.start("Installing dependencies...");
@@ -0,0 +1,2 @@
1
+ import { PropSchema, defineSchema } from "@stdout-design/core/schema";
2
+ export { type PropSchema, defineSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdout-design/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "stdout-design CLI — shallow front door to @stdout-design/core and @stdout-design/dev-server",
5
5
  "keywords": [
6
6
  "cli",
@@ -15,9 +15,6 @@
15
15
  "url": "https://github.com/m7md1alaa/stdout-design/issues"
16
16
  },
17
17
  "license": "MIT",
18
- "publishConfig": {
19
- "access": "public"
20
- },
21
18
  "repository": {
22
19
  "type": "git",
23
20
  "url": "git+https://github.com/m7md1alaa/stdout-design/studio.git"
@@ -48,6 +45,9 @@
48
45
  "types": "./dist/schema.d.mts"
49
46
  }
50
47
  },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
51
  "scripts": {
52
52
  "build": "tsdown",
53
53
  "dev": "tsdown --watch",
@@ -62,7 +62,7 @@
62
62
  "package-manager-detector": "^1.8.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@stdout-design/config": "workspace:*",
65
+ "@stdout-design/config": "0.0.0",
66
66
  "tsdown": "^0.22.5",
67
67
  "typescript": "^7.0.2"
68
68
  },
@@ -0,0 +1,4 @@
1
+ node_modules/
2
+ dist/
3
+ .studio-cache/
4
+ out/
@@ -0,0 +1,7 @@
1
+ import "react";
2
+
3
+ declare module "react" {
4
+ interface DOMAttributes<T> {
5
+ tw?: string;
6
+ }
7
+ }