mirror of
				https://github.com/SteamDeckHomebrew/decky-plugin-template.git
				synced 2025-11-04 08:12:26 -06:00 
			
		
		
		
	Makefile helper tools, frontend UI lib updated, option added to build plugin in docker
This commit is contained in:
		
					parent
					
						
							
								ae179d618e
							
						
					
				
			
			
				commit
				
					
						ddb21cc3b7
					
				
			
		
					 6 changed files with 151 additions and 11 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -22,6 +22,7 @@ coverage
 | 
				
			||||||
# Dependency directory
 | 
					# Dependency directory
 | 
				
			||||||
node_modules
 | 
					node_modules
 | 
				
			||||||
bower_components
 | 
					bower_components
 | 
				
			||||||
 | 
					.pnpm-store
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Editors
 | 
					# Editors
 | 
				
			||||||
.idea
 | 
					.idea
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										8
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					FROM ghcr.io/steamdeckhomebrew/holo-base:latest as tools
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					COPY . /app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN set -eux; \
 | 
				
			||||||
 | 
					    pacman -S --noconfirm npm jq; \
 | 
				
			||||||
 | 
					    npm install -g npm@9.2.0 pnpm;
 | 
				
			||||||
							
								
								
									
										125
									
								
								Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,125 @@
 | 
				
			||||||
 | 
					ifneq (,$(wildcard ./.env))
 | 
				
			||||||
 | 
						include .env
 | 
				
			||||||
 | 
						export
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SHELL=bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: help
 | 
				
			||||||
 | 
					help: ## Display list of tasks with descriptions
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@fgrep -h ": ## " $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed 's/-default//' | awk 'BEGIN {FS = ": ## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: vendor
 | 
				
			||||||
 | 
					vendor: ## Install project dependencies
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@pnpm i
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: env
 | 
				
			||||||
 | 
					env: ## Create default .env file
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@echo -e '# Makefile tools\nDECK_USER=deck\nDECK_HOST=192.168.0.22\nDECK_PORT=22\nDECK_HOME=/home/deck\nDECK_KEY=~/.ssh/id_rsa' >> .env
 | 
				
			||||||
 | 
						@echo -n "PLUGIN_FOLDER=" >> .env
 | 
				
			||||||
 | 
						@jq -r .name package.json >> .env
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: init
 | 
				
			||||||
 | 
					init: ## Initialize project
 | 
				
			||||||
 | 
					init: env vendor
 | 
				
			||||||
 | 
						@echo -e "\n\033[1;36m Almost ready! Just a few things left to do:\033[0m\n"
 | 
				
			||||||
 | 
						@echo -e "1. Open .env file and make sure every DECK_* variable matches your steamdeck's ip, user, etc"
 | 
				
			||||||
 | 
						@echo -e "2. Run \`\033[0;36mmake copy-ssh-key\033[0m\` to copy your public ssh key to steamdeck"
 | 
				
			||||||
 | 
						@echo -e "3. Build your code with \`\033[0;36mmake build\033[0m\` or \`\033[0;36mmake docker-build\033[0m\` to build inside a docker container"
 | 
				
			||||||
 | 
						@echo -e "4. Deploy your plugin code to steamdeck with \`\033[0;36mmake deploy\033[0m\`"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: update-frontend-lib
 | 
				
			||||||
 | 
					update-frontend-lib: ## Update decky-frontend-lib
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@pnpm update decky-frontend-lib --latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: build-front
 | 
				
			||||||
 | 
					build-front: ## Build frontend
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@pnpm run build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: build-back
 | 
				
			||||||
 | 
					build-back: ## Build backend
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@make -C ./backend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: build
 | 
				
			||||||
 | 
					build: ## Build everything
 | 
				
			||||||
 | 
					build: build-front build-back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: copy-ssh-key
 | 
				
			||||||
 | 
					copy-ssh-key: ## Copy public ssh key to steamdeck
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@ssh-copy-id -i $(DECK_KEY) $(DECK_USER)@$(DECK_HOST)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: deploy-steamdeck
 | 
				
			||||||
 | 
					deploy-steamdeck: ## Deploy plugin build to steamdeck
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@ssh $(DECK_USER)@$(DECK_HOST) -p $(DECK_PORT) -i $(DECK_KEY) \
 | 
				
			||||||
 | 
					 		'chmod -v 755 $(DECK_HOME)/homebrew/plugins/ && mkdir -p $(DECK_HOME)/homebrew/plugins/$(PLUGIN_FOLDER)'
 | 
				
			||||||
 | 
						@rsync -azp --delete --progress -e "ssh -i $(DECK_KEY)" \
 | 
				
			||||||
 | 
							--chmod=Du=rwx,Dg=rx,Do=rx,Fu=rwx,Fg=rx,Fo=rx \
 | 
				
			||||||
 | 
							--exclude='.git/' \
 | 
				
			||||||
 | 
							--exclude='.github/' \
 | 
				
			||||||
 | 
							--exclude='.vscode/' \
 | 
				
			||||||
 | 
							--exclude='node_modules/' \
 | 
				
			||||||
 | 
							--exclude='.pnpm-store/' \
 | 
				
			||||||
 | 
							--exclude='src/' \
 | 
				
			||||||
 | 
							--exclude='*.log' \
 | 
				
			||||||
 | 
							--exclude='.gitignore' . \
 | 
				
			||||||
 | 
							--exclude='.idea' . \
 | 
				
			||||||
 | 
							--exclude='.env' . \
 | 
				
			||||||
 | 
							--exclude='Makefile' . \
 | 
				
			||||||
 | 
					 		./ $(DECK_USER)@$(DECK_HOST):$(DECK_HOME)/homebrew/plugins/$(PLUGIN_FOLDER)/
 | 
				
			||||||
 | 
						@ssh $(DECK_USER)@$(DECK_HOST) -p $(DECK_PORT) -i $(DECK_KEY) \
 | 
				
			||||||
 | 
					 		'chmod -v 755 $(DECK_HOME)/homebrew/plugins/'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: restart-decky
 | 
				
			||||||
 | 
					restart-decky: ## Restart Decky on remote steamdeck
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@ssh -t $(DECK_USER)@$(DECK_HOST) -p $(DECK_PORT) -i $(DECK_KEY) \
 | 
				
			||||||
 | 
					 		'sudo systemctl restart plugin_loader.service'
 | 
				
			||||||
 | 
						@echo -e '\033[0;32m+ all is good, restarting Decky...\033[0m'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: deploy
 | 
				
			||||||
 | 
					deploy: ## Deploy code to steamdeck and restart Decky
 | 
				
			||||||
 | 
					deploy: deploy-steamdeck restart-decky
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: it
 | 
				
			||||||
 | 
					it: ## Build all code, deploy it to steamdeck, restart Decky
 | 
				
			||||||
 | 
					it: build deploy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: cleanup
 | 
				
			||||||
 | 
					cleanup: ## Delete all generated files and folders
 | 
				
			||||||
 | 
						@rm -f .env
 | 
				
			||||||
 | 
						@rm -rf ./dist
 | 
				
			||||||
 | 
						@rm -rf ./tmp
 | 
				
			||||||
 | 
						@rm -rf ./node_modules
 | 
				
			||||||
 | 
						@rm -rf ./.pnpm-store
 | 
				
			||||||
 | 
						@rm -rf ./backend/out
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: uninstall-plugin
 | 
				
			||||||
 | 
					uninstall-plugin: ## Uninstall plugin from steamdeck, restart Decky
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@ssh -t $(DECK_USER)@$(DECK_HOST) -p $(DECK_PORT) -i $(DECK_KEY) \
 | 
				
			||||||
 | 
					 		"sudo sh -c 'rm -rf $(DECK_HOME)/homebrew/plugins/$(PLUGIN_FOLDER)/ && systemctl restart plugin_loader.service'"
 | 
				
			||||||
 | 
						@echo -e '\033[0;32m+ all is good, restarting Decky...\033[0m'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: docker-init
 | 
				
			||||||
 | 
					docker-init: ## Initialize project inside docker container
 | 
				
			||||||
 | 
					docker-init: docker-rebuild-image
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@docker compose run --rm tools make init
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: docker-rebuild-image
 | 
				
			||||||
 | 
					docker-rebuild-image: ## Rebuild docker image
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@docker compose build --pull
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: docker-build
 | 
				
			||||||
 | 
					docker-build: ## Build project inside docker container
 | 
				
			||||||
 | 
						@echo "+ $@"
 | 
				
			||||||
 | 
						@docker compose run --rm tools make build
 | 
				
			||||||
							
								
								
									
										12
									
								
								docker-compose.yaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								docker-compose.yaml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					version: "3.8"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  tools:
 | 
				
			||||||
 | 
					    build:
 | 
				
			||||||
 | 
					      context: "."
 | 
				
			||||||
 | 
					      dockerfile: "Dockerfile"
 | 
				
			||||||
 | 
					      target: "tools"
 | 
				
			||||||
 | 
					    restart: "no"
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - "./:/app/:delegated"
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,7 @@
 | 
				
			||||||
    "typescript": "^4.7.4"
 | 
					    "typescript": "^4.7.4"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "decky-frontend-lib": "^3.6.1",
 | 
					    "decky-frontend-lib": "^3.18.10",
 | 
				
			||||||
    "react-icons": "^4.4.0"
 | 
					    "react-icons": "^4.4.0"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "pnpm": {
 | 
					  "pnpm": {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								pnpm-lock.yaml
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										14
									
								
								pnpm-lock.yaml
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -8,7 +8,7 @@ specifiers:
 | 
				
			||||||
  '@rollup/plugin-typescript': ^8.3.3
 | 
					  '@rollup/plugin-typescript': ^8.3.3
 | 
				
			||||||
  '@types/react': 16.14.0
 | 
					  '@types/react': 16.14.0
 | 
				
			||||||
  '@types/webpack': ^5.28.0
 | 
					  '@types/webpack': ^5.28.0
 | 
				
			||||||
  decky-frontend-lib: ^3.6.1
 | 
					  decky-frontend-lib: ^3.18.10
 | 
				
			||||||
  react-icons: ^4.4.0
 | 
					  react-icons: ^4.4.0
 | 
				
			||||||
  rollup: ^2.77.1
 | 
					  rollup: ^2.77.1
 | 
				
			||||||
  rollup-plugin-import-assets: ^1.1.1
 | 
					  rollup-plugin-import-assets: ^1.1.1
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@ specifiers:
 | 
				
			||||||
  typescript: ^4.7.4
 | 
					  typescript: ^4.7.4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dependencies:
 | 
					dependencies:
 | 
				
			||||||
  decky-frontend-lib: 3.6.1
 | 
					  decky-frontend-lib: 3.18.10
 | 
				
			||||||
  react-icons: 4.4.0
 | 
					  react-icons: 4.4.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
devDependencies:
 | 
					devDependencies:
 | 
				
			||||||
| 
						 | 
					@ -418,10 +418,8 @@ packages:
 | 
				
			||||||
    resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
 | 
					    resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
 | 
				
			||||||
    dev: true
 | 
					    dev: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /decky-frontend-lib/3.6.1:
 | 
					  /decky-frontend-lib/3.18.10:
 | 
				
			||||||
    resolution: {integrity: sha512-NBlltn4EktqFgD1fj2AU0ccJJNMNgcqCnmhYd34Z5xR7ypGNT2oSqfSvFIlzU4WbDL9RyrcHSJlSMdYk6n4NXA==}
 | 
					    resolution: {integrity: sha512-2mgbA3sSkuwQR/FnmhXVrcW6LyTS95IuL6muJAmQCruhBvXapDtjk1TcgxqMZxFZwGD1IPnemPYxHZll6IgnZw==}
 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      minimist: 1.2.7
 | 
					 | 
				
			||||||
    dev: false
 | 
					    dev: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /deepmerge/4.2.2:
 | 
					  /deepmerge/4.2.2:
 | 
				
			||||||
| 
						 | 
					@ -640,10 +638,6 @@ packages:
 | 
				
			||||||
    resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==}
 | 
					    resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==}
 | 
				
			||||||
    dev: true
 | 
					    dev: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /minimist/1.2.7:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /neo-async/2.6.2:
 | 
					  /neo-async/2.6.2:
 | 
				
			||||||
    resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
 | 
					    resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
 | 
				
			||||||
    dev: true
 | 
					    dev: true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue