monorepo-next 12.3.0 → 12.4.1

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.1",
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/releasable.js CHANGED
@@ -128,22 +128,10 @@ async function _getChangedReleasableFiles({
128
128
 
129
129
  let changedPublishedFilesOld = new Set(changedPublishedFiles);
130
130
 
131
- let changedPublishedFilesNew = new Set();
132
-
133
- for (let file of changedFiles) {
134
- if (changedPublishedFilesOld.has(file)) {
135
- changedPublishedFilesNew.add(file);
136
- }
137
-
131
+ let changedPublishedFilesNew = changedPublishedFilesOld
138
132
  // these files may not show up in the bundle, but
139
133
  // contribute to what goes in the bundle, so we must preserve
140
134
  // the changed status to know if the package is invalidated or not
141
- if (filesContributingToReleasability.has(file)) {
142
- changedPublishedFilesNew.add(file);
143
- }
144
- }
145
-
146
- changedPublishedFilesNew = changedPublishedFilesOld
147
135
  .union(filesContributingToReleasability)
148
136
  .intersect(changedFiles);
149
137
 
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
+ });