Changes

Jump to navigation Jump to search
split open-source section to new page
Line 92: Line 92:     
==Go open-source==
 
==Go open-source==
===Common questions===
+
Making your mods open-source is highly recommended; see [[Modding:Open source]] for more info.
; What is 'open source'?
  −
: Open source means your mod's code is public and others can change ''a copy of it'' subject to a license you choose. You still have full control of your original code and mod pages; nobody can change those without your approval! However, open source lets others create unofficial updates or publish their own versions.
  −
 
  −
; Do I have to go open-source?
  −
: No, but it's strongly recommended. Making mods open-source is important for the long-term health of the modding community — when you're away or lose interest, others can still update your mods for the latest versions. 66% of SMAPI mods have source code available, which contributes to over 90% of tracked SMAPI mods being updated after major game updates.
  −
 
  −
; What is Git? What's a repository?
  −
: Git is software that helps track changes to your code, and a ''repository'' is a folder containing your mod files plus special files for Git tracking. You don't really need to know how it works at this point; we'll walk you through getting your code up and making changes (and you can look up Git tutorials if you want to dig deeper).
  −
 
  −
; Doesn't this only apply for SMAPI mods?
  −
: Nope! Although content packs aren't compiled, other modders can't legally make changes without a code license. Note that 'permissions' options on sites like Nexus are legally iffy (e.g. who has copyright on derivatives? Can derivatives be relicensed?), so it's a good idea to have a code license for content packs too. That also lets other modders contribute pull requests and updates.
  −
 
  −
===First-time setup===
  −
This looks like a lot of steps, but don't worry: it's pretty straightforward. If you need help, come ask in [[Modding:Community#Discord|#modding on the Stardew Valley Discord]]. :)
  −
 
  −
====Create the Git repository====
  −
First, let's create the public repository which will contain your code.
  −
 
  −
<ol>
  −
<li>Create a [https://github.com/ GitHub] account.</li>
  −
<li>Install [https://www.sourcetreeapp.com/ SourceTree] (Mac/Windows) or [https://www.gitkraken.com/ GitKraken] (Linux). When asked, link it to your GitHub account.</li>
  −
<li>[https://help.github.com/articles/create-a-repo/ Create the repository on GitHub].
  −
 
  −
Suggested settings (see [[:File:Modding - create GitHub repo.png|screenshot]]):
  −
# Repository name: consider ''StardewMods'' if you'll put all your mods in the same repository, otherwise use the name of your mod.
  −
# Description: consider ''Mods for Stardew Valley.''
  −
# Initialize ... with a README: enable this option.
  −
# Add <tt>.gitignore</tt>: leave this blank; we'll add our own later.
  −
# Add a license: [https://choosealicense.com/ choose a license] (MIT License is a good choice if you're undecided), and select it here.
  −
# Click 'Create repository'.
  −
</li>
  −
<li>On the repository page that appears, click the green "Clone or download" button and copy the URL:<br />[[File:Modding - copy GitHub repo URL.png]]</li>
  −
<li>In SourceTree, click ''File > Clone'' and paste the URL. Choose a destination path that's easy to access (like <tt>C:\source\StardewMods</tt>), and click 'Clone'.</li>
  −
</ol>
  −
 
  −
That's the hard part done! Now you have a repository on GitHub that's synced with the folder on your computer.
  −
 
  −
====Add the mod files====
  −
Next, let's add your files to the repository.
  −
 
  −
# Open the repository folder (the destination path you entered in step 5 above).
  −
# Unzip [https://github.com/StardewModders/Files/raw/master/template%20repo/gitattributes%20and%20gitignore.zip this zip file] into the folder. This will add two files to the root of your folder: <tt>.gitattributes</tt> (which normalises line endings between Linux/Mac/Windows) and <tt>.gitignore</tt> (which hides files which shouldn't be committed from Git). You just need to have them in your folder, you won't need to change them.
  −
# Copy your mod files (including the <tt>.sln</tt> file) into the folder.
  −
# Commit your changes in SourceTree:
  −
## Click Commit at the top.
  −
## Click Stage All to add the files to your commit.
  −
## Enter a human-readable description for you changes in the textbox. The format is up to you, but "add initial mod files" is fine for now.
  −
## Make sure "Push changes immediately" is ticked.
  −
## Click "Commit".
  −
 
  −
That's it: all your files will appear on GitHub. Your mod is now open-source!
  −
 
  −
===Making changes===
  −
The steps above are all first-time setup. When you want to make changes, it's much easier:
  −
 
  −
# Edit your code in the repository folder.
  −
# In SourceTree, commit and push your changes (see step 4 in the previous section).
      
{{modding guide footer
 
{{modding guide footer
translators
8,446

edits

Navigation menu