mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
fix github plugin installation (#6584)
This commit is contained in:
parent
1393f338e0
commit
f8225b3e2a
4 changed files with 32 additions and 17 deletions
19
Dockerfile
19
Dockerfile
|
@ -49,6 +49,14 @@ ARG ETHERPAD_PLUGINS=
|
||||||
# ETHERPAD_LOCAL_PLUGINS="../ep_my_plugin ../ep_another_plugin"
|
# ETHERPAD_LOCAL_PLUGINS="../ep_my_plugin ../ep_another_plugin"
|
||||||
ARG ETHERPAD_LOCAL_PLUGINS=
|
ARG ETHERPAD_LOCAL_PLUGINS=
|
||||||
|
|
||||||
|
# github plugins to install while building the container. By default no plugins are
|
||||||
|
# installed.
|
||||||
|
# If given a value, it has to be a space-separated, quoted list of plugin names.
|
||||||
|
#
|
||||||
|
# EXAMPLE:
|
||||||
|
# ETHERPAD_GITHUB_PLUGINS="ether/ep_plugin"
|
||||||
|
ARG ETHERPAD_GITHUB_PLUGINS=
|
||||||
|
|
||||||
# Control whether abiword will be installed, enabling exports to DOC/PDF/ODT formats.
|
# Control whether abiword will be installed, enabling exports to DOC/PDF/ODT formats.
|
||||||
# By default, it is not installed.
|
# By default, it is not installed.
|
||||||
# If given any value, abiword will be installed.
|
# If given any value, abiword will be installed.
|
||||||
|
@ -114,13 +122,13 @@ COPY --chown=etherpad:etherpad ./pnpm-workspace.yaml ./package.json ./
|
||||||
|
|
||||||
FROM build AS development
|
FROM build AS development
|
||||||
|
|
||||||
COPY --chown=etherpad:etherpad ./src/package.json .npmrc ./src/
|
COPY --chown=etherpad:etherpad ./src/ ./src/
|
||||||
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/ templates/admin./src/templates/admin
|
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/ templates/admin./src/templates/admin
|
||||||
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/static/oidc ./src/static/oidc
|
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/static/oidc ./src/static/oidc
|
||||||
|
|
||||||
RUN bin/installDeps.sh && \
|
RUN bin/installDeps.sh && \
|
||||||
if [ ! -z "${ETHERPAD_PLUGINS}" ] || [ ! -z "${ETHERPAD_LOCAL_PLUGINS}" ]; then \
|
if [ ! -z "${ETHERPAD_PLUGINS}" ] || [ ! -z "${ETHERPAD_LOCAL_PLUGINS}" ] || [ ! -z "${ETHERPAD_GITHUB_PLUGINS}" ]; then \
|
||||||
pnpm run plugins i ${ETHERPAD_PLUGINS} ${ETHERPAD_LOCAL_PLUGINS:+--path ${ETHERPAD_LOCAL_PLUGINS}}; \
|
pnpm run plugins i ${ETHERPAD_PLUGINS} ${ETHERPAD_LOCAL_PLUGINS:+--path ${ETHERPAD_LOCAL_PLUGINS}} ${ETHERPAD_GITHUB_PLUGINS:+--github ${ETHERPAD_GITHUB_PLUGINS}}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,11 +142,10 @@ COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/template
|
||||||
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/static/oidc ./src/static/oidc
|
COPY --chown=etherpad:etherpad --from=adminbuild /opt/etherpad-lite/src/static/oidc ./src/static/oidc
|
||||||
|
|
||||||
RUN bin/installDeps.sh && rm -rf ~/.npm && rm -rf ~/.local && rm -rf ~/.cache && \
|
RUN bin/installDeps.sh && rm -rf ~/.npm && rm -rf ~/.local && rm -rf ~/.cache && \
|
||||||
if [ ! -z "${ETHERPAD_PLUGINS}" ] || [ ! -z "${ETHERPAD_LOCAL_PLUGINS}" ]; then \
|
if [ ! -z "${ETHERPAD_PLUGINS}" ] || [ ! -z "${ETHERPAD_LOCAL_PLUGINS}" ] || [ ! -z "${ETHERPAD_GITHUB_PLUGINS}" ]; then \
|
||||||
pnpm run plugins i ${ETHERPAD_PLUGINS} ${ETHERPAD_LOCAL_PLUGINS:+--path ${ETHERPAD_LOCAL_PLUGINS}}; \
|
pnpm run plugins i ${ETHERPAD_PLUGINS} ${ETHERPAD_LOCAL_PLUGINS:+--path ${ETHERPAD_LOCAL_PLUGINS}} ${ETHERPAD_GITHUB_PLUGINS:+--github ${ETHERPAD_GITHUB_PLUGINS}}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Copy the configuration file.
|
# Copy the configuration file.
|
||||||
COPY --chown=etherpad:etherpad ${SETTINGS} "${EP_DIR}"/settings.json
|
COPY --chown=etherpad:etherpad ${SETTINGS} "${EP_DIR}"/settings.json
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,13 @@ const possibleActions = [
|
||||||
]
|
]
|
||||||
|
|
||||||
const install = ()=> {
|
const install = ()=> {
|
||||||
|
const argsAsString: string = args.join(" ");
|
||||||
let registryPlugins: string[] = [];
|
const regexRegistryPlugins = /(?<=i\s)(.*?)(?=--github|--path|$)/;
|
||||||
let localPlugins: string[] = [];
|
const regexLocalPlugins = /(?<=--path\s)(.*?)(?=--github|$)/;
|
||||||
|
const regexGithubPlugins = /(?<=--github\s)(.*?)(?=--path|$)/;
|
||||||
if (args.indexOf('--path') !== -1) {
|
const registryPlugins = argsAsString.match(regexRegistryPlugins)?.[0]?.split(" ")?.filter(s => s) || [];
|
||||||
const indexToSplit = args.indexOf('--path');
|
const localPlugins = argsAsString.match(regexLocalPlugins)?.[0]?.split(" ")?.filter(s => s) || [];
|
||||||
registryPlugins = args.slice(1, indexToSplit);
|
const githubPlugins = argsAsString.match(regexGithubPlugins)?.[0]?.split(" ")?.filter(s => s) || [];
|
||||||
localPlugins = args.slice(indexToSplit + 1);
|
|
||||||
} else {
|
|
||||||
registryPlugins = args;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
for (const plugin of registryPlugins) {
|
for (const plugin of registryPlugins) {
|
||||||
|
@ -53,6 +49,11 @@ const install = ()=> {
|
||||||
console.log(`Installing plugin from path: ${plugin}`);
|
console.log(`Installing plugin from path: ${plugin}`);
|
||||||
await linkInstaller.installFromPath(plugin);
|
await linkInstaller.installFromPath(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const plugin of githubPlugins) {
|
||||||
|
console.log(`Installing plugin from github: ${plugin}`);
|
||||||
|
await linkInstaller.installFromGitHub(plugin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
|
@ -9,6 +9,7 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
args:
|
args:
|
||||||
|
# Attention: installed plugins in the node_modules folder get overwritten during volume mount in dev
|
||||||
ETHERPAD_PLUGINS:
|
ETHERPAD_PLUGINS:
|
||||||
# change from development to production if needed
|
# change from development to production if needed
|
||||||
target: development
|
target: development
|
||||||
|
|
|
@ -44,6 +44,12 @@ export class LinkInstaller {
|
||||||
await this.checkLinkedDependencies(installedPlugin)
|
await this.checkLinkedDependencies(installedPlugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async installFromGitHub(repository: string) {
|
||||||
|
const installedPlugin = await this.livePluginManager.installFromGithub(repository)
|
||||||
|
this.linkDependency(installedPlugin.name)
|
||||||
|
await this.checkLinkedDependencies(installedPlugin)
|
||||||
|
}
|
||||||
|
|
||||||
public async installPlugin(pluginName: string, version?: string) {
|
public async installPlugin(pluginName: string, version?: string) {
|
||||||
if (version) {
|
if (version) {
|
||||||
const installedPlugin = await this.livePluginManager.install(pluginName, version);
|
const installedPlugin = await this.livePluginManager.install(pluginName, version);
|
||||||
|
|
Loading…
Reference in a new issue