basic mod structure

This commit is contained in:
dragonwocky 2020-07-14 00:23:21 +10:00
parent 78865542b7
commit 2131e4e19d
Signed by: dragonwocky
GPG Key ID: C7A48B7846AA706D
5 changed files with 95 additions and 10 deletions

View File

@ -38,7 +38,7 @@ git checkout js
using npm? globally link via `npm link`. using npm? globally link via `npm link`.
using yarn? globally link via `yarn link` (the output of `yarn global bin` must be in PATH). using yarn? globally link via `yarn && yarn link` (the output of `yarn global bin` must be in PATH).
the downloaded folder is now directly linked to the `notion-enhancer` command. the downloaded folder is now directly linked to the `notion-enhancer` command.
@ -57,20 +57,20 @@ depending on the content and scale of a contribution, it may constitute an updat
to keep a consistent code but informative style it is preferred to name variables with to keep a consistent code but informative style it is preferred to name variables with
`snake_case`, functions/methods with `camelCase`, and classes with `PascalCase`. `snake_case`, functions/methods with `camelCase`, and classes with `PascalCase`.
for information on how to create a theme or module, check the [docs](README.md). for information on how to create a theme or module, check the [docs](DOCUMENTATION.md).
## review ## review
active core devs will manually look through each pull request and communicate with contributors before merging to active core devs will manually look through each pull request and communicate with contributors before merging to
make sure it is a) safe, b) functional and c) bug-free. make sure it is a) safe, b) functional and c) bug-free.
**a)** system details (e.g. IP, clipboard) + notion user data are considered private unless directly shared by the user. **a) safe:** system details (e.g. IP, clipboard) + notion user data are considered private unless directly shared by the user.
none of this should be accessed or transmitted to an external server. none of this should be accessed or transmitted to an external server.
**b)** is there a better way to do this? can extra dependencies be removed or replaced by newer web technologies? **b) functional:** is there a better way to do this? can extra dependencies be removed or replaced by newer web technologies?
how can this be made as user-friendly as possible? how can this be made as user-friendly as possible?
**c)** where possible, code should be tested on a variety of platforms in a variety of situations so it can be **c) bug-free:** where possible, code should be tested on a variety of platforms in a variety of situations so it can be
confirmed that it won't break anything for the user and is robust enough to handle use by both confirmed that it won't break anything for the user and is robust enough to handle use by both
power-users and non-tech-savvy users. power-users and non-tech-savvy users.

65
DOCUMENTATION.md Normal file
View File

@ -0,0 +1,65 @@
# readme placeholder
ended up here? this is a wip version of the enhancer, and this file is yet to be completed.
if you're interested in using the project, switch back to the [master branch](https://github.com/dragonwocky/notion-enhancer).
for support, contact me on discord `dragonwocky#8449` or open an issue here in the repo.
want to contribute? check the the [contribution guidelines](CONTRIBUTING.md).
## module creation
each directory in the `mods` folder is considered a module, with the entry point `mod.js`.
this file must have its exports set to an object that defines metadata,
configurable options for the menu, code to be run in both the back- and front- ends of the app,
and styling.
`module.exports =`
| key | value | required |
| ------- | ---------------------------------- | -------- |
| id | uuidv4 string | ✔️ |
| meta | { meta: see below } | ✔️ |
| options | [ array of { option: see below } ] | |
| code | { code: see below } | ✔️ |
`meta: { }`
| key | value | required |
| ------- | ---------------------------- | -------- |
| type | 'extension', 'theme' | ✔️ |
| name | string | ✔️ |
| version | semver string (e.g. '0.3.7') | ✔️ |
| author | github username string | ✔️ |
| thumb | relative file string, url | |
`{ option }`
| key | value | required |
| ----- | -------------------------------------------------------------------------------- | -------- |
| name | string | ✔️ |
| type | 'toggle', 'select', 'input', 'file' | ✔️ |
| value | type.toggle = true, false. type.select = [array of strings]. type.input = string | |
`code: {}`
| key | value | required |
| -------- | -------------------- | -------- |
| styles | relative file string | |
| main | function | |
| renderer | function | |
| hack | function | |
_styles_ should be a css file, which is automatically inserted into each app window via the `enhancement://` protocol.
_main_ code is executed on app launch in the "main" process (singular, shared between all apps - consider it a backend).
_renderer_ code is executed on window launch in the "renderer" process
(per-window, the client-side js one might expect to run on a website).
note that as this code is inserted into notion's app, it may not work to `require()` modules that are not
already installed for the app. in future a fix for this is planned.
_hack_ code is executed on enhancement. this can be useful for things that require modding pre-existing parts of the app,
and can't just be overruled (e.g. making the window frameless).
to make the best use of these, check out [the electron docs](https://www.electronjs.org/docs/)
and explore the contents of your local extracted `app.asar`.

View File

@ -1,7 +1,7 @@
# readme placeholder # readme placeholder
ended up here? this is a wip version of the enhancer, and this file is yet to be written. ended up here? this is a wip version of the enhancer, and this file is yet to be completed.
if you're interested in the project, switch back to the [master branch](https://github.com/dragonwocky/notion-enhancer). if you're interested in using the project, switch back to the [master branch](https://github.com/dragonwocky/notion-enhancer).
for support, contact me on discord `dragonwocky#8449` or open an issue here in the repo. for support, contact me on discord `dragonwocky#8449` or open an issue here in the repo.
want to contribute? check the the [contribution guidelines](CONTRIBUTING.md). want to contribute? check the the [contribution guidelines](CONTRIBUTING.md).
@ -22,9 +22,6 @@ extension?
3. ensure no notion processes are running (you may want to check the task manager to make sure), and try running one of these commands: 3. ensure no notion processes are running (you may want to check the task manager to make sure), and try running one of these commands:
``` ```
notion-enhancer v0.8.0-beta
https://github.com/dragonwocky/notion-enhancer
Usage: Usage:
$ notion-enhancer <command> [options] $ notion-enhancer <command> [options]

23
mods/core/mod.js Normal file
View File

@ -0,0 +1,23 @@
/*
* notion-enhancer
* (c) 2020 dragonwocky <thedragonring.bod@gmail.com>
* (https://dragonwocky.me/) under the MIT license
*/
module.exports = {
id: '0f0bf8b6-eae6-4273-b307-8fc43f2ee082',
meta: {
type: 'extension',
name: 'notion-enhancer core',
version: require('../../package.json').version,
author: 'dragonwocky',
thumb:
'https://camo.githubusercontent.com/5c5bca9e987d986b8cc7e51066f90c6f8a84af08/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3733313634373938343332333931393933332f3733313732373235393239353032333132342f494d475f323137302e6a7067',
},
options: [],
code: {
styles: 'styles.css',
electron: () => {},
client: () => {},
},
};

0
mods/core/styles.css Normal file
View File