monorepo-next 12.4.0 → 12.5.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/README.md CHANGED
@@ -10,6 +10,12 @@ Each package can have a `monorepo-next.config.js` with the following options:
10
10
  module.exports = {
11
11
  // Set this to false to opt-out of change detection and versioning.
12
12
  shouldBumpVersion: true,
13
+
14
+ // If your package has a build step, your package.json/files array
15
+ // will be a git-ignored dir, so we can't use that. Use this to
16
+ // allow us to still find changes to your package. This appends
17
+ // to your existing NPM tracked files.
18
+ changeTrackingFiles: ['src'],
13
19
  }
14
20
  ```
15
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monorepo-next",
3
- "version": "12.4.0",
3
+ "version": "12.5.0",
4
4
  "description": "Detach monorepo packages from normal linking",
5
5
  "bin": {
6
6
  "next": "bin/next.js"
@@ -212,6 +212,7 @@ async function buildChangeGraph({
212
212
  workspacesCwd: workspaceMeta.cwd,
213
213
  shouldExcludeDevChanges,
214
214
  fromCommit: _fromCommit,
215
+ nextConfig,
215
216
  });
216
217
 
217
218
  if (shouldOnlyIncludeReleasable && !changedReleasableFiles.length) {
package/src/releasable.js CHANGED
@@ -111,7 +111,10 @@ async function prepareTmpPackage({
111
111
  async function _getChangedReleasableFiles({
112
112
  cwd,
113
113
  changedFiles,
114
+ nextConfig = {},
114
115
  }) {
116
+ const { minimatch } = await import('minimatch');
117
+
115
118
  let tmpDir = await createTmpDir();
116
119
 
117
120
  // This is all because `npm-packlist`/`ignore-walk`
@@ -128,22 +131,16 @@ async function _getChangedReleasableFiles({
128
131
 
129
132
  let changedPublishedFilesOld = new Set(changedPublishedFiles);
130
133
 
131
- let changedPublishedFilesNew = new Set();
132
-
133
134
  for (let file of changedFiles) {
134
- if (changedPublishedFilesOld.has(file)) {
135
- changedPublishedFilesNew.add(file);
135
+ if (nextConfig.changeTrackingFiles?.some(glob => minimatch(file, glob, { dot: true }))) {
136
+ changedPublishedFilesOld.add(file);
136
137
  }
138
+ }
137
139
 
140
+ let changedPublishedFilesNew = changedPublishedFilesOld
138
141
  // these files may not show up in the bundle, but
139
142
  // contribute to what goes in the bundle, so we must preserve
140
143
  // 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
144
  .union(filesContributingToReleasability)
148
145
  .intersect(changedFiles);
149
146
 
@@ -176,6 +173,7 @@ async function getChangedReleasableFiles({
176
173
  workspacesCwd,
177
174
  shouldExcludeDevChanges,
178
175
  fromCommit,
176
+ nextConfig,
179
177
  }) {
180
178
  changedFiles = new Set(changedFiles);
181
179
 
@@ -188,6 +186,7 @@ async function getChangedReleasableFiles({
188
186
  let changedPublishedFiles = await _getChangedReleasableFiles({
189
187
  cwd: packageCwd,
190
188
  changedFiles: changedFiles.map(file => path.relative(packageCwd, path.join(workspacesCwd, file))),
189
+ nextConfig,
191
190
  });
192
191
 
193
192
  let relative = path.relative(workspacesCwd, packageCwd);