I have a readme file which has docs for the folder, the contained libs and how to use them.
The readme is not part of any lib and so nx-lint throws this error:
NX ERROR The following file(s) do not belong to any projects:
- libs/global/README.md
How can we suppress this error?
Notes:
I don't want to move the file into a lib - the current location is correct
I don't want to add something to the readme that is visible
Ideally we only suppress this specific error for this file
I tried to use exclude in the top-level tslint.json like this:
{
"exclude": [
"libs/global/*.md"
]
}
You can use the file .nxignore in the project root to fix this:
$ yarn lint
yarn run v1.22.4
$ nx workspace-lint && nx lint
> NX ERROR The following file(s) do not belong to any projects:
- libs/global/README.md
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ echo libs/global/README.md >> .nxignore
$ yarn lint
yarn run v1.22.4
$ nx workspace-lint && nx lint
Linting "server"...
All files pass linting.
✨ Done in 2.45s.
Related
enter image description here
node_modules/#openspacelabs/react-native-zoomable-view/src/animations/index.ts:2:23 - error TS2307: Cannot find module 'src/typings' or its corresponding type declarations.
2 import { Vec2D } from 'src/typings';
~~~~~~~~~~~~~
when i build project with "npm run build" after clean cd android && ./gradlew clean
I'm using CMake v3.21.0 to invoke Qt's windeployqt during the install stage by the means of the install(CODE) command as follows:
install(
CODE "
execute_process(
COMMAND \"${CMAKE_COMMAND}\" -E
env PATH=\"${windeployqt_ROOT_DIR}\"
\"${windeployqt_EXECUTABLE}\"
# TODO(2021-08-25 by wolters): This is a different path when CPack is`
# used. How to check for this case and obtain the correct output path?
--dir \"${CMAKE_INSTALL_PREFIX}/${args_INSTALL_SUFFIX}\"
--no-quick-import
--no-system-d3d-compiler
--no-virtualkeyboard
--no-compiler-runtime
--no-webkit2
--no-angle
--no-opengl-sw
--verbose 0
\"\$<TARGET_FILE:${args_TARGET}>\"
)
"
COMPONENT runtime
)
This works fine if installing the project:
cmake --build . --config RelWithDebInfo --target install
But when creating a CPack package the files created by windeployqt are not part of the package (ZIP in this case):
cpack -G ZIP -C RelWithDebInfo -D CPACK_COMPONENTS_ALL="runtime"
I know that the issue is the usage of ${CMAKE_INSTALL_PREFIX} in the CODE.
For the install target this is correct.
For the package target this is not correct. Instead the build directory for the current CPack generator should be used, e.g. ${CMAKE_CURRENT_BINARY_DIR}/_CPack_Packages/win64/ZIP/${CPACK_PACKAGE_FILE_NAME}.
My questions are:
Is there a way to differentiate between install and package target in the CODE section? (pseudo-code: if(CMAKE_IS_PACKAGING))
If there is a way: Is it possible to obtain or dynamically build the directory path to the actual CPack temporary "install" directory?
If both problems can be solved the files generated by windeployqt should be part of the packages generated by CPack.
The variable CMAKE_INSTALL_PREFIX should not be expanded in the CMakeLists.txt, as you are doing. Its actual value at invocation time is available inside the install(CODE) fragments.
Consider the following snippet:
cmake_minimum_required(VERSION 3.21)
project(test NONE)
install(CODE [[message(STATUS "HERE: ${CMAKE_INSTALL_PREFIX}")]])
Note that [[ ... ]] escapes variable expansions (you could also use backslashes). Now if you configure this project with -DCMAKE_INSTALL_PREFIX=/tmp/install, you'll see the message print as you expect.
$ cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/tmp/install
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/test/build
$ cmake --build build/ --target install
[0/1] Install the project...
-- Install configuration: ""
-- HERE: /tmp/install
If you now run the install script again without reconfiguring or rebuilding, it will still work:
$ cmake --install build/ --prefix /tmp/other-prefix
-- Install configuration: ""
-- HERE: /tmp/other-prefix
This is how CPack runs your install rules. It does not use the configuration-time value of CMAKE_INSTALL_PREFIX. It expects your project to be relocatable (i.e. bug-free).
I've installed npm (v4.4.4) and babel (v6.24.0) and babel preset 2015.
All running OK when converting ES6 JS to ES5...except a couple of oddities. Maybe someone can see what this newbie is doing wrong.
1) I run babel from npm (see below) which runs OK. I added some script entries into package.JSON to make it work.
But, UNWANTED oddity...npm inserts the commands into the output JS file. (See below) Is there an npm option to say, don't put the command in the output file.
Yet....if I copy input.JS to the folder with babel.cmd and run it there, I get a clean output.JS. So it looks like npm is inserting the command lines into the output.js file.
How do I prevent the npm commands being written to output.js. (Obviously I don't want to have my JS files having to share a folder with the .bin files)
2) When I type > babel on the command line in my project folder, I get:
babel: not a command.
I EXPECT THIS. After all, I have not added node_modules/.bin to my PATH env var. Yet every YouTube video I watch about npm and babel, it works. How? No one seems to edit the PATH env var. Am I missing something?
Thanks
Milton.
INPUT JS FILE (input.js)
class House {
constructor(v) {
this.name = v;
}
}
OUTPUT JS (TRANSPILED) FILE (output.js) Note 1st 2 lines below...
> milton#1.0.0 babel C:\Projects1\01InstallReact4Dev
> babel.cmd "--presets" "es2015" "input.js"
"use strict";
function _classCallCheck(instance, Constructor)
{ if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var House = function House(v) {
_classCallCheck(this, House);
this.name = v;
};
PACKAGE.JSON
"scripts": {
"babel": "babel.cmd",
"babelv": "babel.cmd -V",
"babelh": "babel.cmd -help"
}
COMMAND
> npm run babel -- --presets es2015 input.js > output.js
Thanks Again.
Milton.
You're redirecting the output of stdout to the file output.js, this includes everything that is displayed. Instead of using the stdout output of babel you can use the --out-file or -o option. This will write the output to the specified file instead of printing it to stdout (see Compile Files).
Your command would be:
npm run babel -- --presets es2015 input.js --out-file output.js
When I type > babel on the command line in my project folder, I get: babel: not a command.
You don't have node_modules/.bin/ in your shells PATH. You could add it or run it directly with ./node_modules/.bin/babel. But this is not necessary if you do it in an npm script, because npm will automatically look into node_modules/.bin/ without it being in your PATH. In this case you could define the following script:
"scripts": {
"build": "babel --presets es2015 input.js --out-file output.js"
}
And then you can simply run:
npm run build
If you'd like to transpile more than one file you should use --out-dir instead of --out-file otherwise they will be concatenated into one file. See also Compile Directories
I copied the js files from project https://github.com/videojs/video.js into a subfolder of my project.
I set up plenty dependencies and called browserify on the command line:
node ./node_modules/browserify/bin/cmd.js dev\videojs\js\video.js -t [ babelify ]
The output looks like:
Error: D:/Webs/videojs/dev/videojs/js/video.js: Cannot find module '../../package.json' from 'D:\Webs\videojs\dev\videojs\js'
at Function.module.exports [as sync] (D:\Webs\videojs\node_modules\resolve\lib\sync.js:33:11)
at PluginPass.MemberExpression (D:\Webs\videojs\node_modules\babel-plugin-inline-json\lib\index.js:27:45)
at newFn (D:\Webs\videojs\node_modules\babel-traverse\lib\visitors.js:276:21)
at NodePath._call (D:\Webs\videojs\node_modules\babel-traverse\lib\path\context.js:76:18)
at NodePath.call (D:\Webs\videojs\node_modules\babel-traverse\lib\path\context.js:48:17)
at NodePath.visit (D:\Webs\videojs\node_modules\babel-traverse\lib\path\context.js:105:12)
at TraversalContext.visitQueue (D:\Webs\videojs\node_modules\babel-traverse\lib\context.js:150:16)
at TraversalContext.visitSingle (D:\Webs\videojs\node_modules\babel-traverse\lib\context.js:108:19)
at TraversalContext.visit (D:\Webs\videojs\node_modules\babel-traverse\lib\context.js:192:19)
at Function.traverse.node (D:\Webs\videojs\node_modules\babel-traverse\lib\index.js:114:17)
When I move the files one folder up, the command runs and and transpiles all the files.
I now wonder where this error comes from. babel-traverse seemingly loops through the plugins and eventually finds out it's being run not exactly 3 levels below the project root. Is this intended behaviour? It this a matter of babel, browserify, a plugin or videojs?
Use this command instead:
./node_modules/.bin/browserify dev\videojs\js\video.js -t [ babelify ]
When Browserify is installed, the command line scripts are added to node_modules/.bin, as that's the standard practice. It's those commands that you should be running; not the scripts in Browserify's own bin directory.
Note that the scripts are either shell scripts or Windows CMD scripts and that they are not run using node.
Or, if you add the following to your package.json, you can run Browserify using NPM (also standard practice):
{
...
"scripts": {
"browserify": "browserify"
}
}
and the command would then be:
npm run browserify dev\videojs\js\video.js -t [ babelify ]
Or, if you want to keep the parameters in the "scripts" configuration:
{
...
"scripts": {
"bundle": "browserify dev/videojs/js/video.js -t [ babelify ]"
}
}
and:
npm run bundle
I'm trying to compile the "Source Code (.c)" example from this tutorial.
I have installed mruby using rbenv: rbenv install mruby-1.2.0
I get an error when trying to compile the program:
$ gcc -std=c99 -Imruby/include test_program.c -o test_program
test_program.c:1:10: fatal error: 'mruby.h' file not found
#include "mruby.h"
^
1 error generated.
How am I supposed to reference the mruby library when installing via rbenv/ruby-build?
Seems like rbenv install mruby-1.2.0 doesn't install header files of mruby(it's only a dump of build/host directory after mruby is built):
% ls $(rbenv prefix mruby-1.2.0)
LEGAL bin lib mrbgems mrblib src
You need
# get mruby's code
git clone https://github.com/mruby/mruby.git mruby
# build mruby
cd mruby && rake
# go back to directory of `test_program.c`
cd ..
before test_program.c's compilation instead.
And you need mruby/build/host/lib/libmruby.a -lm compile options too.
add -lm
in mruby is /include directory in my source is possible -I mruby_directory/include
next add ~/mruby/build/host/lib/libmruby.a