When initializing a react native project with react-native init NativeApp a new directory with a flat project structure is created.
I already have a project directory and I do not want to pollute the root directory excessively. What I want to achive is a root directory that looks like this:
MyProject
| - package.json
| - .gitignore
| - .gitattributes
| - README.md
| - .env
| - .git
| - Server
| | - server.js
| | - <other server files>
|
| - OtherProjectFolder
| - node_modules
| - NativeApp
| - android
| - ios
| - app.json
| - index.android.js
| - index.ios.js
| - ...
In words, I would like the react application to share package.json and node_modules etc. with the rest of my project, without keeping all the application files in the root directory.
Attempting to achieve this, I just moved the package.json, gitignore, node_modules and git files from the NativeApp directory to the MyProject directory, and used the command react-native run-android --root NativeApp, but then the build fails.
How do I reorganize the react native directory structure?
Related
I have a pnpm workspace with the following structure:
root
|- example
| |- package.json
|
|- packages
| |- a
| | |- package.json
| |
| |- b
| | |- package.json
| |
| |- c
| | |- package.json
The package c is a package that should contain a and b:
{
"name": "c",
"dependencies": {
"a": "workspace:*",
"b": "workspace:*"
}
}
package.json file in example looks like this:
{
"name": "example",
"dependencies": {
"c": "workspace:*"
}
}
When I do pnpm install it places only c dependency in example/node_modules - it does not install necessary packages a and b.
What do I have to do to have all nested dependencies installed correctly?
They are installed correctly. The c inside root/example/node_modules is a symlink to root/packages/c. The dependencies of c are symlinked to root/packages/c/node_modules.
I have a project called Alexandria that I want to upload on PyPi as a package. To do so, I have a top folder called alexandria-python in which I put the package and all the elements required to create a package archive with setup.py. The folder alexandria-python has the following structure:
|- setup.py
|- README.md
|- alexandria (root folder for the package)
|- __init__.py
|- many sub-packages
Then, following many tutorials to create an uploadable archive, I open a terminal, cd to alexandria-python, and use the command:
python setup.py sdist
This creates additional folders, so the structure of alexandria-python is now:
|- setup.py
|- README.md
|- alexandria (root folder for the package)
|- __init__.py
|- many sub-packages
|- alexandria.egg-info
|- dist
everything looks fine, and from my understanding the package should now be archived in the dist folder. But when I open the dist folder and extract the alexandria-0.0.2.tar.gz archive that has been created, it does not contain the 'alexandria' package. Everything else thus seems to be there, except the most important element: the package, as shown on the image:
Following, when I upload the project to test-PyPi and then pip install it, any attempt to import a module from the toolbox results in a ModuleNotFoundError. How is it that my package does not get uploaded to the archive? Am I doing something very silly?
Note: in case it can help, this is the structure of my setup.py file:
from setuptools import setup
# set up the package
setup(
name = "alexandria",
license = "Other/Proprietary License",
version = "0.0.2",
author = "Romain Legrand",
author_email = "alexandria.toolbox#gmail.com",
description = "a software for Bayesian time-series econometrics applications",
python_requires = ">=3.6",
keywords=["python", "Bayesian", "time-series", "econometrics"])
Your setup.py has neither py_modules nor packages. Must have one of those. In your case alexandria is a package so
setup(
…
packages = ['alexandria'],
…
)
or
from setuptools import find_packages, setup
…
packages = find_packages('.')
In my project I am using MAP_IMPORTED_CONFIG_FINAL for an external library for a custom configuration FINAL. Is there some working example of how to set the target_link_directories for an imported target for the custom configuration FINAL using cmake.
So here are the steps :
The external library is boost-1.67.0 which I am installing using the following commands for Debug and Release respectively:
.\bootstrap.bat
.\b2 install --prefix=C:\Dev\third-party\vs2017\boost-1.67.0\Debug toolset=msvc-14.1 address-model=64 link=static -j8 variant=debug
.\b2 install --prefix=C:\Dev\third-party\vs2017\boost-1.67.0\Release toolset=msvc-14.1 address-model=64 link=static -j8 variant=release
Here is the example project with following structure
boost-example/
|
+-- main.cpp
|
+-- CMakeLists.txt
|
|
+-- CMake/
| |
| +-- AddConfiguration.cmake
| +-- mpIncludeBoost.cmake
| +-- mpSetupMSVCRuntime.cmake
| +-- SetupConfigurations.cmake
The files are found in this gitlab project: https://gitlab.com/sunayanag/boost-example.
For the sln file generated note that in Visual Studio in the Linker section in Additional Library Directories I get C:/Dev/third-party/boost-1_67_0/install/lib/$(Configuration) which evaluates to C:/Dev/third-party/boost-1_67_0/install/lib/Final but this directory does not exist since Final is not a valid configuration of boost, it should be C:/Dev/third-party/boost-1_67_0/install/lib/Release instead.
I was thinking a way of getting around this would be to use target_link_directories but how do I use this with cmake generator expressions in this case.
Thanks
I came into a eslint problem.
Generally, we have src folder side by side with package.json, like this:
|-projectName
|- src
|- .eslintrc.js
|- package.json
|- vue.config.js
Then i want to take compiling scripts and business code apart into different folders, and to enable them to be linted, i put two '.eslintrc.js' files in each, like this:
|- projectName
|- runtime
|- babel.config.js
|- .eslintrc.js
|- package.json
|- vue.config.js
|- business
|- .eslintrs.js
|- src
|- main.js
|- index.html
|- ...
Then i found eslint turns into chaos:
When i ran 'npm run build', eslint firstly linted files in 'runtime' folder as '.eslintrc.js' in it,
and then vue-cli-service came into building stage, which called eslint again as '.eslintrc.js' in 'template' folder,
but at last the vue-cli-service still finished building even if eslint throws errors, which should stopped building.
The output was like this:
✖ 7 problems (4 errors, 3 warnings)
3 errors and 3 warnings potentially fixable with the `--fix` option.
# ../template/src/store/index.js 14:0-34 18:10-14
# ../template/src/main.js
# multi ../template/src/main.js
...
File Size Gzipped
../template/build/apps/local/0/js/chun 174.42 KiB 58.47 KiB
k-vendors.9db3f582.js
...
DONE Build complete. The ../template/build directory is ready to be deployed.
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
I don't know why this happened? Is there someting wrong with eslint config? I just put two '.eslintrc.js' files generated by 'vue craete' command in two different folders , and configure right paths in vue.config.js, like this:
// vue.config.js
...
outputDir: path.resolve(__dirname, '../template/build'),
pages:{
index: {
entry: path.resolve(__dirname, '../template/src/main.js')
}
}
...
My project is structured as follows
ProjDir
| - CMakeLists.txt
| - SubDir1
| | - CMakeLists.txt
| | - src
| | - inc
| - SubDir2
| | - CMakeLists.txt
| | - src
| | - inc
I have targets in each subdirectory and the subdirectories are included in the main CMakeLists.txt as follows.
add_subdirectory(${CMAKE_SOURCE_DIR}/SubDir1)
add_subdirectory(${CMAKE_SOURCE_DIR}/SubDir2)
My targets in each subdirectory are installed with the cmake function install. These commands are in the CMakeLists.txt of respective subdirectories and are specified per-target (see this post).
install(TARGETS exe1 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin CONFIGURATIONS Release)
While I'm able to successfully compile, the install command doesn't move the binaries to ${CMAKE_INSTALL_PREFIX}/bin but rather finishes after generated the output:
Install the project...
-- Install configuration: ""
How could I resolve this?
On Linux, default build configuration is empty: neither debug, nor release, etc. It can be easily found from the CMake output:
-- Install configuration: ""
Because your install command is "tagged" with Release configuration, it is not triggered by default (with empty configuration).