@stdout-design/cli 0.2.1 → 0.2.3
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 +26 -24
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +24 -17
- package/dist/schema.d.mts +2 -0
- package/package.json +5 -5
- package/template/types.d.ts +7 -0
package/README.md
CHANGED
|
@@ -46,14 +46,14 @@ bun add -g @stdout-design/cli
|
|
|
46
46
|
|
|
47
47
|
## Commands
|
|
48
48
|
|
|
49
|
-
| Command
|
|
50
|
-
|
|
51
|
-
| `studio init`
|
|
52
|
-
| `studio dev`
|
|
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`
|
|
55
|
-
| `studio cache clean`
|
|
56
|
-
| `studio lint`
|
|
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
|
|
67
|
-
|
|
68
|
-
| `--key value`
|
|
69
|
-
| `--data file.csv` | Batch render from CSV or JSON
|
|
70
|
-
| `--preset name`
|
|
71
|
-
| `--locale lang`
|
|
72
|
-
| `--out-dir path`
|
|
73
|
-
| `--out file.png`
|
|
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
|
|
158
|
-
|
|
159
|
-
| og
|
|
160
|
-
| x-card
|
|
161
|
-
| linkedin
|
|
162
|
-
| instagram
|
|
163
|
-
| instagram-story | 1080×1920 | Instagram stories
|
|
164
|
-
| appstore
|
|
165
|
-
| playstore
|
|
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
|
|
package/dist/index.d.mts
ADDED
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
|
|
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) => {
|
|
@@ -3242,25 +3242,34 @@ const config: StudioConfig = {
|
|
|
3242
3242
|
export default config;
|
|
3243
3243
|
`;
|
|
3244
3244
|
const getPkgJson = (name, version) => ({
|
|
3245
|
-
dependencies: {
|
|
3246
|
-
"@stdout-design/cli": `^${version}`,
|
|
3247
|
-
"takumi-js": "^2.0.2"
|
|
3248
|
-
},
|
|
3249
3245
|
name,
|
|
3250
3246
|
private: true,
|
|
3247
|
+
type: "module",
|
|
3251
3248
|
scripts: {
|
|
3252
3249
|
build: "studio build",
|
|
3253
3250
|
dev: "studio dev",
|
|
3254
3251
|
export: "studio export"
|
|
3255
3252
|
},
|
|
3256
|
-
|
|
3253
|
+
dependencies: {
|
|
3254
|
+
"@stdout-design/cli": `^${version}`,
|
|
3255
|
+
"@stdout-design/dev-server": "^0.2.0",
|
|
3256
|
+
"@stdout-design/web-ui": "^0.2.0",
|
|
3257
|
+
"@types/react": "^19.2.17"
|
|
3258
|
+
}
|
|
3257
3259
|
});
|
|
3258
|
-
const
|
|
3259
|
-
const
|
|
3260
|
+
const resolveTemplateDir = () => {
|
|
3261
|
+
const fromDist = path.resolve(import.meta.dirname, "../template");
|
|
3262
|
+
if (existsSync(path.resolve(fromDist, "tsconfig.json"))) return fromDist;
|
|
3263
|
+
return path.resolve(import.meta.dirname, "../../../template");
|
|
3264
|
+
};
|
|
3265
|
+
const resolveTemplatesDir = () => path.resolve(resolveTemplateDir(), "templates");
|
|
3260
3266
|
const copyStaticAssets = async (dir) => {
|
|
3261
|
-
const base =
|
|
3262
|
-
await
|
|
3263
|
-
|
|
3267
|
+
const base = resolveTemplateDir();
|
|
3268
|
+
await Promise.all([
|
|
3269
|
+
cp(path.resolve(base, "tsconfig.json"), path.resolve(dir, "tsconfig.json")),
|
|
3270
|
+
cp(path.resolve(base, "gitignore"), path.resolve(dir, ".gitignore")),
|
|
3271
|
+
cp(path.resolve(base, "types.d.ts"), path.resolve(dir, "types.d.ts"))
|
|
3272
|
+
]);
|
|
3264
3273
|
};
|
|
3265
3274
|
const generateConfig = async (dir, version) => {
|
|
3266
3275
|
await writeFile(path.resolve(dir, "studio.config.ts"), getConfigTemplate(version));
|
|
@@ -3272,7 +3281,7 @@ const copyTemplateFiles = async (dir, templates) => {
|
|
|
3272
3281
|
if (templates.length === 0) return;
|
|
3273
3282
|
const dstTemplatesDir = path.resolve(dir, "templates");
|
|
3274
3283
|
await mkdir(dstTemplatesDir, { recursive: true });
|
|
3275
|
-
const srcTemplatesDir =
|
|
3284
|
+
const srcTemplatesDir = resolveTemplatesDir();
|
|
3276
3285
|
for (const template of templates) if (!existsSync(path.resolve(srcTemplatesDir, `${template}.tsx`))) throw new Error(`Template "${template}" not found at templates/${template}.tsx`);
|
|
3277
3286
|
await Promise.all(templates.map((template) => cp(path.resolve(srcTemplatesDir, `${template}.tsx`), path.resolve(dstTemplatesDir, `${template}.tsx`))));
|
|
3278
3287
|
};
|
|
@@ -3298,10 +3307,8 @@ const scaffold = async (dir, options) => {
|
|
|
3298
3307
|
};
|
|
3299
3308
|
//#endregion
|
|
3300
3309
|
//#region src/commands/init.ts
|
|
3301
|
-
const detectPackageManager = async () => {
|
|
3302
|
-
const
|
|
3303
|
-
if (userAgent) return userAgent;
|
|
3304
|
-
const detected = await detect();
|
|
3310
|
+
const detectPackageManager = async (cwd) => {
|
|
3311
|
+
const detected = await detect({ cwd });
|
|
3305
3312
|
if (detected) return detected.name;
|
|
3306
3313
|
return "npm";
|
|
3307
3314
|
};
|
|
@@ -3340,7 +3347,7 @@ const init = async (projectDir, options) => {
|
|
|
3340
3347
|
const initialized = tryGitInit(collected.resolvedDir);
|
|
3341
3348
|
gitSpinner.stop(initialized ? "Git initialized" : "Git repo already exists or git is not available");
|
|
3342
3349
|
}
|
|
3343
|
-
const pm = await detectPackageManager();
|
|
3350
|
+
const pm = await detectPackageManager(cwd);
|
|
3344
3351
|
if (collected.shouldInstall) {
|
|
3345
3352
|
const installSpinner = spinner();
|
|
3346
3353
|
installSpinner.start("Installing dependencies...");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdout-design/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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": "
|
|
65
|
+
"@stdout-design/config": "0.0.0",
|
|
66
66
|
"tsdown": "^0.22.5",
|
|
67
67
|
"typescript": "^7.0.2"
|
|
68
68
|
},
|