Git Product home page Git Product logo

onatcipli / rename Goto Github PK

View Code? Open in Web Editor NEW
161.0 3.0 39.0 518 KB

The Rename CLI Tool is a utility designed to modify your Flutter project's AppName and BundleId across various platforms, such as iOS, Android, Macos, Linux, Windows and Web

Home Page: https://pub.dev/packages/rename

License: MIT License

Dart 53.58% Kotlin 0.12% Swift 1.71% Objective-C 0.04% CMake 18.53% C++ 22.78% C 1.41% HTML 1.83%
android cli dart flutter ios linux macos web windows

rename's Introduction

Rename CLI Tool v3

GitHub issues GitHub pull requests GitHub contributors GitHub

Warning

  • This package may not be compatible with a flavor setup.
  • The API has undergone significant changes; many elements have been deprecated. Please refer to the usage section for the updated functionalities.

About

The Rename CLI Tool is a utility designed to modify your Flutter project's AppName and BundleId across various platforms. The supported platforms include:

  • IOS
  • Android
  • MacOS
  • Linux
  • Web (only app name related functionality)
  • Windows

Installation

To install the Rename CLI Tool, execute the following command:

flutter pub global activate rename

Running a Script

You can run a script directly using rename from the activated package through the command line. If facing any issues, alternate commands are dart pub global run rename or flutter pub global run rename. For path variable issues, refer to ensuring your path variables are set up correctly.

Usage

Please ensure you are in the Flutter project root directory before executing any commands. The tool supports various commands for retrieving and setting the AppName and BundleId:

Help

Display general help or command-specific help using:

rename help
A CLI tool that helps for renaming in Flutter projects.

Usage: rename <command> [arguments]

Global options:
-h, --help       Print this usage information.
-v, --version    

Available commands:
  getAppName    Get app names for the targeted platforms
  getBundleId   Get bundleId identifiers for the targeted platforms
  setAppName    Set app name for the targeted platforms
  setBundleId   Set bundleId identifier for the targeted platforms

Run "rename help <command>" for more information about a command.

or for a specific command:

rename help <commandName>
Example output for 'rename help setAppName':
Set app name for the targeted platforms

Usage: rename setAppName [arguments]
-h, --help                 Print this usage information.
-t, --targets              Set which platforms to target.
                           [ios (default), android (default), macos, linux, web, windows]
-v, --value (mandatory)    Set value of the given command

Run "rename help" to see global options.

Get AppName

To retrieve the current AppName for a specific platform:

rename getAppName --targets ios
This will output the current AppName for the iOS platform.

or for multiple targets:

rename getAppName --targets ios,android,macos,windows,linux

Set AppName

To set the AppName for specific platforms:

rename setAppName --targets ios,android --value "YourAppName"
This will set the AppName for the iOS and Android platforms to "YourAppName".

Get/Set BundleId

Similarly, use getBundleId and setBundleId to retrieve or set the BundleId for the specified platforms.

rename getBundleId --targets android
This will output the current BundleId for the Android platform.
rename setBundleId --targets android --value "com.example.bundleId"
This will set the BundleId for the Android platform to "com.example.bundleId".

Parameters

Commands

  • setAppName: Change the App Name for the given --targets. The --value option is required.
  • setBundleId: Change the bundle identifiers for the given --targets. The --value option is required.
  • getAppName: Display the app names for the given --targets.
  • getBundleId: Display the bundle identifiers for the given --targets.

Options

  • -t, --targets: Specify the target platforms. Options include android, ios, web, windows, macos, linux. This parameter is mandatory for all commands.
  • -v, --value: Set the value for the specified command. Mandatory for setAppName and setBundleId.
  • -h, --help: Display available instructions for the related command.

Upcoming Features

License

This project is licensed under the MIT License. Refer to the LICENSE file for details.

Contributing

Contributions are welcome! Please refer to our contributing guidelines to get started.

Changelog

For all notable changes to this project, refer to the CHANGELOG.

Support

For any issues or suggestions, please open an issue. Your feedback is highly appreciated.

Author

This project is created and maintained by Onat Çipli.

Troubleshooting

Command Not Working on Windows

If you encounter issues running the rename command directly in Windows, especially from a non-administrator terminal, you might need to use an alternative command format. This issue can arise due to permission restrictions or path variable misconfigurations.

Try executing the command using one of the following formats:

  • Using Flutter:
    flutter pub run rename <command> [arguments]
  • Using Dart:
    dart run rename <command> [arguments]

These alternative commands explicitly invoke the rename tool through the Dart or Flutter toolchain, which can bypass some of the path or permission issues encountered in certain Windows configurations.

rename's People

Contributors

azisyus avatar bbjay avatar iahmadamin avatar jilexandr avatar jpnurmi avatar onatcipli avatar pin73 avatar tonyhoylerps avatar webdastur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rename's Issues

Incorrect command syntax

image

I had previously used the same package to change the app name and bundleID, however now it doesn't seem to work..

change launcher icon

this is a very great tool! how do i change the launcher icon? thank you so much.

Default Usage commands not working

> pub global run rename --appname "appName"     
pub : The term 'pub' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling 
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pub global run rename --appname "appName"
+ ~~~
    + CategoryInfo          : ObjectNotFound: (pub:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

So the lines in the readme file

    pub global run rename --bundleId com.onatcipli.networkUpp
    pub global run rename --appname "Network Upp"

Need to become

    flutter pub global run rename --bundleId com.onatcipli.networkUpp
    flutter pub global run rename --appname "Network Upp"

image

Getting "No active package rename"

From my root folder I'm running: pub global run rename --bundleId com.dreamalytics.dreamapp which gives me the response "No active package rename". What does that mean?

Rename plugin

can this be used to rename plugin or package names?

command not found.

when i add pub global activate rename it says
zsh: command not found: pub

also with rename it says
zsh: command not found rename

zsh: command not found: pub

if you got this error just add flutter before pub
for example; if you get error with pub global run rename --appname "Network Upp", try this; flutter pub global run rename --appname "Network Upp"

Windows main.cpp needs rename as well

Windows rename should also change the window name in windows\runner\main.cpp

...
  Win32Window::Size size(1280, 720);
  if (!window.Create(L"Untitled", origin, size)) {
    return EXIT_FAILURE;
...

Failed to decode data using encoding 'utf-8' = composer.phar

PS C:\Users\safva\OneDrive\Desktop\starkin_projects\recover-http\Recovery> flutter pub global activate rename
+ args 2.4.2pendencies... 
+ logger 2.0.2+1
+ path 1.9.0
+ rename 3.0.1
Building package executables... 
Built rename:rename.
Failed to decode data using encoding 'utf-8', path = 'C:\Users\safva\AppData\Local\Pub\Cache\bin\composer.phar'

Support web

It'd be great to have support to web, since it's now on stable. The package basically needs to change the <title> tag in the <head>, in web/index.html:

<head>
  <title>App Title</title>
</head>

I thought of creating a pull-request for this, but I thought it'd be better to create it after the null-safety version

Issues in android when using tools:replace="android:label"

The package seems to replace the first occurance of android:label keyword.
It should match the tags and not the value.

original:

   <application
        tools:replace="android:label"
        android:label="App Name"
        ...

After rename:

  <application
        android:label="App Name"
        android:label="App Name"

Run rename only for the current project platforms

Previously this is working properly even I created short video on this as well but recently i switched on MacOs and I found this issue.

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   FileRepository.changeIosBundleId (package:rename/file_repository.dart:55:14)
│ #1   <asynchronous suspension>
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ ⚠️       Ios BundleId could not be changed because,
│ ⚠️       The related file could not be found in that path:  ios/Runner.xcodeproj/project.pbxproj
│ ⚠️       
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   FileRepository.changeMacOsBundleId (package:rename/file_repository.dart:79:14)
│ #1   <asynchronous suspension>
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ ⚠️       macOS BundleId could not be changed because,
│ ⚠️       The related file could not be found in that path:  macos/Runner/Configs/AppInfo.xcconfig
│ ⚠️       
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   FileRepository.changeAndroidBundleId (package:rename/file_repository.dart:103:14)
│ #1   <asynchronous suspension>
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ ⚠️       Android BundleId could not be changed because,
│ ⚠️       The related file could not be found in that path:  android/app/build.gradle
│ ⚠️       
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

receiving exception when I tried to rename

akhil-kfn@tech-laptop-bsd:~/OpenSource/SimpleChatUI$ pub global run rename --bundleId com.akhil.simplechat
IOS BundleIdentifier changed successfully to : com.akhil.simplechat
Unhandled exception:
FileSystemException: Cannot open file, path = 'macos/Runner/Configs/AppInfo.xcconfig' (OS Error: No such file or directory, errno = 2)
#0 _File.open. (dart:io/file_impl.dart:366:9)
#1 _RootZone.runUnary (dart:async/zone.dart:1439:54)
#2 _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#3 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#4 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#5 Future._completeWithValue (dart:async/future_impl.dart:526:5)
#6 Future._asyncComplete. (dart:async/future_impl.dart:556:7)
#7 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#8 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#9 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

MainActivity.kt

package com.example.app

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

Need to change the package name in MainActivity.kt also.

I faced this issue when signing and building the app

Renaming BundleID also Renames BundleID of iOS Extensions.

I created an Extension for Awesome Notifications FCM and when using the rename package to set the BundleID of my Flutter app, it also modifies the BundleID of the extension.

Steps to repeat:

  • Create Flutter App
  • Add a new Extension via xcode
  • Run flutter pub global run rename --bundleId com.example.app -t ios

Results:
All instances of PRODUCT_BUNDLE_IDENTIFIER in project.pbxproj are renamed, thus renaming all extensions in the process.

Handle ampersand

I'm trying to rename a project with an ampersand (&) in the name, and the package doesn't handle escaping that character.

Not Changing in the Namespaces

Issue :

  1. So i created app
  2. Wanted to change the bundle id
  3. Used this code : flutter pub global run rename --bundleId com.softasium.nqvault
  4. flutter run

Error:

image

Resolving dependencies fail : incompatible with flutter_markdown

Today with new Flutter version fail :(

Because markdown 4.0.0 depends on args ^2.0.0 and no versions of markdown match >4.0.0 <5.0.0, markdown ^4.0.0 requires args ^2.0.0.
And because rename >=1.0.7 depends on args ^1.5.2, rename >=1.0.7 is incompatible with markdown ^4.0.0.
And because flutter_markdown 0.6.0 depends on markdown ^4.0.0 and no versions of flutter_markdown match >0.6.0 <0.7.0, rename >=1.0.7 is incompatible with flutter_markdown ^0.6.0.
So, because ciber_app depends on both flutter_markdown ^0.6.0 and rename ^1.2.0, version solving failed.
pub get failed (1; So, because ciber_app depends on both flutter_markdown ^0.6.0 and rename ^1.2.0, version solving failed.)

CFBundleDisplayName not updating

Inside the Info.plist there is a <key>CFBundleDisplayName</key> and a <key>CFBundleName</key>.

Running rename --appname yourappname -t ios will only update the <key>CFBundleName</key>.

Is there a way to change both using this package so they're the same?

Add option to silence Logger

Use case:
we're using rename within our own build script and would like to have the option to silence the output to console of the rename package.

I'm happy to submit a PR for this if you think it would be a useful addition!

--launcherIcon does not work (iInvalid character)

Command:

flutter pub global run rename --launcherIcon "../my-app/ic_launcher.png"

Error:

Invalid character

-t, --target          Set which platforms to target.
                      [android, macOS, ios]
-a, --appname         Sets the name of the app.
-b, --bundleId        Sets the bundle id.
-l, --launcherIcon    Sets the launcher icon.
-h, --help            Shows help.

zsh: command not found: rename

Hi there, i just followed the instructions:

$ pub global activate rename
$ rename

But I got this error instead:
zsh: command not found: rename

Can you give me a hint on that?

--bundleId does not change package name of the app.

rename correctly changed the applicationId in the build.gradle file but it didn't change the package name in AndroidManifest.xml
I'm new to app dev so I don't if package name is important or if it needs to be same as applicationId...

Breaks AndroidManifest.xml

Running rename with --appname AppName flag removed this line:

<application android:label="AppName" android:name="${applicationName}" android:icon="@mipmap/ic_launcher">

and added this line:

android:label="AppName"

which is invalid XML and breaks the build;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.