monorepo-next 12.3.0 → 12.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monorepo-next",
3
- "version": "12.3.0",
3
+ "version": "12.4.0",
4
4
  "description": "Detach monorepo packages from normal linking",
5
5
  "bin": {
6
6
  "next": "bin/next.js"
package/src/fs.js CHANGED
@@ -63,10 +63,28 @@ async function ensureWriteFile(path, data) {
63
63
  await fs.writeFile(path, data);
64
64
  }
65
65
 
66
+ /**
67
+ * @param {string} path
68
+ */
69
+ async function exists(path) {
70
+ try {
71
+ await fs.access(path, fs.constants.F_OK);
72
+
73
+ return true;
74
+ } catch (err) {
75
+ if (err.code !== 'ENOENT') {
76
+ throw err;
77
+ }
78
+
79
+ return false;
80
+ }
81
+ }
82
+
66
83
  module.exports = {
67
84
  replaceFile,
68
85
  replaceJsonFile,
69
86
  safeReadFile,
70
87
  ensureDir,
71
88
  ensureWriteFile,
89
+ exists,
72
90
  };
package/src/release.js CHANGED
@@ -19,6 +19,9 @@ const semver = require('semver');
19
19
  const { builder } = require('../bin/commands/release');
20
20
  const debug = require('./debug');
21
21
  const { createAsyncLogger } = require('./log');
22
+ const {
23
+ exists: fsExists,
24
+ } = require('./fs');
22
25
 
23
26
  async function release({
24
27
  cwd = process.cwd(),
@@ -179,6 +182,10 @@ async function release({
179
182
 
180
183
  let commitMessage = `chore(release): ${tags.join()}`;
181
184
 
185
+ if (await fsExists(path.join(workspaceCwd, 'pnpm-lock.yaml'))) {
186
+ await module.exports.updatePnpmLockfile({ cwd: workspaceCwd, silent, dryRun });
187
+ }
188
+
182
189
  if (!dryRun) {
183
190
  await execa('git', ['add', '-A'], { cwd: workspaceCwd, silent: true });
184
191
  }
@@ -305,4 +312,11 @@ async function publish({ cwd, silent, distTag, dryRun }) {
305
312
  await execa('npm', ['publish', '--tag', distTag, ...dryRunArgs], { cwd, silent });
306
313
  }
307
314
 
315
+ async function updatePnpmLockfile({ cwd, silent, dryRun }) {
316
+ await execa('pnpm', ['install', '--lockfile-only'], { cwd, silent, dryRun });
317
+ }
318
+
308
319
  module.exports = release;
320
+ module.exports = Object.assign(release, {
321
+ updatePnpmLockfile,
322
+ });