From 5f633376d52e6d74573a73df01928d1a09cd653d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Da=C3=9Fler?= Date: Fri, 16 Feb 2024 14:17:31 +0100 Subject: [PATCH] chore(): Modify README.md, cleanup script and package.json to reflect the doc --- README.md | 31 +++++++++++++++++++ clean.sh | 6 ++-- .../wp-content/plugins/wp-react/package.json | 1 + 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3e6315d..8d57ffa 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,34 @@ Link to the article ["Setting up a WordPress plugin with React and TypeScript "](https://serhii.io/posts/setting-up-a-wordpress-plugin-with-react-and-typescript) + + +## How to start + +If you use the Nix package manager, just type in `nix-shell`. Otherwise make sure that you have the following dependencies installed: +- NodeJS >=18 +- NPM (if you don't want to use the included YARN 4.0.2) +- PHP >=8.2 with composer + +After that you can initialize the project: + +```bash +cd wp/src/wp-content/plugins/wp-react +yarn install +yarn compose +yarn prod +``` + +Now you need to fire up the docker containers in the project root: + +```bash +docker compose build +docker compose up -d --force-recreate +``` + +To clean up everything what was created by Wordpress, stop the docker containers and run the cleanup script: + +```bash +docker compose down +./clean.sh +``` diff --git a/clean.sh b/clean.sh index 2376825..1f0e2cc 100755 --- a/clean.sh +++ b/clean.sh @@ -1,4 +1,6 @@ #!/bin/bash -rm -R db/ +rm -rf db/ rm -rf $(find wp/src/* -maxdepth 1 -name "*" ! -name "plugins" ! -name "wp-content") -rm -rf $(find wp/src/wp-content/* -maxdepth 1 -name "*" ! -name "plugins" ! -name "wp-react") \ No newline at end of file +rm -rf $(find wp/src/wp-content/* -maxdepth 1 -name "*" ! -name "plugins" ! -name "wp-react") +#rm -rf wp/src/wp-content/plugins/wp-react/node_modules +#rm -rf wp/src/wp-content/plugins/wp-react/vendor \ No newline at end of file diff --git a/wp/src/wp-content/plugins/wp-react/package.json b/wp/src/wp-content/plugins/wp-react/package.json index e1a1688..0b0e40d 100644 --- a/wp/src/wp-content/plugins/wp-react/package.json +++ b/wp/src/wp-content/plugins/wp-react/package.json @@ -23,6 +23,7 @@ "react-dom": "^18.2.0" }, "scripts": { + "compose": "composer install", "watch": "mix watch", "prod": "mix --production" },