monorepo-next 12.4.1 → 12.5.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/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.1",
3
+ "version": "12.5.1",
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,6 +131,12 @@ async function _getChangedReleasableFiles({
128
131
 
129
132
  let changedPublishedFilesOld = new Set(changedPublishedFiles);
130
133
 
134
+ for (let file of changedFiles) {
135
+ if (nextConfig.changeTrackingFiles?.some(glob => minimatch(file, glob, { dot: true }))) {
136
+ changedPublishedFilesOld.add(file);
137
+ }
138
+ }
139
+
131
140
  let changedPublishedFilesNew = changedPublishedFilesOld
132
141
  // these files may not show up in the bundle, but
133
142
  // contribute to what goes in the bundle, so we must preserve
@@ -164,6 +173,7 @@ async function getChangedReleasableFiles({
164
173
  workspacesCwd,
165
174
  shouldExcludeDevChanges,
166
175
  fromCommit,
176
+ nextConfig,
167
177
  }) {
168
178
  changedFiles = new Set(changedFiles);
169
179
 
@@ -176,6 +186,7 @@ async function getChangedReleasableFiles({
176
186
  let changedPublishedFiles = await _getChangedReleasableFiles({
177
187
  cwd: packageCwd,
178
188
  changedFiles: changedFiles.map(file => path.relative(packageCwd, path.join(workspacesCwd, file))),
189
+ nextConfig,
179
190
  });
180
191
 
181
192
  let relative = path.relative(workspacesCwd, packageCwd);
package/src/version.js CHANGED
@@ -18,14 +18,8 @@ function trackNewVersion({
18
18
  // https://github.com/npm/node-semver/commit/bcab95a966413b978dc1e7bdbcb8f495b63303cd
19
19
  range.set[0][0].operator
20
20
  ) {
21
- let hint = range.raw[0];
22
-
23
- if (hint !== '^' && hint !== '~') {
24
- hint = '~';
25
- }
26
-
27
21
  // This behaviour can probably be removed in the next major.
28
- newRange = `${hint}${newVersion}`;
22
+ newRange = `~${newVersion}`;
29
23
  } else if (
30
24
  // NOTE: wildcard range is empty string
31
25
  // SEE: https://github.com/npm/node-semver/blob/bcab95a966413b978dc1e7bdbcb8f495b63303cd/test/ranges/to-comparators.js#L10-L12