diff --git a/api/CONFIG.md b/api/CONFIG.md index 83d4c28e0b..b957b1fc56 100644 --- a/api/CONFIG.md +++ b/api/CONFIG.md @@ -156,7 +156,6 @@ icon | | The icon to use for identifying your app in Linux desktop environment Key | Default Value | Description :--- | :--- | :--- -appstore_icon | | Mac App Store icon category | | A category in the App Store cmd | | The command to execute to spawn the "back-end" process. icon | | The icon to use for identifying your app on MacOS. diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000000..dc2f73dda8 Binary files /dev/null and b/assets/icon.png differ diff --git a/bin/install.sh b/bin/install.sh index 850a03d056..5cb86e5b38 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -583,6 +583,9 @@ function _install { mkdir -p "$SOCKET_HOME/api" cp -frp "$root"/api/* "$SOCKET_HOME/api" + mkdir -p "$SOCKET_HOME/assets" + cp -rf "$root"/assets/* "$SOCKET_HOME/assets" + # only do this for desktop, no need to copy again for other platforms rm -rf "$SOCKET_HOME/include" mkdir -p "$SOCKET_HOME/include" diff --git a/bin/publish-npm-modules.sh b/bin/publish-npm-modules.sh index 041657a4b1..11492fb982 100755 --- a/bin/publish-npm-modules.sh +++ b/bin/publish-npm-modules.sh @@ -169,6 +169,9 @@ if (( !only_top_level )); then cp -f "$root/LICENSE.txt" "$SOCKET_HOME/packages/$package" cp -f "$root/README.md" "$SOCKET_HOME/packages/$package" + mkdir -p "$SOCKET_HOME/packages/$package/assets" + cp -rf "$root/assets"/* "$SOCKET_HOME/packages/$package/assets" + cp -rf "$SOCKET_HOME/uv"/* "$SOCKET_HOME/packages/$package/uv" cp -rf "$SOCKET_HOME/bin"/* "$SOCKET_HOME/packages/$package/bin" cp -rf "$SOCKET_HOME/src"/* "$SOCKET_HOME/packages/$package/src" diff --git a/src/cli/cli.cc b/src/cli/cli.cc index 6df11d3a9a..f06465040a 100644 --- a/src/cli/cli.cc +++ b/src/cli/cli.cc @@ -2194,6 +2194,7 @@ int main (const int argc, const char* argv[]) { auto configOnly = optionsWithoutValue.find("--config") != optionsWithoutValue.end(); auto projectName = optionsWithValue["--name"]; + // create socket.ini if (fs::exists(targetPath / "socket.ini")) { log("socket.ini already exists in " + targetPath.string()); } else { @@ -2203,19 +2204,26 @@ int main (const int argc, const char* argv[]) { writeFile(targetPath / "socket.ini", tmpl(gDefaultConfig, defaultTemplateAttrs)); log("socket.ini created in " + targetPath.string()); } + if (!configOnly) { if (isCurrentPathEmpty) { + // create src/index.html fs::create_directories(targetPath / "src"); writeFile(targetPath / "src" / "index.html", gHelloWorld); log("src/index.html created in " + targetPath.string()); + + // copy icon.png + fs::copy(trim(prefixFile("assets/icon.png")), targetPath / "src" / "icon.png", fs::copy_options::overwrite_existing); + log("icon.png created in " + targetPath.string() + "/src"); } else { - log("Current directory was not empty. Assuming index.html is already in place."); + log("Current directory was not empty. Assuming index.html and icon are already in place."); } - if (fs::exists(targetPath / ".gitignore")) { - log(".gitignore already exists in " + targetPath.string()); - } else { + // create .gitignore + if (!fs::exists(targetPath / ".gitignore")) { writeFile(targetPath / ".gitignore", gDefaultGitignore); log(".gitignore created in " + targetPath.string()); + } else { + log(".gitignore already exists in " + targetPath.string()); } } exit(0); diff --git a/src/cli/templates.hh b/src/cli/templates.hh index d1715f3f5b..65b2769b10 100644 --- a/src/cli/templates.hh +++ b/src/cli/templates.hh @@ -1815,9 +1815,6 @@ icon = "src/icon.png" [mac] -; Mac App Store icon -appstore_icon = "src/icons/icon.png" - ; A category in the App Store category = "" @@ -1825,7 +1822,7 @@ category = "" ; cmd = "node backend/index.js" ; The icon to use for identifying your app on MacOS. -icon = "" +icon = "src/icon.png" ; TODO Signing guide: https://socketsupply.co/guides/#code-signing-certificates codesign_identity = "" @@ -1849,13 +1846,13 @@ headers = native-module1.hh ; cmd = "node backend/index.js" ; The icon to use for identifying your app on Windows. -icon = "" +icon = "src/icon.png" ; The icon to use for identifying your app on Windows. logo = "src/icons/icon.png" ; A relative path to the pfx file used for signing. -pfx = "certs/cert.pfx" +; pfx = "certs/cert.pfx" ; The signing information needed by the appx api. ; publisher = "CN=Beep Boop Corp., O=Beep Boop Corp., L=San Francisco, S=California, C=US"