-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow initialising project with custom package name with init --package-name
#1808
feat: allow initialising project with custom package name with init --package-name
#1808
Conversation
Can we have some tests for this? |
861e3f0
to
515b6d3
Compare
name: '--package-name <string>', | ||
description: | ||
'Inits a project with a custom package name (Android) and bundle ID (iOS), e.g. com.example.app', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add this to docs 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
tests added ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
fs.rename( | ||
`${filePath}/${segmentsList.join('.')}`, | ||
`${filePath}/${segmentsList[segmentsList.length - 1]}`, | ||
); | ||
|
||
for (const segment of segmentsList) { | ||
fs.mkdirSync(segment); | ||
process.chdir(segment); | ||
} | ||
|
||
fs.rename( | ||
`${filePath}/${segmentsList[segmentsList.length - 1]}`, | ||
process.cwd(), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those renames can fail and createAndroidPackagePaths
also isn't guarded by try/catch, so the user would be left blind when fs.rename
throws. Please make sure to guard this case
init --package-name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one comment and looks good. Thanks for the test! :)
51e8128
to
3f8e712
Compare
can we have an example for this? I tried this npx react-native@latest init [APP_NAME] --package-name [PACKAGE_NAME] --title [APP_TITLE] but it doesn't work |
Hey @bryanltobing, what error you get if you try this command? And also could you please provide output from |
it does work now. sorry for the inconvenient |
packages only can start by "com"? can be changed as user sets? for example if domain start with "org" or by country domain |
hi @javier8340, it was fixed in #1915 |
Summary:
Closes #1269
Relates to #1111
Added
--package-name
option toinit
command, which allows initialising project with custom package name for Android and iOS.Test Plan:
Use
init
command with--package-name
option:example
,[email protected]
--package-name example.app
- project should be initialised withcom.example.app
Android package name and iOS bundleID--package-name com.example.app
- project should be initialised withcom.example.app
Android package name and iOS bundleIDFor 2. and 3., app should be installed on the device/emulator named by project name - not package name.