Technical Documentation: Automattic/simplenote-electron
โน๏ธ Provenance: Multi-Tier Ingestion ยท CodeWiki Reference
Overview (`README.md`)
Simplenote for Electron
A Simplenote React client packaged in Electron. Learn more about Simplenote at Simplenote.com.
Running
Read this first!! Local development is currently not supported if you don't have an existing account on the test server or access to the production credentials. This is because the move to an email-first signup flow has made it impossible to create accounts in the test database. We hope to be able to support an open-source development workflow again in the future.
- Clone the repo:
git clone https://github.com/Automattic/simplenote-electron.git cd simplenote-electronnpm install --legacy-peer-deps(This flag is necessary becausereact-monaco-editoris pinned to a specificmonaco-editordependency, butnpmconsiders minor versions to be breaking changes for sub-1.0.0 apps)- Decrypt the config file using
make decrypt_conf. npm run dev- The dev server will start on http://localhost:4000, and the Electron app will launch automatically.
- For all logging from Electron to be printed to the terminal (e.g.
console.logstatements withinapp.js), you might need to setenv ELECTRON_ENABLE_LOGGING=1.
Note: Simplenote API features such as sharing and publishing will not work with development builds. Due to a limitation of make, installation paths used for build cannot have spaces.
Building
make package-osxmake package-win32make package-linux
Testing
Unit tests are run with npm test.
Coding Guidelines
Please adhere to the same guidelines as found in wp-calypso.
See CONTRIBUTING.md for more guidelines.
Dependencies
- node-simperium for Simperium syncing.
- ReactJS for UI.
- Electron for wrapping the JavaScript application.
rpmmust be installed in order to build Linux packages (brew install rpmon OSX).
Simplenote for Other Platforms
simplenote-electron is the official Simplenote desktop app for Windows and Linux.
For other platforms, see:
Overview (`desktop/app-quit/README.md`)
App Quit
Determines whether the app should quit and exit, or quit to background.
Note that the implementation of quit-to-background is left up to platform.
Overview (`desktop/updater/README.md`)
Updater
Uses either the manual or auto updater to check for updates.
The config updater.url is used as the base URL and has the platform, version, and beta setting appended.
The updater uses:
Overview (`lib/analytics/README.md`)
Analytics
This module is a simplified version of the analytics module found in WP-Calypso.
Original: https://github.com/Automattic/wp-calypso/tree/master/client/analytics
Tracks API
analytics#tracks#recordEvent( eventName, eventProperties )
Record an event with optional properties:
analytics.tracks.recordEvent( 'calypso_checkout_coupon_apply', {
'coupon_code': 'abc123'
} );Overview (`desktop/updater/auto-updater/README.md`)
Auto Updater
Handles Squirrel auto-update events. Note that the app must be signed for this to work.
Functions
ping() - checks for an update
Overview (`desktop/updater/manual-updater/README.md`)
Manual Updater
Provides a manual updater on platforms where the auto updater does not work.
If an update is detected then a dialog is shown with a link to the update for download.
The update is shown once until the app is restarted.
Functions
ping() - checks for an update
Overview (`lib/utils/export/README.md`)
Simplenote Export
This module provides a couple of functions for exporting all of the notes in the active account.
The output of exportNote() is an object containing a map of two arrays: the active notes in an account; the trashed notes in an account.
The notes will be sorted by last modification time with the most recently-modified notes appearing first in the list.
The output from exportNotes() can be fed into noteExportToZip() to generate a JSZip object containing the information for creating a zip archive of the notes.
This archive contains each note as its own file with a generated filename and the list of associated tags at the end of the content.
Example export
{
"activeNotes": [ {
"id": "some-auto-generated-id",
"content": "Simplenote is so simple! I love it.",
"creationDate": "2016-11-18T23:28:42.957Z",
"lastModified": "2016-12-22T21:59:36.623Z"
}, {
"id": "some-auto-generated-id-that-is-unique",
"content": "This note can be accessed from a secret URL",
"creationDate": "2016-07-02T07:24:22.699Z",
"lastModified": "2016-11-29T16:55:49.890Z",
"publicURL": "http://simp.ly/p/short-url-string"
}, {
"id": "some-auto-generated-id-again",
"content": "Sharing is caring",
"creationDate": "2016-10-01T08:40:33.968Z",
"lastModified": "2016-10-30T01:57:56.050Z",
"tags": [
"reminders",
"people"
],
"collaboratorEmails": [
"[email protected]",
"[email protected]"
]
} ],
"trashedNotes": [ {
"id": "some-different-auto-generated-id",
"content": "This note is no longer relevant",
"creationDate": "2015-11-18T10:13:42.138Z",
"lastModified": "2016-01-13T14:03:33.583Z",
"tags": [
"the departed"
]
} ]
}Overview (`lib/utils/import/README.MD`)
Simplenote Import
This is the core importer for Simplenote. It expects an object of notes in the same format as the import module. It is aggressive about only allowing certain properties, and converts dates into timestamps where appropriate. Importing specific export files (Such as Evernote .enex) should use a separate conversion script and then pass the resulting object to importNotes().
Example object with allowed properties:
{
"activeNotes": [
{
"content": "Random thought: How much wood could a woodchuck chuck if a woodchuck could chuck wood?",
"creationDate": "2013-10-16T20:17:41.760Z",
"lastModified": "2018-10-10T22:07:54.128Z",
"pinned": true,
"tags": [
"Reminders"
]
},
],
"trashedNotes": [
{
"content": "Hello, world!",
"creationDate": "2016-02-29T23:01:03.115Z",
"lastModified": "2016-02-29T23:01:08.000Z"
}
]
}Packaging (`docs/packaging.md`)
Building a Release
make osxmake linuxmake win32
Packaging
Some builds require further packaging before they can be released:
make package-win32- Produces a signedSetup.exeinstall wizardmake package-osx- Produces aDMGfilemake package-linux- Produces a.deb,.rpmand.AppImagefile forx86andx64processors
Requirements
Mac Package
A Mac build requires the app to be signed. This prevents a security warning being issued when you run the app.
You can obtain all the appropriate signing certificates from an Apple Developer account.
Note that you need the certificates installed prior to building.
Windows Package
The Windows package requires installing a valid certificate, installing the makensis, wine and mono packages, installable from brew.
brew install mono wine makensis
The Windows build doesn't get signed until the packaging stage.
Linux Package
The Linux package is built using electron-builder which is a tool that makes it easy to build different package systems. electron-builder should be installed by npm install.
Note for creating Linux package on Linux
Creating all Linux packages requires tool for converting
.icnsfile to.png. May be installed viaaptby typing:sudo apt install --no-install-recommends -y icnsutilsCreating
.rpmpackage requiresrpmpackage, installable from 'apt'.sudo apt install --no-install-recommends -y rpm
Note for creating Linux package on MacOS:
Creating Linux package on MacOS requires
rpmpackage, installable frombrew.brew install rpm
--- METRICS ---
- Files Extracted: 9
- Estimated Token Budget: ~2224 tokens
- Canonical Reference: https://codewiki.google/github.com/Automattic/simplenote-electron