Skip to content

Commit d17b88f

Browse files
committed
use different release path
1 parent 48f5a92 commit d17b88f

File tree

7 files changed

+74
-61
lines changed

7 files changed

+74
-61
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export { bumpAuxiliaryPackages } from './bump';
2-
export { publishNpmPackages } from './publish';
2+
export { publishToNpm } from './publish';

packages/build/src/npm-packages/publish.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { expect } from 'chai';
22
import path from 'path';
33
import type { SinonStub } from 'sinon';
44
import sinon from 'sinon';
5-
import { publishNpmPackages } from './publish';
5+
import { publishToNpm } from './publish';
66

7-
describe('npm-packages publishNpmPackages', function () {
7+
describe('npm-packages publishToNpm', function () {
88
let listNpmPackages: SinonStub;
99
let markBumpedFilesAsAssumeUnchanged: SinonStub;
1010
let spawnSync: SinonStub;
@@ -30,7 +30,7 @@ describe('npm-packages publishNpmPackages', function () {
3030
listNpmPackages.returns(packages);
3131

3232
expect(() =>
33-
publishNpmPackages(
33+
publishToNpm(
3434
{ isDryRun: false, useAuxiliaryPackagesOnly: false },
3535
listNpmPackages,
3636
markBumpedFilesAsAssumeUnchanged,
@@ -46,7 +46,7 @@ describe('npm-packages publishNpmPackages', function () {
4646
];
4747
listNpmPackages.returns(packages);
4848

49-
publishNpmPackages(
49+
publishToNpm(
5050
{ isDryRun: false, useAuxiliaryPackagesOnly: false },
5151
listNpmPackages,
5252
markBumpedFilesAsAssumeUnchanged,
@@ -64,7 +64,7 @@ describe('npm-packages publishNpmPackages', function () {
6464
];
6565
listNpmPackages.returns(packages);
6666

67-
publishNpmPackages(
67+
publishToNpm(
6868
{ isDryRun: false, useAuxiliaryPackagesOnly: true },
6969
listNpmPackages,
7070
markBumpedFilesAsAssumeUnchanged,
@@ -88,7 +88,7 @@ describe('npm-packages publishNpmPackages', function () {
8888
];
8989
listNpmPackages.returns(packages);
9090

91-
publishNpmPackages(
91+
publishToNpm(
9292
{ isDryRun: false, useAuxiliaryPackagesOnly: false },
9393
listNpmPackages,
9494
markBumpedFilesAsAssumeUnchanged,
@@ -124,7 +124,7 @@ describe('npm-packages publishNpmPackages', function () {
124124
spawnSync.throws(new Error('meeep'));
125125

126126
try {
127-
publishNpmPackages(
127+
publishToNpm(
128128
{ isDryRun: false, useAuxiliaryPackagesOnly: false },
129129
listNpmPackages,
130130
markBumpedFilesAsAssumeUnchanged,

packages/build/src/npm-packages/publish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { listNpmPackages as listNpmPackagesFn } from './list';
1010
import { spawnSync as spawnSyncFn } from '../helpers/spawn-sync';
1111
import type { SpawnSyncOptionsWithStringEncoding } from 'child_process';
1212

13-
export function publishNpmPackages(
13+
export function publishToNpm(
1414
{ isDryRun = false, useAuxiliaryPackagesOnly = false },
1515
listNpmPackages: typeof listNpmPackagesFn = listNpmPackagesFn,
1616
markBumpedFilesAsAssumeUnchangedFn: typeof markBumpedFilesAsAssumeUnchanged = markBumpedFilesAsAssumeUnchanged,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Config } from './config';
2+
import { publishToNpm } from './npm-packages';
3+
4+
export function publishAuxiliaryPackages(config: Config) {
5+
if (!config.useAuxiliaryPackagesOnly) {
6+
throw new Error(
7+
'This should only be used when publishing auxiliary packages'
8+
);
9+
}
10+
publishToNpm(config);
11+
}

packages/build/src/run-publish.spec.ts renamed to packages/build/src/publish-mongosh.spec.ts

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import type {
99
import type { createAndPublishDownloadCenterConfig as createAndPublishDownloadCenterConfigFn } from './download-center';
1010
import { GithubRepo } from '@mongodb-js/devtools-github-repo';
1111
import type { publishToHomebrew as publishToHomebrewType } from './homebrew';
12-
import type { publishNpmPackages as publishNpmPackagesType } from './npm-packages';
13-
import { runPublish } from './run-publish';
12+
import type { publishToNpm as publishToNpmType } from './npm-packages';
13+
import { publishMongosh } from './publish-mongosh';
1414
import { dummyConfig } from '../test/helpers';
1515

1616
chai.use(require('sinon-chai'));
@@ -26,10 +26,10 @@ function createStubBarque(overrides?: any): Barque {
2626
return sinon.createStubInstance(Barque, overrides) as unknown as Barque;
2727
}
2828

29-
describe('publish', function () {
29+
describe('publishMongosh', function () {
3030
let config: Config;
3131
let createAndPublishDownloadCenterConfig: typeof createAndPublishDownloadCenterConfigFn;
32-
let publishNpmPackages: typeof publishNpmPackagesType;
32+
let publishToNpm: typeof publishToNpmType;
3333
let writeBuildInfo: typeof writeBuildInfoType;
3434
let publishToHomebrew: typeof publishToHomebrewType;
3535
let shouldDoPublicRelease: typeof shouldDoPublicReleaseFn;
@@ -42,7 +42,7 @@ describe('publish', function () {
4242
config = { ...dummyConfig };
4343

4444
createAndPublishDownloadCenterConfig = sinon.spy();
45-
publishNpmPackages = sinon.spy();
45+
publishToNpm = sinon.spy();
4646
writeBuildInfo = sinon.spy();
4747
publishToHomebrew = sinon.spy();
4848
shouldDoPublicRelease = sinon.spy();
@@ -78,14 +78,14 @@ describe('publish', function () {
7878
getMostRecentDraftTagForRelease: sinon.stub().resolves(undefined),
7979
});
8080
try {
81-
await runPublish(
81+
await publishMongosh(
8282
config,
8383
githubRepo,
8484
mongoHomebrewCoreForkRepo,
8585
homebrewCoreRepo,
8686
barque,
8787
createAndPublishDownloadCenterConfig,
88-
publishNpmPackages,
88+
publishToNpm,
8989
writeBuildInfo,
9090
publishToHomebrew,
9191
shouldDoPublicRelease
@@ -103,14 +103,14 @@ describe('publish', function () {
103103
.resolves({ name: 'v0.7.0-draft.42', sha: 'wrong' }),
104104
});
105105
try {
106-
await runPublish(
106+
await publishMongosh(
107107
config,
108108
githubRepo,
109109
mongoHomebrewCoreForkRepo,
110110
homebrewCoreRepo,
111111
barque,
112112
createAndPublishDownloadCenterConfig,
113-
publishNpmPackages,
113+
publishToNpm,
114114
writeBuildInfo,
115115
publishToHomebrew,
116116
shouldDoPublicRelease
@@ -123,14 +123,14 @@ describe('publish', function () {
123123
});
124124

125125
it('publishes artifacts to barque', async function () {
126-
await runPublish(
126+
await publishMongosh(
127127
config,
128128
githubRepo,
129129
mongoHomebrewCoreForkRepo,
130130
homebrewCoreRepo,
131131
barque,
132132
createAndPublishDownloadCenterConfig,
133-
publishNpmPackages,
133+
publishToNpm,
134134
writeBuildInfo,
135135
publishToHomebrew,
136136
shouldDoPublicRelease
@@ -153,14 +153,14 @@ describe('publish', function () {
153153
});
154154

155155
it('updates the download center config', async function () {
156-
await runPublish(
156+
await publishMongosh(
157157
config,
158158
githubRepo,
159159
mongoHomebrewCoreForkRepo,
160160
homebrewCoreRepo,
161161
barque,
162162
createAndPublishDownloadCenterConfig,
163-
publishNpmPackages,
163+
publishToNpm,
164164
writeBuildInfo,
165165
publishToHomebrew,
166166
shouldDoPublicRelease
@@ -175,14 +175,14 @@ describe('publish', function () {
175175
});
176176

177177
it('promotes the release in github', async function () {
178-
await runPublish(
178+
await publishMongosh(
179179
config,
180180
githubRepo,
181181
mongoHomebrewCoreForkRepo,
182182
homebrewCoreRepo,
183183
barque,
184184
createAndPublishDownloadCenterConfig,
185-
publishNpmPackages,
185+
publishToNpm,
186186
writeBuildInfo,
187187
publishToHomebrew,
188188
shouldDoPublicRelease
@@ -192,34 +192,32 @@ describe('publish', function () {
192192
});
193193

194194
it('writes analytics config and then publishes NPM packages', async function () {
195-
await runPublish(
195+
await publishMongosh(
196196
config,
197197
githubRepo,
198198
mongoHomebrewCoreForkRepo,
199199
homebrewCoreRepo,
200200
barque,
201201
createAndPublishDownloadCenterConfig,
202-
publishNpmPackages,
202+
publishToNpm,
203203
writeBuildInfo,
204204
publishToHomebrew,
205205
shouldDoPublicRelease
206206
);
207207

208208
expect(writeBuildInfo).to.have.been.calledOnceWith(config);
209-
expect(publishNpmPackages).to.have.been.calledWith();
210-
expect(publishNpmPackages).to.have.been.calledAfter(
211-
writeBuildInfo as any
212-
);
209+
expect(publishToNpm).to.have.been.calledWith();
210+
expect(publishToNpm).to.have.been.calledAfter(writeBuildInfo as any);
213211
});
214212
it('publishes to homebrew', async function () {
215-
await runPublish(
213+
await publishMongosh(
216214
config,
217215
githubRepo,
218216
mongoHomebrewCoreForkRepo,
219217
homebrewCoreRepo,
220218
barque,
221219
createAndPublishDownloadCenterConfig,
222-
publishNpmPackages,
220+
publishToNpm,
223221
writeBuildInfo,
224222
publishToHomebrew,
225223
shouldDoPublicRelease
@@ -242,14 +240,14 @@ describe('publish', function () {
242240
});
243241

244242
it('does not update the download center config', async function () {
245-
await runPublish(
243+
await publishMongosh(
246244
config,
247245
githubRepo,
248246
mongoHomebrewCoreForkRepo,
249247
homebrewCoreRepo,
250248
barque,
251249
createAndPublishDownloadCenterConfig,
252-
publishNpmPackages,
250+
publishToNpm,
253251
writeBuildInfo,
254252
publishToHomebrew,
255253
shouldDoPublicRelease
@@ -259,14 +257,14 @@ describe('publish', function () {
259257
});
260258

261259
it('does not promote the release in github', async function () {
262-
await runPublish(
260+
await publishMongosh(
263261
config,
264262
githubRepo,
265263
mongoHomebrewCoreForkRepo,
266264
homebrewCoreRepo,
267265
barque,
268266
createAndPublishDownloadCenterConfig,
269-
publishNpmPackages,
267+
publishToNpm,
270268
writeBuildInfo,
271269
publishToHomebrew,
272270
shouldDoPublicRelease
@@ -276,31 +274,31 @@ describe('publish', function () {
276274
});
277275

278276
it('does not publish npm packages', async function () {
279-
await runPublish(
277+
await publishMongosh(
280278
config,
281279
githubRepo,
282280
mongoHomebrewCoreForkRepo,
283281
homebrewCoreRepo,
284282
barque,
285283
createAndPublishDownloadCenterConfig,
286-
publishNpmPackages,
284+
publishToNpm,
287285
writeBuildInfo,
288286
publishToHomebrew,
289287
shouldDoPublicRelease
290288
);
291289

292-
expect(publishNpmPackages).not.to.have.been.called;
290+
expect(publishToNpm).not.to.have.been.called;
293291
});
294292

295293
it('does not publish to homebrew', async function () {
296-
await runPublish(
294+
await publishMongosh(
297295
config,
298296
githubRepo,
299297
mongoHomebrewCoreForkRepo,
300298
homebrewCoreRepo,
301299
barque,
302300
createAndPublishDownloadCenterConfig,
303-
publishNpmPackages,
301+
publishToNpm,
304302
writeBuildInfo,
305303
publishToHomebrew,
306304
shouldDoPublicRelease
@@ -310,14 +308,14 @@ describe('publish', function () {
310308
});
311309

312310
it('does not release to barque', async function () {
313-
await runPublish(
311+
await publishMongosh(
314312
config,
315313
githubRepo,
316314
mongoHomebrewCoreForkRepo,
317315
homebrewCoreRepo,
318316
barque,
319317
createAndPublishDownloadCenterConfig,
320-
publishNpmPackages,
318+
publishToNpm,
321319
writeBuildInfo,
322320
publishToHomebrew,
323321
shouldDoPublicRelease

packages/build/src/run-publish.ts renamed to packages/build/src/publish-mongosh.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ import type { createAndPublishDownloadCenterConfig as createAndPublishDownloadCe
1010
import { getArtifactUrl as getArtifactUrlFn } from './evergreen';
1111
import type { GithubRepo } from '@mongodb-js/devtools-github-repo';
1212
import type { publishToHomebrew as publishToHomebrewType } from './homebrew';
13-
import type { publishNpmPackages as publishNpmPackagesType } from './npm-packages';
13+
import type { publishToNpm as publishToNpmType } from './npm-packages';
1414
import type { PackageInformationProvider } from './packaging';
1515
import { getPackageFile } from './packaging';
1616

17-
export async function runPublish(
17+
export async function publishMongosh(
1818
config: Config,
1919
mongoshGithubRepo: GithubRepo,
2020
mongodbHomebrewForkGithubRepo: GithubRepo,
2121
homebrewCoreGithubRepo: GithubRepo,
2222
barque: Barque,
2323
createAndPublishDownloadCenterConfig: typeof createAndPublishDownloadCenterConfigFn,
24-
publishNpmPackages: typeof publishNpmPackagesType,
24+
publishToNpm: typeof publishToNpmType,
2525
writeBuildInfo: typeof writeBuildInfoType,
2626
publishToHomebrew: typeof publishToHomebrewType,
2727
shouldDoPublicRelease: typeof shouldDoPublicReleaseFn = shouldDoPublicReleaseFn,
@@ -81,7 +81,7 @@ export async function runPublish(
8181
// ensures the segment api key to be present in the published packages
8282
await writeBuildInfo(config, 'packaged');
8383

84-
publishNpmPackages({
84+
publishToNpm({
8585
isDryRun: config.isDryRun,
8686
useAuxiliaryPackagesOnly: config.useAuxiliaryPackagesOnly,
8787
});

0 commit comments

Comments
 (0)