Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): create icon file on ssc init #674

Merged
merged 7 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions bin/publish-npm-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 12 additions & 4 deletions src/cli/cli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down
9 changes: 3 additions & 6 deletions src/cli/templates.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1815,17 +1815,14 @@ icon = "src/icon.png"

[mac]

; Mac App Store icon
appstore_icon = "src/icons/icon.png"

chicoxyzzy marked this conversation as resolved.
Show resolved Hide resolved
; A category in the App Store
category = ""

; The command to execute to spawn the "back-end" process.
; 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 = ""
Expand All @@ -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"
Expand Down
Loading