Building ConverseJS ourself.

This commit is contained in:
John Livingston 2021-11-08 16:35:26 +01:00
parent 1ea9feaab4
commit 679992146b
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
7 changed files with 51 additions and 11 deletions

View File

@ -4,6 +4,6 @@
"extends": [],
"globals": {},
"plugins": [],
"ignorePatterns": ["node_modules/", "dist/", "webpack.config.js"],
"ignorePatterns": ["node_modules/", "dist/", "webpack.config.js", "build/", "vendor/"],
"rules": {}
}

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules
.cache
dist
.vscode
build

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "vendor/converse.js"]
path = vendor/converse.js
url = https://github.com/conversejs/converse.js.git

View File

@ -0,0 +1,41 @@
#!/bin/bash
set -euo pipefail
set -x
rootdir="$(pwd)"
src_dir="$rootdir/conversejs"
converse_src_dir="$rootdir/vendor/converse.js"
converse_build_dir="$rootdir/build/converse.js"
converse_destination_dir="$rootdir/dist/client/conversejs"
if [[ ! -d $src_dir ]]; then
echo "$0 must be called from the plugin livechat root dir.\n"
exit 1
fi
if [[ ! -d "$converse_src_dir" ]]; then
echo "ConverseJS sources are not here. Please be sure to have all the submodules downloaded ('git pull --recurse-submodules').\n"
exit 1
fi
if cmp -s "$converse_src_dir/package.json" "$converse_build_dir/package.json"; then
echo "ConverseJS files are already up to date in the build directory.\n"
else
echo "ConverseJS files are not up to date in the build directory, copying them...\n"
rm -rf "$converse_build_dir"
mkdir -p "$converse_build_dir"
cp -R $converse_src_dir/* "$converse_build_dir"
fi
echo "Building ConverseJS"
cd "$converse_build_dir"
make dist
cd $rootdir
echo "Copying ConverseJS dist files...\n"
mkdir -p "$converse_destination_dir" && cp -r $converse_build_dir/dist/* "$converse_destination_dir/"
echo "ConverseJS OK.\n"
exit 0

6
package-lock.json generated
View File

@ -1744,12 +1744,6 @@
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"converse.js": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/converse.js/-/converse.js-7.0.6.tgz",
"integrity": "sha512-fcuj6H44F4RTg+WTpX6gsuSfARxL/lXlISeHBJfYfevOD+mFHOgN0tfI7PvoC25DmKCiZRXhm1iIdpfoiKvM3A==",
"dev": true
},
"copy-concurrently": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",

View File

@ -49,7 +49,6 @@
"@types/winston": "^2.4.4",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"converse.js": "^7.0.6",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-config-standard-with-typescript": "^20.0.0",
@ -75,15 +74,16 @@
],
"library": "./dist/server/main.js",
"scripts": {
"clean": "rm -rf dist/*",
"clean": "rm -rf dist/* build/*",
"clean:light": "rm -rf dist/*",
"prepare": "npm run build",
"build:converse": "mkdir -p dist/client/conversejs && cp -r node_modules/converse.js/dist/* dist/client/conversejs/",
"build:converse": "bash conversejs/build-conversejs.sh",
"build:images": "mkdir -p dist/client/images && npx svgo -f public/images/ -o dist/client/images/",
"build:webpack": "webpack --mode=production",
"build:server": "npx tsc --build server/tsconfig.json",
"build:serverconverse": "mkdir -p dist/server/conversejs && cp conversejs/index.html dist/server/conversejs/",
"build:prosodymodules": "mkdir -p dist/server/prosody-modules && cp -r prosody-modules/* dist/server/prosody-modules/",
"build": "npm-run-all -s clean -p build:converse build:images build:webpack build:server build:serverconverse build:prosodymodules",
"build": "npm-run-all -s clean:light -p build:converse build:images build:webpack build:server build:serverconverse build:prosodymodules",
"lint": "npx eslint --ext .js --ext .ts ."
},
"staticDirs": {

1
vendor/converse.js vendored Submodule

@ -0,0 +1 @@
Subproject commit e9967882a94ee48667d6d1aac33118dd32edebbb