diff --git a/.aegir.js b/.aegir.js index 786aad205..be7880d6a 100644 --- a/.aegir.js +++ b/.aegir.js @@ -9,7 +9,7 @@ export default { 'buffer', 'c8', 'conventional-changelog-conventionalcommits', - 'electron-mocha-main', + 'electron-mocha', 'mocha', 'npm-package-json-lint', 'nyc', @@ -17,7 +17,7 @@ export default { 'playwright-test', 'react-native-test-runner', 'semantic-release', - '@anolilab/multi-semantic-release', + 'semantic-release-monorepo', 'source-map-support', 'typedoc-plugin-mdn-links', 'typedoc-plugin-missing-exports', diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bc965936..5b3d8521a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,173 @@ +## [44.1.2](https://github.com/ipfs/aegir/compare/v44.1.1...v44.1.2) (2024-09-28) + +### Trivial Changes + +* allow setting docker registry in login action ([d842ee0](https://github.com/ipfs/aegir/commit/d842ee0f15d2ce85db6c7d56f3681f61651b088e)) + +## [44.1.1](https://github.com/ipfs/aegir/compare/v44.1.0...v44.1.1) (2024-08-09) + +### Dependencies + +* **dev:** bump electron from 27.3.11 to 31.3.1 ([#1582](https://github.com/ipfs/aegir/issues/1582)) ([7e3d579](https://github.com/ipfs/aegir/commit/7e3d57961fd145d73b236868293f8f67ab899a5e)) + +## [44.1.0](https://github.com/ipfs/aegir/compare/v44.0.3...v44.1.0) (2024-07-29) + +### Features + +* move tsc linter rules to eslint ([#1513](https://github.com/ipfs/aegir/issues/1513)) ([f78c9ac](https://github.com/ipfs/aegir/commit/f78c9ac808fd259be95c660ca12967a408fb0f5b)) + +## [44.0.3](https://github.com/ipfs/aegir/compare/v44.0.2...v44.0.3) (2024-07-29) + +### Bug Fixes + +* unpin eslint-plugin-jsdoc ([#1580](https://github.com/ipfs/aegir/issues/1580)) ([545af7c](https://github.com/ipfs/aegir/commit/545af7c33231a2b5bfdf3dd5dd5ae0fa7d571844)) + +## [44.0.2](https://github.com/ipfs/aegir/compare/v44.0.1...v44.0.2) (2024-07-29) + +### Bug Fixes + +* pin eslint-plugin-jsdoc ([#1579](https://github.com/ipfs/aegir/issues/1579)) ([c4f998c](https://github.com/ipfs/aegir/commit/c4f998ca4d74d68c6f098cbad9aefb11ed746587)) + +## [44.0.1](https://github.com/ipfs/aegir/compare/v44.0.0...v44.0.1) (2024-07-01) + +### Documentation + +* fix typo - it's -> its ([#1566](https://github.com/ipfs/aegir/issues/1566)) ([559395f](https://github.com/ipfs/aegir/commit/559395f9d34b1253dfdea0ee378dd6cfdf382a67)) + +## [44.0.0](https://github.com/ipfs/aegir/compare/v43.0.1...v44.0.0) (2024-06-21) + +### ⚠ BREAKING CHANGES + +* linting rules may have changed + +### Bug Fixes + +* format changelog ([#1561](https://github.com/ipfs/aegir/issues/1561)) ([5c68eaa](https://github.com/ipfs/aegir/commit/5c68eaa6923f71d21b5e98bc02ff7b1b637b3b42)) +* format log ([7cd095d](https://github.com/ipfs/aegir/commit/7cd095de74e1bf578f6bd66ea8054dc08bcb3883)) +* revert dep updates ([7f3617d](https://github.com/ipfs/aegir/commit/7f3617d9a58a5df5e1d85421da51eb9a46b445c3)) +* update linting related deps ([ce225e0](https://github.com/ipfs/aegir/commit/ce225e0b8d5b2717a174838f3d088b5efdd8abbd)) +* update version ([773708d](https://github.com/ipfs/aegir/commit/773708da68fd6bd770df4dd50a1148663f587d41)) + +### Trivial Changes + +* **release:** 43.0.2 [skip ci] ([da4b8e2](https://github.com/ipfs/aegir/commit/da4b8e282170e0a62bc3a588aaa924ea24091428)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1544](https://github.com/ipfs/aegir/issues/1544) [#1543](https://github.com/ipfs/aegir/issues/1543) [#1558](https://github.com/ipfs/aegir/issues/1558) [#1555](https://github.com/ipfs/aegir/issues/1555) [#1540](https://github.com/ipfs/aegir/issues/1540) [#1550](https://github.com/ipfs/aegir/issues/1550) [#1548](https://github.com/ipfs/aegir/issues/1548) [#1541](https://github.com/ipfs/aegir/issues/1541) +* **release:** 43.0.2 [skip ci] ([fea9dec](https://github.com/ipfs/aegir/commit/fea9decd8a2aad3def77adbf566bb1ecfd2c9b4b)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([2080a34](https://github.com/ipfs/aegir/commit/2080a34e65af8752c74c3be276badc243c813aff)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([3c0555b](https://github.com/ipfs/aegir/commit/3c0555bac4b2504340cb61e12ec8792530740b04)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([aa88f15](https://github.com/ipfs/aegir/commit/aa88f15527ad92eec903fb47c5968e1b36449e78)) + +## [43.0.2](https://github.com/ipfs/aegir/compare/v43.0.1...v43.0.2) (2024-06-21) + +### Bug Fixes + +* format changelog ([#1561](https://github.com/ipfs/aegir/issues/1561)) ([5c68eaa](https://github.com/ipfs/aegir/commit/5c68eaa6923f71d21b5e98bc02ff7b1b637b3b42)) +* format log ([7cd095d](https://github.com/ipfs/aegir/commit/7cd095de74e1bf578f6bd66ea8054dc08bcb3883)) +* revert dep updates ([7f3617d](https://github.com/ipfs/aegir/commit/7f3617d9a58a5df5e1d85421da51eb9a46b445c3)) +* update version ([773708d](https://github.com/ipfs/aegir/commit/773708da68fd6bd770df4dd50a1148663f587d41)) + +### Trivial Changes + +* **release:** 43.0.2 [skip ci] ([fea9dec](https://github.com/ipfs/aegir/commit/fea9decd8a2aad3def77adbf566bb1ecfd2c9b4b)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([2080a34](https://github.com/ipfs/aegir/commit/2080a34e65af8752c74c3be276badc243c813aff)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([3c0555b](https://github.com/ipfs/aegir/commit/3c0555bac4b2504340cb61e12ec8792530740b04)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([aa88f15](https://github.com/ipfs/aegir/commit/aa88f15527ad92eec903fb47c5968e1b36449e78)) + +### Dependencies + +* bump @semantic-release/commit-analyzer from 12.0.0 to 13.0.0 ([#1544](https://github.com/ipfs/aegir/issues/1544)) ([ce5264c](https://github.com/ipfs/aegir/commit/ce5264c005f3b680acf9ecd28dcee08f0d157cf3)) +* bump @semantic-release/release-notes-generator ([#1543](https://github.com/ipfs/aegir/issues/1543)) ([14eaa50](https://github.com/ipfs/aegir/commit/14eaa507c29fbf45a06aee57da5e9d67c8373efd)) +* bump @typescript-eslint/eslint-plugin from 5.62.0 to 7.13.1 ([#1558](https://github.com/ipfs/aegir/issues/1558)) ([22f4cf5](https://github.com/ipfs/aegir/commit/22f4cf52d3d8f4eb549f6a379b84b32fae324310)) +* bump c8 from 9.1.0 to 10.1.2 ([#1555](https://github.com/ipfs/aegir/issues/1555)) ([ce31644](https://github.com/ipfs/aegir/commit/ce31644e205b075a874c18c1eb221c8a967893fe)) +* bump conventional-changelog-conventionalcommits ([#1540](https://github.com/ipfs/aegir/issues/1540)) ([a6b2201](https://github.com/ipfs/aegir/commit/a6b2201a2677f52fc82714917729d7631299068a)) +* bump npm-package-json-lint from 7.1.0 to 8.0.0 ([#1550](https://github.com/ipfs/aegir/issues/1550)) ([bef022d](https://github.com/ipfs/aegir/commit/bef022df3963ff422fab55221e9e3247a27c94dd)) +* bump nyc from 15.1.0 to 17.0.0 ([#1548](https://github.com/ipfs/aegir/issues/1548)) ([0588f50](https://github.com/ipfs/aegir/commit/0588f50420627ca4a1b70babc0aaf1870dfac369)) +* bump semantic-release from 23.1.1 to 24.0.0 ([#1541](https://github.com/ipfs/aegir/issues/1541)) ([88bc0d1](https://github.com/ipfs/aegir/commit/88bc0d11ba67a9800e14add1638e18132044c787)) + +## [43.0.2](https://github.com/ipfs/aegir/compare/v43.0.1...v43.0.2) (2024-06-21) + + +### Bug Fixes + +* format changelog ([#1561](https://github.com/ipfs/aegir/issues/1561)) ([5c68eaa](https://github.com/ipfs/aegir/commit/5c68eaa6923f71d21b5e98bc02ff7b1b637b3b42)) +* format log ([7cd095d](https://github.com/ipfs/aegir/commit/7cd095de74e1bf578f6bd66ea8054dc08bcb3883)) +* revert dep updates ([7f3617d](https://github.com/ipfs/aegir/commit/7f3617d9a58a5df5e1d85421da51eb9a46b445c3)) +* update version ([773708d](https://github.com/ipfs/aegir/commit/773708da68fd6bd770df4dd50a1148663f587d41)) + + +### Trivial Changes + +* **release:** 43.0.2 [skip ci] ([2080a34](https://github.com/ipfs/aegir/commit/2080a34e65af8752c74c3be276badc243c813aff)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([3c0555b](https://github.com/ipfs/aegir/commit/3c0555bac4b2504340cb61e12ec8792530740b04)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([aa88f15](https://github.com/ipfs/aegir/commit/aa88f15527ad92eec903fb47c5968e1b36449e78)) + +## [43.0.2](https://github.com/ipfs/aegir/compare/v43.0.1...v43.0.2) (2024-06-21) + + +### Bug Fixes + +* format changelog ([#1561](https://github.com/ipfs/aegir/issues/1561)) ([5c68eaa](https://github.com/ipfs/aegir/commit/5c68eaa6923f71d21b5e98bc02ff7b1b637b3b42)) +* revert dep updates ([7f3617d](https://github.com/ipfs/aegir/commit/7f3617d9a58a5df5e1d85421da51eb9a46b445c3)) +* update version ([773708d](https://github.com/ipfs/aegir/commit/773708da68fd6bd770df4dd50a1148663f587d41)) + + +### Trivial Changes + +* **release:** 43.0.2 [skip ci] ([3c0555b](https://github.com/ipfs/aegir/commit/3c0555bac4b2504340cb61e12ec8792530740b04)), closes [#1561](https://github.com/ipfs/aegir/issues/1561) +* **release:** 43.0.2 [skip ci] ([aa88f15](https://github.com/ipfs/aegir/commit/aa88f15527ad92eec903fb47c5968e1b36449e78)) + +## [43.0.2](https://github.com/ipfs/aegir/compare/v43.0.1...v43.0.2) (2024-06-21) + + +### Bug Fixes + +* format changelog ([#1561](https://github.com/ipfs/aegir/issues/1561)) ([5c68eaa](https://github.com/ipfs/aegir/commit/5c68eaa6923f71d21b5e98bc02ff7b1b637b3b42)) +* revert dep updates ([7f3617d](https://github.com/ipfs/aegir/commit/7f3617d9a58a5df5e1d85421da51eb9a46b445c3)) + + +### Trivial Changes + +* **release:** 43.0.2 [skip ci] ([aa88f15](https://github.com/ipfs/aegir/commit/aa88f15527ad92eec903fb47c5968e1b36449e78)) + +## [43.0.2](https://github.com/ipfs/aegir/compare/v43.0.1...v43.0.2) (2024-06-21) + + +### Bug Fixes + +* revert dep updates ([7f3617d](https://github.com/ipfs/aegir/commit/7f3617d9a58a5df5e1d85421da51eb9a46b445c3)) + +## [43.0.1](https://github.com/ipfs/aegir/compare/v43.0.0...v43.0.1) (2024-05-30) + + +### Bug Fixes + +* downgrade conventional-changelog-conventionalcommits ([3d063ce](https://github.com/ipfs/aegir/commit/3d063cec7ca69473539479d6b2e0cb1236235ce4)) + +## [43.0.0](https://github.com/ipfs/aegir/compare/v42.2.11...v43.0.0) (2024-05-30) + +### ⚠ BREAKING CHANGES + +* if using `aegir release` in the scripts of a monorepo package, config must be updated: + +1. Change `"release": "aegir release"` in the monorepo root to `"release": "aegir run release"` +2. Add `"release": "aegir release"` to each monorepo package +3. Add semantic release config to each monorepo package + +### Bug Fixes + +* remove unused types that break compilation ([#1535](https://github.com/ipfs/aegir/issues/1535)) ([a020beb](https://github.com/ipfs/aegir/commit/a020beb8fcb318767430a37bac87ebefc277a183)) +* revert to semantic-release-monorepo ([#1536](https://github.com/ipfs/aegir/issues/1536)) ([00bebd4](https://github.com/ipfs/aegir/commit/00bebd405458749af43a3ce7fc86e237edb2d957)) +* update check-project to use semantic-release-monorepo again ([#1537](https://github.com/ipfs/aegir/issues/1537)) ([aa65b02](https://github.com/ipfs/aegir/commit/aa65b026a53213b0e289cb00782c98976a5d099a)) +* use semantic-release beta release ([#1539](https://github.com/ipfs/aegir/issues/1539)) ([a16e7c2](https://github.com/ipfs/aegir/commit/a16e7c225835b87abeb1a1d15ea143e5f8a95c4e)) + +### Dependencies + +* bump @semantic-release/commit-analyzer from 11.1.0 to 12.0.0 ([#1484](https://github.com/ipfs/aegir/issues/1484)) ([9f10341](https://github.com/ipfs/aegir/commit/9f103413ccdae1f0f4c02276110c770ab45b9300)) +* bump @semantic-release/github from 9.2.6 to 10.0.3 ([#1497](https://github.com/ipfs/aegir/issues/1497)) ([295fa01](https://github.com/ipfs/aegir/commit/295fa018bf2564ce04dc830117d6dba2f92afead)) +* bump @semantic-release/npm from 11.0.3 to 12.0.0 ([#1483](https://github.com/ipfs/aegir/issues/1483)) ([0ab5632](https://github.com/ipfs/aegir/commit/0ab5632ce841b648c08b65f37f8cf9a317171d26)) +* bump @semantic-release/release-notes-generator from 12.1.0 to 13.0.0 ([#1489](https://github.com/ipfs/aegir/issues/1489)) ([db9e2e7](https://github.com/ipfs/aegir/commit/db9e2e74c77bd51f24deca095af3ba5a90cf26bf)) +* bump conventional-changelog-conventionalcommits from 7.0.2 to 8.0.0 ([#1518](https://github.com/ipfs/aegir/issues/1518)) ([a566958](https://github.com/ipfs/aegir/commit/a566958428f4a148026bd377cdba4a297439bd9e)) +* bump esbuild from 0.20.2 to 0.21.1 ([#1520](https://github.com/ipfs/aegir/issues/1520)) ([74ff688](https://github.com/ipfs/aegir/commit/74ff688574f0fe0c2f55b05e268c82c5bda70678)) + ## [42.2.11](https://github.com/ipfs/aegir/compare/v42.2.10...v42.2.11) (2024-05-01) @@ -1442,7 +1612,7 @@ Co-authored-by: Alex Potsides -# [36.1.0](https://github.com/ipfs/aegir/compare/v36.0.2...v36.1.0) (2021-12-13) +## [36.1.0](https://github.com/ipfs/aegir/compare/v36.0.2...v36.1.0) (2021-12-13) ### Bug Fixes @@ -1464,7 +1634,7 @@ Co-authored-by: Alex Potsides -# [36.0.0](https://github.com/ipfs/aegir/compare/v35.2.1...v36.0.0) (2021-11-06) +## [36.0.0](https://github.com/ipfs/aegir/compare/v35.2.1...v36.0.0) (2021-11-06) ### chore @@ -1487,7 +1657,7 @@ Co-authored-by: Alex Potsides -# [35.2.0](https://github.com/ipfs/aegir/compare/v35.1.1...v35.2.0) (2021-11-05) +## [35.2.0](https://github.com/ipfs/aegir/compare/v35.1.1...v35.2.0) (2021-11-05) ### Bug Fixes @@ -1509,7 +1679,7 @@ Co-authored-by: Alex Potsides -# [35.1.0](https://github.com/ipfs/aegir/compare/v35.0.4...v35.1.0) (2021-09-21) +## [35.1.0](https://github.com/ipfs/aegir/compare/v35.0.4...v35.1.0) (2021-09-21) ### Features @@ -1555,7 +1725,7 @@ Co-authored-by: Alex Potsides -# [35.0.0](https://github.com/ipfs/aegir/compare/v34.1.0...v35.0.0) (2021-08-14) +## [35.0.0](https://github.com/ipfs/aegir/compare/v34.1.0...v35.0.0) (2021-08-14) ### Bug Fixes @@ -1569,7 +1739,7 @@ Co-authored-by: Alex Potsides -# [34.1.0](https://github.com/ipfs/aegir/compare/v34.0.3...v34.1.0) (2021-07-29) +## [34.1.0](https://github.com/ipfs/aegir/compare/v34.0.3...v34.1.0) (2021-07-29) ### Features @@ -1590,7 +1760,7 @@ Co-authored-by: Alex Potsides -# [34.0.0](https://github.com/ipfs/aegir/compare/v33.2.2...v34.0.0) (2021-07-09) +## [34.0.0](https://github.com/ipfs/aegir/compare/v33.2.2...v34.0.0) (2021-07-09) ### Features @@ -1612,7 +1782,7 @@ Co-authored-by: Alex Potsides -# [33.2.0](https://github.com/ipfs/aegir/compare/v33.1.2...v33.2.0) (2021-05-21) +## [33.2.0](https://github.com/ipfs/aegir/compare/v33.1.2...v33.2.0) (2021-05-21) ### Features @@ -1634,7 +1804,7 @@ Co-authored-by: Alex Potsides -# [33.1.0](https://github.com/ipfs/aegir/compare/v33.0.0...v33.1.0) (2021-04-14) +## [33.1.0](https://github.com/ipfs/aegir/compare/v33.0.0...v33.1.0) (2021-04-14) ### Features @@ -1643,7 +1813,7 @@ Co-authored-by: Alex Potsides -# [33.0.0](https://github.com/ipfs/aegir/compare/v32.2.0...v33.0.0) (2021-04-06) +## [33.0.0](https://github.com/ipfs/aegir/compare/v32.2.0...v33.0.0) (2021-04-06) ### Features @@ -1652,7 +1822,7 @@ Co-authored-by: Alex Potsides -# [32.2.0](https://github.com/ipfs/aegir/compare/v32.1.0...v32.2.0) (2021-03-30) +## [32.2.0](https://github.com/ipfs/aegir/compare/v32.1.0...v32.2.0) (2021-03-30) ### Bug Fixes @@ -1663,7 +1833,7 @@ Co-authored-by: Alex Potsides -# [32.1.0](https://github.com/ipfs/aegir/compare/v32.0.2...v32.1.0) (2021-03-17) +## [32.1.0](https://github.com/ipfs/aegir/compare/v32.0.2...v32.1.0) (2021-03-17) ### Bug Fixes @@ -1692,7 +1862,7 @@ Co-authored-by: Alex Potsides -# [32.0.0](https://github.com/ipfs/aegir/compare/v31.0.4...v32.0.0) (2021-03-13) +## [32.0.0](https://github.com/ipfs/aegir/compare/v31.0.4...v32.0.0) (2021-03-13) ### Bug Fixes @@ -1748,7 +1918,7 @@ Co-authored-by: Alex Potsides -# [31.0.0](https://github.com/ipfs/aegir/compare/v30.3.0...v31.0.0) (2021-02-23) +## [31.0.0](https://github.com/ipfs/aegir/compare/v30.3.0...v31.0.0) (2021-02-23) ### Bug Fixes @@ -1795,7 +1965,7 @@ Co-authored-by: Alex Potsides -# [31.0.0-next.2](https://github.com/ipfs/aegir/compare/v31.0.0-next.1...v31.0.0-next.2) (2021-02-23) +## [31.0.0-next.2](https://github.com/ipfs/aegir/compare/v31.0.0-next.1...v31.0.0-next.2) (2021-02-23) ### Bug Fixes @@ -1804,11 +1974,11 @@ Co-authored-by: Alex Potsides -# [31.0.0-next.1](https://github.com/ipfs/aegir/compare/v31.0.0-next.0...v31.0.0-next.1) (2021-02-23) +## [31.0.0-next.1](https://github.com/ipfs/aegir/compare/v31.0.0-next.0...v31.0.0-next.1) (2021-02-23) -# [31.0.0-next.0](https://github.com/ipfs/aegir/compare/v30.3.0...v31.0.0-next.0) (2021-02-23) +## [31.0.0-next.0](https://github.com/ipfs/aegir/compare/v30.3.0...v31.0.0-next.0) (2021-02-23) ### Bug Fixes @@ -1888,7 +2058,7 @@ Co-authored-by: Alex Potsides -# [30.3.0](https://github.com/ipfs/aegir/compare/v30.2.0...v30.3.0) (2021-01-05) +## [30.3.0](https://github.com/ipfs/aegir/compare/v30.2.0...v30.3.0) (2021-01-05) ### Features @@ -1897,7 +2067,7 @@ Co-authored-by: Alex Potsides -# [30.2.0](https://github.com/ipfs/aegir/compare/v30.1.0...v30.2.0) (2020-12-20) +## [30.2.0](https://github.com/ipfs/aegir/compare/v30.1.0...v30.2.0) (2020-12-20) ### Bug Fixes @@ -1906,7 +2076,7 @@ Co-authored-by: Alex Potsides -# [30.1.0](https://github.com/ipfs/aegir/compare/v30.0.0...v30.1.0) (2020-12-18) +## [30.1.0](https://github.com/ipfs/aegir/compare/v30.0.0...v30.1.0) (2020-12-18) ### Features diff --git a/README.md b/README.md index 278d3478d..d70fac5c0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ $ npm i aegir ### Browser ` diff --git a/actions/docker-login/action.yml b/actions/docker-login/action.yml index e8dc051c5..e5a3d7ec2 100644 --- a/actions/docker-login/action.yml +++ b/actions/docker-login/action.yml @@ -7,11 +7,15 @@ inputs: docker-username: description: 'Docker username' required: false + docker-registry: + description: 'Docker registry' + default: 'ghcr.io' + required: false runs: using: composite steps: - run: | if [[ -n "${{ inputs.docker-token }}" ]] && [[ -n "${{ inputs.docker-username }}" ]]; then - echo "${{ inputs.docker-token }}" | docker login -u "${{ inputs.docker-username }}" --password-stdin + echo "${{ inputs.docker-token }}" | docker login -u "${{ inputs.docker-username }}" --password-stdin ${{ inputs.docker-registry }} fi shell: bash diff --git a/md/esm.md b/md/esm.md index 371400ea9..3b2b140df 100644 --- a/md/esm.md +++ b/md/esm.md @@ -8,8 +8,6 @@ Electron supports ESM but [electron-mocha does not](https://github.com/jprichardson/electron-mocha/pull/187). It's capable of supporting it in the main thread but since Chrome does not provide any way to intercept calls to `import` it's unlikely to work with the renderer thread for the foreseeable future. -We currently use a [fork of electron-mocha](https://www.npmjs.com/package/electron-mocha-main) that allows running ESM tests on the main thread but we have no support for running them on the renderer thread until the issues with Chrome and intercepting `import` above are resolved. - ## Examples TODO: List examples when merged (`ipfs-unixfs`, `uint8arrays`) diff --git a/package.json b/package.json index 53b029edc..4939f503f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aegir", - "version": "42.2.11", + "version": "44.1.2", "description": "JavaScript project management", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/aegir#readme", @@ -222,25 +222,24 @@ "release": "node src/index.js release --no-bundle" }, "dependencies": { - "@anolilab/multi-semantic-release": "^1.0.3", "@electron/get": "^3.0.0", "@polka/send-type": "^0.5.2", "@semantic-release/changelog": "^6.0.1", - "@semantic-release/commit-analyzer": "^12.0.0", + "@semantic-release/commit-analyzer": "^13.0.0", "@semantic-release/git": "^10.0.1", - "@semantic-release/github": "^10.0.3", + "@semantic-release/github": "^11.0.0", "@semantic-release/npm": "^12.0.0", - "@semantic-release/release-notes-generator": "^13.0.0", + "@semantic-release/release-notes-generator": "^14.0.0", "@types/chai": "^4.2.16", "@types/chai-as-promised": "^7.1.3", "@types/chai-string": "^1.4.2", "@types/chai-subset": "^1.3.3", "@types/mocha": "^10.0.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.18.0", + "@typescript-eslint/eslint-plugin": "^7.13.1", "buffer": "^6.0.3", "bytes": "^3.1.0", - "c8": "^9.0.0", + "c8": "^10.1.2", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "chai-bites": "^0.1.2", @@ -250,19 +249,20 @@ "conventional-changelog-conventionalcommits": "^8.0.0", "cors": "^2.8.5", "depcheck": "^1.4.3", - "diff": "^5.1.0", - "electron-mocha-main": "^11.0.3", + "diff": "^7.0.0", + "electron-mocha": "^13.0.0", "env-paths": "^3.0.0", - "esbuild": "^0.21.1", + "esbuild": "^0.24.0", "eslint": "^8.31.0", - "eslint-config-ipfs": "^6.0.0", + "eslint-config-ipfs": "^7.0.0", "eslint-plugin-etc": "^2.0.2", "eslint-plugin-import": "^2.18.0", - "eslint-plugin-jsdoc": "^48.0.2", + "eslint-plugin-jsdoc": "^48.9.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.1.1", "execa": "^9.1.0", "extract-zip": "^2.0.1", + "fast-glob": "^3.3.2", "fs-extra": "^11.1.0", "gh-pages": "^6.0.0", "globby": "^14.0.0", @@ -283,10 +283,9 @@ "micromark-extension-gfm-strikethrough": "^2.0.0", "micromark-extension-gfm-table": "^2.0.0", "micromark-extension-gfm-task-list-item": "^2.0.1", - "fast-glob": "^3.3.2", "mocha": "^10.0.0", - "npm-package-json-lint": "^7.0.0", - "nyc": "^15.1.0", + "npm-package-json-lint": "^8.0.0", + "nyc": "^17.0.0", "p-map": "^7.0.1", "p-queue": "^8.0.1", "p-retry": "^6.0.0", @@ -298,8 +297,9 @@ "proper-lockfile": "^4.1.2", "react-native-test-runner": "^5.0.0", "read-pkg-up": "^11.0.0", - "rimraf": "^5.0.0", - "semantic-release": "^23.0.0", + "rimraf": "^6.0.1", + "semantic-release": "^24.0.0", + "semantic-release-monorepo": "^8.0.2", "semver": "^7.3.8", "source-map-support": "^0.5.20", "strip-bom": "^5.0.0", @@ -331,7 +331,7 @@ "@types/semver": "^7.3.4", "@types/strong-log-transformer": "^1.0.2", "@types/yargs": "^17.0.0", - "electron": "^27.0.2", + "electron": "^32.2.0", "uint8arrays": "^5.0.1", "undici": "^6.2.1" }, diff --git a/src/align-versions.js b/src/align-versions.js new file mode 100644 index 000000000..c01a937dc --- /dev/null +++ b/src/align-versions.js @@ -0,0 +1,135 @@ +/* eslint-disable no-console */ + +import path from 'path' +import { execa } from 'execa' +import fs from 'fs-extra' +import Listr from 'listr' +import { calculateSiblingVersion } from './check-project/utils.js' +import { isMonorepoRoot, getSubprojectDirectories, pkg } from './utils.js' + +/** + * @typedef {import("./types.js").GlobalOptions} GlobalOptions + * @typedef {import("./types.js").ReleaseOptions} ReleaseOptions + * @typedef {import("listr").ListrTaskWrapper} Task + */ + +const tasks = new Listr([ + { + title: 'align sibling dependency versions', + enabled: () => isMonorepoRoot(), + /** + * @param {GlobalOptions & ReleaseOptions} ctx + */ + task: async (ctx) => { + if (!process.env.CI) { + console.info('⚠ This run was not triggered in a known CI environment, running in dry-run mode.') // eslint-disable-line no-console + return + } + + const rootDir = process.cwd() + const workspaces = pkg.workspaces + + if (!workspaces || !Array.isArray(workspaces)) { + throw new Error('No monorepo workspaces found') + } + + const { + siblingVersions, + packageDirs + } = await calculateSiblingVersions(rootDir, workspaces) + + // check these dependency types for monorepo siblings + const dependencyTypes = [ + 'dependencies', + 'devDependencies', + 'peerDependencies', + 'optionalDependencies' + ] + + // align the versions of siblings in each package + for (const packageDir of packageDirs) { + const manifestPath = path.join(packageDir, 'package.json') + const manifest = fs.readJSONSync(path.join(packageDir, 'package.json')) + + console.info('check project', manifest.name) + + for (const type of dependencyTypes) { + for (const [dep, version] of Object.entries(siblingVersions)) { + if (manifest[type] != null && manifest[type][dep] != null && manifest[type][dep] !== version) { + console.info('Update', type, dep, manifest[type][dep], '->', version) // eslint-disable-line no-console + manifest[type][dep] = version + } + } + } + + fs.writeJSONSync(manifestPath, manifest, { + spaces: 2 + }) + } + + // all done, commit changes and push to remote + const status = await execa('git', ['status', '--porcelain'], { + cwd: rootDir + }) + + if (status.stdout === '') { + // no changes, nothing to do + return + } + + if (!process.env.CI) { + // do not push to remote repo if in dry-run mode + return + } + + // When running on CI, set the commits author and commiter info and prevent the `git` CLI to prompt for username/password. + // Borrowed from `semantic-release` + process.env.GIT_AUTHOR_NAME = ctx.siblingDepUpdateName + process.env.GIT_AUTHOR_EMAIL = ctx.siblingDepUpdateEmail + process.env.GIT_COMMITTER_NAME = ctx.siblingDepUpdateName + process.env.GIT_COMMITTER_EMAIL = ctx.siblingDepUpdateEmail + process.env.GIT_ASKPASS = 'echo' + process.env.GIT_TERMINAL_PROMPT = '0' + + console.info(`Commit with message "${ctx.siblingDepUpdateMessage}"`) // eslint-disable-line no-console + + await execa('git', ['add', '-A'], { + cwd: rootDir + }) + await execa('git', ['commit', '-m', ctx.siblingDepUpdateMessage], { + cwd: rootDir + }) + console.info('Push to remote') // eslint-disable-line no-console + await execa('git', ['push'], { + cwd: rootDir + }) + } + } +], { renderer: 'verbose' }) + +/** + * @param {string} rootDir + * @param {string[]} workspaces + */ +async function calculateSiblingVersions (rootDir, workspaces) { + const packageDirs = [] + + /** @type {Record} */ + const siblingVersions = {} + + for (const subProjectDir of await getSubprojectDirectories(rootDir, workspaces)) { + const pkg = JSON.parse(fs.readFileSync(path.join(subProjectDir, 'package.json'), { + encoding: 'utf-8' + })) + + siblingVersions[pkg.name] = calculateSiblingVersion(pkg.version) + packageDirs.push(subProjectDir) + } + + return { + packageDirs, + siblingVersions + } +} + +export default tasks diff --git a/src/check-project/check-monorepo-readme.js b/src/check-project/check-monorepo-readme.js index e71deaedd..a6e29240c 100644 --- a/src/check-project/check-monorepo-readme.js +++ b/src/check-project/check-monorepo-readme.js @@ -159,7 +159,7 @@ export async function checkMonorepoReadme (projectDir, repoUrl, webRoot, default apiDocs = parseMarkdown(APIDOCS(pkg)) } - const structure = parseMarkdown(STRUCTURE(projectDir, projectDirs)) + const structure = parseMarkdown(STRUCTURE(projectDir, projectDirs, webRoot)) readme.children = [ ...header, diff --git a/src/check-project/index.js b/src/check-project/index.js index 56870aac4..5f2ee3304 100755 --- a/src/check-project/index.js +++ b/src/check-project/index.js @@ -115,6 +115,23 @@ async function processMonorepo (projectDir, manifest, branchName, repoUrl, ciFil const projectDirs = [] const webRoot = `${repoUrl}/tree/${branchName}` + const { releaseType } = await prompt.get({ + properties: { + releaseType: { + description: 'Monorepo release type: semantic-release | release-please', + required: true, + conform: (value) => { + return ['semantic-release', 'release-please'].includes(value) + }, + default: usesReleasePlease() ? 'release-please' : 'semantic-release' + } + } + }) + + if (releaseType !== 'release-please' && releaseType !== 'semantic-release') { + throw new Error('Invalid release type specified') + } + for (const subProjectDir of await getSubprojectDirectories(projectDir, workspaces)) { const stat = await fs.stat(subProjectDir) @@ -133,7 +150,16 @@ async function processMonorepo (projectDir, manifest, branchName, repoUrl, ciFil console.info('Found monorepo project', pkg.name) - await processModule(subProjectDir, pkg, branchName, repoUrl, homePage, ciFile, manifest) + await processModule({ + projectDir: subProjectDir, + manifest: pkg, + branchName, + repoUrl, + homePage, + ciFile, + rootManifest: manifest, + releaseType + }) projectDirs.push(subProjectDir) } @@ -141,7 +167,13 @@ async function processMonorepo (projectDir, manifest, branchName, repoUrl, ciFil await alignMonorepoProjectDependencies(projectDirs) await configureMonorepoProjectReferences(projectDirs) - let proposedManifest = await monorepoManifest(manifest, repoUrl, repoUrl, branchName) + let proposedManifest = await monorepoManifest({ + manifest, + repoUrl, + homePage: repoUrl, + branchName, + releaseType + }) proposedManifest = sortManifest(proposedManifest) await ensureFileHasContents(projectDir, 'package.json', JSON.stringify(proposedManifest, null, 2)) @@ -324,7 +356,9 @@ function addReferences (deps, references, refs) { * @param {string} ciFile */ async function processProject (projectDir, manifest, branchName, repoUrl, ciFile) { - await processModule(projectDir, manifest, branchName, repoUrl, repoUrl, ciFile) + const releaseType = 'semantic-release' + + await processModule({ projectDir, manifest, branchName, repoUrl, homePage: repoUrl, ciFile, releaseType }) await checkBuildFiles(projectDir, branchName, repoUrl) } @@ -336,16 +370,32 @@ function isAegirProject (manifest) { } /** - * - * @param {string} projectDir - * @param {any} manifest - * @param {string} branchName - * @param {string} repoUrl - * @param {string} homePage - * @param {string} ciFile - * @param {any} [rootManifest] + * @typedef {object} ProcessModuleContext + * @property {string} projectDir + * @property {any} manifest + * @property {string} branchName + * @property {string} repoUrl + * @property {string} homePage + * @property {string} ciFile + * @property {any} [rootManifest] + * @property {"semantic-release" | "release-please"} releaseType + */ + +/** + * @typedef {object} ProcessManifestContext + * @property {any} manifest + * @property {string} branchName + * @property {string} repoUrl + * @property {string} homePage + * @property {"semantic-release" | "release-please"} releaseType */ -async function processModule (projectDir, manifest, branchName, repoUrl, homePage = repoUrl, ciFile, rootManifest) { + +/** + * @param {ProcessModuleContext} context + */ +async function processModule (context) { + const { projectDir, manifest, branchName, repoUrl, homePage = repoUrl, ciFile, rootManifest, releaseType } = context + if (!isAegirProject(manifest) && manifest.name !== 'aegir') { throw new Error(`"${projectDir}" is not an aegir project`) } @@ -412,29 +462,23 @@ async function processModule (projectDir, manifest, branchName, repoUrl, homePag if (typescript) { console.info('TypeScript project detected') - proposedManifest = await typescriptManifest(manifest, branchName, repoUrl, homePage) + proposedManifest = await typescriptManifest({ manifest, branchName, repoUrl, homePage, releaseType }) } else if (typedESM) { console.info('Typed ESM project detected') - proposedManifest = await typedESMManifest(manifest, branchName, repoUrl, homePage) + proposedManifest = await typedESMManifest({ manifest, branchName, repoUrl, homePage, releaseType }) } else if (typedCJS) { console.info('Typed CJS project detected') - proposedManifest = await typedCJSManifest(manifest, branchName, repoUrl, homePage) + proposedManifest = await typedCJSManifest({ manifest, branchName, repoUrl, homePage, releaseType }) } else if (untypedESM) { console.info('Untyped ESM project detected') - proposedManifest = await untypedESMManifest(manifest, branchName, repoUrl, homePage) + proposedManifest = await untypedESMManifest({ manifest, branchName, repoUrl, homePage, releaseType }) } else if (untypedCJS) { console.info('Untyped CJS project detected') - proposedManifest = await untypedCJSManifest(manifest, branchName, repoUrl, homePage) + proposedManifest = await untypedCJSManifest({ manifest, branchName, repoUrl, homePage, releaseType }) } else { throw new Error('Cannot determine project type') } - // remove release config from monorepo projects as multi-semantic-release - // wants it defined in the root manifest - if (rootManifest != null) { - proposedManifest.release = undefined - } - proposedManifest = sortManifest(proposedManifest) await ensureFileHasContents(projectDir, 'package.json', JSON.stringify(proposedManifest, null, 2)) diff --git a/src/check-project/manifests/monorepo.js b/src/check-project/manifests/monorepo.js index 8cebd6d0f..7a29b3321 100644 --- a/src/check-project/manifests/monorepo.js +++ b/src/check-project/manifests/monorepo.js @@ -1,24 +1,41 @@ -import { semanticReleaseConfig } from '../semantic-release-config.js' import { sortFields, constructManifest } from '../utils.js' /** - * @param {any} manifest - * @param {string} repoUrl - * @param {string} homePage - * @param {string} branchName + * @param {import('../index.js').ProcessManifestContext} context */ -export async function monorepoManifest (manifest, repoUrl, homePage, branchName) { +export async function monorepoManifest (context) { + const { manifest, repoUrl, homePage } = context + + const scripts = { + ...manifest.scripts + } + + const devDependencies = manifest.devDependencies ?? {} + + if (context.releaseType === 'semantic-release') { + scripts.release = 'run-s build npm:release docs' + scripts['npm:release'] = 'aegir run release' + scripts.docs = 'aegir docs' + + delete manifest.release + devDependencies['npm-run-all'] = '^4.1.5' + } + + if (context.releaseType === 'release-please') { + scripts.release = 'run-s build npm:release docs' + scripts['npm:release'] = 'aegir exec --bail false npm -- publish' + scripts['release:rc'] = 'aegir release-rc' + scripts.docs = 'aegir docs' + + devDependencies['npm-run-all'] = '^4.1.5' + } + let proposedManifest = constructManifest(manifest, { private: true, - release: ( - Object.values(manifest.scripts ?? {}) - .some(script => script.includes('semantic-release') || script.includes('aegir release')) - ) - ? semanticReleaseConfig(branchName) - : undefined + scripts }, repoUrl, homePage) const rest = { diff --git a/src/check-project/manifests/typed-cjs.js b/src/check-project/manifests/typed-cjs.js index 5a90ace9e..0d408ab44 100644 --- a/src/check-project/manifests/typed-cjs.js +++ b/src/check-project/manifests/typed-cjs.js @@ -8,12 +8,24 @@ import { const merge = mergeOptions.bind({ ignoreUndefined: true }) /** - * @param {any} manifest - * @param {string} branchName - * @param {string} repoUrl - * @param {string} [homePage] + * @param {import('../index.js').ProcessManifestContext} context */ -export async function typedCJSManifest (manifest, branchName, repoUrl, homePage = repoUrl) { +export async function typedCJSManifest (context) { + const { manifest, branchName, repoUrl, homePage } = context + let release + const scripts = { + ...manifest.scripts + } + + if (context.releaseType === 'semantic-release') { + scripts.release = 'aegir release' + release = semanticReleaseConfig(branchName) + } + + if (context.releaseType === 'release-please') { + delete scripts.release + } + let proposedManifest = constructManifest(manifest, { main: 'src/index.js', types: 'dist/src/index.d.ts', @@ -41,7 +53,8 @@ export async function typedCJSManifest (manifest, branchName, repoUrl, homePage project: true } }, manifest.eslintConfig), - release: (manifest.scripts?.release?.includes('semantic-release') || manifest.scripts?.release?.includes('aegir release')) ? semanticReleaseConfig(branchName) : undefined + scripts, + release }, repoUrl, homePage) const rest = { diff --git a/src/check-project/manifests/typed-esm.js b/src/check-project/manifests/typed-esm.js index d8aed8423..d5312b0a4 100644 --- a/src/check-project/manifests/typed-esm.js +++ b/src/check-project/manifests/typed-esm.js @@ -9,12 +9,24 @@ import { const merge = mergeOptions.bind({ ignoreUndefined: true }) /** - * @param {any} manifest - * @param {string} branchName - * @param {string} repoUrl - * @param {string} [homePage] + * @param {import('../index.js').ProcessManifestContext} context */ -export async function typedESMManifest (manifest, branchName, repoUrl, homePage = repoUrl) { +export async function typedESMManifest (context) { + const { manifest, branchName, repoUrl, homePage } = context + let release + const scripts = { + ...manifest.scripts + } + + if (context.releaseType === 'semantic-release') { + scripts.release = 'aegir release' + release = semanticReleaseConfig(branchName) + } + + if (context.releaseType === 'release-please') { + delete scripts.release + } + let proposedManifest = constructManifest(manifest, { type: 'module', types: './dist/src/index.d.ts', @@ -55,7 +67,8 @@ export async function typedESMManifest (manifest, branchName, repoUrl, homePage sourceType: 'module' } }, manifest.eslintConfig), - release: (manifest.scripts?.release?.includes('semantic-release') || manifest.scripts?.release?.includes('aegir release')) ? semanticReleaseConfig(branchName) : undefined + release, + scripts }, repoUrl, homePage) const rest = { diff --git a/src/check-project/manifests/typescript.js b/src/check-project/manifests/typescript.js index 671a8e9fc..9b002ffe7 100644 --- a/src/check-project/manifests/typescript.js +++ b/src/check-project/manifests/typescript.js @@ -11,12 +11,21 @@ import { const merge = mergeOptions.bind({ ignoreUndefined: true }) /** - * @param {any} manifest - * @param {string} branchName - * @param {string} repoUrl - * @param {string} [homePage] + * @param {import('../index.js').ProcessManifestContext} context */ -export async function typescriptManifest (manifest, branchName, repoUrl, homePage = repoUrl) { +export async function typescriptManifest (context) { + const { manifest, branchName, repoUrl, homePage } = context + let release + + if (context.releaseType === 'semantic-release') { + manifest.scripts.release = 'aegir release' + release = semanticReleaseConfig(branchName) + } + + if (context.releaseType === 'release-please') { + delete manifest.scripts.release + } + let proposedManifest = constructManifest(manifest, { type: 'module', types: './dist/src/index.d.ts', @@ -42,7 +51,7 @@ export async function typescriptManifest (manifest, branchName, repoUrl, homePag sourceType: 'module' } }, manifest.eslintConfig), - release: (manifest.scripts?.release?.includes('semantic-release') || manifest.scripts?.release?.includes('aegir release')) ? semanticReleaseConfig(branchName) : undefined + release }, repoUrl, homePage) if (proposedManifest.exports != null && Object.keys(proposedManifest.exports).length > 1) { diff --git a/src/check-project/manifests/untyped-cjs.js b/src/check-project/manifests/untyped-cjs.js index 84b3daf3a..f8f3fef12 100644 --- a/src/check-project/manifests/untyped-cjs.js +++ b/src/check-project/manifests/untyped-cjs.js @@ -8,12 +8,24 @@ import { const merge = mergeOptions.bind({ ignoreUndefined: true }) /** - * @param {any} manifest - * @param {string} branchName - * @param {string} repoUrl - * @param {string} [homePage] + * @param {import('../index.js').ProcessManifestContext} context */ -export async function untypedCJSManifest (manifest, branchName, repoUrl, homePage = repoUrl) { +export async function untypedCJSManifest (context) { + const { manifest, branchName, repoUrl, homePage } = context + let release + const scripts = { + ...manifest.scripts + } + + if (context.releaseType === 'semantic-release') { + scripts.release = 'aegir release' + release = semanticReleaseConfig(branchName) + } + + if (context.releaseType === 'release-please') { + delete scripts.release + } + let proposedManifest = constructManifest(manifest, { main: 'src/index.js', files: [ @@ -26,7 +38,8 @@ export async function untypedCJSManifest (manifest, branchName, repoUrl, homePag project: true } }, manifest.eslintConfig), - release: (manifest.scripts?.release?.includes('semantic-release') || manifest.scripts?.release?.includes('aegir release')) ? semanticReleaseConfig(branchName) : undefined + release, + scripts }, repoUrl, homePage) const rest = { diff --git a/src/check-project/manifests/untyped-esm.js b/src/check-project/manifests/untyped-esm.js index 4a9dd4693..29e8b00ba 100644 --- a/src/check-project/manifests/untyped-esm.js +++ b/src/check-project/manifests/untyped-esm.js @@ -8,12 +8,24 @@ import { const merge = mergeOptions.bind({ ignoreUndefined: true }) /** - * @param {any} manifest - * @param {string} branchName - * @param {string} repoUrl - * @param {string} [homePage] + * @param {import('../index.js').ProcessManifestContext} context */ -export async function untypedESMManifest (manifest, branchName, repoUrl, homePage = repoUrl) { +export async function untypedESMManifest (context) { + const { manifest, branchName, repoUrl, homePage } = context + let release + const scripts = { + ...manifest.scripts + } + + if (context.releaseType === 'semantic-release') { + scripts.release = 'aegir release' + release = semanticReleaseConfig(branchName) + } + + if (context.releaseType === 'release-please') { + delete scripts.release + } + let proposedManifest = constructManifest(manifest, { type: 'module', files: [ @@ -35,7 +47,8 @@ export async function untypedESMManifest (manifest, branchName, repoUrl, homePag sourceType: 'module' } }, manifest.eslintConfig), - release: (manifest.scripts?.release?.includes('semantic-release') || manifest.scripts?.release?.includes('aegir release')) ? semanticReleaseConfig(branchName) : undefined + release, + scripts }, repoUrl, homePage) const rest = { diff --git a/src/check-project/readme/install.js b/src/check-project/readme/install.js index 50147be16..a32ecad73 100644 --- a/src/check-project/readme/install.js +++ b/src/check-project/readme/install.js @@ -16,7 +16,7 @@ $ npm i ${pkg.name} ` const browserInstall = `## Browser \` diff --git a/src/check-project/readme/structure.js b/src/check-project/readme/structure.js index 48522335e..7cc532361 100644 --- a/src/check-project/readme/structure.js +++ b/src/check-project/readme/structure.js @@ -4,8 +4,9 @@ import fs from 'fs-extra' /** * @param {string} monorepoDir * @param {string[]} projectDirs + * @param {string} webRoot */ -export const STRUCTURE = (monorepoDir, projectDirs) => { +export const STRUCTURE = (monorepoDir, projectDirs, webRoot) => { /** @type {Record} */ const packages = {} @@ -21,7 +22,7 @@ export const STRUCTURE = (monorepoDir, projectDirs) => { # Packages ${Object.entries(packages).map(([key, value]) => { - return `* [\`${key}\`](.${key}) ${value}` + return `* [\`${key}\`](${webRoot}/${key}) ${value}` }).join('\n')} ` } diff --git a/src/cmds/align-versions.js b/src/cmds/align-versions.js new file mode 100644 index 000000000..ba00d0628 --- /dev/null +++ b/src/cmds/align-versions.js @@ -0,0 +1,46 @@ +import alignVersions from '../align-versions.js' +import { loadUserConfig } from '../config/user.js' + +/** + * @typedef {import("yargs").Argv} Argv + * @typedef {import("yargs").Arguments} Arguments + * @typedef {import("yargs").CommandModule} CommandModule + */ + +/** @type {CommandModule} */ +export default { + command: 'align-versions', + describe: 'Align monorepo sibling dependency versions', + /** + * @param {Argv} yargs + */ + builder: async (yargs) => { + const userConfig = await loadUserConfig() + + return yargs + .options({ + siblingDepUpdateMessage: { + alias: 'm', + type: 'string', + describe: 'The commit message to use when updating sibling dependencies', + default: userConfig.release.siblingDepUpdateMessage + }, + siblingDepUpdateName: { + type: 'string', + describe: 'The user name to use when updating sibling dependencies', + default: userConfig.release.siblingDepUpdateName + }, + siblingDepUpdateEmail: { + type: 'string', + describe: 'The email to use when updating sibling dependencies', + default: userConfig.release.siblingDepUpdateEmail + } + }) + }, + /** + * @param {any} argv + */ + async handler (argv) { + await alignVersions.run(argv) + } +} diff --git a/src/cmds/release.js b/src/cmds/release.js index c2d4c919a..f1753918f 100644 --- a/src/cmds/release.js +++ b/src/cmds/release.js @@ -1,4 +1,3 @@ -import { loadUserConfig } from '../config/user.js' import releaseCmd from '../release.js' /** @@ -19,28 +18,9 @@ export default { * @param {Argv} yargs */ builder: async (yargs) => { - const userConfig = await loadUserConfig() - return yargs .epilog(EPILOG) - .options({ - siblingDepUpdateMessage: { - alias: 'm', - type: 'string', - describe: 'The commit message to use when updating sibling dependencies', - default: userConfig.release.siblingDepUpdateMessage - }, - siblingDepUpdateName: { - type: 'string', - describe: 'The user name to use when updating sibling dependencies', - default: userConfig.release.siblingDepUpdateName - }, - siblingDepUpdateEmail: { - type: 'string', - describe: 'The email to use when updating sibling dependencies', - default: userConfig.release.siblingDepUpdateEmail - } - }) + .options({}) }, /** * @param {any} argv diff --git a/src/config/tsconfig.aegir.json b/src/config/tsconfig.aegir.json index 0d4d47438..013a02cf6 100644 --- a/src/config/tsconfig.aegir.json +++ b/src/config/tsconfig.aegir.json @@ -21,11 +21,6 @@ // module resolution "esModuleInterop": true, "moduleResolution": "node", - // linter checks - "noImplicitReturns": false, - "noFallthroughCasesInSwitch": true, - "noUnusedLocals": true, - "noUnusedParameters": false, // advanced "verbatimModuleSyntax": true, "forceConsistentCasingInFileNames": true, diff --git a/src/index.js b/src/index.js index c5c3db23e..344ef0ea9 100755 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,7 @@ import { readPackageUpSync } from 'read-pkg-up' import yargs from 'yargs' import { hideBin } from 'yargs/helpers' +import alignVersionsCmd from './cmds/align-versions.js' import buildCmd from './cmds/build.js' import checkProjectCmd from './cmds/check-project.js' import checkCmd from './cmds/check.js' @@ -92,6 +93,7 @@ async function main () { res.command(testCmd) res.command(execCmd) res.command(runCmd) + res.command(alignVersionsCmd) try { await res.parse() diff --git a/src/release.js b/src/release.js index 10ee1a4f4..fcfc5c54b 100644 --- a/src/release.js +++ b/src/release.js @@ -1,11 +1,8 @@ /* eslint-disable no-console */ -import path from 'path' import { execa } from 'execa' -import fs from 'fs-extra' import Listr from 'listr' -import { calculateSiblingVersion } from './check-project/utils.js' -import { isMonorepoProject, isMonorepoRoot, hasDocs, getSubprojectDirectories } from './utils.js' +import { isMonorepoProject, hasDocs, pkg } from './utils.js' /** * @typedef {import("./types").GlobalOptions} GlobalOptions @@ -29,104 +26,15 @@ const tasks = new Listr([ * @param {GlobalOptions} ctx */ task: async (ctx) => { - const args = ctx['--'] ?? [] + let args = ctx['--'] ?? [] - if (isMonorepoRoot()) { - await execa('multi-semantic-release', [ - // eslint-disable-next-line no-template-curly-in-string - '--tag-format', '${name}-${version}', - '--deps.bump', 'satisfy', - '--deps.release', 'minor', - ...args - ], { - preferLocal: true, - stdio: 'inherit' - }) - } else { - await execa('semantic-release', args, { - preferLocal: true, - stdio: 'inherit' - }) + if (isMonorepoProject()) { + args = ['-e', 'semantic-release-monorepo', `--tag-format="${pkg.name}-\${version}"`, ...args] } - } - }, - { - title: 'align sibling dependency versions', - enabled: () => isMonorepoProject(), - /** - * @param {GlobalOptions & ReleaseOptions} ctx - */ - task: async (ctx) => { - const parentManifestPath = path.resolve(path.join(process.cwd(), '..', '..', 'package.json')) - const rootDir = path.dirname(parentManifestPath) - const parentManifest = fs.readJSONSync(parentManifestPath) - const workspaces = parentManifest.workspaces - - if (!workspaces || !Array.isArray(workspaces)) { - throw new Error('No monorepo workspaces found') - } - - const { - siblingVersions, - packageDirs - } = await calculateSiblingVersions(rootDir, workspaces) - - // check these dependency types for monorepo siblings - const dependencyTypes = [ - 'dependencies', - 'devDependencies', - 'peerDependencies', - 'optionalDependencies' - ] - - // align the versions of siblings in each package - for (const packageDir of packageDirs) { - const manifestPath = path.join(packageDir, 'package.json') - const manifest = fs.readJSONSync(path.join(packageDir, 'package.json')) - - for (const type of dependencyTypes) { - for (const [dep, version] of Object.entries(siblingVersions)) { - if (manifest[type] != null && manifest[type][dep] != null && manifest[type][dep] !== version) { - console.info('Update', type, dep, manifest[type][dep], '->', version) // eslint-disable-line no-console - manifest[type][dep] = version - } - } - } - - fs.writeJSONSync(manifestPath, manifest, { - spaces: 2 - }) - } - - // all done, commit changes and push to remote - const status = await execa('git', ['status', '--porcelain'], { - cwd: rootDir - }) - if (status.stdout === '') { - // no changes, nothing to do - return - } - - // When running on CI, set the commits author and commiter info and prevent the `git` CLI to prompt for username/password. - // Borrowed from `semantic-release` - process.env.GIT_AUTHOR_NAME = ctx.siblingDepUpdateName - process.env.GIT_AUTHOR_EMAIL = ctx.siblingDepUpdateEmail - process.env.GIT_COMMITTER_NAME = ctx.siblingDepUpdateName - process.env.GIT_COMMITTER_EMAIL = ctx.siblingDepUpdateEmail - process.env.GIT_ASKPASS = 'echo' - process.env.GIT_TERMINAL_PROMPT = '0' - - console.info(`Commit with message "${ctx.siblingDepUpdateMessage}"`) // eslint-disable-line no-console - await execa('git', ['add', '-A'], { - cwd: rootDir - }) - await execa('git', ['commit', '-m', ctx.siblingDepUpdateMessage], { - cwd: rootDir - }) - console.info('Push to remote') // eslint-disable-line no-console - await execa('git', ['push'], { - cwd: rootDir + await execa('semantic-release', args, { + preferLocal: true, + stdio: 'inherit' }) } }, @@ -141,29 +49,4 @@ const tasks = new Listr([ } ], { renderer: 'verbose' }) -/** - * @param {string} rootDir - * @param {string[]} workspaces - */ -async function calculateSiblingVersions (rootDir, workspaces) { - const packageDirs = [] - - /** @type {Record} */ - const siblingVersions = {} - - for (const subProjectDir of await getSubprojectDirectories(rootDir, workspaces)) { - const pkg = JSON.parse(fs.readFileSync(path.join(subProjectDir, 'package.json'), { - encoding: 'utf-8' - })) - - siblingVersions[pkg.name] = calculateSiblingVersion(pkg.version) - packageDirs.push(subProjectDir) - } - - return { - packageDirs, - siblingVersions - } -} - export default tasks diff --git a/src/utils.js b/src/utils.js index a6ee1642c..6289d78cd 100644 --- a/src/utils.js +++ b/src/utils.js @@ -301,6 +301,24 @@ export const usesReleasePlease = (dir = process.cwd()) => { } } +export const usesSemanticReleaseMonorepo = (dir = process.cwd()) => { + try { + if (pkg.private) { + return false + } + + const cwd = path.resolve(dir, '..') + const rootManifest = readPackageUpSync({ + cwd + }) + + return Object.values(rootManifest?.packageJson.scripts ?? {}) + .some(script => script.includes('aegir run release')) + } catch { + return false + } +} + /** * Binaries we need are normally in `node_modules/.bin` of the root project * unless a sibling dependency has caused a different version to be hoisted diff --git a/test/fixtures/dependency-check/fail-unused/index.js b/test/fixtures/dependency-check/fail-unused/index.js index 0499edc20..0779a5c78 100644 --- a/test/fixtures/dependency-check/fail-unused/index.js +++ b/test/fixtures/dependency-check/fail-unused/index.js @@ -1,3 +1,2 @@ /* eslint-disable no-unused-vars */ -// @ts-expect-error unused import { execa } from 'execa' diff --git a/test/fixtures/dependency-check/ts-fail/src/index.ts b/test/fixtures/dependency-check/ts-fail/src/index.ts index b0c8f387a..0a6f23f99 100644 --- a/test/fixtures/dependency-check/ts-fail/src/index.ts +++ b/test/fixtures/dependency-check/ts-fail/src/index.ts @@ -1,4 +1,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -// @ts-expect-error unused import { execa } from 'execa' import './other.js' diff --git a/test/fixtures/dependency-check/ts-pass/src/index.ts b/test/fixtures/dependency-check/ts-pass/src/index.ts index 0b6a46149..e8afcb68d 100644 --- a/test/fixtures/dependency-check/ts-pass/src/index.ts +++ b/test/fixtures/dependency-check/ts-pass/src/index.ts @@ -1,3 +1,2 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -// @ts-expect-error unused import { execa } from 'execa'