monorepo-next 8.1.0 → 8.3.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
@@ -4,6 +4,15 @@
4
4
 
5
5
  Detach monorepo packages from normal linking. Work on breaking changes while gradually updating consumers.
6
6
 
7
+ Each package can have a `monorepo-next.config.js` with the following options:
8
+
9
+ ```js
10
+ module.exports = {
11
+ // Set this to false to opt-out of change detection and versioning.
12
+ shouldBumpVersion: true,
13
+ }
14
+ ```
15
+
7
16
  <!-- CODEGEN_CLI_HELP -->
8
17
 
9
18
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monorepo-next",
3
- "version": "8.1.0",
3
+ "version": "8.3.0",
4
4
  "description": "Detach monorepo packages from normal linking",
5
5
  "bin": {
6
6
  "next": "bin/next.js"
@@ -12,6 +12,7 @@ const { collectPackages } = require('./build-dep-graph');
12
12
  const minimatch = require('minimatch');
13
13
  const { getChangedReleasableFiles } = require('./releasable');
14
14
  const Set = require('superset');
15
+ const { loadPackageConfig } = require('./config');
15
16
 
16
17
  async function getPackageChangedFiles({
17
18
  fromCommit,
@@ -76,6 +77,12 @@ async function buildChangeGraph({
76
77
  continue;
77
78
  }
78
79
 
80
+ let nextConfig = loadPackageConfig(_package.cwd);
81
+
82
+ if (!nextConfig.shouldBumpVersion) {
83
+ continue;
84
+ }
85
+
79
86
  let _fromCommit;
80
87
  if (fromCommit) {
81
88
  _fromCommit = fromCommit;
@@ -10,6 +10,7 @@ const { trackNewVersion } = require('./version');
10
10
  const semver = require('semver');
11
11
  const dependencyTypes = require('./dependency-types');
12
12
  const { isCycle } = require('./build-dag');
13
+ const { loadPackageConfig } = require('./config');
13
14
 
14
15
  const defaultReleaseType = 'patch';
15
16
 
@@ -139,6 +140,12 @@ async function secondPass({
139
140
 
140
141
  visitedNodes.add(dag.node.packageName);
141
142
 
143
+ let nextConfig = loadPackageConfig(dag.node.cwd);
144
+
145
+ if (!nextConfig.shouldBumpVersion) {
146
+ return;
147
+ }
148
+
142
149
  let doesPackageHaveChanges = !!releaseTrees[dag.node.packageName];
143
150
  if (!doesPackageHaveChanges) {
144
151
  let isDevDep = dag.dependencyType === 'devDependencies';
@@ -182,8 +189,6 @@ function thirdPass({
182
189
  shouldInheritGreaterReleaseType,
183
190
  shouldExcludeDevChanges,
184
191
  }) {
185
- let visitedNodes = new Set();
186
-
187
192
  for (let { dag, changedReleasableFiles } of packagesWithChanges) {
188
193
  if (!changedReleasableFiles.length) {
189
194
  continue;
@@ -193,12 +198,6 @@ function thirdPass({
193
198
  dag,
194
199
  parent,
195
200
  }) {
196
- if (visitedNodes.has(dag.node.packageName)) {
197
- // return;
198
- }
199
-
200
- visitedNodes.add(dag.node.packageName);
201
-
202
201
  let current = releaseTrees[dag.node.packageName];
203
202
 
204
203
  if (!current) {
@@ -242,8 +241,6 @@ function fourthPass({
242
241
  packagesWithChanges,
243
242
  shouldBumpInRangeDependencies,
244
243
  }) {
245
- let visitedNodes = new Set();
246
-
247
244
  for (let { dag, changedReleasableFiles } of packagesWithChanges) {
248
245
  if (!changedReleasableFiles.length) {
249
246
  continue;
@@ -253,12 +250,6 @@ function fourthPass({
253
250
  dag,
254
251
  parent,
255
252
  }) {
256
- if (visitedNodes.has(dag.node.packageName)) {
257
- // return;
258
- }
259
-
260
- visitedNodes.add(dag.node.packageName);
261
-
262
253
  let current = releaseTrees[dag.node.packageName];
263
254
 
264
255
  if (!current) {
package/src/config.js ADDED
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+
5
+ function loadPackageConfig(cwd) {
6
+ let nextConfig;
7
+
8
+ try {
9
+ nextConfig = require(path.join(cwd, 'monorepo-next.config.js'));
10
+ } catch (err) {
11
+ if (err.code !== 'MODULE_NOT_FOUND') {
12
+ throw err;
13
+ }
14
+
15
+ nextConfig = {};
16
+ }
17
+
18
+ return {
19
+ shouldBumpVersion: true,
20
+ ...nextConfig,
21
+ };
22
+ }
23
+
24
+ module.exports = {
25
+ loadPackageConfig,
26
+ };