Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed May 23, 2019
2 parents 99fd6bb + dd436c3 commit 33fa01d
Show file tree
Hide file tree
Showing 49 changed files with 3,249 additions and 2,784 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ os:

language: node_js
node_js:
"8"
"12"

install:
- yarn install

before_script:
- export NODE_ENV=production

script:
- yarn tsc:validate
- yarn lint
Expand Down
8 changes: 8 additions & 0 deletions .vscode/launch.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
],
"console": "internalConsole",
"internalConsoleOptions": "neverOpen"
},
{
"type": "chrome",
"request": "attach",
"name": "Electron Renderer",
"port": 9223,
"webRoot": "${workspaceFolder}",
"timeout": 10000
}
]
}
7 changes: 5 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
image: Visual Studio 2017

environment:
nodejs_version: "8"
nodejs_version: "12"

platform:
- x64

install:
- ps: Install-Product node $env:nodejs_version $env:platform
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) x64
- node --version
- yarn install

before_build:
- set NODE_ENV=production

build_script:
- yarn tsc:validate
- yarn lint
Expand Down
2 changes: 1 addition & 1 deletion main.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<body>
<div id="app">
<user-styles :appearance="config.appearanceOptions" :colortheme="config.colorThemeOptions"></user-styles>
<user-input :appearance="config.appearanceOptions"></user-input>
<user-input :appearance="config.appearanceOptions" :translations="translations"></user-input>
<search-results :appearance="config.appearanceOptions"></search-results>
</div>
<script src="./bundle/renderer.js"></script>
Expand Down
42 changes: 20 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,40 @@
"scripts": {
"bundle": "./node_modules/.bin/webpack",
"bundle:watch": "./node_modules/.bin/webpack --watch",
"start": "./node_modules/.bin/electron .",
"start": "./node_modules/.bin/electron . --remote-debugging-port=9223",
"lint": "./node_modules/.bin/tslint --project tsconfig.json --config tslint.json",
"lint:fix": "./node_modules/.bin/tslint --project tsconfig.json --config tslint.json --fix",
"test": "./node_modules/.bin/jest --config jest.json --silent .",
"tsc:validate": "./node_modules/.bin/tsc --noEmit",
"package:dir": "./node_modules/.bin/electron-builder --dir --config electron-builder-config.yml --publish never"
},
"devDependencies": {
"@types/electron-store": "^1.3.0",
"@types/jest": "^23.3.13",
"@types/lodash": "^4.14.119",
"@types/jest": "^24.0.13",
"@types/lodash": "^4.14.130",
"@types/mathjs": "^5.0.1",
"@types/vue-color": "^2.4.1",
"@types/vue-color": "^2.4.2",
"app2png": "https://github.com/oliverschwendener/app2png",
"axios": "^0.18.0",
"electron": "^4.0.0",
"electron-builder": "^20.39.0",
"electron-store": "^2.0.0",
"fuse.js": "^3.3.0",
"jest": "^23.6.0",
"electron": "^5.0.1",
"electron-builder": "^20.40.2",
"electron-store": "^3.2.0",
"fuse.js": "^3.4.4",
"jest": "^24.8.0",
"lodash": "^4.17.11",
"mathjs": "^5.8.0",
"ts-jest": "^23.10.5",
"ts-loader": "^5.3.2",
"tslint": "^5.12.0",
"typescript": "^3.3.3",
"vue": "^2.6.6",
"mathjs": "^5.10.3",
"ts-jest": "^24.0.2",
"ts-loader": "^6.0.1",
"tslint": "^5.16.0",
"typescript": "^3.4.5",
"vue": "^2.6.10",
"vue-color": "^2.7.0",
"webpack": "^4.28.3",
"webpack-cli": "^3.1.2",
"windows-system-icon": "0.0.5",
"webpack": "^4.32.0",
"webpack-cli": "^3.3.2",
"winston": "^3.2.1"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.6.3",
"bulma": "^0.7.4",
"bulma-extensions": "^6.2.4"
"@fortawesome/fontawesome-free": "^5.8.2",
"bulma": "^0.7.5",
"bulma-extensions": "^6.2.7"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OperatingSystemSettingsOptions } from "./operating-system-settings-options";

export const defaultOperatingSystemSettingsOptions: OperatingSystemSettingsOptions = {
isEnabled: true,
};
13 changes: 13 additions & 0 deletions src/common/config/default-simple-folder-search-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { SimpleFolderSearchOptions } from "./simple-folder-search-options";
import { homedir } from "os";

export const defaultSimpleFolderSearchOptions: SimpleFolderSearchOptions = {
folders: [
{
excludeHiddenFiles: false,
folderPath: homedir(),
recursive: false,
},
],
isEnabled: true,
};
4 changes: 4 additions & 0 deletions src/common/config/default-user-config-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { defaultEmailOptions } from "./default-email-options";
import { defaultCurrencyConverterOptions } from "./default-currency-converter-options";
import { defaultWorkflowOptions } from "./default-workflow-options";
import { defaultCommandlineOptions } from "./default-commandline-options";
import { defaultOperatingSystemSettingsOptions } from "./default-operating-system-settings-options";
import { defaultSimpleFolderSearchOptions } from "./default-simple-folder-search-options";

export const defaultUserConfigOptions: UserConfigOptions = {
appearanceOptions: defaultAppearanceOptions,
Expand All @@ -31,8 +33,10 @@ export const defaultUserConfigOptions: UserConfigOptions = {
generalOptions: defaultGeneralOptions,
mdfindOptions: defaultMdfindOptions,
operatingSystemCommandsOptions: defaultOperatingSystemCommandsOptions,
operatingSystemSettingsOptions: defaultOperatingSystemSettingsOptions,
searchEngineOptions: defaultSearchEngineOptions,
shortcutOptions: defaultShortcutOptions,
simpleFolderSearchOptions: defaultSimpleFolderSearchOptions,
translationOptions: defaultTranslationOptions,
urlOptions: defaultUrlOptions,
websearchOptions: defaultWebSearchOptions,
Expand Down
3 changes: 3 additions & 0 deletions src/common/config/operating-system-settings-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface OperatingSystemSettingsOptions {
isEnabled: boolean;
}
10 changes: 10 additions & 0 deletions src/common/config/simple-folder-search-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface SimpleFolderSearchOptions {
isEnabled: boolean;
folders: SimpleFolderSearchFolderOption[];
}

interface SimpleFolderSearchFolderOption {
folderPath: string;
recursive: boolean;
excludeHiddenFiles: boolean;
}
4 changes: 4 additions & 0 deletions src/common/config/user-config-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { EmailOptions } from "./email-options";
import { CurrencyConverterOptions } from "./currency-converter-options";
import { WorkflowOptions } from "./workflow-options";
import { CommandlineOptions } from "./commandline-options";
import { OperatingSystemSettingsOptions } from "./operating-system-settings-options";
import { SimpleFolderSearchOptions } from "./simple-folder-search-options";

export interface UserConfigOptions {
appearanceOptions: AppearanceOptions;
Expand All @@ -30,10 +32,12 @@ export interface UserConfigOptions {
websearchOptions: WebSearchOptions;
fileBrowserOptions: FileBrowserOptions;
operatingSystemCommandsOptions: OperatingSystemCommandsOptions;
operatingSystemSettingsOptions: OperatingSystemSettingsOptions;
calculatorOptions: CalculatorOptions;
urlOptions: UrlOptions;
emailOptions: EmailOptions;
currencyConverterOptions: CurrencyConverterOptions;
workflowOptions: WorkflowOptions;
commandlineOptions: CommandlineOptions;
simpleFolderSearchOptions: SimpleFolderSearchOptions;
}
66 changes: 46 additions & 20 deletions src/common/helpers/file-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ interface FileStat {
stats: Stats;
}

function isPackageFile(filePath: string): boolean {
return extname(filePath) === ".app"
|| extname(filePath) === ".prefPane";
}

export class FileHelpers {
public static readFile(filePath: string): Promise<string> {
return new Promise((resolve, reject) => {
Expand All @@ -27,9 +32,31 @@ export class FileHelpers {
});
}

public static readFilesFromFoldersRecursively(folderPaths: string[]): Promise<string[]> {
public static readFilesFromFolder(folerPath: string, excludeHiddenFiles?: boolean): Promise<string[]> {
return new Promise((resolve, reject) => {
readdir(folerPath, (err, files) => {
if (err) {
reject(err);
} else {
const result = files
.filter((file) => {
if (excludeHiddenFiles) {
return !this.isHiddenFile(file);
} else {
return true;
}
})
.map((file) => join(folerPath, file));

resolve(result);
}
});
});
}

public static readFilesFromFoldersRecursively(folderPaths: string[], excludeHiddenFiles?: boolean): Promise<string[]> {
return new Promise((resolve, reject) => {
Promise.all(folderPaths.map((folderPath) => this.readFilesFromFolderRecursively(folderPath)))
Promise.all(folderPaths.map((folderPath) => this.readFilesFromFolderRecursively(folderPath, excludeHiddenFiles)))
.then((fileLists) => {
let result: string[] = [];
fileLists.forEach((fileList) => result = result.concat(fileList));
Expand All @@ -39,13 +66,20 @@ export class FileHelpers {
});
}

public static readFilesFromFolderRecursively(folderPath: string): Promise<string[]> {
public static readFilesFromFolderRecursively(folderPath: string, excludeHiddenFiles?: boolean): Promise<string[]> {
return new Promise((resolve, reject) => {
readdir(folderPath, (readDirError, readDirResult) => {
if (readDirError) {
reject(readDirError);
} else {
const statPromises = readDirResult
.filter((file) => {
if (excludeHiddenFiles) {
return !this.isHiddenFile(file);
} else {
return true;
}
})
.map((file) => join(folderPath, file))
.map((filePath) => this.getStats(filePath));

Expand All @@ -62,10 +96,10 @@ export class FileHelpers {

Promise.all(fileHandles)
.then((fileLists) => {
let files: string[] = [];
fileLists.forEach((fileList) => {
files = files.concat(fileList);
});
const files = fileLists.length > 0
? fileLists.reduce((all, fileList) => all = all.concat(fileList))
: [];

resolve(files);
})
.catch((fileHandleError) => reject(fileHandleError));
Expand All @@ -76,18 +110,6 @@ export class FileHelpers {
});
}

public static getFilesFromFolder(folderPath: string): Promise<string[]> {
return new Promise((resolve, reject) => {
readdir(folderPath, (err, files) => {
if (err) {
reject(err);
} else {
resolve(files);
}
});
});
}

public static deleteFile(filePath: string): Promise<void> {
return new Promise((resolve, reject) => {
unlink(filePath, (err) => {
Expand Down Expand Up @@ -145,7 +167,7 @@ export class FileHelpers {

private static handleFileStat(fileStat: FileStat): Promise<string[]> {
return new Promise((resolve, reject) => {
const isFile = fileStat.stats.isFile() || extname(fileStat.filePath) === ".app";
const isFile = fileStat.stats.isFile() || isPackageFile(fileStat.filePath);
const isDirectory = fileStat.stats.isDirectory();

if (isFile) {
Expand All @@ -159,4 +181,8 @@ export class FileHelpers {
}
});
}

private static isHiddenFile(fileName: string): boolean {
return fileName.startsWith(".");
}
}
5 changes: 3 additions & 2 deletions src/common/icon/generate-file-icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface FileIconDataResult {
}

export function getFileIconDataUrl(filePath: string, defaultFileIcon: Icon, folderIcon?: Icon): Promise<FileIconDataResult> {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
FileHelpers.fileExists(filePath)
.then((fileExists) => {
if (fileExists) {
Expand Down Expand Up @@ -40,6 +40,7 @@ export function getFileIconDataUrl(filePath: string, defaultFileIcon: Icon, fold
icon: defaultFileIcon,
});
}
});
})
.catch((err) => reject(err));
});
}
1 change: 1 addition & 0 deletions src/common/ipc-channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export enum IpcChannels {
openSettingsWindow = "open-settings-window",
configUpdated = "config-updated",
appearanceOptionsUpdated = "user-styles-updated",
languageUpdated = "language-updated",
colorThemeOptionsUpdated = "color-theme-updated",
ueliCommandExecuted = "ueli-command-executed",
folderPathRequested = "folder-path-requested",
Expand Down
1 change: 1 addition & 0 deletions src/common/search-result-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface SearchResultItem {
hideMainWindowAfterExecution: boolean;
icon: Icon;
name: string;
needsUserConfirmationBeforeExecution?: boolean;
originPluginType: PluginType;
searchable: string[];
}
2 changes: 2 additions & 0 deletions src/common/translation/english-translation-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const englishTranslationSet: TranslationSet = {
trayIconSettings: "Settings",
trayIconQuit: "Quit",

userConfirmationProceed: "Proceed?",

noSearchResultsFoundDescription: "",
noSearchResultsFoundTitle: "No search results found",

Expand Down
2 changes: 2 additions & 0 deletions src/common/translation/german-translation-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const germanTranslationSet: TranslationSet = {
trayIconSettings: "Einstellungen",
trayIconQuit: "Beenden",

userConfirmationProceed: "Fortfahren?",

noSearchResultsFoundDescription: "",
noSearchResultsFoundTitle: "Keine Suchergebnisse gefunden",

Expand Down
2 changes: 2 additions & 0 deletions src/common/translation/translation-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export interface TranslationSet {
trayIconSettings: string;
trayIconQuit: string;

userConfirmationProceed: string;

noSearchResultsFoundTitle: string;
noSearchResultsFoundDescription: string;

Expand Down
9 changes: 9 additions & 0 deletions src/main/executors/operating-system-setting-executor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { executeFilePathMacOs } from "./file-path-executor";

export function executeMacOSOperatingSystemSetting(executionArgument: string): Promise<void> {
return executeFilePathMacOs(executionArgument, false);
}

export function executeWindowsOperatingSystemSetting(executionArgument: string): Promise<void> {
throw new Error("not implemented");
}
Loading

0 comments on commit 33fa01d

Please sign in to comment.