Best JavaScript code snippet using storybook-root
boost.py
Source:boost.py
...20 opt.load('compiler_cxx boost')2122def configure(conf):23 conf.load('compiler_cxx boost')24 conf.check_boost(lib='system filesystem', mt=True, static=True)2526def build(bld):27 bld(source='main.cpp', target='app', use='BOOST')28'''2930import sys31import re32from waflib import Utils, Logs33from waflib.Configure import conf34from waflib.Errors import WafError3536BOOST_LIBS = ('/usr/lib', '/usr/local/lib',37 '/opt/local/lib', '/sw/lib', '/lib')38BOOST_INCLUDES = ('/usr/include', '/usr/local/include',39 '/opt/local/include', '/sw/include')40BOOST_VERSION_FILE = 'boost/version.hpp'41BOOST_VERSION_CODE = '''42#include <iostream>43#include <boost/version.hpp>44int main() { std::cout << BOOST_LIB_VERSION << std::endl; }45'''4647# toolsets from {boost_dir}/tools/build/v2/tools/common.jam48PLATFORM = Utils.unversioned_sys_platform()49detect_intel = lambda env: (PLATFORM == 'win32') and 'iw' or 'il'50detect_clang = lambda env: (PLATFORM == 'darwin') and 'clang-darwin' or 'clang'51detect_mingw = lambda env: (re.search('MinGW', env.CXX[0])) and 'mgw' or 'gcc'52BOOST_TOOLSETS = {53 'borland': 'bcb',54 'clang': detect_clang,55 'como': 'como',56 'cw': 'cw',57 'darwin': 'xgcc',58 'edg': 'edg',59 'g++': detect_mingw,60 'gcc': detect_mingw,61 'icpc': detect_intel,62 'intel': detect_intel,63 'kcc': 'kcc',64 'kylix': 'bck',65 'mipspro': 'mp',66 'mingw': 'mgw',67 'msvc': 'vc',68 'qcc': 'qcc',69 'sun': 'sw',70 'sunc++': 'sw',71 'tru64cxx': 'tru',72 'vacpp': 'xlc'73}747576def options(opt):77 opt.add_option('--boost-includes', type='string',78 default='', dest='boost_includes',79 help='''path to the boost directory where the includes are80 e.g. /boost_1_45_0/include''')81 opt.add_option('--boost-libs', type='string',82 default='', dest='boost_libs',83 help='''path to the directory where the boost libs are84 e.g. /boost_1_45_0/stage/lib''')85 opt.add_option('--boost-static', action='store_true',86 default=False, dest='boost_static',87 help='link static libraries')88 opt.add_option('--boost-mt', action='store_true',89 default=False, dest='boost_mt',90 help='select multi-threaded libraries')91 opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',92 help='''select libraries with tags (dgsyp, d for debug),93 see doc Boost, Getting Started, chapter 6.1''')94 opt.add_option('--boost-toolset', type='string',95 default='', dest='boost_toolset',96 help='force a toolset e.g. msvc, vc90, \97 gcc, mingw, mgw45 (default: auto)')98 py_version = '%d%d' % (sys.version_info[0], sys.version_info[1])99 opt.add_option('--boost-python', type='string',100 default=py_version, dest='boost_python',101 help='select the lib python with this version \102 (default: %s)' % py_version)103104105@conf106def __boost_get_version_file(self, dir):107 try:108 return self.root.find_dir(dir).find_node(BOOST_VERSION_FILE)109 except:110 return None111112113@conf114def boost_get_version(self, dir):115 """silently retrieve the boost version number"""116 re_but = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.*)"$', re.M)117 try:118 val = re_but.search(self.__boost_get_version_file(dir).read()).group(1)119 except:120 val = self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[dir],121 execute=True, define_ret=True)122 return val123124125@conf126def boost_get_includes(self, *k, **kw):127 includes = k and k[0] or kw.get('includes', None)128 if includes and self.__boost_get_version_file(includes):129 return includes130 for dir in BOOST_INCLUDES:131 if self.__boost_get_version_file(dir):132 return dir133 if includes:134 self.fatal('headers not found in %s' % includes)135 else:136 self.fatal('headers not found, use --boost-includes=/path/to/boost')137138139@conf140def boost_get_toolset(self, cc):141 toolset = cc142 if not cc:143 build_platform = Utils.unversioned_sys_platform()144 if build_platform in BOOST_TOOLSETS:145 cc = build_platform146 else:147 cc = self.env.CXX_NAME148 if cc in BOOST_TOOLSETS:149 toolset = BOOST_TOOLSETS[cc]150 return isinstance(toolset, str) and toolset or toolset(self.env)151152153@conf154def __boost_get_libs_path(self, *k, **kw):155 ''' return the lib path and all the files in it '''156 if 'files' in kw:157 return self.root.find_dir('.'), Utils.to_list(kw['files'])158 libs = k and k[0] or kw.get('libs', None)159 if libs:160 path = self.root.find_dir(libs)161 files = path.ant_glob('*boost_*')162 if not libs or not files:163 for dir in BOOST_LIBS:164 try:165 path = self.root.find_dir(dir)166 files = path.ant_glob('*boost_*')167 if files:168 break169 path = self.root.find_dir(dir + '64')170 files = path.ant_glob('*boost_*')171 if files:172 break173 except:174 path = None175 if not path:176 if libs:177 self.fatal('libs not found in %s' % libs)178 else:179 self.fatal('libs not found, \180 use --boost-includes=/path/to/boost/lib')181 return path, files182183184@conf185def boost_get_libs(self, *k, **kw):186 '''187 return the lib path and the required libs188 according to the parameters189 '''190 path, files = self.__boost_get_libs_path(**kw)191 t = []192 if kw.get('mt', False):193 t.append('mt')194 if kw.get('abi', None):195 t.append(kw['abi'])196 tags = t and '(-%s)+' % '-'.join(t) or ''197 toolset = '(-%s[0-9]{0,3})+' % self.boost_get_toolset(kw.get('toolset', ''))198 version = '(-%s)+' % self.env.BOOST_VERSION199200 def find_lib(re_lib, files):201 for file in files:202 if re_lib.search(file.name):203 return file204 return None205206 def format_lib_name(name):207 if name.startswith('lib'):208 name = name[3:]209 return name.split('.')[0]210211 libs = []212 for lib in Utils.to_list(k and k[0] or kw.get('lib', None)):213 py = (lib == 'python') and '(-py%s)+' % kw['python'] or ''214 # Trying libraries, from most strict match to least one215 for pattern in ['boost_%s%s%s%s%s' % (lib, toolset, tags, py, version),216 'boost_%s%s%s%s' % (lib, tags, py, version),217 'boost_%s%s%s' % (lib, tags, version),218 # Give up trying to find the right version219 'boost_%s%s%s%s' % (lib, toolset, tags, py),220 'boost_%s%s%s' % (lib, tags, py),221 'boost_%s%s' % (lib, tags)]:222 file = find_lib(re.compile(pattern), files)223 if file:224 libs.append(format_lib_name(file.name))225 break226 else:227 self.fatal('lib %s not found in %s' % (lib, path))228229 return path.abspath(), libs230231232@conf233def check_boost(self, *k, **kw):234 """235 initialize boost236237 You can pass the same parameters as the command line (without "--boost-"),238 but the command line has the priority.239 """240 if not self.env['CXX']:241 self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')242243 params = {'lib': k and k[0] or kw.get('lib', None)}244 for key, value in self.options.__dict__.items():245 if not key.startswith('boost_'):246 continue247 key = key[len('boost_'):]
...
Using AI Code Generation
1import { withInfo } from 'storybook-addon-vue-info';2import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';3import { withA11y } from '@storybook/addon-a11y';4import { withPaddings } from 'storybook-addon-paddings';5import { withDesign } from 'storybook-addon-designs';6import { withInfo } from 'storybook-addon-vue-info';7import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';8import { withA11y } from '@storybook/addon-a11y';9import { withPaddings } from 'storybook-addon-paddings';10import { withDesign } from 'storybook-addon-designs';11import { withInfo } from 'storybook-addon-vue-info';12import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';13import { withA11y } from '@storybook/addon-a11y';14import { withPaddings } from 'storybook-addon-paddings';15import { withDesign } from 'storybook-addon-designs';16import { withInfo } from 'storybook-addon-vue-info';17import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';18import { withA11y } from '@storybook/addon-a11y';19import { withPaddings } from 'storybook-addon-paddings';20import { withDesign } from 'storybook-addon-designs';21import { withInfo } from 'storybook-addon-vue-info';22import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';23import { withA11y } from '@storybook/addon-a11y';24import { withPaddings } from 'storybook-addon-paddings';25import { withDesign } from 'storybook-addon-designs';26import { withInfo } from 'storybook-addon-vue-info';27import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';28import { withA11y } from '@storybook/addon-a11y';29import { withPaddings } from '
Using AI Code Generation
1import { addDecorator } from '@storybook/react';2import { withThemesProvider } from 'storybook-addon-styled-component-theme';3import { withKnobs } from '@storybook/addon-knobs';4import { withA11y } from '@storybook/addon-a11y';5import { withInfo } from '@storybook/addon-info';6import { withTests } from '@storybook/addon-jest';7import { withConsole } from '@storybook/addon-console';8import { withOptions } from '@storybook/addon-options';9import { withTheme } from 'storybook-addon-theme';10import { withThemes } from 'storybook-addon-themes';11import { withThemesProvider } from 'storybook-addon-styled-component-theme';12import { addReadme } from 'storybook-readme';13import { withViewport } from '@storybook/addon-viewport';14import { withTests } from '@storybook/addon-jest';15import { withConsole } from '@storybook/addon-console';16import { withOptions } from '@storybook/addon-options';17import { withA11y } from '@storybook/addon-a11y';18import { withInfo } from '@storybook/addon-info';19import { withKnobs } from '@storybook/addon-knobs';20import { withThemesProvider } from 'storybook-addon-styled-component-theme';21import { withThemes } from 'storybook-addon-themes';22import { withTheme } from 'storybook-addon-theme';23import { withViewport } from '@storybook/addon-viewport';24import { withTests } from '@storybook/addon-jest';25import { withConsole } from '@storybook/addon-console';26import { withOptions } from '@storybook/addon-options';27import { withA11y } from '@storybook/addon-a11y';28import { withInfo } from '@storybook/addon-info';29import { withKnobs } from '@storybook/addon-knobs';30import { withThemesProvider } from 'storybook-addon-styled-component-theme';31import { withThemes } from 'storybook-addon-themes';32import { withTheme } from 'storybook-addon-theme';33import { withViewport } from '@storybook/addon-viewport';34import { withTests } from '@storybook/addon-jest';35import { withConsole } from '@storybook/addon-console';36import { withOptions } from '@storybook/addon-options';37import { withA11y } from '@storybook/addon-a11y';38import { withInfo } from '@storybook/addon-info';39import { withKn
Using AI Code Generation
1import { configure } from 'storybook-root';2configure(() => {3 require('./stories');4}, module);5import React from 'react';6import { storiesOf } from '@storybook/react';7import { action } from '@storybook/addon-actions';8storiesOf('Button', module)9 .add('with text', () => (10 <Button onClick={action('clicked')}>Hello Button</Button>11 .add('with some emoji', () => (12 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>13 ));14import React from 'react';15import PropTypes from 'prop-types';16import { Button } from '@storybook/react/demo';17export default Button;18import React from 'react';19import { storiesOf } from '@storybook/react';20import { action } from '@storybook/addon-actions';21import Button from './Button';22storiesOf('Button', module)23 .add('with text', () => (24 <Button onClick={action('clicked')}>Hello Button</Button>25 .add('with some emoji', () => (26 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>27 ));28import React from 'react';29import { storiesOf } from '@storybook/react';30import { action } from '@storybook/addon-actions';31import Button from './Button';32storiesOf('Button', module)33 .add('with text', () => (34 <Button onClick={action('clicked')}>Hello Button</Button>35 .add('with some emoji', () => (36 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>37 ));38import React from 'react';39import { storiesOf } from '@storybook/react';40import { action } from '@storybook/addon-actions';41import Button from './Button';42storiesOf('Button', module)43 .add('with text', () => (44 <Button onClick={action('clicked')}>Hello Button</Button>45 .add('with some emoji', () => (46 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>47 ));48import React from 'react';49import { storiesOf }
Using AI Code Generation
1const { configure } = require('storybook-root');2configure(require.context('../src', true, /\.stories\.js$/), module);3import { configure } from 'storybook-root';4configure(require.context('../src', true, /\.stories\.js$/), module);5const { createWebpackConfig } = require('storybook-root');6module.exports = createWebpackConfig();7import 'storybook-root/register';8import { addons } from '@storybook/addons';9import { create } from 'storybook-root';10addons.setConfig(create());11import { addDecorator, addParameters } from '@storybook/react';12import { create } from 'storybook-root';13addDecorator(create());14addParameters({15 options: {16 },17});
Using AI Code Generation
1import { configure } from "@storybook/react";2configure(require.context("../src", true, /\.stories\.js$/), module);3module.exports = (baseConfig, env, config) => {4 config.resolve.extensions.push(".ts", ".tsx");5 return config;6};7"scripts": {8}9I just ran into this issue. I am using the latest version of storybook (4.0.1) and the latest version of react (16.7.0-alpha.2). I was able to fix the issue by adding the following to my .storybook/config.js file:10import { configure } from '@storybook/react';11import { setOptions } from '@storybook/addon-options';12setOptions({
Using AI Code Generation
1const path = require('path');2const root = path.resolve(__dirname, '../../');3const getStorybookRoot = require(path.join(root, 'node_modules/@storybook/react/dist/server/getstorybook'));4const storybookRoot = getStorybookRoot(root);5const getStorybookConfig = require(path.join(storybookRoot, 'config'));6const storybookConfig = getStorybookConfig(storybookRoot);7const getStorybook = require(path.join(storybookRoot, 'getstorybook'));8getStorybook(storybookConfig);9const startStorybookServer = require(path.join(storybookRoot, 'start-storybook-server'));10const storybookServer = startStorybookServer(storybookConfig);11const startStorybookClient = require(path.join(storybookRoot, 'start-storybook-client'));12startStorybookClient(storybookServer, storybookConfig);13const buildStorybookStatic = require(path.join(storybookRoot, 'build-storybook-static'));14buildStorybookStatic(storybookConfig);15const serveStorybookStatic = require(path.join(storybookRoot, 'serve-storybook-static'));16serveStorybookStatic(storybookConfig);17const buildStorybook = require(path.join(storybookRoot, 'build-storybook'));18buildStorybook(storybookConfig);19const serveStorybook = require(path.join(storybookRoot, 'serve-storybook'));20serveStorybook(storybookConfig);21const buildStorybookStatic = require(path.join(storybookRoot, 'build-storybook-static'));22buildStorybookStatic(storybookConfig);23const serveStorybookStatic = require(path.join(storybookRoot, 'serve-storybook-static'));24serveStorybookStatic(storybookConfig);25const buildStorybook = require(path.join(storybookRoot, 'build-storybook'));26buildStorybook(storybookConfig);
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!