Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Command guide #214

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

MiniDigger
Copy link
Contributor

@MiniDigger MiniDigger commented Jul 6, 2019

Wrote two short guide on writing plugins and commands.

English isn't my first language and I am not experienced on JS either, so feel free to critique everything :D

see https://deploy-preview-214--thelounge.netlify.com/docs/guides/command-creation
and https://deploy-preview-214--thelounge.netlify.com/docs/guides/plugin-creation

@xPaw xPaw requested a review from AlMcKinlay July 6, 2019 10:47
_layouts/default.html Outdated Show resolved Hide resolved
Copy link
Member

@AlMcKinlay AlMcKinlay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove the command creation guide and stick to just the main one. I will be creating the API docs for the command API, and it'll supercede this.

I like the other guide though. Just a few points. Let me know if you have any issues with what I've said.

I'll make sure I cover everything in the commands guide into the actual API docs, thanks for this, it's helpful.

_guides/plugin-creation.md Outdated Show resolved Hide resolved
Plugins for The Lounge are npm packages hosted on [the npm registry](https://www.npmjs.com).
The work similarly to themes. A theme is a plugin but not every plugin is a theme.

In a directory named after your new plugin (for example, `thelounge-plugin-foo`), start by creating a new package with the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of this info, it might be better if we create a blank template for packages as a repository in the org? How does that sound to you? Then we can have a bit more info there around exactly what all this stuff is doing, but instead of all this explanation in this guide for setting up a dir, using yarn, etc, we can just say "clone this repo" and go from there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh, yeah, that would work too. I was just adapting the themes guide. Do we want to for the same for that too?

Refer to [the API reference](/docs/api) to learn what you can do or start implementing your own custom command with
[the custom command guide](/guides/command-creation).

## Helpful things for plugin developers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking these can be sorted by making some helper functions in the api, and then just having them in the API docs. We won't want to explain everything here, you know?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A helper for sending a message would be cool, I require could be helpful for other stuff tho I guess? For ppl who no experience with node like me, that might help.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we don't want to make this seem "official" because then we have to support it, you know? The helper functions are about being able to abstract out the internal code, and if people decide to use internal stuff, and we change it, we don't have to worry about that because it's not supported. Putting it in a guide on our official docs makes it look official.

_guides/plugin-creation.md Outdated Show resolved Hide resolved
The Lounge currently doesn't allow you to install a plugin from source, thats why we have to do it manually.

For that we have to add our plugin as a new package in the THELOUNGE_HOME/packages dir.
For that you need to have a package.json in that packages dir that looks kinda like this:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For that you need to have a package.json in that packages dir that looks kinda like this:
For that you need to edit the package.json in that dir. If it doesn't exist, you can create it by installing 1 plugin/theme as per the docs It will look something like this:

Also, maybe link docs to the docs for installing plugins.

}
}
```
the important thing is the name here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the important thing is the name here.
the version number doesn't matter at this point in time, just ensure that the name is unique. This should be the name of your package.

```
the important thing is the name here.

You then need to create a folder with that name in the `node_modules` sub dir.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth just suggesting they copy the whole folder that we know they have already created above, if they have been following this guide?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmhm, maybe. Ideally this would all be replace by a proper way to install themes locally anyways. If they copy the whole dir, it might become confusing on what to edit, that's why I only symlinked the two files that actually matter

You then need to create a folder with that name in the `node_modules` sub dir.
We then need to place our index.js and package.json in that dir.
You can do that manually by just copy pasting it, but that would involve copy pasting it for every change.
I would recommend symlinking the files from the project into the packages folder, kinda like this:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move away from I, and do something like "It is recommended" or something. We don't want these to be first person guides. Also, probably best to remove all of the bit above this with the "you could do X, but instead do Y" and just go straight to giving the command to symlink the whole directory that they have created.

So something like "in the directory that you have created your plugin, do ln ... etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I just copy pasted that out of my readme, I'll rewrite it tomorrow.

MiniDigger and others added 2 commits July 8, 2019 20:38
Co-Authored-By: Al McKinlay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants