Skip to content

Instantly share code, notes, and snippets.

@lisandi
Created October 3, 2021 15:47
Show Gist options
  • Save lisandi/e2ed83af0862e0f013150da58ad160c5 to your computer and use it in GitHub Desktop.
Save lisandi/e2ed83af0862e0f013150da58ad160c5 to your computer and use it in GitHub Desktop.
Creating New structure for Etherpad Plugin -> Select All -> Copy Paste to Shell -> Change the name for the Plugin and press Enter
# Creating the directory structure
mkdir ep_123 ep_123/locales ep_123/static ep_123/static/css ep_123/static/js ep_123/static/image ep_123/static/tests ep_123/templates
&
# Creating ep_123/package.json
cat <<EOF >ep_123/package.json
{
"name": "ep_PLUGINNAME",
"version": "0.0.1",
"description": "DESCRIPTION",
"author": {
"name": "USERNAME (REAL NAME)",
"email": "<MAIL@EXAMPLE.COM>",
},
"contributors": [
"CONTRIBUTORNAME (REAL NAME)",
],
"keywords": [
"etherpad",
"plugin",
"ep",
],
"license": {
"Apache2"
},
"repository": {
"type": "git",
"url": "https://github.com/ether/myplugin.git",
},
"bugs": {
"url": "https://github.com/ether/myplugin/issues",
},
"homepage": {
"url": "https://github.com/ether/myplugin/README.md",
},
"funding": {
"type": "individual",
"url": "https://etherpad.org/",
},
"dependencies": {
"MODULE": "0.3.20",
},
"peerDependencies": {
"ep_etherpad_lite":">=1.8.6",
},
"devDependencies": {
"eslint": "^7.18.0",
"eslint-config-etherpad": "^1.0.24",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-mocha": "^8.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
},
"eslintConfig": {
"root": true,
"extends": "etherpad/plugin",
},
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix .",
},
"engines": {
"node": ">= 10.13.0",
}
}
EOF
&
# Creating ep_123/ep.json
cat<<EOF >ep_123/ep.json
{
"parts": [
{
"name": "main",
"client_hooks": {
"aceEditEvent": "ep_PLUGINNAME/static/js/index",
"postToolbarInit": "ep_PLUGINNAME/static/js/index",
"aceDomLineProcessLineAttributes": "ep_PLUGINNAME/static/js/index",
"postAceInit": "ep_PLUGINNAME/static/js/index",
"aceInitialized": "ep_PLUGINNAME/static/js/index",
"aceAttribsToClasses": "ep_PLUGINNAME/static/js/index",
"collectContentPre": "ep_PLUGINNAME/static/js/shared",
"aceRegisterBlockElements": "ep_PLUGINNAME/static/js/index",
},
"hooks": {
"authorize": "ep_PLUGINNAME/YOURFILE:FUNCTIONNAME1",
"authenticate": "ep_PLUGINNAME/YOURFILE:FUNCTIONNAME2",
"expressCreateServer": "ep_PLUGINNAME/YOURFILE:FUNCTIONNAME3",
"eejsBlock_editbarMenuLeft": "ep_PLUGINNAME/index",
"collectContentPre": "ep_PLUGINNAME/static/js/shared",
"collectContentPost": "ep_PLUGINNAME/static/js/shared",
"padInitToolbar": "ep_PLUGINNAME/index",
"getLineHTMLForExport": "ep_PLUGINNAME/index",
}
}
]
}
EOF
&
# Create ep_123/README.md
cat<<EOF >ep_123/README.md
# My Example Plugin Name
![Publish Status](https://github.com/ether/ep_my_example/workflows/Node.js%20Package/badge.svg) ![Publish Status](https://github.com/ether/ep_my_example/workflows/Node.js%20Package/badge.svg)
![Screenshot](https://user-images.githubusercontent.com/220864/107214131-5c3dd600-6a01-11eb-82d9-b2d67ec8ae93.png)
## What is this?
An Etherpad Plugin to apply the my_example_plugin functionality (describe what it is) in a pad.
Currently supports:
* My example functionality 1
* My example functionality 2
* My example functionality 3
* My example functionality 4
## Export support
Experimental. As a special attribute on Etherpad, some weirdness may be experienced.
## History
I decided to copy/paste the ep_headings2 plugin over ep_align to fix a load of issues.
## License
Apache 2
## Development
Development did for free to help support continued learning due to disruption by the coronavirus. 26LLC supported.
## Author
My Example Plugin by XYZ
## Funding
Place your funding information here.
EOF
&
# Create ep_123/LICENSE.MD
cat<<EOF >ep_123/LICENSE.md
Copyright 2021 [ENTER YOUR FULL REAL NAME]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
EOF
&
# CREATE ep_123/en.json
cat<<EOF >ep_123/locales/en.json
{
"ep_my_example.toolbar.left.title" : "Left"
}
EOF
&
# renaming the main directory
mv ep_123 ep_my_example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment