Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

Commit

Permalink
feat: add downloading electron custom dist
Browse files Browse the repository at this point in the history
  • Loading branch information
sentialx committed Aug 23, 2019
1 parent 8fe3898 commit f17483d
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -6,4 +6,4 @@ target
electron-launcher*
obj
curl-build*

download
4 changes: 2 additions & 2 deletions makefile.darwin
Expand Up @@ -5,8 +5,8 @@ CFLAGS = -Os -fdata-sections -ffunction-sections
LDFLAGS = -lm -lcurl -lpthread -ldl `pkg-config gtk+-3.0 --libs` -s -Wl,-dead_strip
OBJ_DIR = obj/darwin

electron-launcher: $(OBJ_DIR)/main.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/libui.a
$(CXX) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(LDFLAGS) -o build/electron-launcher
electron: $(OBJ_DIR)/main.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/libui.a
$(CXX) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(LDFLAGS) -o build/electron

$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
Expand Down
4 changes: 2 additions & 2 deletions makefile.linux
Expand Up @@ -5,8 +5,8 @@ CFLAGS = -Os -fdata-sections -ffunction-sections
LDFLAGS = -lm -lcurl -lpthread -ldl `pkg-config gtk+-3.0 --libs` -s -Wl,--gc-sections
OBJ_DIR = obj/linux

electron-launcher: $(OBJ_DIR)/main.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/libui.a
$(CXX) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(LDFLAGS) -o build/electron-launcher
electron: $(OBJ_DIR)/main.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/libui.a
$(CXX) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(LDFLAGS) -o build/electron

$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
Expand Down
4 changes: 2 additions & 2 deletions makefile.win32
Expand Up @@ -7,8 +7,8 @@ CMAKE_COMMANDS = env CFLAGS="-fdata-sections -ffunction-sections" CXXFLAGS="-fda
LDFLAGS = -lm -s -Wl,--gc-sections -static-libgcc -static-libstdc++ -mwindows -lcomctl32 -lole32 -ld2d1 -ldwrite -lws2_32 -lcrypt32 -lpthread -static
OBJ_DIR = obj/mingw32

electron-launcher.exe: $(OBJ_DIR)/main.o $(OBJ_DIR)/resources.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/libui.a $(OBJ_DIR)/libcurl.a
$(CXX) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(LDFLAGS) -o build/electron-launcher.exe
electron.exe: $(OBJ_DIR)/main.o $(OBJ_DIR)/resources.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/libui.a $(OBJ_DIR)/libcurl.a
$(CXX) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(LDFLAGS) -o build/electron.exe

$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
Expand Down
121 changes: 121 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -31,6 +31,7 @@
},
"homepage": "https://github.com/sentialx/electron-global#readme",
"devDependencies": {
"@types/extract-zip": "^1.6.2",
"@types/mkdirp": "^0.5.2",
"@types/ncp": "^2.0.1",
"@types/node": "^12.7.2",
Expand All @@ -47,6 +48,7 @@
"typescript": "^3.5.3"
},
"dependencies": {
"extract-zip": "^1.6.7",
"mkdirp": "^0.5.1",
"ncp": "^2.0.0",
"phin": "^3.4.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.sh
Expand Up @@ -17,11 +17,11 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
else
make -f makefile.linux
OS="linux"
zip -r "build/electron-launcher-${TRAVIS_TAG}-${OS}-ia32.zip" "build/electron-launcher"
zip -r "build/electron-${TRAVIS_TAG}-${OS}-ia32.zip" "build/electron"

# TODO: I need help with it, Travis keeps throwing `ERROR: Could not invoke sanity test executable`
# make -f makefile.win32 clean
# make -f makefile.win32
# OS="win32"
# zip -r "build/electron-launcher-${TRAVIS_TAG}-${OS}-ia32.zip" "build/electron-launcher.exe"
# zip -r "build/electron-${TRAVIS_TAG}-${OS}-ia32.zip" "build/electron.exe"
fi
26 changes: 24 additions & 2 deletions tools/cli/index.ts
@@ -1,7 +1,12 @@
#!/usr/bin/env node

import * as program from 'commander';
import { createElectronDistMac } from '..';
import {
createDistMac,
createDistWindows,
downloadBinaries,
createDistLinux,
} from '..';
import { DEFAULT_DEST } from '../constants';

program.option('-m, --mac', 'Create Electron dist for macOS.');
Expand All @@ -20,7 +25,24 @@ program.parse(process.argv);

(async function(): Promise<void> {
if (program.mac) {
await createElectronDistMac(
await downloadBinaries('darwin');
await createDistMac(
program.projectDir ? program.projectDir : process.cwd(),
program.output ? program.output : DEFAULT_DEST,
);
}

if (program.windows) {
await downloadBinaries('win32');
await createDistWindows(
program.projectDir ? program.projectDir : process.cwd(),
program.output ? program.output : DEFAULT_DEST,
);
}

if (program.linux) {
await downloadBinaries('linux');
await createDistLinux(
program.projectDir ? program.projectDir : process.cwd(),
program.output ? program.output : DEFAULT_DEST,
);
Expand Down

0 comments on commit f17483d

Please sign in to comment.