You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the BoxUK mono-repo for our WordPress packages. The [WordPress Skeleton](https://github.com/boxuk/wp-project-skeleton) uses these packages to add functionality.
3
+
This is the BoxUK mono-repo for our WordPress packages. The [WordPress Skeleton](https://github.com/boxuk/wp-project-skeleton) uses these packages to add functionality. All packages provide their own documentation:
4
4
5
-
## How to use
5
+
## [📚 Read the docs](https://boxuk.github.io/wp-packages/)
6
+
7
+
---
8
+
9
+
## Working on the packages mono-repo
10
+
11
+
### How to use
6
12
7
13
This mono repo allows you to develop any of the packages. To start a WordPress development environment to test against, either:
8
14
@@ -14,11 +20,11 @@ and you'll be able to access WordPress at [http://localhost:8000](http://localho
14
20
15
21
We use [Monorepo Builder](https://github.com/symplify/monorepo-builder) tools to manage the mono-repo dependancies.
16
22
17
-
## Structure
23
+
###Structure
18
24
19
25
Each of the packages within the `packages` directory is an individual package. These should be standalone, and any dependancies they have (with another package or external) should be loaded via composer.
20
26
21
-
## Adding Dependancies
27
+
###Adding Dependancies
22
28
23
29
Dependancies for each package should be defined in the package's `composer.json` file. Once the file has been altered, from the root of the project run the following commands:
24
30
@@ -29,20 +35,20 @@ bin/composer run mono:merge
29
35
bin/composer install <package-name>
30
36
```
31
37
32
-
## Adding a package
38
+
###Adding a package
33
39
34
40
To create a package, you can run `bin/create-package <package-name>` and this will scaffold out all the necessary changes needed. In order for your package to be published, you'll also need to modify `/.github/workflows/packages.yml` to configure the package name and the target repository for publishing. This will automate pushing changes of the package out to the target repository, but you may need further work to ensure that repository is available via `composer` in your projects.
35
41
36
-
## Tests
42
+
###Tests
37
43
38
44
All packages need to have 100% test coverage. During CI they will be tested for this capability.
39
45
40
-
## Javascript
46
+
###Javascript
41
47
42
48
If your package requires javascript, you can also setup a `package.json` file in the root of the package. Much like `composer.json`, this will be merged automatically at the root level.
43
49
44
50
To run `npm` commands directly in your package run `bin/npm -w packages/<package-name>` with your command. For example `bin/npm -w packages/iconography run test` would run tests specifically in the iconography package.
45
51
46
52
Commands can also be run globally across all packages using `turbo`. This is setup so that if you run `bin/npm run test` it will run test in every package that has a `package.json` file with a `test` script. You should try to keep naming consistent across packages to support this work. All currently supported scripts in `turbo` are listed in the `turbo.json` file at the root.
47
53
48
-
During CI, the `lint`, `test` and `build` NPM scripts are run to validate the package quality. You should ensure your package supports these.
54
+
During CI, the `lint`, `test` and `build` NPM scripts are run to validate the package quality. You should ensure your package supports these.
0 commit comments