I really don't want Portugal to waste her power fighting Napoleon. Simply accepting Napoleon's fairly liberal constitution and codes loses Portugal nothing and the Continental System just allows her the opportunity to usurp some of Britain's European Market.
But Napoleon being the greedy pal that he is will want the Portuguese Army and most importantly Navy, something that ain't happening so war might very well be inevitable.
While we are not going to discuss politics and military action of the Napoleonic era at this stage we need to discuss a few items that existed iOTL and will exist in TL
1) the US revolution will happen due to the many issues between the settlers in US and Britain. While Portugal was reforming and modernizing its interactions with Brazil they were going through the motions.
2) the French will aid the US because they cannot stop themselves from participating in an event that would weaken their major enemy / adversary.
3) the French state and economy is under great strain and financing of American revolution will not help. Can the French avoid the pitfalls and avoid the financial crises and revolution?
4) in case everything does happen like iOTL (which there is no guarantee) and Napoleon becomes leader of France one of his priorities is to enforce continental system to isolate Britain and to assemble a navy capable of challenging the Royal Navy.
5) fyi when Spain joined the continental system and the French side, trade with its American colonies suffered greatly as British navy targeted Spanish ships. The Portuguese empire which is more connected to the British empire would also suffer greatly or even more.
6) Spain currently resents Portuguese independence and is starting to hate Portugal for its reforms and recent military actions. So any alliance with Spain is certain to end in failure. This happened iOTL and now with the political, economic and religious events that the empire is going through this is more certain to happen.
7) the Portuguese navy was a huge prize that Napoleon wanted and the escape of the court to Rio was a huge defeat for Napoleon. Now the increased size Portuguese navy will be an even greater target.
Could we ally with Napoleon and split Spain in half? Oh would that not be tempting. But what would happen to our empire we would be at mercy of British navy.
Can we stay neutral? We tried that and neither France or Spain allowed that to happen.
How will Portugal protect itself? Sorry but we are not going to reveal it now. But wanted to lay the facts on the table do people understand the situation.