How to use the react-styleguidist/lib/scripts/utils/error function in react-styleguidist

To help you get started, we’ve selected a few react-styleguidist 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 / scripts / config.ts View on Github external
export default function getConfig(
	configParam: string | StyleguidistConfig | { serverPort?: string | number },
	update?: (conf: StyleguidistConfig | {}) => StyleguidistConfig
): StyleguidistConfig {
	let configFilepath
	let config: StyleguidistConfig | { serverPort?: string | number }
	if (isString(configParam)) {
		// Load config from a given file
		configFilepath = path.resolve(process.cwd(), configParam)
		if (!fs.existsSync(configFilepath)) {
			throw new StyleguidistError('Styleguidist config not found: ' + configFilepath + '.')
		}
		config = {}
	} else if (!isPlainObject(configParam)) {
		// Try to read config options from a file
		configFilepath = findConfigFile()
		config = {}
	} else {
		config = configParam
	}

	if (typeof configFilepath === 'string') {
		config = require(configFilepath)
	}

	if (update) {
		config = update(config)
github vue-styleguidist / vue-styleguidist / packages / vue-styleguidist / src / scripts / schemas / config.ts View on Github external
process: (value: any) => {
			if (typeof value === 'string') {
				throw new StyleguidistError(
					`${kleur.bold(
						'template'
					)} config option format has been changed, you need to update your config.`,
					'template'
				)
			}
			return value
		}
	},