chore(): Modify README.md, cleanup script and package.json to reflect the doc
This commit is contained in:
parent
68e6b20a23
commit
5f633376d5
31
README.md
31
README.md
|
@ -2,3 +2,34 @@
|
||||||
|
|
||||||
Link to the article ["Setting up a WordPress plugin with React and TypeScript
|
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)
|
"](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
|
||||||
|
```
|
||||||
|
|
6
clean.sh
6
clean.sh
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash
|
#!/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/* -maxdepth 1 -name "*" ! -name "plugins" ! -name "wp-content")
|
||||||
rm -rf $(find wp/src/wp-content/* -maxdepth 1 -name "*" ! -name "plugins" ! -name "wp-react")
|
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
|
|
@ -23,6 +23,7 @@
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"compose": "composer install",
|
||||||
"watch": "mix watch",
|
"watch": "mix watch",
|
||||||
"prod": "mix --production"
|
"prod": "mix --production"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user