Use specific package name when setting up a react-native project - react-native

When creating a react-native app with react-native init MyApp the Android and iOS package names are automatically set to com.myapp.
Changing the Android package name (especially if you need something longer like com.organisation.propject.app) later in the development is pretty fiddly and I was wondering if there was a way to set the package name when setting up a project with react-native init?

Note: it's working only in RN 0.37 and maybe one or two versions up, in 0.40+ this feature was removed.
You need to specify a --package option:
$ react-native init MyApp --package=com.organization.project.app

The below worked for me. Substitute your own app name for "Foo App" and your own package name for org.newpackage.app.
NEW_APP_NAME="Foo App"
NEW_PACKAGE_NAME=org.newpackage.app
OLD_PACKAGE_NAME=org.reactjs.native.example
npx react-native init rndemo && \
cd rndemo && \
npx react-native-rename "${NEW_APP_NAME}" -b ${NEW_PACKAGE_NAME} && \
rm -rf ios/Pods && \
pod install --project-directory=./iOS && \
grep -rl ${OLD_PACKAGE_NAME} * | \
xargs sed -i '.bak' "s/${OLD_PACKAGE_NAME}/${NEW_PACKAGE_NAME}/g"
I've created a gist that does this, prompting interactively for the app name and package name. The gist is a tiny bit more sophisticated, in that (in the above example) it would initially create the app fooapp instead of rndemo.
Explanation:
Create a react-native app. It's called rndemo temporarily; we need to know what it's going to be called so we can change to it.
Run react-native-rename to rename the new project to whatever you specified; this lets us replace the package name too.
Remove the installed cocoa pods and reinstall them (so they'll pick up the new folder locations etc).
Search for the default package name org.reactjs.native.example and replace it with your new package name. Currently this will only find ios/FooApp.xcodeproj/project.pbxproj. The old project.pbxproj file will be saved with a '.bak' extension. This step would probably be better done with find . -name project.pbxproj -exec ..... but this was good enough for my needs.

Related

Renaming react-native projetc works but give me a warning

After some research I renamed my cloned react native project and it works but I got a warning message, I'm worried about future problems because this message mainly for Google Play publishing and security.
The process was:
# PowerShell7:
cd C:\myDevFolder
rm -R C:\myDevFolder\myNewProjectName
git clone https://github.com/someRepo0000001/someProj00001.git myNewProjectName
cd C:\myDevFolder\myNewProjectName
# replace every myOLDProjectName for myNewProjectName on every file
cd .\android\app\src\main\java\com\
mv .\myOLDProjectName\ .\myNewProjectName\
cd C:\myDevFolder\myNewProjectName
cd .\ios\
mv .\myOLDProjectName\ .\myNewProjectName\
mv .\myOLDProjectName-tvOS\ .\myNewProjectName-tvOS\
mv .\myOLDProjectName-tvOSTests\ .\myNewProjectName-tvOSTests\
mv .\myOLDProjectName.xcodeproj\ .\myNewProjectName.xcodeproj\
mv .\myOLDProjectName.xcworkspace\ .\myNewProjectName.xcworkspace\
mv .\myOLDProjectNameTests\ .\myNewProjectNameTests\
cd C:\myDevFolder\myNewProjectName
yarn
npx react-native run-android
The warning message was:
warn Invalid application's package name "com.myNewProjectName" in
'AndroidManifest.xml'. Read guidelines for setting the package name here:
https://developer.android.com/studio/build/application-id
Others rename process I found dont works, including the most viewed page about it here:
Renaming a React Native project?
There multiple places where you should replace the old name with the new one
So as an easy solution change the name with react-native-rename package
react-native-rename "new name"
and reset the cache

sass --watch : could not find option named "watch"

Simple one, but could not find the answer anywhere online! Installed sass globally (npm install -g sass) on my Mac.
This works as expected:
sass style.scss style.css
Then I try:
sass --watch style.scss:style.css
And get:
Could not find an option named "watch".
Usage: sass <input> [output]
--[no-]stdin Read the stylesheet from stdin.
--[no-]indented Use the indented syntax for input from stdin.
-I, --load-path=<PATH> A path to use when resolving imports.
May be passed multiple times.
-s, --style=<NAME> Output style.
[expanded (default), compressed]
-c, --[no-]color Whether to emit terminal colors.
-q, --[no-]quiet Don't print warnings.
--[no-]trace Print full Dart stack traces for exceptions.
-h, --help Print this usage information.
--version Print the version of Dart Sass.
What am I missing??
Thanks!!
First create the SASS's folder, and in there create your SASS's file. Example:
sass/styles.sass
In your project root folder, open the console and type the command:
sass --watch sass/styles.sass:css/styles.css
This command will create your CSS's folder and CSS's file. In addition to compiling your .sass content for your .css.
In the end, I gave up on sass as tried above, and went for a solution with webpack.
Another option I tried which worked was to use node-sass.
I solved running this command on your terminal
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
i hope that help

How do I remove CLion-2016.2.3 completely from Ubuntu 16.04 LTS?

I had installed CLion(2016.2.3) IDE from CLion-2016.2.3.tar.gz file. I accidentally deleted the CLion-2016.2.3.tar.gz file and CLion-2016.2.3 folder(which I got after extracting CLion-2016.2.3.tar.gz). Now CLion isn't working. When I ran dpkg --list from terminal, CLion wasn't present in the output. I want to remove CLion completely(all its files, folders, dependencies, etc.(even the configuration files)). How do I remove it completely?
Run the following command in terminal to find all the directories and files containing clion in their name :-
$ sudo find . -iname "*clion*"
Then delete the directories and files you have found.
To delete directories/files, go to the location of that directory/file in terminal using cd and run the following command :-
$ sudo rm -rf DIRECTORY_NAME/FILE_NAME
Simple Steps are :
Delete the clion folder you have downloaded and extracted.
Remove cache in ~/. using the command : sudo rm -r ~/.Clion.
Also need remove settings: /home/user/.config/JetBrains
You need also to remove settings that are stored in ~/. directory. That's it for Unix/Linux.
All Clion's binaries are store inside the folder you deleted.
But Clion sets up preferences at first launch, and you may have a menu icon which is pointing nowhere.
I suggest you run something like find ~ -iname "*clion*" and investigate what is found. If you are using Gnome2 or MATE desktop you will certainly find .desktop files which are the icons you are looking for.
If you used snap to install you can uninstall using
sudo snap remove --purge clion

output file after docker image is created through Dockerfile

I'm creating a Dockerfile to build my docker image. I was wondering what the best way, or if it's even possible, to create a log file of some sort that can show the results of the build and see if there were any errors in the process. For example, right now I have this:
monoVersion="3.8.0"
mkdir ~/mono
curl http://download.mono-project.com/sources/mono/mono-$monoVersion.tar.bz2 | tar xj --strip-components 1 -C ~/mono
cd ~/mono
git apply /src/mono-fix-20131106.patch
./configure --prefix=/usr/local
make -j 2
make install
in a install.sh script. In my Dockerfile I have:
FROM centos
MAINTAINER crystaltwix
ADD . /src
RUN cd /src ; ./install.sh
I'd like a way that I can look at the output after the image is created so every time I grab a different version of Mono, or do something similar when creating a new iamge, I can look after the image is created to see if any errors were generated. Is this possible? Or is that "connection" to the image being built closed once the Dockerfile is completed. Thank you.
One approach that I have been seeing for years (well before docker though docker makes it easier) is to have the script save it's output to a build log with the resulting image so that when you use the image and find a bug you can be sure you know hot this image was created.
RUN cd /src ; ./install.sh | tee buildlog

Uninstall Mono from Mac OS X v10.5 Leopard

I installed Mono on my iMac last night and I immidiately had a change of heart! I don't think Mono is ready for prime time.
The Mono website says to run the following script to uninstall:
#!/bin/sh -x
#This script removes Mono from an OS X System. It must be run as root
rm -r /Library/Frameworks/Mono.framework
rm -r /Library/Receipts/MonoFramework-SVN.pkg
cd /usr/bin
for i in `ls -al | grep Mono | awk '{print $9}'`; do
rm ${i}
done
Has anyone had to uninstall Mono? Was it as straight forward as running the above script or do I have to do more? How messy was it? Any pointers are appreciated.
The above script simply deletes everything related to Mono on your system -- and since the developers wrote it, I'm sure they didn't miss anything :) Unlike some other operating systems made by software companies that rhyme with "Macrosoft", uninstalling software in OS X is as simple as deleting the files, 99% of the time.. no registry or anything like that.
So, long story short, yes, that script is probably the only thing you need to do.
Year 2017 answer for those, like myself, looking at SE first and official docs later (FYI I know the question was for OS Leopard). Run these commands in the terminal:
sudo rm -rf /Library/Frameworks/Mono.framework
sudo pkgutil --forget com.xamarin.mono-MDK.pkg
sudo rm -rf /etc/paths.d/mono-commands
Seems the uninstall script has been slightly modified as today (2011-07-12):
#!/bin/sh -x
#This script removes Mono from an OS X System. It must be run as root
rm -r /Library/Frameworks/Mono.framework
rm -r /Library/Receipts/MonoFramework-*
for dir in /usr/bin /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man5; do
(cd ${dir};
for i in `ls -al | grep /Library/Frameworks/Mono.framework/ | awk '{print $9}'`; do
rm ${i}
done);
done
You can find the current version here.
By the way: it's the same exact thing that runs the uninstaller mentioned by joev (although as jochem noted it is not located in the /Library/Receipts, it must be found in the installation package=.
To expand on feelingsofwhite.com's answer, the Mono installer for Mac OS puts the uninstall script in the /Library/Receipts directory, not in the installer image as it says in the Notes.rtf file. The Receipts directory is what the Mac OS Installer.app uses to keep track of which packages were responsible for installing which files. Usually, a list of these is kept in a .bom ("Bill of Materials") file, which can be explored with the lsbom command.
In the case of Mono, they also add a whole bunch of links from your /usr/bin and man directories. Their uninstall scripts finds these and removes them. Since the uninstall script lives in a place the uninstaller deletes, you should probably copy the uninstall script somewhere else before running it:
cd
cp /Library/Receipts/MonoFramework-2.4_7.macos10.novell.universal.pkg/Contents/Resources/uninstallMono.sh .
sudo ./uninstallMono.sh
rm uninstallMono.sh
http://dragthor.wordpress.com/2007/07/24/uninstall-mono-on-mac-os-x/
Work for me, OSX, But I Use the uninstall script file (.sh) from the Mono Installer Package.
Mono doesn't contain a lot of fluff, so just running those commands will be fine. It's as simple as deleting all the data folders, and the binaries.
I just deleted the mono.frameworks folder. I got tired of answering "yes" billions of times...