@stdout-design/cli 0.2.6 → 0.2.7

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/index.mjs +1 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -28,4 +28,4 @@ export default config;
28
28
  const config: StudioConfig = ${JSON.stringify(config,null,2)};
29
29
 
30
30
  export default config;
31
- `,handlers={cache:cacheStats,cacheClean,cacheStats,dev,init,lint,render,update:async(projectDir,options)=>{let cwd=process.cwd(),dir=path.resolve(cwd,projectDir??`.`),configPath=path.resolve(dir,`studio.config.ts`);if(!existsSync(configPath))throw Error("No studio project found. Run `studio init` first.");let existingModule=await import(pathToFileURL(configPath).href),existing=existingModule.default??existingModule,existingConfig={defaultPreset:existing.defaultPreset,outDir:existing.outDir,presets:existing.presets??[],scaffoldVersion:existing.scaffoldVersion,templates:existing.templates??{}},defaults=getDefaults(),currentVersion=getScaffoldVersion(),{config:merged,summary}=mergeConfig(existingConfig,defaults,currentVersion,DEPRECATED_PRESET_IDS),{intro,outro,confirm}=await import(`@clack/prompts`);if(intro(`studio update`),!(summary.addedPresets.length>0||summary.deprecatedPresets.length>0||summary.addedTemplates.length>0||summary.oldVersion!==summary.newVersion)){console.log(`Project is already up to date.`),outro(`Done`);return}console.log(``),summary.oldVersion!==summary.newVersion&&console.log(` scaffoldVersion ${summary.oldVersion??`(none)`} -> ${summary.newVersion}`);for(let id of summary.addedPresets)console.log(` presets +${id}`);for(let id of summary.deprecatedPresets)console.log(` presets ! ${id} (deprecated)`);for(let id of summary.addedTemplates)console.log(` templates +${id}`);if(console.log(` assets tsconfig.json, .gitignore, types.d.ts (overwrite)`),console.log(` deps @stdout-design/cli ^x -> ^${currentVersion}`),console.log(``),!options?.yes&&!await confirm({initialValue:!0,message:`Apply these changes?`})){console.log(`Cancelled.`),outro(`Done`);return}await writeFile(configPath,serializeConfig(merged)),await copyStaticAssets(dir);let pkgPath=path.resolve(dir,`package.json`);if(existsSync(pkgPath)){let{updated,changed}=updatePackageJsonDeps(readFileSync(pkgPath,`utf-8`),currentVersion);changed&&await writeFile(pkgPath,updated)}console.log(``),outro(`Done`)}},run=(moduleName,handlerName)=>async(...args)=>{try{let handler=handlerName?handlers[handlerName]:handlers[moduleName];if(!handler)throw Error(`Unknown command: ${handlerName??moduleName}`);await handler(...args)}catch(error){console.error(formatError$1(error)),process.exit(1)}},pkg=createRequire(import.meta.url)(`../package.json`),program=new Command().allowExcessArguments(!0);program.name(`studio`).description(`Social media design tool — render, preview, batch`).version(pkg.version,`-v, -V, --version`),program.command(`dev`).description(`Start the studio dev server with live preview`).argument(`[rootDir]`,`Project root directory (default: cwd)`).option(`-p, --port <number>`,`Port to run on`,`3000`).option(`--open`,`Open browser on start`).action(run(`dev`)),program.command(`render`).description(`Render a template — single or batch with --data`).argument(`<template>`,`Template ID from studio.config.ts`).argument(`[props...]`,`Props as key=value pairs (e.g. title="Hello")`).option(`--data <path>`,`CSV or JSON data file for batch rendering`).option(`--preset <ids>`,`Comma-separated preset IDs`).option(`--locale <locales>`,`Comma-separated locale codes`).option(`--out-dir <path>`,`Output directory`).option(`--concurrency <n>`,`Max concurrent renders in batch mode`,`4`).option(`--fail-fast`,`Stop batch on first error`).option(`--json`,`Output results as JSON`).action(run(`render`));const cacheCmd=program.command(`cache`).description(`Manage the render cache`);cacheCmd.command(`stats`).description(`Show cache statistics`).option(`--json`,`Output as JSON`).argument(`[rootDir]`,`Project root directory (default: cwd)`).action(run(`cache`,`cacheStats`)),cacheCmd.command(`clean`).description(`Clear the render cache`).option(`--json`,`Output as JSON`).argument(`[rootDir]`,`Project root directory (default: cwd)`).action(run(`cache`,`cacheClean`)),program.command(`lint`).description(`Check templates for compatibility (coming soon)`).argument(`[rootDir]`,`Project root directory (default: cwd)`).action(run(`lint`)),program.command(`init`).description(`Scaffold a new studio project`).argument(`[projectDir]`,`Project directory (default: cwd)`).option(`-y, --yes`,`Skip prompts, use defaults`).action(run(`init`)),program.command(`update`).description(`Update an existing studio project to the latest CLI version`).argument(`[projectDir]`,`Project directory (default: cwd)`).option(`-y, --yes`,`Skip confirmation prompts`).action(run(`update`)),program.parse();export{};
31
+ `,handlers={cache:cacheStats,cacheClean,cacheStats,dev,init,lint,render,update:async(projectDir,options)=>{let cwd=process.cwd(),dir=path.resolve(cwd,projectDir??`.`),configPath=path.resolve(dir,`studio.config.ts`);if(!existsSync(configPath))throw Error("No studio project found. Run `studio init` first.");let existingModule=await import(pathToFileURL(configPath).href),existing=existingModule.default??existingModule,existingConfig={defaultPreset:existing.defaultPreset,outDir:existing.outDir,presets:existing.presets??[],scaffoldVersion:existing.scaffoldVersion,templates:existing.templates??{}},defaults=getDefaults(),currentVersion=getScaffoldVersion(),{config:merged,summary}=mergeConfig(existingConfig,defaults,currentVersion,DEPRECATED_PRESET_IDS),{intro,outro,confirm}=await import(`@clack/prompts`);if(intro(`studio update`),!(summary.addedPresets.length>0||summary.deprecatedPresets.length>0||summary.addedTemplates.length>0||summary.oldVersion!==summary.newVersion)){console.log(`Project is already up to date.`),outro(`Done`);return}console.log(``),summary.oldVersion!==summary.newVersion&&console.log(` scaffoldVersion ${summary.oldVersion??`(none)`} -> ${summary.newVersion}`);for(let id of summary.addedPresets)console.log(` presets +${id}`);for(let id of summary.deprecatedPresets)console.log(` presets ! ${id} (deprecated)`);for(let id of summary.addedTemplates)console.log(` templates +${id}`);if(console.log(` assets tsconfig.json, .gitignore, types.d.ts (overwrite)`),console.log(` deps @stdout-design/cli ^x -> ^${currentVersion}`),console.log(``),!options?.yes&&!await confirm({initialValue:!0,message:`Apply these changes?`})){console.log(`Cancelled.`),outro(`Done`);return}await writeFile(configPath,serializeConfig(merged)),await copyStaticAssets(dir);let pkgPath=path.resolve(dir,`package.json`);if(existsSync(pkgPath)){let{updated,changed}=updatePackageJsonDeps(readFileSync(pkgPath,`utf-8`),currentVersion);changed&&await writeFile(pkgPath,updated)}console.log(``),outro(`Done`)}},run=(moduleName,handlerName)=>async(...args)=>{try{let handler=handlerName?handlers[handlerName]:handlers[moduleName];if(!handler)throw Error(`Unknown command: ${handlerName??moduleName}`);await handler(...args)}catch(error){console.error(formatError$1(error)),process.exit(1)}},pkg=createRequire(import.meta.url)(`../package.json`),program=new Command().allowExcessArguments(!0);program.name(`studio`).description(`Social media design tool — render, preview, batch`).version(pkg.version,`-v, --version`),program.command(`dev`).description(`Start the studio dev server with live preview`).argument(`[rootDir]`,`Project root directory (default: cwd)`).option(`-p, --port <number>`,`Port to run on`,`3000`).option(`--open`,`Open browser on start`).action(run(`dev`)),program.command(`render`).description(`Render a template — single or batch with --data`).argument(`<template>`,`Template ID from studio.config.ts`).argument(`[props...]`,`Props as key=value pairs (e.g. title="Hello")`).option(`--data <path>`,`CSV or JSON data file for batch rendering`).option(`--preset <ids>`,`Comma-separated preset IDs`).option(`--locale <locales>`,`Comma-separated locale codes`).option(`--out-dir <path>`,`Output directory`).option(`--concurrency <n>`,`Max concurrent renders in batch mode`,`4`).option(`--fail-fast`,`Stop batch on first error`).option(`--json`,`Output results as JSON`).action(run(`render`));const cacheCmd=program.command(`cache`).description(`Manage the render cache`);cacheCmd.command(`stats`).description(`Show cache statistics`).option(`--json`,`Output as JSON`).argument(`[rootDir]`,`Project root directory (default: cwd)`).action(run(`cache`,`cacheStats`)),cacheCmd.command(`clean`).description(`Clear the render cache`).option(`--json`,`Output as JSON`).argument(`[rootDir]`,`Project root directory (default: cwd)`).action(run(`cache`,`cacheClean`)),program.command(`lint`).description(`Check templates for compatibility (coming soon)`).argument(`[rootDir]`,`Project root directory (default: cwd)`).action(run(`lint`)),program.command(`init`).description(`Scaffold a new studio project`).argument(`[projectDir]`,`Project directory (default: cwd)`).option(`-y, --yes`,`Skip prompts, use defaults`).action(run(`init`)),program.command(`update`).description(`Update an existing studio project to the latest CLI version`).argument(`[projectDir]`,`Project directory (default: cwd)`).option(`-y, --yes`,`Skip confirmation prompts`).action(run(`update`)),program.parse();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdout-design/cli",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "stdout-design CLI — shallow front door to @stdout-design/core and @stdout-design/dev-server",
5
5
  "keywords": [
6
6
  "cli",