Skip to content

Commit

Permalink
[WIP] Adding sqlite
Browse files Browse the repository at this point in the history
Trying to add sqlite, but having issues with NODE_MODULE_VERSION

Issue found: electron-userland/electron-builder#3660
  • Loading branch information
ferranDelgado committed Feb 12, 2019
1 parent ed728ac commit 8d54c7c
Show file tree
Hide file tree
Showing 6 changed files with 1,766 additions and 23 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -1 +1,5 @@
node_modules
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
79 changes: 79 additions & 0 deletions build/config.gypi
@@ -0,0 +1,79 @@
# Do not edit. File was generated by node-gyp's "configure" step
{
"target_defaults": {
"cflags": [],
"default_configuration": "Release",
"defines": [],
"include_dirs": [],
"libraries": [],
"msbuild_toolset": "v141",
"msvs_windows_target_platform_version": "10.0.17763.0"
},
"variables": {
"asan": 0,
"build_v8_with_gn": "false",
"coverage": "false",
"debug_nghttp2": "false",
"enable_lto": "false",
"enable_pgo_generate": "false",
"enable_pgo_use": "false",
"force_dynamic_crt": 0,
"host_arch": "x64",
"icu_data_in": "..\\..\\deps/icu-small\\source/data/in\\icudt62l.dat",
"icu_endianness": "l",
"icu_gyp_path": "tools/icu/icu-generic.gyp",
"icu_locales": "en,root",
"icu_path": "deps/icu-small",
"icu_small": "true",
"icu_ver_major": "62",
"nasm_version": "2.13",
"node_byteorder": "little",
"node_debug_lib": "false",
"node_enable_d8": "false",
"node_enable_v8_vtunejit": "false",
"node_install_npm": "true",
"node_module_version": 64,
"node_no_browser_globals": "false",
"node_prefix": "/usr/local",
"node_release_urlbase": "https://nodejs.org/download/release/",
"node_shared": "false",
"node_shared_cares": "false",
"node_shared_http_parser": "false",
"node_shared_libuv": "false",
"node_shared_nghttp2": "false",
"node_shared_openssl": "false",
"node_shared_zlib": "false",
"node_tag": "",
"node_target_type": "executable",
"node_use_bundled_v8": "true",
"node_use_dtrace": "false",
"node_use_etw": "true",
"node_use_large_pages": "false",
"node_use_openssl": "true",
"node_use_pch": "false",
"node_use_perfctr": "true",
"node_use_v8_platform": "true",
"node_with_ltcg": "true",
"node_without_node_options": "false",
"openssl_fips": "",
"openssl_no_asm": 0,
"shlib_suffix": "so.64",
"target_arch": "x64",
"v8_enable_gdbjit": 0,
"v8_enable_i18n_support": 1,
"v8_enable_inspector": 1,
"v8_no_strict_aliasing": 1,
"v8_optimized_debug": 0,
"v8_promise_internal_field_count": 1,
"v8_random_seed": 0,
"v8_trace_maps": 0,
"v8_typed_array_max_size_in_heap": 0,
"v8_use_snapshot": "true",
"want_separate_host_toolset": 0,
"nodedir": "C:\\Users\\ferra\\.node-gyp\\10.15.0",
"standalone_static_library": 1,
"msbuild_path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe",
"module_name": "node_sqlite3",
"module_path": "../lib/binding/electron-v1.3-win32-x64"
}
}
7 changes: 7 additions & 0 deletions main.js
@@ -1,5 +1,6 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')
const { bookshelf } = require('./sandbox/sqlite.js')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
Expand All @@ -9,6 +10,8 @@ function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600})

testSqliteCode()

// and load the index.html of the app.
mainWindow.loadFile('index.html')

Expand All @@ -24,6 +27,10 @@ function createWindow () {
})
}

function testSqliteCode() {
bookshelf.hello()
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
Expand Down
11 changes: 9 additions & 2 deletions package.json
Expand Up @@ -4,7 +4,8 @@
"description": "My electron playground to learn about it",
"main": "main.js",
"scripts": {
"start": "electron ."
"start": "electron .",
"postinstall": "electron-builder install-app-deps"
},
"repository": "https://github.com/ferranDelgado/electron-learning",
"keywords": [
Expand All @@ -17,7 +18,13 @@
],
"author": "fdelgado",
"license": "CC0-1.0",
"dependencies": {
"sqlite3": "^4.0.6",
"sequelize": "^4.42.0"
},
"devDependencies": {
"electron": "^4.0.4"
"electron": "^4.0.3",
"electron-builder": "^20.38.5",
"electron-rebuild": "^1.8.4"
}
}
7 changes: 7 additions & 0 deletions sandbox/sqlite.js
@@ -0,0 +1,7 @@
const sqlite3 = require('sqlite3').verbose();

exports.bookshelf = {
hello: function () {
console.log('Hy I\'m a BookShelf')
}
}

0 comments on commit 8d54c7c

Please sign in to comment.