chore: add Prettier configuration and update prettier binary

This commit is contained in:
josselinonduty 2025-04-21 00:24:19 +09:00
parent d12c45308d
commit b199dead1e
No known key found for this signature in database
3 changed files with 18 additions and 5 deletions

8
.prettierrc.json Normal file
View File

@ -0,0 +1,8 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always"
}

View File

@ -31,11 +31,11 @@ prepare: clean install_build_deps
@cd $(SOURCE_DIR) && 7z x -y -bsp0 -bso0 app-32.7z @cd $(SOURCE_DIR) && 7z x -y -bsp0 -bso0 app-32.7z
@echo "Extract app sources from the app" @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" @echo "Prettier the sources to patch successfully"
@node_modules/prettier/bin-prettier.js --write "$(APP_DIR)/build/*.js" @cp .prettierrc.json $(APP_DIR)/
@node_modules/prettier/bin-prettier.js --write "$(APP_DIR)/build/*.html" @npm run prettier -- --write "$(APP_DIR)/build/*.{js,html}" --config .prettierrc.json --ignore-path /dev/null
@echo "Apply patches from ./patches:" @echo "Apply patches from ./patches:"
@echo "01 - Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4)" @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 "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 "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)" @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 "Append `package-append.json` to the `package.json` of the app"
@echo "Adds electron, elecron-builder dependencies, prod and build directives" @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." @echo "Don't forget to rename your patch."
patch-gen: 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 @cd $(APP_DIR) && git format-patch -1 HEAD --stdout > ../patches/$(shell date +%y%m%d-%s).patch
#! UTILS #! UTILS

View File

@ -1,6 +1,10 @@
{ {
"dependencies": { "dependencies": {
"@electron/asar": "3.4.1", "@electron/asar": "3.4.1",
"prettier": "2.8.8" "prettier": "3.5.3"
},
"scripts": {
"asar": "asar",
"prettier": "prettier"
} }
} }