New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

storybook-nuxt

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-nuxt - npm Package Compare versions

Comparing version 0.0.5-alpha.5 to 0.0.5-alpha.6

.storybook/rendererAssets/.eslintrc.json

104

init.js
#!/usr/bin/env node
/* eslint-disable @typescript-eslint/indent */
const fs = require('node:fs')

@@ -31,6 +33,6 @@ const path = require('node:path')

const configFileExtension = isTypeScriptProject ? 'ts' : 'js'
// Build the paths for stories based on the source folder
const extensions = isTypeScriptProject ? 'js|jsx|mjs|ts|tsx' : 'js|jsx|mjs'
// Build the paths for stories based on the source folder
const storiesPath = path.join(sourceFolder, '../stories')
const storiesGlob = `${storiesPath}/**/*.stories.@(js|jsx|mjs|ts|tsx)`
const storiesGlob = `${storiesPath}/**/*.stories.@(${extensions})`

@@ -66,13 +68,5 @@ // Load the main and preview template files

// Install required packages using pnpm
const installProcess = spawn(packageManager, [packageManager === 'npm' ? 'install' : 'add',
'storybook@next',
'@storybook-vue/nuxt',
'@storybook/vue3@next',
'@storybook/addon-essentials@next',
'@storybook/addon-interactions@next',
'@storybook/addon-links@next',
'@storybook/blocks@next',
packageManager === 'npm' ? '--save-dev' : '-D',
], {
addDevDependencies()
// Install required packages using pnpm
const installProcess = spawn(packageManager, ['install'], {
cwd: projectRoot,

@@ -85,5 +79,9 @@ stdio: 'inherit',

logger.error(`${CROSSMARK} Package installation failed with code ${code}`)
} else {
}
else {
logger.log(`${CHECKMARK} Packages installed successfully!`)
addScripts(packageManager)
copyTemplateFiles(configFileExtension, path.join(sourceFolder, 'stories'))
logger.log()

@@ -115,2 +113,34 @@ logger.log('✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨')

function addDevDependencies() {
const devDependencies = {
'storybook': 'next',
'@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',
}
const packageJsonPath = path.join(process.cwd(), 'package.json')
const packageJson = require(packageJsonPath)
if (packageJson) {
packageJson.devDependencies = packageJson.devDependencies || {}
Object.keys(devDependencies).forEach((key) => {
packageJson.devDependencies[key] = devDependencies[key]
})
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
logger.log(`${CHECKMARK} Storybook devDependencies added to package.json `)
}
else {
logger.log(`${CROSSMARK} Sorry, this feature is currently only supported with pnpm.`)
}
}
function addScripts() {

@@ -127,3 +157,4 @@ // Update package.json with the script

logger.log(`${CHECKMARK} Storybook scripts added to package.json `)
} else {
}
else {
logger.log(`${CROSSMARK} Sorry, this feature is currently only supported with pnpm.`)

@@ -133,2 +164,41 @@ }

module.exports = { initStorybook }
function copyTemplateFiles(extension, storiesPath) {
// Copy the template files to the project root
const templateDir = path.join(require.resolve('@storybook-vue/nuxt'), '../../template/cli/', extension)
const targetDir = path.join(process.cwd(), storiesPath)
copyFolderRecursive(templateDir, targetDir)
// Copy the common assets to the project root
const commonAssetsDir = path.join(__dirname, '.storybook', 'rendererAssets/common')
copyFolderRecursive(commonAssetsDir, targetDir)
}
function copyFolderRecursive(sourceFolder, destinationFolder) {
// Create the destination folder if it doesn't exist
if (!fs.existsSync(destinationFolder))
fs.mkdirSync(destinationFolder)
// Read the contents of the source folder
const files = fs.readdirSync(sourceFolder)
// Loop through the files in the source folder
for (const file of files) {
const sourceFilePath = path.join(sourceFolder, file)
const destinationFilePath = path.join(destinationFolder, file)
// Get the file's stats to check if it's a directory or a file
const stats = fs.statSync(sourceFilePath)
if (stats.isFile()) {
// If it's a file, copy it to the destination folder
fs.copyFileSync(sourceFilePath, destinationFilePath)
}
else if (stats.isDirectory()) {
// If it's a directory, recursively copy it
copyFolderRecursive(sourceFilePath, destinationFilePath)
}
}
}
// Usage example:
module.exports = { initStorybook }

6

package.json
{
"name": "storybook-nuxt",
"version": "0.0.5-alpha.5",
"version": "0.0.5-alpha.6",
"description": "Storybook init CLI for Nuxt ",

@@ -27,4 +27,6 @@ "author": "Chakas@",

"scripts": {
"test": "cd playground && node ../index.js init"
"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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc