How to generate a single storybook for storybook 5 - storybook

The main build-storybook does not seem to accept a single storybook argument.
build-storybook --help
Usage: build-storybook [options]
Options:
-V, --version output the version number
-s, --static-dir <dir-names> Directory where to load static files from
-o, --output-dir [dir-name] Directory where to store built files
-c, --config-dir [dir-name] Directory where to load Storybook configurations from
-w, --watch Enable watch mode
-h, --help output usage information
Is it possible to make build-storybook only build one storybook specifically?

Related

Makefile "No such file or directory" when command is in PATH

I'm trying to write a Makefile in such a way that all of the steps in my recipe can call scripts a list of directories. As an example, I have node commands that are in a node_modules/.bin directory, but there could just as well be Python commands from a Python virtual environment as well, etc.
I have node installed, as well as TypeScript installed via npm in my /node_modules. Given my directory /tmp/test123, I wrote the following Makefile at /tmp/test123/Makefile as an example:
PATH = /tmp/test123/node_modules/.bin:$(PATH)
.PHONY: compile
compile:
env | grep "PATH"
tsc --help
However, if I try to run it, it outputs:
$ make compile
env | grep "PATH"
PATH=/tmp/test123/node_modules/.bin:... # the rest of my PATH
tsc --help
make: tsc: No such file or directory
make: *** [compile] Error 1
But if I change the last line to cd . && tsc --help, then compile runs successfully.
Why is make unable to find the tsc command in the PATH? Why do I need to run cd . && in front of it? Is there any better workaround than writing cd . && in front of all of my recipe steps?

Node Server missing css

I have a small node backend application used to: simple database operations, calling external services, and building emails. To build those templates I'm using Handlebars. Every email includes its own HTML and CSS files. In the development process, those files are available in runtime. But in the production build not. I noticed that the build command only touches *.js files. All other files are not built, and not visible in the build folder in the final step. In fact on production, only emails don't work. How to force node build command to compile also CSS, HTML files.
package.json build command:
"build": "babel src -d build",
build output:
src/constants/errorMessages.js -> build/constants/errorMessages.js
src/constants/index.js -> build/constants/index.js
src/index.js -> build/index.js
src/lib/email.js -> build/lib/email.js
src/lib/emailBuilder/index.js -> build/lib/emailBuilder/index.js
src/lib/index.js -> build/lib/index.js
src/lib/mongo.js -> build/lib/mongo.js
src/lib/responses.js -> build/lib/responses.js
src/resolvers/index.js -> build/resolvers/index.js
src/resolvers/message.js -> build/resolvers/message.js
src/resolvers/product.js -> build/resolvers/product.js
src/resolvers/stripe.js -> build/resolvers/stripe.js
src/sessionsObserver.js -> build/sessionsObserver.js
As you see there are not *.css | *.html files here.
I've found workaround. After build process im picking by bash script all HTML, CSS files and copy them to demanded directories:
#!/usr/bin/env bash
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
echo "Running build script"
rm -rf build
# compile is an alias to classic build
npm run compile
# create directories for HTML and CSS files
mkdir ./build/lib/emailBuilder/templates
mkdir ./build/lib/emailBuilder/styles
# Find and copy HTML templates
for FILE in $(find ./src -name '*.html'); do
cp $FILE ./build/lib/emailBuilder/templates
done
# Find and copy styles
for FILE in $(find ./src -name '*.css'); do
cp $FILE ./build/lib/emailBuilder/styles
done

Building Qt from source, qmake is invoke by their script with invalid parameters?

I am trying to get a boot2qt build environment setup. It's for an iMX53 - not that it should really matter when it comes to answering my question...
So, as part of the process I run their script called "build_qt.sh". That calls a nested configure script with a big pile of parameters. That script, in turn, builds qmake from source, and then tries to use the new qmake to build the rest of qt (from what it looks like?).
After a long battle, I got it to successfully create the qmake binary, but then the script ends by invoking that with all the parameters passed to the configure script. Qmake then fails because most of these parameters are not valid qmake options!
Here's an excerpt from build_qt.sh:
CONFIGURE_ARGS="${CONFIGURE_ARGS} \
-commercial -confirm-license -release \
-device ${DEVICE} \
-device-option CROSS_COMPILE=${WORKDIR}/tmp/sysroots/x86_64-linux/usr/bin/${COMPILER} \
-sysroot ${WORKDIR}/toolchain/sysroots/${SYSROOT} \
-no-xcb -separate-debug-info -silent -nomake examples -nomake tests -tslib -no-pch -v"
...
./configure ${CONFIGURE_ARGS}
At the end of the that configure script, it does this:
"$outpath/bin/qmake" "$relpathMangled" -- "$#"
Note the $#. That's where all those config arguments end up, which blows it up. Specifically, it complains about the first argument it gets that isn't intended for qmake.
Here's the actual statement it tries to execute:
/home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/bin/qmake /home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/qt5-src -- -commercial -confirm-license -release -device linux-imx53qsb-hf-g++ -device-option CROSS_COMPILE=/home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/tmp/sysroots/x86_64-linux/usr/bin/armv7ahf-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi- -sysroot /home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/toolchain/sysroots/armv7ahf-vfp-neon-poky-linux-gnueabi -no-xcb -separate-debug-info -silent -nomake examples -nomake tests -tslib -no-pch -v
And this is the result:
ERROR: Unknown command line option '-commercial'.
Here is the actual qmake binary help output, which defines the expected syntax:
Usage: ./bin/qmake [mode] [options] [files]
QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project
Mode:
-project Put qmake into project file generation mode
In this mode qmake interprets files as files to
be built,
defaults to *; *; *; *.ts; *.xlf; *.qrc
Note: The created .pro file probably will
need to be edited. For example add the QT variable to
specify what modules are required.
-makefile Put qmake into makefile generation mode (default)
In this mode qmake interprets files as project files to
be processed, if skipped qmake will try to find a project
file in your current working directory
Warnings Options:
-Wnone Turn off all warnings; specific ones may be re-enabled by
later -W options
-Wall Turn on all warnings
-Wparser Turn on parser warnings
-Wlogic Turn on logic warnings (on by default)
-Wdeprecated Turn on deprecation warnings (on by default)
Options:
* You can place any variable assignment in options and it will be *
* processed as if it was in [files]. These assignments will be *
* processed before [files] by default. *
-o file Write output to file
-d Increase debug level
-t templ Overrides TEMPLATE as templ
-tp prefix Overrides TEMPLATE so that prefix is prefixed into the value
-help This help
-v Version information
-early All subsequent variable assignments will be
parsed right before default_pre.prf
-before All subsequent variable assignments will be
parsed right before [files] (the default)
-after All subsequent variable assignments will be
parsed after [files]
-late All subsequent variable assignments will be
parsed right after default_post.prf
-norecursive Don't do a recursive search
-recursive Do a recursive search
-set <prop> <value> Set persistent property
-unset <prop> Unset persistent property
-query <prop> Query persistent property. Show all if <prop> is empty.
-qtconf file Use file instead of looking for qt.conf
-cache file Use file as cache [makefile mode only]
-spec spec Use spec as QMAKESPEC [makefile mode only]
-nocache Don't use a cache file [makefile mode only]
-nodepend Don't generate dependencies [makefile mode only]
-nomoc Don't generate moc targets [makefile mode only]
-nopwd Don't look for files in pwd [project mode only]
Note that the parent build_qt.sh script runs Make after this. Also, the qmake "default mode" is -makefile which will Put qmake into makefile generation mode (default). So, I'm pretty certain this command that is failing to execute is supposed to be writing a makefile (essentially this is a "configure script" inside another one).
Does anyone know what that command should be here?
Could someone run a similar instance of build_qt.sh for me and post what command is run here by their functional script? That would likely go a very long ways towards solving this.
Turns out the parent build_qt.sh script and the configure script come from different versions of Qt. They are not compatible! Older versions of Qt don't have this troublesome line:
"$outpath/bin/qmake" "$relpathMangled" -- "$#"
Instead they look like this:
"$outpath/bin/qmake" "$relpathMangled"
Which makes way more sense! I don't know why the current configure file has that funkiness in it, but it doesn't matter for me at the moment.

How to use existing QMake project (.pro project file) as "external project" in CMake?

Is there a concise doc or example for how to use an existing QMake project with .pro project file as an "external project" in CMake? This can somewhat be done in qtcreator by marking one project as dependency of another, but it would be nice to define it more explicitly with the ExternalProject() CMake syntax.
related question: CMake: How to build external projects and include their targets
Something like this works. You can then edit the files from either qtcreator in main CMake project tree, OR from opening the .pro file; great for iterating quickly on QT widgets in SomeGarbageApplication that is part of large cmake build tree.
macro(DeclareProjectFiles Tag Filez)
######### Trick: use this syntax to make arbitrary files
######### appear in IDE project. #######################
### Note: pass in the raw name of a list variable,
### since it will get expanded here in this macro.
add_custom_target(${Tag}_files ALL
pwd
COMMAND ls -ltrh
COMMENT " ${Tag} files thunk... got list: [ ${${Filez}} ]"
VERBATIM
SOURCES ${${Filez}}
)
endmacro()
message(STATUS "QT_QMAKE_EXE is: ${QT_QMAKE_EXECUTABLE}")
set(Z SomeGarbageApplication)
file(GLOB ${Z}_Files
./*.cpp
./*.h
./*.ui
./*.pro
./*.png
./*.jpg)
DeclareProjectFiles( ${Z}_grbg ${Z}_Files )
add_custom_target(${Z}_pro ALL)
set(ExtraQMakeArgs -r -spec linux-g++ CONFIG+=release)
# note: use killall because this can/will fail if the exe is running
# But, need || true to not fail build when it's not running.
add_custom_command(TARGET ${Z}_pro
COMMAND killall
ARGS -q -9 -v ${Z} || true
COMMAND ${QT_QMAKE_EXECUTABLE}
ARGS -query
COMMAND ${QT_QMAKE_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${Z}.pro ${ExtraQMakeArgs}
COMMAND make ${Z}
ARGS -j4
COMMAND cp
ARGS ${Z} ${CMAKE_CURRENT_SOURCE_DIR}/${${Z}_config} ${CMAKE_BINARY_DIR}/bin/
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
)
#################################################################

(How) Can I determine the version of the c99 compiler on my machine?

Is there a command line flag, or something similar, that I can use to get c99 to print it's version?
I'm looking for output similar to gcc's -v flag, which gives me:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
I really only care about the Target: line and the last line.
c99 --version
~$c99 --version
gcc (Debian 4.4.5-8) 4.4.5
also try c99 --help
~$ c99 --help
Usage: gcc [options] file...
Options:
-pass-exit-codes Exit with highest error code from a phase
--help Display this information
--target-help Display target specific command line options
--help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]
Display specific types of command line options
(Use '-v --help' to display command line options of sub-processes)
--version Display compiler version information
-dumpspecs Display all of the built in spec strings
-dumpversion Display the version of the compiler
-dumpmachine Display the compiler's target processor
-print-search-dirs Display the directories in the compiler's search path
-print-libgcc-file-name Display the name of the compiler's companion library
-print-file-name=<lib> Display the full path to library <lib>
-print-prog-name=<prog> Display the full path to compiler component <prog>
-print-multi-directory Display the root directory for versions of libgcc
-print-multi-lib Display the mapping between command line options and
multiple library search directories
-print-multi-os-directory Display the relative path to OS libraries
-print-sysroot Display the target libraries directory
-print-sysroot-headers-suffix Display the sysroot suffix used to find headers
-Wa,<options> Pass comma-separated <options> on to the assembler
-Wp,<options> Pass comma-separated <options> on to the preprocessor
-Wl,<options> Pass comma-separated <options> on to the linker
-Xassembler <arg> Pass <arg> on to the assembler
-Xpreprocessor <arg> Pass <arg> on to the preprocessor
-Xlinker <arg> Pass <arg> on to the linker
-combine Pass multiple source files to compiler at once
-save-temps Do not delete intermediate files
-pipe Use pipes rather than intermediate files
-time Time the execution of each subprocess
-specs=<file> Override built-in specs with the contents of <file>
-std=<standard> Assume that the input sources are for <standard>
--sysroot=<directory> Use <directory> as the root directory for headers
and libraries
-B <directory> Add <directory> to the compiler's search paths
-b <machine> Run gcc for target <machine>, if installed
-V <version> Run gcc version number <version>, if installed
-v Display the programs invoked by the compiler
-### Like -v but options quoted and commands not executed
-E Preprocess only; do not compile, assemble or link
-S Compile only; do not assemble or link
-c Compile and assemble, but do not link
-o <file> Place the output into <file>
-x <language> Specify the language of the following input files
Permissible languages include: c c++ assembler none
'none' means revert to the default behavior of
guessing the language based on the file's extension
Options starting with -g, -f, -m, -O, -W, or --param are automatically
passed on to the various sub-processes invoked by gcc. In order to pass
other options on to these processes the -W<letter> options must be used.

Resources