From dca4e67b3585429709781976a6739858ed03b683 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Wed, 7 Apr 2021 15:53:22 +0200 Subject: [PATCH] Separing frontend and backend code in different folders. --- package.json | 20 +++++++++++--------- main.js => server/main.js | 0 webpack.config.js | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) rename main.js => server/main.js (100%) diff --git a/package.json b/package.json index 7e5a1257..ea1e4e5c 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "bugs": "https://github.com/JohnXLivingston/peertube-plugin-livechat/issues", "clientScripts": [ { - "script": "dist/videowatch-client-plugin.js", + "script": "dist/client/videowatch-client-plugin.js", "scopes": [ "video-watch" ] }, { - "script": "dist/common-client-plugin.js", + "script": "dist/client/common-client-plugin.js", "scopes": [ "common" ] @@ -43,20 +43,22 @@ "peertube", "plugin" ], - "library": "./main.js", + "library": "./dist/server/main.js", "scripts": { "clean": "rm -rf dist/*", "prepare": "npm run build", - "build:converse": "mkdir -p dist/conversejs && cp -r node_modules/converse.js/dist/* dist/conversejs/", - "build:images": "mkdir -p dist/images && npx svgo -f public/images/ -o dist/images/", + "build:converse": "mkdir -p dist/client/conversejs && cp -r node_modules/converse.js/dist/* dist/client/conversejs/", + "build:images": "mkdir -p dist/client/images && npx svgo -f public/images/ -o dist/client/images/", "build:webpack": "webpack --mode=production", - "build": "npm-run-all -s clean -p build:converse build:images build:webpack", + "build:server": "mkdir -p dist/server && cp ./server/main.js dist/server/", + "build:serverconverse": "mkdir -p dist/server/conversejs && cp conversejs/index.html dist/server/conversejs/", + "build": "npm-run-all -s clean -p build:converse build:images build:webpack build:server build:serverconverse", "lint": "npx eslint --ext .js ." }, "staticDirs": { - "static": "dist/static", - "conversejs": "dist/conversejs/", - "images": "dist/images/" + "static": "dist/client/static", + "conversejs": "dist/client/conversejs/", + "images": "dist/client/images/" }, "translations": { "fr-FR": "./languages/fr.json" diff --git a/main.js b/server/main.js similarity index 100% rename from main.js rename to server/main.js diff --git a/webpack.config.js b/webpack.config.js index db1d51f2..e370961b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,7 @@ const clientFiles = [ let config = clientFiles.map(f => ({ entry: "./client/" + f, output: { - path: path.resolve(__dirname, "./dist"), + path: path.resolve(__dirname, "./dist/client"), filename: "./" + f, library: "script", libraryTarget: "var" @@ -21,7 +21,7 @@ let config = clientFiles.map(f => ({ config.push({ entry: "./conversejs/builtin.js", output: { - path: path.resolve(__dirname, "./dist/static"), + path: path.resolve(__dirname, "./dist/client/static"), filename: "./builtin.js" } })