ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   How to prevent Minion from overriding the development version of my add-on? (https://www.esoui.com/forums/showthread.php?t=9130)

Aenathel 05/03/20 01:59 AM

How to prevent Minion from overriding the development version of my add-on?
 
Hi all, just made my first ESO add-on and having a lot of fun.

I published the add-on to ESOUI yesterday after only having worked on it locally, but fortunately using Git for version control from the beginning.

The first time I opened Minion after submitting my add-on, Minion completely replaced my development version with the released version... which also wiped out the changes I was working on plus some files I don't commit to Git.

Fortunately, I often push my changes to my remote (I use Azure DevOps for my projects), but I'd rather not have this happen again. Is there a way I can prevent Minion from overriding my development version while still having automatic add-on updates enabled?

My thoughts so far are to either:
  1. Use a different name for the development version, but I'd rather not do that...
  2. Set the AddOnVersion in the manifest to something like 9999, but then I have to update that every time I do a release. (I guess I'll automate it if so, but it's still additional work.)
Any thoughts?

sirinsidiator 05/03/20 02:25 AM

Personally I recommend you do not keep your development version in the AddOns folder, simply because of Minion. It will remove all folders in the root of an addon on update. You can ignore a specific addon update by right clicking it and selecting ignore, but if some other addon were to add the folder for any reason and you update, it will still delete it.

I use some scripts to "build" my addons and copy them to the target folder. That way it doesn't matter even when I just delete the whole folder.

Aenathel 05/03/20 02:29 AM

Quote:

Originally Posted by sirinsidiator (Post 41037)
Personally I recommend you do not keep your development version in the AddOns folder, simply because of Minion. It will remove all folders in the root of an addon on update. You can ignore a specific addon update by right clicking it and selecting ignore, but if some other addon were to add the folder for any reason and you update, it will still delete it.

I use some scripts to "build" my addons and copy them to the target folder. That way it doesn't matter even when I just delete the whole folder.

That's a good point. And I can just set up a file watcher to do this for me when I'm developing. I'm going to need those scripts for my release pipeline anyway. Thanks for the insight!

Aenathel 05/03/20 04:07 AM

All right, created a few PowerShell scripts to take care of this and hooked it up to a file watcher in WebStorm, works beautifully. :cool:

Baertram 05/03/20 06:50 AM

Sounds like a helper, are you able to share it with us (maybe) if possible?

Aenathel 05/03/20 07:03 AM

Sure. It's a bit rough, I have specified the necessary files manually, but I'll add some better filtering later.

The first script is bin/build.ps1, which copies files to a build/ directory and substitutes some variables:

Code:

Param(
    [Parameter()]
    [string] $AddOnVersion = "1",
    [Parameter()]
    [string] $Version = "0.0.0",
    [Parameter()]
    [string] $SavedVariables = "AenathelsKeybinds_SavedVariables"
)

$PSDefaultParameterValues['Out-File:Encoding'] = "utf8"

Remove-Item -Force -Recurse build -ErrorAction SilentlyContinue
New-Item -Type Directory -Path build > $null

Copy-Item AenathelsKeybinds.lua -Destination build/
Copy-Item AenathelsKeybinds.txt -Destination build/

Copy-Item CHANGELOG -Destination build/
Copy-Item DESCRIPTION -Destination build/
Copy-Item LICENSE -Destination build/

Copy-Item -Recurse -Path lang -Destination build/lang
Copy-Item -Recurse -Path xml -Destination build/xml

$manifest = Get-Content build/AenathelsKeybinds.txt | Out-String
$manifest = $manifest -replace "{{AddOnVersion}}", $AddOnVersion
$manifest = $manifest -replace "{{Version}}", $Version
$manifest = $manifest -replace "{{SavedVariables}}", $SavedVariables
$manifest | Set-Content build/AenathelsKeybinds.txt

$shared = Get-Content build/lang/shared.lua | Out-String
$shared = $shared -replace "{{Version}}", $Version
$shared | Set-Content build/lang/shared.lua

The second script is bin/deploy.ps1, which copies the build output to the AddOns folder:

Code:

Param(
    [Parameter()]
    [string] $AddOnsFolder = "$env:USERPROFILE\Documents\Elder Scrolls Online\live\AddOns"
)

. bin\build.ps1

$path = "$AddOnsFolder\AenathelsKeybinds"

Remove-Item -Force -Recurse $path -ErrorAction SilentlyContinue
New-Item -Force -Type Directory -Path $path > $null

Copy-Item -Force -Recurse -Path build/* -Destination $path

Finally, here's the raw watcher task--if you're using WebStorm or something like it, it should be possible to splice it into your existing .idea/watcherTasks.xml if you have it:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectTasksOptions">
    <TaskOptions isEnabled="true">
      <option name="arguments" value="&quot;&amp; $ProjectFileDir$\bin\deploy.ps1&quot;" />
      <option name="checkSyntaxErrors" value="true" />
      <option name="description" />
      <option name="exitCodeBehavior" value="ERROR" />
      <option name="fileExtension" value="*" />
      <option name="immediateSync" value="false" />
      <option name="name" value="Deploy to ESO AddOns" />
      <option name="output" value="" />
      <option name="outputFilters">
        <array />
      </option>
      <option name="outputFromStdout" value="false" />
      <option name="program" value="powershell.exe" />
      <option name="runOnExternalChanges" value="true" />
      <option name="scopeName" value="Project Files" />
      <option name="trackOnlyRoot" value="false" />
      <option name="workingDir" value="$ProjectFileDir$" />
      <envs />
    </TaskOptions>
  </component>
</project>

Here's what it looks like in WebStorm if you want to create it manually:



I'm planning to use this to publish new releases of my add-on through Azure Pipelines. (Massive overkill unless you already have an Azure DevOps setup, though, but I'll let you know when I get that far, as the approach should also be possible with GitHub Actions.)

If you have questions, let me know.

Baertram 05/03/20 07:32 AM

Thanks!
Never used Webstorm so far, need to read about it first.

Hint: If you use UTF-8 for your files be sure to remove the BOM or ESO will freak out in the addon manager, sometimes at least. Especially if it's set within the txt manifest files.

Aenathel 05/03/20 08:38 AM

Quote:

Originally Posted by Baertram (Post 41042)
Thanks!
Never used Webstorm so far, need to read about it first.

It's a web IDE built in IntelliJ IDEA. It's perfect for my hobby projects.

Quote:

Originally Posted by Baertram (Post 41042)
Hint: If you use UTF-8 for your files be sure to remove the BOM or ESO will freak out in the addon manager, sometimes at least. Especially if it's set within the txt manifest files.

I took care of that on line 10:

Code:

$PSDefaultParameterValues['Out-File:Encoding'] = "utf8"
Of course, this requires PowerShell 5.1, but I'd be surprised if you didn't have that.

Baertram 05/03/20 09:11 AM

Quote:

built in IntelliJ IDEA
Cool, working with IntelliJ myself.
Haven't build any web content for years but wanted to start with something to keep learning soon.
Definately need to take a look! Thanks

Edit:
Is it somehow free to use or do I need to buy it? Just saw there is only a 30 days test version available.

I've found threads that Webstorm is included into IntelliJ but my guess it's only in the ultimate version?
The community version does not support JavaScript afaik and found online.

Aenathel 05/03/20 10:50 AM

Quote:

Originally Posted by Baertram (Post 41044)
Cool, working with IntelliJ myself.
Haven't build any web content for years but wanted to start with something to keep learning soon.
Definately need to take a look! Thanks

You're welcome! It's quite nice, I primarily use PhpStorm and Rider at work (I have a JetBrains Toolbox subscription with all their programs included), but use WebStorm at home because it's cheaper.

Quote:

Originally Posted by Baertram (Post 41044)
Edit:
Is it somehow free to use or do I need to buy it? Just saw there is only a 30 days test version available.

There are various discounts and offers available.

Quote:

Originally Posted by Baertram (Post 41044)
I've found threads that Webstorm is included into IntelliJ but my guess it's only in the ultimate version?
The community version does not support JavaScript afaik and found online.

Yeah, you need IntelliJ IDEA Ultimate for that, which is about 3x as expensive as WebStorm. WebStorm doesn't have as much language support as IntelliJ IDEA Ultimate, though, it looks like the Lua support is limited, but as Lua isn't my primary reason for having WebStorm, that is fine for me.

A free alternative that you might have heard of is Visual Studio Code. It has extensions for almost anything these days and runs quite well. If I hadn't been spoiled by JetBrains products, that's what I would use.


All times are GMT -6. The time now is 10:54 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI