How to use common-dir - 1 common examples

To help you get started, we’ve selected a few common-dir examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vue-styleguidist / vue-styleguidist / packages / vue-styleguidist / src / loaders / styleguide-loader.ts View on Github external
)
	const allContentPages = getAllContentPages(sections)

	// Nothing to show in the style guide
	const welcomeScreen = allContentPages.length === 0 && allComponentFiles.length === 0
	const patterns = welcomeScreen ? getComponentPatternsFromSections(config.sections) : undefined
	const renderRootJsx = config.renderRootJsx ? requireIt(config.renderRootJsx) : undefined

	logger.debug('Loading components:\n' + allComponentFiles.join('\n'))

	// Setup Webpack context dependencies to enable hot reload when adding new files
	if (config.contextDependencies) {
		config.contextDependencies.forEach((dir: string) => this.addContextDependency(dir))
	} else if (allComponentFiles.length > 0) {
		// Use common parent directory of all components as a context
		this.addContextDependency(commonDir(allComponentFiles))
	}

	const styleguide = {
		config: pick(config, CLIENT_CONFIG_OPTIONS),
		welcomeScreen,
		patterns,
		sections,
		renderRootJsx
	}

	return `
if (module.hot) {
	module.hot.accept([])
}

module.exports = ${generate(toAst(styleguide))}

common-dir

Returns the parent directory common to each path

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Popular common-dir functions