monorepo-next 8.2.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.2.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';
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
+ };