diff --git a/lib/collaborators.js b/lib/collaborators.js index 4ff93d0b..078b16f1 100644 --- a/lib/collaborators.js +++ b/lib/collaborators.js @@ -1,9 +1,10 @@ import fs from 'node:fs'; -const TSC_TITLE = '### TSC (Technical Steering Committee)'; -const TSCE_TITLE = '### TSC Emeriti'; +const TSC_TITLE = '#### TSC voting members'; +const TSC_REGULAR_TITLE = '#### TSC regular members'; +const TSCE_TITLE = '#### TSC emeriti members'; const CL_TITLE = '### Collaborators'; -const CLE_TITLE = '### Collaborator Emeriti'; +const CLE_TITLE = '### Collaborator emeriti'; const CONTACT_RE = /\* +\[(.+?)\]\(.+?\) +-\s+\*\*([^*]+?)\*\* +(?:<|\\<|<<)([^>]+?)(?:>|>)/mg; const TSC = 'TSC'; @@ -73,6 +74,7 @@ function parseCollaborators(readme, cli) { let m; const tscIndex = readme.toUpperCase().indexOf(TSC_TITLE.toUpperCase()); + const tscrIndex = readme.toUpperCase().indexOf(TSC_REGULAR_TITLE.toUpperCase()); const tsceIndex = readme.toUpperCase().indexOf(TSCE_TITLE.toUpperCase()); const clIndex = readme.toUpperCase().indexOf(CL_TITLE.toUpperCase()); const cleIndex = readme.toUpperCase().indexOf(CLE_TITLE.toUpperCase()); @@ -80,6 +82,9 @@ function parseCollaborators(readme, cli) { if (tscIndex === -1) { throw new Error(`Couldn't find ${TSC_TITLE} in the README`); } + if (tscrIndex === -1) { + throw new Error(`Couldn't find ${TSC_REGULAR_TITLE} in the README`); + } if (tsceIndex === -1) { throw new Error(`Couldn't find ${TSCE_TITLE} in the README`); } @@ -90,7 +95,8 @@ function parseCollaborators(readme, cli) { throw new Error(`Couldn't find ${CLE_TITLE} in the README`); } - if (!(tscIndex < tsceIndex && + if (!(tscIndex < tscrIndex && + tscrIndex < tsceIndex && tsceIndex < clIndex && clIndex < cleIndex)) { cli.warn('Contacts in the README is out of order, ' + @@ -100,7 +106,7 @@ function parseCollaborators(readme, cli) { // We also assume that TSC & TSC Emeriti are also listed as collaborators CONTACT_RE.lastIndex = tscIndex; // eslint-disable-next-line no-cond-assign - while ((m = CONTACT_RE.exec(readme)) && CONTACT_RE.lastIndex < tsceIndex) { + while ((m = CONTACT_RE.exec(readme)) && CONTACT_RE.lastIndex < tscrIndex) { const login = m[1].toLowerCase(); const user = new Collaborator(m[1], m[2], m[3], TSC); collaborators.set(login, user); diff --git a/test/fixtures/README/README.md b/test/fixtures/README/README.md index 48e3a6e2..cb117435 100644 --- a/test/fixtures/README/README.md +++ b/test/fixtures/README/README.md @@ -234,13 +234,26 @@ For more information about the governance of the Node.js project, see ### TSC (Technical Steering Committee) +#### TSC voting members + * [bar](https://github.com/bar) - **Bar User** <> (she/her) -### TSC emeriti +#### TSC regular members + +* [Baz](https://github.com/Baz) - +**Baz User** <baz@example.com> (he/him) + +
+ +TSC emeriti members + +#### TSC emeriti members * [test](https://github.com/test) - -**Test** <test@example.com> + **Test User** <> + +
### Collaborators @@ -257,11 +270,17 @@ For more information about the governance of the Node.js project, see * [ExtraSpace](https://github.com/extraspace) - **Extra Space** <extraspace@example.com> (he/him) +
+ +Emeriti + ### Collaborator emeriti * [bee](https://github.com/bee) - **bee** <bee@example.com> +
+ Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js project. diff --git a/test/fixtures/README/README_alternative.md b/test/fixtures/README/README_alternative.md index 621606d0..46c06d51 100644 --- a/test/fixtures/README/README_alternative.md +++ b/test/fixtures/README/README_alternative.md @@ -234,10 +234,20 @@ For more information about the governance of the Node.js project, see ### TSC (Technical Steering Committee) +#### TSC voting members + * [bar](https://github.com/bar) - **Bar User (张三)** <bar@example.com> (she/her) -### TSC Emeriti +#### TSC regular members + +
+ +TSC emeriti members + +#### TSC emeriti members + +
### Collaborators @@ -246,7 +256,13 @@ For more information about the governance of the Node.js project, see * [Baz](https://github.com/Baz) - **Baz User** <baz@example.com> (he/him) -### Collaborator Emeriti +
+ +Emeriti + +### Collaborator emeriti + +
Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js project. diff --git a/test/fixtures/README/README_no_TSC.md b/test/fixtures/README/README_no_TSC.md index 0f5c9473..8a6d354e 100644 --- a/test/fixtures/README/README_no_TSC.md +++ b/test/fixtures/README/README_no_TSC.md @@ -231,11 +231,19 @@ that forms the _Technical Steering Committee_ (TSC) which governs the project. For more information about the governance of the Node.js project, see [GOVERNANCE.md](./GOVERNANCE.md). -### TSC Emeriti +### TSC (Technical Steering Committee) + +
+ +TSC emeriti members + +#### TSC emeriti members * [test](https://github.com/test) - **Test** <test@example.com> +
+ ### Collaborators * [bar](https://github.com/bar) - @@ -247,11 +255,17 @@ For more information about the governance of the Node.js project, see * [Quo](https://github.com/quo) - **Quo User** <quo@example.com> (she/her) -### Collaborator Emeriti +
+ +Emeriti + +### Collaborator emeriti * [bee](https://github.com/bee) - **bee** <bee@example.com> +
+ Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js project. diff --git a/test/fixtures/README/README_no_TSCE.md b/test/fixtures/README/README_no_TSCE.md index ce559598..d1f4d478 100644 --- a/test/fixtures/README/README_no_TSCE.md +++ b/test/fixtures/README/README_no_TSCE.md @@ -234,6 +234,8 @@ For more information about the governance of the Node.js project, see ### TSC (Technical Steering Committee) +#### TSC voting members + * [bar](https://github.com/bar) - **Bar User** <bar@example.com> (she/her) @@ -248,11 +250,17 @@ For more information about the governance of the Node.js project, see * [Quo](https://github.com/quo) - **Quo User** <quo@example.com> (she/her) -### Collaborator Emeriti +
+ +Emeriti + +### Collaborator emeriti * [bee](https://github.com/bee) - **bee** <bee@example.com> +
+ Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js project. diff --git a/test/fixtures/README/README_no_collaboratorE.md b/test/fixtures/README/README_no_collaboratorE.md index 26370471..cf5d880b 100644 --- a/test/fixtures/README/README_no_collaboratorE.md +++ b/test/fixtures/README/README_no_collaboratorE.md @@ -234,14 +234,24 @@ For more information about the governance of the Node.js project, see ### TSC (Technical Steering Committee) +#### TSC voting members + * [bar](https://github.com/bar) - **Bar User** <bar@example.com> (she/her) -### TSC Emeriti +#### TSC regular members + +
+ +TSC emeriti members + +#### TSC emeriti members * [test](https://github.com/test) - **Test** <test@example.com> +
+ ### Collaborators * [bar](https://github.com/bar) - diff --git a/test/fixtures/README/README_no_collaborators.md b/test/fixtures/README/README_no_collaborators.md index 966701f5..4a465288 100644 --- a/test/fixtures/README/README_no_collaborators.md +++ b/test/fixtures/README/README_no_collaborators.md @@ -233,19 +233,35 @@ For more information about the governance of the Node.js project, see ### TSC (Technical Steering Committee) +#### TSC voting members + * [bar](https://github.com/bar) - **Bar User** <bar@example.com> (she/her) -### TSC Emeriti +#### TSC regular members + +
+ +TSC emeriti members + +#### TSC emeriti members * [test](https://github.com/test) - **Test** <test@example.com> -### Collaborator Emeriti +
+ +
+ +Emeriti + +### Collaborator emeriti * [bee](https://github.com/bee) - **bee** <bee@example.com> +
+ Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js project. diff --git a/test/fixtures/README/README_unordered.md b/test/fixtures/README/README_unordered.md index a3ea4512..664c2832 100644 --- a/test/fixtures/README/README_unordered.md +++ b/test/fixtures/README/README_unordered.md @@ -232,11 +232,17 @@ that forms the _Technical Steering Committee_ (TSC) which governs the project. For more information about the governance of the Node.js project, see [GOVERNANCE.md](./GOVERNANCE.md). -### Collaborator Emeriti +
+ +Emeriti + +### Collaborator emeriti * [bee](https://github.com/bee) - **bee** <bee@example.com> +
+ Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js project. @@ -251,12 +257,22 @@ maintaining the Node.js project. * [Quo](https://github.com/quo) - **Quo User** <quo@example.com> (she/her) -### TSC Emeriti +### TSC (Technical Steering Committee) + +
+ +Emeriti + +#### TSC emeriti members * [test](https://github.com/test) - **Test** <test@example.com> -### TSC (Technical Steering Committee) +
+ +#### TSC regular members + +#### TSC voting members * [bar](https://github.com/bar) - **Bar User** <bar@example.com> (she/her) diff --git a/test/unit/collaborators.test.js b/test/unit/collaborators.test.js index 754efe7f..8d154160 100644 --- a/test/unit/collaborators.test.js +++ b/test/unit/collaborators.test.js @@ -132,13 +132,13 @@ describe('collaborators', function() { }); it( - 'should throw error if there is no TSC Emeriti section in the README', + 'should throw error if there is no TSC Regular Members section in the README', async() => { const argv = { owner: 'nodejs', repo: 'node' }; const request = mockRequest(readmeNoTscE, argv); await assertThrowsAsync( async() => getCollaborators(cli, request, argv), - /Error: Couldn't find ### TSC Emeriti in the README/); + /Error: Couldn't find #### TSC regular members in the README/); }); it('should throw error if there is no Collaborators section in the README', @@ -158,7 +158,7 @@ describe('collaborators', function() { const request = mockRequest(readmeNoCollaboratorE, argv); await assertThrowsAsync( async() => getCollaborators(cli, request, argv), - /Error: Couldn't find ### Collaborator Emeriti in the README/); + /Error: Couldn't find ### Collaborator emeriti in the README/); }); it(