@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 +26 -24
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +18 -13
- package/dist/schema.d.mts +2 -0
- package/package.json +5 -5
- package/template/gitignore +4 -0
- 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) => {
|
|
@@ -3244,7 +3244,7 @@ export default config;
|
|
|
3244
3244
|
const getPkgJson = (name, version) => ({
|
|
3245
3245
|
dependencies: {
|
|
3246
3246
|
"@stdout-design/cli": `^${version}`,
|
|
3247
|
-
"
|
|
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
|
|
3259
|
-
const
|
|
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 =
|
|
3262
|
-
await
|
|
3263
|
-
|
|
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 =
|
|
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
|
|
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...");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdout-design/cli",
|
|
3
|
-
"version": "0.2.
|
|
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": "
|
|
65
|
+
"@stdout-design/config": "0.0.0",
|
|
66
66
|
"tsdown": "^0.22.5",
|
|
67
67
|
"typescript": "^7.0.2"
|
|
68
68
|
},
|