Skip to content

Instantly share code, notes, and snippets.

@lisandi
Last active October 6, 2021 16:26
Show Gist options
  • Select an option

  • Save lisandi/4a09acf2be3eb23722f30d49d1b5c8c5 to your computer and use it in GitHub Desktop.

Select an option

Save lisandi/4a09acf2be3eb23722f30d49d1b5c8c5 to your computer and use it in GitHub Desktop.
Demo structure and content for an etherpad plugin.
#! /bin/sh
read -p "Enter the plugin name: ep_" PLUGINNAME
read -p "Enter a short description - min. 50 letters:" DESCRIPTION
read -p "Enter your user or nick-name: " USERNAME
read -p "Enter your real name: " AUTHORNAME
read -p "Enter your email-address: " AUTHOREMAIL
# Having shifted twice, the rest is now comments ...
COMMENTS=$@
# Creating the directory structure
echo "Creating the Folderstructure for ep_${PLUGINNAME} ..."
mkdir ep_${PLUGINNAME} ep_${PLUGINNAME}/locales ep_${PLUGINNAME}/static ep_${PLUGINNAME}/static/css ep_${PLUGINNAME}/static/js ep_${PLUGINNAME}/static/image ep_${PLUGINNAME}/static/tests ep_${PLUGINNAME}/templates
# Creating ep_${PLUGINNAME}/package.json
echo "Creating the package.json for ep_${PLUGINNAME} ..."
cat <<EOF >ep_${PLUGINNAME}/package.json
{
"name": "ep_${PLUGINNAME}",
"version": "0.0.1",
"description": "$DESCRIPTION",
"author": {
"name": "$USERNAME ($AUTHORNAME)",
"email": "<$AUTHOREMAIL>",
},
"contributors": [
"CONTRIBUTORNAME (REAL NAME)",
],
"keywords": [
"etherpad",
"plugin",
"ep",
],
"license": {
"Apache2"
},
"repository": {
"type": "git",
"url": "https://github.com/ether/ep_${PLUGINNAME}.git",
},
"bugs": {
"url": "https://github.com/ether/ep_${PLUGINNAME}/issues",
},
"homepage": {
"url": "https://github.com/ether/ep_${PLUGINNAME}/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_${PLUGINNAME}/ep.json
echo "Creating the ep.json for ep_${PLUGINNAME} ..."
cat<<EOF >ep_${PLUGINNAME}/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_${PLUGINNAME}/README.md
echo "Creating the README.md for ep_${PLUGINNAME} ..."
cat<<EOF >ep_${PLUGINNAME}/README.md
# My Example Plugin Name
![Publish Status](https://github.com/ether/ep_${PLUGINNAME}/workflows/Node.js%20Package/badge.svg) ![Publish Status](https://github.com/ether/ep_${PLUGINNAME}/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 ep_${PLUGINNAME} functionality in a pad. (describe in minimum 50 Letters what it is)
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
$USERNAME ($AUTHORNAME) - <$AUTHOREMAIL>
## Funding
Place your funding information here.
SEND
MORE
-----
MONEY
Thanks
$AUTHORNAME
EOF
# Create ep_${PLUGINNAME}/LICENSE.MD
echo "Creating the Apache2.0 LICENSE.md for ep_${PLUGINNAME} ..."
cat<<EOF >ep_${PLUGINNAME}/LICENSE.md
Copyright 2021 [$AUTHORNAME]
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_${PLUGINNAME}/en.json
echo "Creating the example English language file en.json for ep_${PLUGINNAME} ..."
cat<<EOF >ep_${PLUGINNAME}/locales/en.json
{
"ep_${PLUGINNAME}.toolbar.left.title" : "Left"
}
EOF
echo "Created the folderstructure and mandatory files for ep_${PLUGINNAME} by $USERNAME ($AUTHORNAME)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment