diff --git a/src/plugins/node-workspace.ts b/src/plugins/node-workspace.ts index 1e12698b0..713f5ecb1 100644 --- a/src/plugins/node-workspace.ts +++ b/src/plugins/node-workspace.ts @@ -67,7 +67,7 @@ interface NodeWorkspaceOptions extends WorkspacePluginOptions { * into a single node package. */ export class NodeWorkspace extends WorkspacePlugin { - private alwaysLinkLocal: boolean; + readonly alwaysLinkLocal: boolean; private packageGraph?: PackageGraph; constructor( github: GitHub, diff --git a/test/fixtures/manifest/config/node-workspace-plugins-deprecated.json b/test/fixtures/manifest/config/node-workspace-plugins-deprecated.json new file mode 100644 index 000000000..4d48afd4d --- /dev/null +++ b/test/fixtures/manifest/config/node-workspace-plugins-deprecated.json @@ -0,0 +1,20 @@ +{ + "release-type": "node", + "always-link-local": false, + "plugins": [ + { + "type": "node-workspace" + } + ], + "packages": { + "pkg1": { + "component": "pkg1" + }, + "pkg2": { + "component": "pkg2" + }, + "pkg3": { + "component": "pkg3" + } + } +} diff --git a/test/fixtures/manifest/config/node-workspace-plugins.json b/test/fixtures/manifest/config/node-workspace-plugins.json new file mode 100644 index 000000000..fc07278d3 --- /dev/null +++ b/test/fixtures/manifest/config/node-workspace-plugins.json @@ -0,0 +1,20 @@ +{ + "release-type": "node", + "plugins": [ + { + "type": "node-workspace", + "alwaysLinkLocal": false + } + ], + "packages": { + "pkg1": { + "component": "pkg1" + }, + "pkg2": { + "component": "pkg2" + }, + "pkg3": { + "component": "pkg3" + } + } +} diff --git a/test/manifest.ts b/test/manifest.ts index f43115d0b..cf5722da0 100644 --- a/test/manifest.ts +++ b/test/manifest.ts @@ -619,6 +619,64 @@ describe('Manifest', () => { const plugin = manifest.plugins[0] as MavenWorkspace; expect(plugin.considerAllArtifacts).to.be.true; }); + it('should build node-workspace from manifest', async () => { + const getFileContentsStub = sandbox.stub( + github, + 'getFileContentsOnBranch' + ); + getFileContentsStub + .withArgs('release-please-config.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/config/node-workspace-plugins.json' + ) + ) + .withArgs('.release-please-manifest.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/versions/versions.json' + ) + ); + const manifest = await Manifest.fromManifest( + github, + github.repository.defaultBranch + ); + expect(manifest.plugins).lengthOf(1); + expect(manifest.plugins[0]).instanceOf(NodeWorkspace); + const plugin = manifest.plugins[0] as NodeWorkspace; + expect(plugin.alwaysLinkLocal).to.be.false; + }); + it('should build node-workspace from manifest with deprecated always-link-local', async () => { + const getFileContentsStub = sandbox.stub( + github, + 'getFileContentsOnBranch' + ); + getFileContentsStub + .withArgs('release-please-config.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/config/node-workspace-plugins-deprecated.json' + ) + ) + .withArgs('.release-please-manifest.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/versions/versions.json' + ) + ); + const manifest = await Manifest.fromManifest( + github, + github.repository.defaultBranch + ); + expect(manifest.plugins).lengthOf(1); + expect(manifest.plugins[0]).instanceOf(NodeWorkspace); + const plugin = manifest.plugins[0] as NodeWorkspace; + expect(plugin.alwaysLinkLocal).to.be.false; + }); it('should configure search depth from manifest', async () => { const getFileContentsStub = sandbox.stub( github,