Skip to content
Open
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
29 changes: 29 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: macos-latest

strategy:
matrix:
node-version: [10.x,12.x,14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
73 changes: 73 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
/build/
/node_modules/
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

10 changes: 5 additions & 5 deletions addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ NAN_METHOD(getIconForExtension)
return;
}

v8::String::Utf8Value extension{info[0]->ToString()};
auto size = static_cast<IconSize>(info[1]->Int32Value());
Nan::Utf8String extension{info[0]};
auto size = static_cast<IconSize>(info[1]->Int32Value(Nan::GetCurrentContext()).FromJust());
auto callback = new Nan::Callback(info[2].As<v8::Function>());
Nan::AsyncQueueWorker(
new SystemIconAsyncWorker<ExtensionTag>(*extension, size, callback));
Expand All @@ -36,8 +36,8 @@ NAN_METHOD(getIconForPath)
return;
}

v8::String::Utf8Value path{info[0]->ToString()};
auto size = static_cast<IconSize>(info[1]->Int32Value());
Nan::Utf8String path{info[0]};
auto size = static_cast<IconSize>(info[1]->Int32Value(Nan::GetCurrentContext()).FromJust());
auto callback = new Nan::Callback(info[2].As<v8::Function>());
Nan::AsyncQueueWorker(
new SystemIconAsyncWorker<PathTag>(*path, size, callback));
Expand All @@ -60,4 +60,4 @@ NAN_MODULE_INIT(init)
Nan::New(static_cast<int>(IconSize::ExtraLarge)));
}

NODE_MODULE(system_icon, init);
NODE_MODULE(system_icon, init) //DONT ADD A SEMI COLON THIS IS NOT A FUNCTION CALL IT IS A MACRO
20 changes: 0 additions & 20 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,6 @@
],
}],
],
'msbuild_settings': {
'ClCompile': {
'WarningLevel': 'Level3',
'Optimization': 'Full',
'FunctionLevelLinking': 'true',
},
'Lib': {
'LinkTimeCodeGeneration': 'true',
},
},
'msvs_settings': {
'VCCLCompilerTool': {
'WarningLevel': '3',
'Optimization': '3',
'EnableFunctionLevelLinking': 'true',
},
'VCLibrarianTool': {
'LinkTimeCodeGeneration': 'true',
},
},
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'CLANG_CXX_LIBRARY': 'libc++',
Expand Down
22 changes: 14 additions & 8 deletions package-lock.json

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

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
"url": "https://github.com/mtojo/node-system-icon/issues"
},
"dependencies": {
"bindings": "~1.3.0",
"nan": "~2.8.0"
},
"engines": {
"node": ">=6.0.0"
"bindings": "~1.5.0",
"nan": "~2.14.0"
},
"homepage": "https://github.com/mtojo/node-system-icon",
"keywords": [
Expand All @@ -28,7 +25,9 @@
"url": "https://github.com/mtojo/node-system-icon.git"
},
"scripts": {
"install": "node-gyp rebuild"
"install": "node-gyp rebuild",
"rebuild": "node-gyp rebuild",
"test": "node test.js"
},
"os": [
"darwin",
Expand Down
13 changes: 13 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const system = require("./index");
const {writeFileSync} = require('fs');

// const {getIconForPath, ICON_SIZE_MEDIUM} = require('system-icon');


system.getIconForPath("/Applications/Brave Browser.app", system.ICON_SIZE_MEDIUM, (err, result) => {
if (err) {
console.error(err);
} else {
writeFileSync("icon.png", result);
}
});