@ivanpierre/app v1.0.13
CLJStron (ClojureScript's Electron)
Project
A library to manage and develop electron applications in ClojureScript... and Clojure?
Goals
- Library for
mainandrendererparts ofelectron. - Offer standard operations on
electron. - Use a maximum of declarative programming, sending modified states instead of function mutating the state. This will enable to manage a react-like management in the
mainprocess and so to be able to figwhell innode.jsandClojureapp - Offer loading external modules into application.
- Centralized configuration storage (
.cljstron). Storage management is a module. - Usable as a
NPMlibrary. - Usable as a
ClojureScriptlibrary (throughclojars). - Usable as an
electronapplication, with configuration of one'sIDEthrough tool modules that should be composable:- Editors
- REPLs
- State managements
- Sandboxes (
DevCards, ...) - Project management
- Compilers
- Linters
- Configuration tools
- Packagers
- ...
- Monitoring of an external
electronproject. (module(s)?) - Compiler agnostic. Compiler is a module. Idea, to be able to integrate every language compiling in
JavaScriopt. - Editor agnostic. Editor should be a module.
- Modules are language agnostic. The library and modules have a clear
JavaScriptAPIfor inter-operation. - A
Java(minimum 8) version of themainprocess : .- As a
JavaScriptcontainer forelectronmain process. - As a
Clojureelectron(CLJtron) and aClojureScriptelectron(CLJJStron) module to encapsulate correspondingIPCcommunication withelectron.
- As a
- A
native-reactmodule (CLJSNATIVEtron), asnode.jsis now on the electronic devices. This will too have it's ownIPCcommunication management. - Projects should be (if possible) completely and transparently moved from an environment to another and work seamlessly, one with any other one, with the same code:
- Desktop application
- Desktop client
Clojureservernode.jsserver- Browser client
- Mobile
node.jsmain - Mobile client
- One Page Application (
OPA) - Standalone server
- ... :sweat:
State of project
Project is now a WIP in pre-alpha stage as of 22th of October 2017. :mask:
It is only as for now a simple experimental electron app used as a sandbox.
Version
@ivanpierre/app@1.0.13first beta version will be moved tocljstronon NPM ascljstron@0.0.1-beta1.- GitHub repository: https://github.com/cljstron/cljs-node-electron-boot. First beta version will be moved to
cljstron/CLJStronrepository with release0.0.1-beta1.
Dependencies (as for now)
NPM
electron@1.8.1It's necessary to compile the project. Why? because of the compiler... :unamused:.shadow-cljs@2.0.34The compiler for now, but this will be in a module afterward (compiler agnostic). Root compilation will be a rawleinproject.
Clojars
[camel-snake-kebab "0.4.0"]It's used to managesnake-cased andcamelCased keys. I will change to thecamel-caselibrary included inelectronpackage, or not... :wink:
Installation
As it's an alpha release, I suppose you already know how to install programs and the configuration of your computer... :yum:
Prerequisites
leinigengit- If you're on a mac, you'll probably will have to install XCode which is in the Apple Store.
- hint : if when you use git you have message about XCode, that's it... :grin:
- If you install it you'll have to aggree to the licence aggrement : type
'sudo xcodebuild -license', give your password, hit the space key, or enter, until you're at the end of the licence, typeaggreeENTER, and you're done.
node.jsthat includesnpm, the package manager. You can also use theyarnmanager if it's your favorite tool. I figure out you know how to translate the following npm commands... :innocent:- Not mandatory but useful, a node version selector
nvmso you can play with the lastestnode.jsversion.- if you do it, change version before proceeding...
- with
npminstall :- latest version of
npm:'npm i -g "npm@latest"' shadow-cljs:'npm i -g "shadow-cljs"'electron:'npm i -g "electron@1.8.1"'
- latest version of
Installing project
Go in a developpement directory or create it.
create and download the project directory :
'git clone https://github.com/cljstron/cljs-node-electron-boot.git'
You should be in the project directory :
'cd cljs-node-electron-boot'
And download the needed libraries :
'npm i --save'
Compiling project
Compile the mainand renderer applications in development mode:
'shadow-cljs compile main''shadow-cljs compile renderer'
If you've got errors... you're at work... :grin: Go to the Editing the project part. And try to figure out why, by reading the error messages.
I'll try to only push working versions, but I'm on a mac now, so Windows and Linux releases have not been tested.
You can also put an issue on the project's GitHub repository issues page.
Lanching the project
It's just :
'electron .' or 'npm start'
Normally you have an open window with infos on the versions of your eclipse environment.
For mac users, closing the windows doesn't stop the program, you have to go to the menu and close the application. Bad mac habit, but you can change it, see editing code.
Editing the project
You can use whatever editor that support Clojure and ClojureScript
- EMACS
- Atom
- Eclipse
- Vi
- LightTable
- NightCode
- Sublime
- IntelliJ
- ...
ou même qui ne le supporte pas. Personellement j'utilise Visual Sudio Code avec les packages Clojure (I test for now), ParInfer, Rainbow Brackets (buggy), and I use the Integrated Terminal to lauch compilation as I wait for the REPL, Compilation and Reboot On Edit modules.
Application structure
├== -> generated code ├** -> downloaded libraries
[directory] ├++ -> compiled libraries and runtime in development mode
all integrated in generated code on production
.
├── README.md This page
├── [docs] Documentation directory
│ └── Home.md Junk file
├── LICENSE Licence file
│
├── cljs.edn Futur project file for cljsjs "Lumo"
├── clojure.clj Futur project file for leiningen
├── project.boot Futur project file for boot
├── shadow-cljs.edn The working project file for shadow-cljs
├── package.json Project file for the application as npm package
│
├** package-lock.json Control file for the loaded npm packages
├** [node_modules] Repository of the npm packages
│
├++ [target] Compiled AOT, cache and runtime of main application libraries
│
├── [resources] Public HTML root directory for the renderer
│ ├── [plugs] Directory of plugins' resources
│ │ └── [cljstron_simple] Resources for a plug
│ │ ├── plug.edn Plugin descriptor, windows, menus, dependences, ...
│ │ ├── [css] CSS directory
│ │ ├── index.html Optional HTML pages
│ │ └== [js] Compiled AOT, cache an executables for renderer
│ │ ├++ [cljs-runtime] Library and runtime for renderer
│ │ ├++ manifest.json Manifest of libraries and runtime
│ │ └== simple.js The compiled main program for the renderer
│ │
│ ├── app.edn Application descriptor
│ ├── index.html Empty page to create content from javascript
│ └== main.js The compiled main program of the application
│
└── [src] Sources root
│
├── [cljstron] Root of cljstron library
│ ├── [main] Root for helper function for main application
│ │ ├── interop.cljs A file to translate recursively JS->CLJS structures (unused)
│ │ └── window.cljs Helper for windows management, containers of renderers
│ ├── [common] Root for helper function for both applications
│ └── [renderer] Root for helper function for renderer application
│
├── [cljstron_simple] Sources for plug
│ ├── [main] Main plug sources
│ │ └── main.cljs Source for main. Manage the windows and events
│ ├── [common] Both main and renderer plug sources
│ └── [renderer] Renderer plug sources
│ └── simple.cljs Source for renderer.
│
└── main.cljs Main entry point. Activate cljstron_simple A last thing... the doc for electron is here. It may help... :innocent: