storybook-nuxt
Advanced tools
Comparing version 0.0.6-alpha.2 to 0.0.6-alpha.3
@@ -14,8 +14,10 @@ #!/usr/bin/env node | ||
.description('Initialize the Storybook configuration') | ||
.action(() => { | ||
.option('-s, --start', 'Start Storybook after initialization') | ||
.action((options) => { | ||
// ... perform the initialization ... | ||
initStorybook() | ||
initStorybook(Boolean(options.start)) | ||
}) | ||
// Parse command-line arguments | ||
program.parse(process.argv) | ||
program.parse(process.argv) |
42
init.js
@@ -17,6 +17,7 @@ #!/usr/bin/env node | ||
const CROSSMARK = '\u274C' // ❌ | ||
const logger = console | ||
function initStorybook() { | ||
logger.log('Initializing Storybook configuration...') | ||
function initStorybook(start = false) { | ||
logger.log('Initializing Storybook configuration...', start) | ||
logger.log() | ||
@@ -71,3 +72,3 @@ // Path to the project root | ||
const packageManager = detectPackageManager() | ||
logger.log(`Using ${packageManager} to install dependencies...`) | ||
addDevDependencies() | ||
@@ -97,2 +98,15 @@ // Install required packages using pnpm | ||
logger.log() | ||
if (start) { | ||
const startProcess = spawn(packageManager, ['storybook', 'dev'], { | ||
cwd: projectRoot, | ||
stdio: 'inherit', | ||
}) | ||
startProcess.on('close', (code) => { | ||
if (code !== 0) | ||
logger.error(`${CROSSMARK} Storybook failed to start with code ${code}`) | ||
else | ||
logger.log(`${CHECKMARK} Storybook started successfully!`) | ||
}) | ||
} | ||
} | ||
@@ -120,13 +134,13 @@ }) | ||
'@storybook-vue/nuxt': 'next', | ||
'@storybook/addon-essentials': 'next', | ||
'@storybook/addon-interactions': 'next', | ||
'@storybook/addon-links': 'next', | ||
'@storybook/blocks': 'next', | ||
'@storybook/builder-vite': 'next', | ||
'@storybook/testing-library': '^0.2.0', | ||
'@storybook/vue3': 'next', | ||
'@storybook/vue3-vite': 'next', | ||
'@types/node': '^18.17.5', | ||
'react': '^18.2.0', | ||
'react-dom': '^18.2.0', | ||
// '@storybook/addon-essentials': 'next', | ||
// '@storybook/addon-interactions': 'next', | ||
// '@storybook/addon-links': 'next', | ||
// '@storybook/blocks': 'next', | ||
// '@storybook/builder-vite': 'next', | ||
// '@storybook/testing-library': '^0.2.0', | ||
// '@storybook/vue3': 'next', | ||
// '@storybook/vue3-vite': 'next', | ||
// '@types/node': '^18.17.5', | ||
// 'react': '^18.2.0', | ||
// 'react-dom': '^18.2.0', | ||
@@ -133,0 +147,0 @@ } |
{ | ||
"name": "storybook-nuxt", | ||
"version": "0.0.6-alpha.2", | ||
"version": "0.0.6-alpha.3", | ||
"description": "Storybook init CLI for Nuxt ", | ||
@@ -28,5 +28,5 @@ "author": "Chakas@", | ||
"test": "cd test-npm && node ../index.js init && npm run storybook dev", | ||
"test-pnpm": "cd test-pnpm && node ../index.js init && pnpm run storybook dev", | ||
"test-yarn": "cd test-yarn && node ../index.js init && yarn run storybook dev" | ||
"test-pnpm": "cd test-pnpm && node ../index.js init --start ", | ||
"test-yarn": "cd test-yarn && node ../index.js init " | ||
} | ||
} |
68548
338