monorepo-next 10.1.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/release.js +13 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monorepo-next",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "Detach monorepo packages from normal linking",
5
5
  "bin": {
6
6
  "next": "bin/next.js"
package/src/release.js CHANGED
@@ -198,11 +198,7 @@ async function release({
198
198
  await handleLifecycleScript('posttag');
199
199
 
200
200
  async function originalPush() {
201
- if (dryRun) {
202
- _log('push');
203
- } else {
204
- await push({ cwd: workspaceCwd });
205
- }
201
+ await push({ cwd: workspaceCwd, silent, dryRun });
206
202
  }
207
203
 
208
204
  if (shouldPush) {
@@ -240,11 +236,7 @@ async function release({
240
236
  if (shouldPublish && _shouldPublish) {
241
237
  // eslint-disable-next-line no-inner-declarations
242
238
  async function originalPublish() {
243
- if (dryRun) {
244
- _log('publish');
245
- } else {
246
- await publish({ cwd });
247
- }
239
+ await publish({ cwd, silent, dryRun });
248
240
  }
249
241
 
250
242
  if (publishOverride) {
@@ -268,8 +260,10 @@ async function release({
268
260
  }
269
261
  }
270
262
 
271
- async function push({ cwd }) {
272
- let remoteUrl = (await execa('git', ['config', '--get', 'remote.origin.url'], { cwd })).stdout;
263
+ async function push({ cwd, silent, dryRun }) {
264
+ let remoteUrl = (await execa('git', ['config', '--get', 'remote.origin.url'], { cwd, silent: true })).stdout;
265
+
266
+ let dryRunArgs = dryRun ? ['--dry-run'] : [];
273
267
 
274
268
  // https://stackoverflow.com/a/55586434
275
269
  let doesntSupportAtomic = remoteUrl.includes('https://');
@@ -278,9 +272,9 @@ async function push({ cwd }) {
278
272
 
279
273
  try {
280
274
  if (doesntSupportAtomic) {
281
- await execa('git', ['push'], { cwd });
275
+ await execa('git', ['push', ...dryRunArgs], { cwd, silent });
282
276
  } else {
283
- await execa('git', ['push', '--follow-tags', '--atomic'], { cwd });
277
+ await execa('git', ['push', '--follow-tags', '--atomic', ...dryRunArgs], { cwd, silent });
284
278
  }
285
279
 
286
280
  success = true;
@@ -296,12 +290,14 @@ async function push({ cwd }) {
296
290
  if (doesntSupportAtomic && success) {
297
291
  // only push tags after the commit
298
292
  // and hard error if there is a tag collision
299
- await execa('git', ['push', '--follow-tags'], { cwd });
293
+ await execa('git', ['push', '--follow-tags', ...dryRunArgs], { cwd, silent });
300
294
  }
301
295
  }
302
296
 
303
- async function publish({ cwd }) {
304
- await execa('npm', ['publish'], { cwd });
297
+ async function publish({ cwd, silent, dryRun }) {
298
+ let dryRunArgs = dryRun ? ['--dry-run'] : [];
299
+
300
+ await execa('npm', ['publish', ...dryRunArgs], { cwd, silent });
305
301
  }
306
302
 
307
303
  module.exports = release;