diff --git a/__snapshots__/manifest.js b/__snapshots__/manifest.js index 69195db56..492c9e978 100644 --- a/__snapshots__/manifest.js +++ b/__snapshots__/manifest.js @@ -1,70 +1,70 @@ exports['Manifest pullRequest allows root module to be published, via special "." path: changes'] = ` -filename: node/pkg1/CHANGELOG.md +filename: CHANGELOG.md # Changelog -## [4.0.0](https://www.github.com/fake/repo/compare/pkg1-v3.2.1...pkg1-v4.0.0) (1983-10-10) +## [3.0.0](https://www.github.com/fake/repo/compare/googleapis-v2.0.0...googleapis-v3.0.0) (1983-10-10) ### ⚠ BREAKING CHANGES * **@node/pkg1:** major new feature +* **@node/pkg2:** major new feature ### Features * **@node/pkg1:** major new feature ([e3ab0ab](https://www.github.com/fake/repo/commit/e3ab0abfd66e66324f685ceeececf35c)) +* **@node/pkg2:** major new feature ([72f962d](https://www.github.com/fake/repo/commit/72f962d44ba0bcee15594ea6bdc67d8b)) -filename: node/pkg1/package.json + +### Bug Fixes + +* **root:** root only change ([8b55db3](https://www.github.com/fake/repo/commit/8b55db3f6115306cc9c132bec0bb1447)) + +filename: package.json { - "name": "@node/pkg1", - "version": "4.0.0" + "name": "googleapis", + "version": "3.0.0" } -filename: node/pkg2/CHANGELOG.md +filename: node/pkg1/CHANGELOG.md # Changelog -## [2.0.0](https://www.github.com/fake/repo/compare/pkg2-v1.2.3...pkg2-v2.0.0) (1983-10-10) +## [4.0.0](https://www.github.com/fake/repo/compare/pkg1-v3.2.1...pkg1-v4.0.0) (1983-10-10) ### ⚠ BREAKING CHANGES -* **@node/pkg2:** major new feature +* **@node/pkg1:** major new feature ### Features -* **@node/pkg2:** major new feature ([72f962d](https://www.github.com/fake/repo/commit/72f962d44ba0bcee15594ea6bdc67d8b)) +* **@node/pkg1:** major new feature ([e3ab0ab](https://www.github.com/fake/repo/commit/e3ab0abfd66e66324f685ceeececf35c)) -filename: node/pkg2/package.json +filename: node/pkg1/package.json { - "name": "@node/pkg2", - "version": "2.0.0" + "name": "@node/pkg1", + "version": "4.0.0" } -filename: CHANGELOG.md +filename: node/pkg2/CHANGELOG.md # Changelog -## [3.0.0](https://www.github.com/fake/repo/compare/googleapis-v2.0.0...googleapis-v3.0.0) (1983-10-10) +## [2.0.0](https://www.github.com/fake/repo/compare/pkg2-v1.2.3...pkg2-v2.0.0) (1983-10-10) ### ⚠ BREAKING CHANGES -* **@node/pkg1:** major new feature * **@node/pkg2:** major new feature ### Features -* **@node/pkg1:** major new feature ([e3ab0ab](https://www.github.com/fake/repo/commit/e3ab0abfd66e66324f685ceeececf35c)) * **@node/pkg2:** major new feature ([72f962d](https://www.github.com/fake/repo/commit/72f962d44ba0bcee15594ea6bdc67d8b)) - -### Bug Fixes - -* **root:** root only change ([8b55db3](https://www.github.com/fake/repo/commit/8b55db3f6115306cc9c132bec0bb1447)) - -filename: package.json +filename: node/pkg2/package.json { - "name": "googleapis", - "version": "3.0.0" + "name": "@node/pkg2", + "version": "2.0.0" } filename: .release-please-manifest.json @@ -85,54 +85,54 @@ branch: release-please/branches/main description: :robot: I have created a release \\*beep\\* \\*boop\\* --- -@node/pkg1: 4.0.0 -## [4.0.0](https://www.github.com/fake/repo/compare/pkg1-v3.2.1...pkg1-v4.0.0) (1983-10-10) +googleapis: 3.0.0 +## [3.0.0](https://www.github.com/fake/repo/compare/googleapis-v2.0.0...googleapis-v3.0.0) (1983-10-10) ### ⚠ BREAKING CHANGES * **@node/pkg1:** major new feature +* **@node/pkg2:** major new feature ### Features * **@node/pkg1:** major new feature ([e3ab0ab](https://www.github.com/fake/repo/commit/e3ab0abfd66e66324f685ceeececf35c)) +* **@node/pkg2:** major new feature ([72f962d](https://www.github.com/fake/repo/commit/72f962d44ba0bcee15594ea6bdc67d8b)) + + +### Bug Fixes + +* **root:** root only change ([8b55db3](https://www.github.com/fake/repo/commit/8b55db3f6115306cc9c132bec0bb1447)) --- --- -@node/pkg2: 2.0.0 -## [2.0.0](https://www.github.com/fake/repo/compare/pkg2-v1.2.3...pkg2-v2.0.0) (1983-10-10) +@node/pkg1: 4.0.0 +## [4.0.0](https://www.github.com/fake/repo/compare/pkg1-v3.2.1...pkg1-v4.0.0) (1983-10-10) ### ⚠ BREAKING CHANGES -* **@node/pkg2:** major new feature +* **@node/pkg1:** major new feature ### Features -* **@node/pkg2:** major new feature ([72f962d](https://www.github.com/fake/repo/commit/72f962d44ba0bcee15594ea6bdc67d8b)) +* **@node/pkg1:** major new feature ([e3ab0ab](https://www.github.com/fake/repo/commit/e3ab0abfd66e66324f685ceeececf35c)) --- --- -googleapis: 3.0.0 -## [3.0.0](https://www.github.com/fake/repo/compare/googleapis-v2.0.0...googleapis-v3.0.0) (1983-10-10) +@node/pkg2: 2.0.0 +## [2.0.0](https://www.github.com/fake/repo/compare/pkg2-v1.2.3...pkg2-v2.0.0) (1983-10-10) ### ⚠ BREAKING CHANGES -* **@node/pkg1:** major new feature * **@node/pkg2:** major new feature ### Features -* **@node/pkg1:** major new feature ([e3ab0ab](https://www.github.com/fake/repo/commit/e3ab0abfd66e66324f685ceeececf35c)) * **@node/pkg2:** major new feature ([72f962d](https://www.github.com/fake/repo/commit/72f962d44ba0bcee15594ea6bdc67d8b)) - - -### Bug Fixes - -* **root:** root only change ([8b55db3](https://www.github.com/fake/repo/commit/8b55db3f6115306cc9c132bec0bb1447)) --- diff --git a/src/commit-split.ts b/src/commit-split.ts index 4ee62401a..ccdedd018 100644 --- a/src/commit-split.ts +++ b/src/commit-split.ts @@ -91,7 +91,11 @@ export class CommitSplit { let pkgName; if (this.packagePaths) { // only track paths under this.packagePaths - pkgName = this.packagePaths.find(p => file.indexOf(p) >= 0); + pkgName = this.packagePaths.find(p => { + // The special "." path, representing the root of the module + // should be ignored by commit-split: + return file.indexOf(p) >= 0 && p !== '.'; + }); } else { // track paths by top level folder pkgName = splitPath[0]; diff --git a/test/manifest.ts b/test/manifest.ts index 0de8b81f9..98cfea235 100644 --- a/test/manifest.ts +++ b/test/manifest.ts @@ -288,15 +288,15 @@ describe('Manifest', () => { it('allows root module to be published, via special "." path', async function () { const manifest = JSON.stringify({ + '.': '2.0.0', 'node/pkg1': '3.2.1', 'node/pkg2': '1.2.3', - '.': '2.0.0', }); const config = JSON.stringify({ packages: { + '.': {}, 'node/pkg1': {}, 'node/pkg2': {}, - '.': {}, }, }); const commits = [ @@ -341,20 +341,20 @@ describe('Manifest', () => { expect(pr).to.equal(22); expect(logs).to.eql([ [ - 'Found version 3.2.1 for node/pkg1 in .release-please-manifest.json at abc123 of main', + 'Found version 2.0.0 for . in .release-please-manifest.json at abc123 of main', CheckpointType.Success, ], [ - 'Found version 1.2.3 for node/pkg2 in .release-please-manifest.json at abc123 of main', + 'Found version 3.2.1 for node/pkg1 in .release-please-manifest.json at abc123 of main', CheckpointType.Success, ], [ - 'Found version 2.0.0 for . in .release-please-manifest.json at abc123 of main', + 'Found version 1.2.3 for node/pkg2 in .release-please-manifest.json at abc123 of main', CheckpointType.Success, ], + ['Processing package: Node(googleapis)', CheckpointType.Success], ['Processing package: Node(@node/pkg1)', CheckpointType.Success], ['Processing package: Node(@node/pkg2)', CheckpointType.Success], - ['Processing package: Node(googleapis)', CheckpointType.Success], ]); });