Note
|
It is assumed that you are using We recommend to base your Electron application on top of |
Currently, Coulomb provides some GUI components based on React and Palantir’s Blueprint 3.
It is on our roadmap to make the library GUI-agnostic, but for now it is required for a Coulomb-based app to use those.
Coulomb does not bundle them, so add them to your runtime dependencies:
yarn add react-dom react @blueprintjs/core @blueprintjs/icons
Note
|
If you have not added custom Webpack configuration for main thread,
make sure you configure
Given that, Webpack configuration described below will go in file named "main.webpack.js" in the same directory as your package.json. |
Coulomb uses Node workers for Git operations that would otherwise block the UI, even though they run in main thread.
To bundle dependencies (such as isomorphic-git) alongside worker code,
it uses threads
and requires your project to configure the corresponding
Webpack plugin.
The configuration is done in two steps:
-
Add the
threads-plugin
build-time dependency:yarn add --dev threads-plugin
-
Configure Webpack for your main thread to use
threads-plugin
:const ThreadsPlugin = require('threads-plugin'); module.exports = function (config) { config.plugins.unshift( new ThreadsPlugin({ target: 'electron-node-worker' }) ); // other configuration... }
Some Coulomb dependencies use Node extensions (namely, node-keytar
).
To ensure those extensions get appropriately packed,
-
add the
native-ext-loader
build-time dependency:yarn add --dev native-ext-loader
-
Configure Webpack for your main thread to use
native-ext-loader
instead of electron-webpack’s default choice ofnode-loader
.This may be done like so:
module.exports = function (config) { config.module.rules = config.module.rules.filter(r => { return (r.use !== 'node-loader'); }) config.module.rules.unshift({ test: /\.node$/, use: { loader: 'native-ext-loader', options: { rewritePath: undefined, name: '[path][name].[ext]', }, }, }); // other configuration... }
Note
|
Heads-up! This exact solution may break if |
Add the following to your package.json file under "build":
...
"build": {
...
"asarUnpack": [
"**/*.node",
"node_modules/source-map/**/*",
"node_modules/source-map-support/**/*",
"node_modules/buffer-from/**/*",
"dist/main/*.worker.js*"
]
}
This ensures that dependencies of Coulomb’s workers are accessible at runtime within packaged app. If you get a JavaScript error alert during packaged app startup, especially if it’s being launched from within macOS’s Applications folder, check this setting.
Coulomb uses Commitizen. To follow commit message conventions,
it is suggested to use git commit
CLI command, which would show
interactive prompt and format commit message appropriately.