From b199dead1eeff9090b0b9af30a7a8a30e64898f9 Mon Sep 17 00:00:00 2001 From: josselinonduty Date: Mon, 21 Apr 2025 00:24:19 +0900 Subject: [PATCH] chore: add Prettier configuration and update prettier binary --- .prettierrc.json | 8 ++++++++ Makefile | 9 +++++---- package.json | 6 +++++- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..689c248 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "semi": true, + "singleQuote": false, + "trailingComma": "es5", + "tabWidth": 2, + "useTabs": false, + "arrowParens": "always" +} diff --git a/Makefile b/Makefile index 5a1d0f6..b0868cd 100644 --- a/Makefile +++ b/Makefile @@ -31,11 +31,11 @@ prepare: clean install_build_deps @cd $(SOURCE_DIR) && 7z x -y -bsp0 -bso0 app-32.7z @echo "Extract app sources from the app" - @node_modules/@electron/asar/bin/asar.js extract $(SOURCE_DIR)/resources/app.asar $(APP_DIR) + @npm run asar extract "$(SOURCE_DIR)/resources/app.asar" "$(APP_DIR)" @echo "Prettier the sources to patch successfully" - @node_modules/prettier/bin-prettier.js --write "$(APP_DIR)/build/*.js" - @node_modules/prettier/bin-prettier.js --write "$(APP_DIR)/build/*.html" + @cp .prettierrc.json $(APP_DIR)/ + @npm run prettier -- --write "$(APP_DIR)/build/*.{js,html}" --config .prettierrc.json --ignore-path /dev/null @echo "Apply patches from ./patches:" @echo "01 - Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4)" @@ -49,7 +49,7 @@ prepare: clean install_build_deps @echo "09 - Add environment variable to change log level (https://github.com/aunetx/deezer-linux/pull/95)" @echo "10 - Add track duration and url, various fixes (https://github.com/aunetx/deezer-linux/pull/95)" @echo "11 - Improve responsiveness on small devices (https://github.com/aunetx/deezer-linux/pull/107)" - $(foreach p, $(wildcard ./patches/*), patch -p 1 -d $(APP_DIR) < $(p);) + @$(foreach p, $(wildcard ./patches/*), patch -p 1 -d $(APP_DIR) < $(p);) @echo "Append `package-append.json` to the `package.json` of the app" @echo "Adds electron, elecron-builder dependencies, prod and build directives" @@ -117,6 +117,7 @@ patch-new: install_deps @echo "Don't forget to rename your patch." patch-gen: + @npm run prettier -- --write "$(APP_DIR)/build/*.{js,html}" --config .prettierrc.json --ignore-path /dev/null @cd $(APP_DIR) && git format-patch -1 HEAD --stdout > ../patches/$(shell date +%y%m%d-%s).patch #! UTILS diff --git a/package.json b/package.json index aa5316a..117cc4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,10 @@ { "dependencies": { "@electron/asar": "3.4.1", - "prettier": "2.8.8" + "prettier": "3.5.3" + }, + "scripts": { + "asar": "asar", + "prettier": "prettier" } }