mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	Merge pull request #4671 from AlexeiKharchev/master
Reduce warnings count caused by bin/copy-trilium.sh
This commit is contained in:
		| @@ -2,49 +2,37 @@ | |||||||
|  |  | ||||||
| SRC_DIR=./dist/trilium-linux-x64-src | SRC_DIR=./dist/trilium-linux-x64-src | ||||||
|  |  | ||||||
| if [ "$1" != "DONTCOPY" ] | [ "$1" != "DONTCOPY" ] && ./bin/copy-trilium.sh "$SRC_DIR" | ||||||
| then |  | ||||||
|     ./bin/copy-trilium.sh $SRC_DIR |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| rm -r $SRC_DIR/src/public/app-dist/*.mobile.* | rm -r "$SRC_DIR"/src/public/app-dist/*.mobile.* | ||||||
|  |  | ||||||
| echo "Copying required linux-x64 binaries" | echo "Copying required linux-x64 binaries" | ||||||
|  | cp -r bin/better-sqlite3/linux-desktop-better_sqlite3.node "$SRC_DIR"/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||||
| cp -r bin/better-sqlite3/linux-desktop-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node |  | ||||||
|  |  | ||||||
| echo "Packaging linux x64 electron build" | echo "Packaging linux x64 electron build" | ||||||
|  | ./node_modules/.bin/electron-packager "$SRC_DIR" --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite | ||||||
| ./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite |  | ||||||
|  |  | ||||||
| BUILD_DIR=./dist/trilium-linux-x64 | BUILD_DIR=./dist/trilium-linux-x64 | ||||||
| rm -rf $BUILD_DIR | rm -rf "$BUILD_DIR" | ||||||
|  |  | ||||||
| mv "./dist/Trilium Notes-linux-x64" $BUILD_DIR | mv "./dist/Trilium Notes-linux-x64" "$BUILD_DIR" | ||||||
|  |  | ||||||
| cp images/app-icons/png/128x128.png $BUILD_DIR/icon.png | cp images/app-icons/png/128x128.png "$BUILD_DIR"/icon.png | ||||||
|  | cp bin/tpl/anonymize-database.sql "$BUILD_DIR"/ | ||||||
|  |  | ||||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | cp -r dump-db "$BUILD_DIR"/ | ||||||
|  | rm -rf "$BUILD_DIR"/dump-db/node_modules | ||||||
|  |  | ||||||
| cp -r dump-db $BUILD_DIR/ | for f in 'trilium-portable' 'trilium-safe-mode' 'trilium-no-cert-check'; do | ||||||
| rm -rf $BUILD_DIR/dump-db/node_modules |     cp bin/tpl/"$f".sh "$BUILD_DIR"/ | ||||||
|  |     chmod 755 "$BUILD_DIR"/"$f".sh | ||||||
| cp bin/tpl/trilium-portable.sh $BUILD_DIR/ | done | ||||||
| chmod 755 $BUILD_DIR/trilium-portable.sh |  | ||||||
|  |  | ||||||
| cp bin/tpl/trilium-safe-mode.sh $BUILD_DIR/ |  | ||||||
| chmod 755 $BUILD_DIR/trilium-safe-mode.sh |  | ||||||
|  |  | ||||||
| cp bin/tpl/trilium-no-cert-check.sh $BUILD_DIR/ |  | ||||||
| chmod 755 $BUILD_DIR/trilium-no-cert-check.sh |  | ||||||
|  |  | ||||||
| echo "Packaging linux x64 electron distribution..." | echo "Packaging linux x64 electron distribution..." | ||||||
| VERSION=`jq -r ".version" package.json` | VERSION=`jq -r ".version" package.json` | ||||||
|  |  | ||||||
| cd dist | pushd dist | ||||||
|  |     tar cJf "trilium-linux-x64-${VERSION}.tar.xz" trilium-linux-x64 | ||||||
| tar cJf trilium-linux-x64-${VERSION}.tar.xz trilium-linux-x64 | popd | ||||||
|  |  | ||||||
| cd .. |  | ||||||
|  |  | ||||||
| bin/build-debian.sh | bin/build-debian.sh | ||||||
|   | |||||||
| @@ -4,47 +4,49 @@ if [[ $# -eq 0 ]] ; then | |||||||
|     echo "Missing argument of target directory" |     echo "Missing argument of target directory" | ||||||
|     exit 1 |     exit 1 | ||||||
| fi | fi | ||||||
|  | if ! [[ $(which npm) ]]; then | ||||||
|  |     echo "Missing npm" | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
| n exec 18.18.2 npm run webpack | n exec 18.18.2 npm run webpack || npm run webpack | ||||||
|  |  | ||||||
| DIR=$1 | DIR="$1" | ||||||
|  |  | ||||||
| rm -rf $DIR | rm -rf "$DIR" | ||||||
| mkdir $DIR | mkdir -pv "$DIR" | ||||||
|  |  | ||||||
| echo "Copying Trilium to build directory $DIR" | echo "Copying Trilium to build directory $DIR" | ||||||
|  |  | ||||||
| cp -r images $DIR/ | for d in 'images' 'libraries' 'src' 'db'; do | ||||||
| cp -r libraries $DIR/ |     cp -r "$d" "$DIR"/ | ||||||
| cp -r src $DIR/ | done | ||||||
| cp -r db $DIR/ | for f in 'package.json' 'package-lock.json' 'README.md' 'LICENSE' 'config-sample.ini' 'electron.js'; do | ||||||
| cp -r package.json $DIR/ |     cp "$f" "$DIR"/ | ||||||
| cp -r package-lock.json $DIR/ | done | ||||||
| cp -r README.md $DIR/ | cp webpack-* "$DIR"/      # here warning because there is no 'webpack-*', but webpack.config.js only | ||||||
| cp -r LICENSE $DIR/ |  | ||||||
| cp -r config-sample.ini $DIR/ |  | ||||||
| cp -r electron.js $DIR/ |  | ||||||
| cp webpack-* $DIR/ |  | ||||||
|  |  | ||||||
| # run in subshell (so we return to original dir) | # run in subshell (so we return to original dir) | ||||||
| (cd $DIR && n exec 18.18.2 npm install --only=prod) | (cd $DIR && n exec 18.18.2 npm install --only=prod) | ||||||
|  |  | ||||||
|  | if [[ -d "$DIR"/node_modules ]]; then | ||||||
| # cleanup of useless files in dependencies | # cleanup of useless files in dependencies | ||||||
| rm -r $DIR/node_modules/image-q/demo |     for d in 'image-q/demo' 'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' '@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do | ||||||
| rm -r $DIR/node_modules/better-sqlite3/Release |         [[ -e "$DIR"/node_modules/"$d" ]] && rm -rv "$DIR"/node_modules/"$d" | ||||||
| rm -r $DIR/node_modules/better-sqlite3/deps/sqlite3.tar.gz |     done | ||||||
| rm -r $DIR/node_modules/@jimp/plugin-print/fonts |  | ||||||
| rm -r $DIR/node_modules/jimp/browser |  | ||||||
| rm -r $DIR/node_modules/jimp/fonts |  | ||||||
|  |  | ||||||
| # delete all tests (there are often large images as test file for jimp etc.) | # delete all tests (there are often large images as test file for jimp etc.) | ||||||
| find $DIR/node_modules -name test -exec rm -rf {} \; |     for d in 'test' 'docs' 'demo'; do | ||||||
| find $DIR/node_modules -name docs -exec rm -rf {} \; |         find "$DIR"/node_modules -name "$d" -exec rm -rf {} \; | ||||||
| find $DIR/node_modules -name demo -exec rm -rf {} \; |     done | ||||||
|  | fi | ||||||
|  |  | ||||||
| find $DIR/libraries -name "*.map" -type f -delete | find $DIR/libraries -name "*.map" -type f -delete | ||||||
|  |  | ||||||
| cp $DIR/src/public/app/share.js $DIR/src/public/app-dist/ | d="$DIR"/src/public | ||||||
| cp -r $DIR/src/public/app/doc_notes $DIR/src/public/app-dist/ | [[ -d "$d"/app-dist ]] || mkdir -pv "$d"/app-dist | ||||||
|  | cp "$d"/app/share.js "$d"/app-dist/ | ||||||
|  | cp -r "$d"/app/doc_notes "$d"/app-dist/ | ||||||
|  |  | ||||||
| rm -rf $DIR/src/public/app | rm -rf "$d"/app | ||||||
|  | unset f d DIR | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user