1
0
Форкнуть 0
Microsoft Start WordPress Plugin
Перейти к файлу
microsoft-github-policy-service[bot] c144af6198
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2022-11-28 19:08:11 +00:00
.vscode initial commit (#1) 2021-09-21 19:12:29 -07:00
deps initial commit (#1) 2021-09-21 19:12:29 -07:00
microsoft-core initial commit (#1) 2021-09-21 19:12:29 -07:00
microsoft-news microsoft-start-v1.3 (#3) 2021-09-24 13:50:11 -07:00
.gitignore initial commit (#1) 2021-09-21 19:12:29 -07:00
CONTRIBUTING.md initial commit (#1) 2021-09-21 19:12:29 -07:00
COPYING initial commit (#1) 2021-09-21 19:12:29 -07:00
Dockerfile initial commit (#1) 2021-09-21 19:12:29 -07:00
LICENSE.txt initial commit (#1) 2021-09-21 19:12:29 -07:00
README.md initial commit (#1) 2021-09-21 19:12:29 -07:00
SECURITY.md Microsoft mandatory file 2022-07-25 19:07:25 +00:00
azure-pipelines.yml initial commit (#1) 2021-09-21 19:12:29 -07:00
babel.config.json initial commit (#1) 2021-09-21 19:12:29 -07:00
docker-compose.override.yml initial commit (#1) 2021-09-21 19:12:29 -07:00
docker-compose.yml initial commit (#1) 2021-09-21 19:12:29 -07:00
jsconfig.json initial commit (#1) 2021-09-21 19:12:29 -07:00
package-lock.json initial commit (#1) 2021-09-21 19:12:29 -07:00
package.json initial commit (#1) 2021-09-21 19:12:29 -07:00
readme.txt microsoft-start-v1.3 (#3) 2021-09-24 13:50:11 -07:00
webpack.config.js initial commit (#1) 2021-09-21 19:12:29 -07:00

README.md

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

Resources:

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.

  1. Ensure you have docker desktop and WSL2 installed/enabled

  2. Install npm dependencies

    npm install

  3. 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

  4. Start the docker machine, install the php composer dependencies.

    npm run install

  5. 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

  6. 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

  7. 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