Skip to content

Commit 5a1274e

Browse files
committed
docs: add MAINTAINING guide
1 parent 5806dd8 commit 5a1274e

File tree

2 files changed

+178
-1
lines changed

2 files changed

+178
-1
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ For example:
157157

158158
The `<scope>` can be empty (e.g. if the change is a global or difficult to assign to a single component), in which case the parentheses are omitted and the first line just becomes: `<type>: <subject>`
159159

160-
The `<!>` is optional. It must be used for a BREAKING CHANGE. For example, `fix(widgets)!: Fix incompatibility with widget v2` indicates the bugfix required a breaking change.
160+
The `<!>` is optional. It should be used for a BREAKING CHANGE. For example, `fix(widgets)!: Fix incompatibility with widget v2` indicates the bugfix required a breaking change. Note that the "BREAKING CHANGE:" FOOTER is REQUIRED (see below).
161161

162162
### Commit message `<body>`
163163

MAINTAINING.md

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# Maintenance guide
2+
3+
This document is for maintainers to explain the various procedures for all the projects in this monorepo.
4+
5+
## Making releases
6+
7+
### `next` (Drupal Module)
8+
9+
While maintaining releases for packages, starters and examples is done with Lerna, releases for Drupal modules are controlled by drupal.org’s infrastructure, so these steps don’t involve Lerna.
10+
11+
1. Optionally, create a new branch on drupal.org.
12+
13+
1. Follow the “Release branches” rules described on the [“Release naming conventions” documentation](https://www.drupal.org/docs/develop/git/git-for-drupal-project-maintainers/release-naming-conventions).
14+
2. On Drupal.org’s GitLab, [create a new branch](https://git.drupalcode.org/project/next/-/tags/new).
15+
3. In the monorepo’s `package.json`, update the `sync:modules` script to use the new branch name. The monorepo’s `main` branch will then sync with this new drupal.org branch.
16+
17+
For example, change:
18+
19+
```
20+
"sync:modules": "./scripts/sync-repo.sh 2.x git@git.drupal.org:project/ \"modules/*\"",
21+
```
22+
23+
to:
24+
25+
```
26+
"sync:modules": "./scripts/sync-repo.sh 3.x git@git.drupal.org:project/ \"modules/*\"",
27+
```
28+
29+
2. Run `yarn sync:modules` to sync the latest commit on `main` with the git repo on drupal.org. All recent changes will be squashed into a commit using the latest commit message.
30+
31+
3. On Drupal.org’s GitLab, [tag a release](https://git.drupalcode.org/project/next/-/tags/new) following the [“Release tags naming conventions” docs](https://www.drupal.org/docs/develop/git/git-for-drupal-project-maintainers/release-naming-conventions#release-tags).
32+
33+
4. On Drupal.org’s Next.js project page, [create a release](https://www.drupal.org/node/add/project-release/3192303) using the git tag you just created.
34+
35+
### `next-drupal` (NPM package)
36+
37+
Since we are using semantic commits, Lerna is able to read the git commits since the last release to auto-generate a CHANGELOG and to determine if the next release should be a:
38+
39+
- major version bump (e.g. 1.0.0 to 2.0.0). This will happen when Lerna finds a `BREAKING CHANGE` commit message.
40+
- minor version bump (e.g. 1.0.0 to 1.1.0). This will happen when Lerna finds a `feat` commit message.
41+
- patch version bump (e.g. 1.0.0 to 1.0.1). This is the default version bump for bug fixes, etc.
42+
- prerelease version bump (e.g. 1.0.0-alpha.0 to 1.0.0-alpha.1)
43+
44+
We’ll be using Lerna’s `--no-push` flag so that Lerna does not push git tags and commits automatically. This allows us to delete any commits and tags locally if we make a mistake.
45+
46+
1. **Tag a new release**
47+
48+
- **to make the next logical semantic version**, run:
49+
50+
```
51+
npx lerna version --no-push
52+
```
53+
54+
- **to make a new alpha prerelease version:**
55+
56+
If the current version is not a prerelease version, you’ll need to explicitly tell Lerna that the next version should be an alpha release with:
57+
58+
```
59+
npx lerna version --conventional-prerelease --no-push
60+
```
61+
62+
When creating a new prerelease version of `next-drupal`, Lerna will automatically determine if it needs to be a `premajor` (2.0.0-alpha.0), `preminor` (1.1.0-alpha.0), or `prepatch` (1.0.1-alpha.0) version.
63+
64+
- **to make a new beta prerelease version:**
65+
66+
If the current version is not a beta version, you’ll need to explicitly tell Lerna that the next version should be a beta release with:
67+
68+
```
69+
npx lerna version --conventional-prerelease --preid beta --no-push
70+
```
71+
72+
- **to make a new regular version from a prerelease version:**
73+
74+
If the current version is a prerelease version, you’ll need to explicitly tell Lerna that the next version should no longer be a prerelease version with:
75+
76+
```
77+
npx lerna version --conventional-graduate --no-push
78+
```
79+
80+
**Confirm changes**
81+
82+
When Lerna asks “Are you sure you want to create these versions?”, carefully check if the versions listed are the ones you expect.
83+
84+
2. **Push git changes** with:
85+
86+
```
87+
git push
88+
git push --tags
89+
```
90+
91+
3. **Publish** with:
92+
93+
```
94+
npx lerna publish from-git
95+
```
96+
97+
Maintainers will need permission to publish to `next-drupal` on npmjs.com. http://npmjs.com/package/next-drupal
98+
99+
For more information, see Lerna’s [version docs](https://github.com/lerna/lerna/tree/main/libs/commands/version) and [publish docs](https://github.com/lerna/lerna/tree/main/libs/commands/publish).
100+
101+
### Examples
102+
103+
The code in the examples repos do not strictly require a versioned release since they simply contain an example usage of the latest `next-drupal` release. However, each example has its own separate git repo so developers can see previous versions of the latest example.
104+
105+
1. Optionally, **create a tag** that is Lerna-compatible matching the format: `[project]@[version]`, e.g. `example-auth@1.1.2`
106+
107+
```
108+
git tag example-NAME@1.0.0
109+
git push --tags
110+
```
111+
112+
2. **Sync git repositories** with:
113+
114+
```
115+
yarn sync:examples
116+
```
117+
118+
All recent changes on `main` will be squashed into a commit on the target git repo using the latest commit message.
119+
120+
### Starters
121+
122+
1. **Create a tag** that is Lerna-compatible matching the format: `[project]@[version]`, e.g. `basic-starter@2.0.0-alpha.0`
123+
124+
```
125+
git tag NAME-starter@2.0.0
126+
git push --tags
127+
```
128+
129+
2. **Sync git repositories**
130+
131+
If the release is a prerelease, sync the monorepo with:
132+
133+
```
134+
yarn sync:starters
135+
```
136+
137+
If the release is not a prerelease, sync the monorepo with:
138+
139+
```
140+
yarn sync:starters:release
141+
```
142+
143+
All recent changes on `main` will be squashed into a commit on the target git repo using the latest commit message.
144+
145+
### Docs
146+
147+
@TODO: Expand details the next time docs are deployed.
148+
149+
Documentation is deployed to Vercel and controlled via the following Git branches:
150+
151+
- `v1.6`
152+
- `v1`
153+
- `v0`
154+
155+
## Tests
156+
157+
The Jest tests currently rely on a Drupal 9.4 installation deployed to [tests.next-drupal.org](https://tests.next-drupal.org) on Pantheon.
158+
159+
Developers will need a copy of the db, a copy of the installation files, and to set the following environment variables when running tests locally:
160+
161+
```dotenv
162+
export DRUPAL_BASE_URL='https://tests.next-drupal.org'
163+
export DRUPAL_CLIENT_ID='example-xxxx'
164+
export DRUPAL_CLIENT_SECRET='example-xxxx'
165+
export DRUPAL_USERNAME='Umami'
166+
export DRUPAL_PASSWORD='example-xxxx'
167+
```
168+
169+
The files, db and environment variable values can be obtained from other Chapter Three developers.
170+
171+
@TODO: Replace the live server with a way to install Drupal with the needed demo content and config. The updated docs should not be here, but instead in CONTRIBUTING.md.
172+
173+
## Drupal (`/drupal` directory)
174+
175+
This is probably a single Drupal install with the config for all the examples and is used for running Cypress tests.
176+
177+
@TODO Confirm speculation by getting a copy of the database so `/drupal` can be run locally.

0 commit comments

Comments
 (0)