c144af6198
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days. |
||
---|---|---|
.vscode | ||
deps | ||
microsoft-core | ||
microsoft-news | ||
.gitignore | ||
CONTRIBUTING.md | ||
COPYING | ||
Dockerfile | ||
LICENSE.txt | ||
README.md | ||
SECURITY.md | ||
azure-pipelines.yml | ||
babel.config.json | ||
docker-compose.override.yml | ||
docker-compose.yml | ||
jsconfig.json | ||
package-lock.json | ||
package.json | ||
readme.txt | ||
webpack.config.js |
README.md
Microsoft Open Source Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct.
Resources:
- Microsoft Open Source Code of Conduct
- Microsoft Code of Conduct FAQ
- Contact opencode@microsoft.com with questions or concerns
Introduction
WordPress Plugin for MSN.
This allows posts from WP to be pushed to MSN for ingestion and has a dashboard to show users their publishing statistics.
VS Code Plugins
- PHP Debugger (Felix Becker)
Dependencies
- Docker desktop
- WSL2 (or linux based host machine)
- Node 14 (or higher)
Getting Started
Project is designed to be run in docker via WSL2, although other methods may also work.
-
Ensure you have docker desktop and WSL2 installed/enabled
-
Install npm dependencies
npm install
-
Start the php debugger (runs on port 9000 on windows machine so that the docker image can connect), either by pushing f5 or the play button in the debug tab in vs code
-
Start the docker machine, install the php composer dependencies.
npm run install
-
Because we're running a slightly older version of wordpress for compatibility testing we need to alter mysql auth
npm run docker-db
mysql --password=somewordpress mypasswordforwordpress
ALTER USER wordpress IDENTIFIED WITH mysql_native_password BY 'mypasswordforwordpress';
quit
exit
-
start the webpack watch script to build the react code. This uses nodemon so will restart when the webpack or packages config changes. you can also type
rs
to restart it.npm run start
-
You should have a wordpress instance up on http://localhost:8000/wp-admin/, you will need to:
- run through the install wizard
- activate the microsoft news plugin
Note: if you visit the plugin dashboard and the widgets are too wide then the .container
class wasn't generated correctly, this is a known issue and sometimes you need to restart npm run start
to address this.
Build Plugin
A wordpress plugin is essentially whatever is in the /wp-content/plugins/microsoft-news/ zipped up for distribution.
We setup a docker based build at our end that creates a full dev environment as it was the easiest way to get composer (php package manager) working, and allowed us to easily setup new dev/test environments. We then exteded it to zip up the plugin directory then upload it to DevOps as an artifact of an installable build.
Useful Package.json commands
- install - setup docker and run php:install
- install:php - install php composer dependencies
- start - run webpack in watch mode
- docker-db - open bash terminal on mysql box
- docker-wp - open bash terminal on wp box
- generate-pot- generate language POT file based on plugin strings
- generate-languages - convert PO file to json files for frontend