Could you provide an example? After following the instructions provided by patch-package, whenever I’ve tried to do it, I keep getting this message. The specific part of the admin panel I am trying to edit is the LeftMenu component:
$ npx patch-package @strapi/strapi
patch-package 6.4.7
• Creating temporary folder
• Installing @strapi/strapi@4.3.2 with yarn
• Diffing your files with clean files
⁉️ Not creating patch file for package '@strapi/strapi'
⁉️ There don't appear to be any changes.
Make changes to relevant files, likely found in /node_modules/@strapi/admin/admin/src/pages
Save changes via npm run generate-admin-patches
We can then apply these patches, for example if we update strapi or when packages are initially installed packages, by running npm run apply-admin-patches
According to the Strapi team, there used to be an extensions feature but they got rid of it cause it kept causing a lot of bugs and they advice using patch-package.
Here’s a simple example of how to achieve this.
First install patch-package and postinstall using one of the following commands
yarn add patch-package postinstall-postinstall
or
npm i patch-package postinstall-postinstall
you can add a ‘–dev’ flag if you don’t wanna use it in production
add the following command to your scripts in your ‘package.json’ file
next go into the node_modules folder and find the @strapi directory in which you’ll find the different components available by default.
A sample change like in my case was changing the content in the Homepage which I was able to find in the @strapi/admin/admin/src/pages/HomePage directory.
After making changes to the index.js file for example, head to your terminal and run yarn patch-package @strapi/admin.
This will create a patch folder in the root directory of your project with the changes made. Once the operation is done running, run yarn build and then yarn develop and your changes should be properly reflected. Not the most convenient of methods and that’s understandable but it’s the most effective method i could find online right now. I encourage you to read the patch-package docs for more info on how to use it. Good luck
I can’t get this to work. I run the patch-package and run npm build and then npm run dev (strapi develop) but no luck on seeing any of the patch changes…
Now that the admin panel is largely obfuscated and unpatchable, this can be achieved with a combination of @huylv177’s fantastic suggestion, along with custom middleware:
Why isn’t there yet a very simple solution to solve this?
Moreover, by default, the admin page should not contain that info. It should be blank. That would be more satisfactory in most cases than having links to GitHub, etc., which for technical people are not useful at all. Users should not need to know we’re using strapi or anything.
So, can you at least change the default admin welcome page to just be a blank page (maybe with some modifiable text, which by default is something like “Welcome to the Strapi admin UI”)?
yes you can! In admin/app.ts at the bootstrap function, you can add some javascript to add css to the page and override te content. But I prefer @dgrebb solution.
here is a sample