monorepo-next 12.1.1 → 12.2.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
@@ -115,33 +115,37 @@ next release
115
115
  release all packages as needed
116
116
 
117
117
  Options:
118
- --help Show help [boolean]
119
- --version Show version number [boolean]
120
- --silent Don't print logs and errors
118
+ --help Show help [boolean]
119
+ --version Show version number [boolean]
120
+ --silent Don't print logs and errors
121
121
  [boolean] [default: false]
122
- --dry-run log to console instead of modifying files
122
+ --dry-run log to console instead of modifying files
123
123
  [boolean] [default: false]
124
- --push git push + tags when done
124
+ --push git push + tags when done
125
125
  [boolean] [default: true]
126
- --publish npm publish when done[boolean] [default: true]
127
- --dist-tag publish to a different NPM dist-tag
126
+ --publish npm publish when done
127
+ [boolean] [default: true]
128
+ --dist-tag publish to a different NPM dist-tag
128
129
  [string] [default: "latest"]
129
- --bump-in-range-dependencies If a dependency is still in range, and nothing
130
- changed in my package, still bump my version
131
- and the dependency version.
130
+ --bump-in-range-dependencies If a dependency is still in range, and
131
+ nothing changed in my package, still bump my
132
+ version and the dependency version.
132
133
  [boolean] [default: true]
133
- --inherit-greater-release-type If a dependency has a greater release type,
134
- bump my package the with the same release
135
- type. [boolean] [default: false]
136
- --exclude-dev-changes If a change doesn't affect consumers, like a
137
- monorepo dev dep change or manually bumping an
138
- external dev dep, don't count it towards a
139
- package change. [boolean] [default: false]
140
- --clean-up-after-failed-push If there's already a new commit on the remote,
141
- clean up the commit and tags that won't be
142
- used [boolean] [default: false]
143
- --scripts Provide scripts to execute for lifecycle
144
- events (prebump, precommit, etc.,)
134
+ --inherit-greater-release-type If a dependency has a greater release type,
135
+ bump my package the with the same release
136
+ type. [boolean] [default: false]
137
+ --exclude-dev-changes If a change doesn't affect consumers, like a
138
+ monorepo dev dep change or manually bumping
139
+ an external dev dep, don't count it towards
140
+ a package change. [boolean] [default: false]
141
+ --validate-dependency-visibility Prevent releasing public packages that
142
+ depend on private packages.
143
+ [boolean] [default: false]
144
+ --clean-up-after-failed-push If there's already a new commit on the
145
+ remote, clean up the commit and tags that
146
+ won't be used [boolean] [default: false]
147
+ --scripts Provide scripts to execute for lifecycle
148
+ events (prebump, precommit, etc.,)
145
149
  [default: {}]
146
150
  --package-files
147
151
  [array] [default: ["package.json","bower.json","manifest.json"]]
@@ -37,6 +37,11 @@ module.exports = {
37
37
  default: false,
38
38
  },
39
39
  'exclude-dev-changes': commonArgs['exclude-dev-changes'],
40
+ 'validate-dependency-visibility': {
41
+ describe: 'Prevent releasing public packages that depend on private packages.',
42
+ type: 'boolean',
43
+ default: false,
44
+ },
40
45
  'clean-up-after-failed-push': {
41
46
  describe: 'If there\'s already a new commit on the remote, clean up the commit and tags that won\'t be used',
42
47
  type: 'boolean',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monorepo-next",
3
- "version": "12.1.1",
3
+ "version": "12.2.1",
4
4
  "description": "Detach monorepo packages from normal linking",
5
5
  "bin": {
6
6
  "next": "bin/next.js"
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@npmcli/arborist": "^7.0.0",
63
- "commit-and-tag-version": "12.4.1",
63
+ "commit-and-tag-version": "12.5.0",
64
64
  "conventional-changelog": "5.1.0",
65
65
  "conventional-recommended-bump": "9.0.0",
66
66
  "debug": "^4.3.1",
@@ -133,6 +133,7 @@ async function secondPass({
133
133
  shouldBumpInRangeDependencies,
134
134
  shouldInheritGreaterReleaseType,
135
135
  shouldExcludeDevChanges,
136
+ shouldValidateDependencyVisibility,
136
137
  }) {
137
138
  function shouldInit({
138
139
  dag,
@@ -200,6 +201,15 @@ async function secondPass({
200
201
  continue;
201
202
  }
202
203
 
204
+ if (
205
+ shouldValidateDependencyVisibility &&
206
+ !dag.node.isPackage &&
207
+ group.node.isPackage &&
208
+ group.dependencyType === 'dependencies'
209
+ ) {
210
+ throw new Error(`Public package "${group.node.packageName}" has a dependency on the private package "${dag.node.packageName}".`);
211
+ }
212
+
203
213
  await crawlDag({
204
214
  dag: group,
205
215
  parent: releaseTrees[dag.node.packageName],
@@ -350,6 +360,7 @@ async function buildReleaseGraph({
350
360
  shouldBumpInRangeDependencies,
351
361
  shouldInheritGreaterReleaseType,
352
362
  shouldExcludeDevChanges,
363
+ shouldValidateDependencyVisibility,
353
364
  }) {
354
365
  let logSync = createSyncLogger(_debug);
355
366
  let logAsync = createAsyncLogger(_debug);
@@ -369,6 +380,7 @@ async function buildReleaseGraph({
369
380
  shouldBumpInRangeDependencies,
370
381
  shouldInheritGreaterReleaseType,
371
382
  shouldExcludeDevChanges,
383
+ shouldValidateDependencyVisibility,
372
384
  });
373
385
 
374
386
  // packages without changes, but need to be analyzed because of options
@@ -20,6 +20,7 @@ async function getChangelog({
20
20
  shouldBumpInRangeDependencies = builder['bump-in-range-dependencies'].default,
21
21
  shouldInheritGreaterReleaseType = builder['inherit-greater-release-type'].default,
22
22
  shouldExcludeDevChanges = builder['exclude-dev-changes'].default,
23
+ shouldValidateDependencyVisibility = builder['validate-dependency-visibility'].default,
23
24
  releaseCount = 1,
24
25
  fromCommit,
25
26
  cached,
@@ -48,6 +49,7 @@ async function getChangelog({
48
49
  shouldBumpInRangeDependencies,
49
50
  shouldInheritGreaterReleaseType,
50
51
  shouldExcludeDevChanges,
52
+ shouldValidateDependencyVisibility,
51
53
  });
52
54
 
53
55
  let releaseTree = releaseTrees.find(releaseTree => releaseTree.name === name);
@@ -15,6 +15,7 @@ async function getNewVersions({
15
15
  shouldBumpInRangeDependencies = builder['bump-in-range-dependencies'].default,
16
16
  shouldInheritGreaterReleaseType = builder['inherit-greater-release-type'].default,
17
17
  shouldExcludeDevChanges = builder['exclude-dev-changes'].default,
18
+ shouldValidateDependencyVisibility = builder['validate-dependency-visibility'].default,
18
19
  fromCommit,
19
20
  sinceBranch,
20
21
  cached,
@@ -36,6 +37,7 @@ async function getNewVersions({
36
37
  shouldBumpInRangeDependencies,
37
38
  shouldInheritGreaterReleaseType,
38
39
  shouldExcludeDevChanges,
40
+ shouldValidateDependencyVisibility,
39
41
  });
40
42
 
41
43
  let newVersions = {};
package/src/release.js CHANGED
@@ -30,6 +30,7 @@ async function release({
30
30
  shouldBumpInRangeDependencies = builder['bump-in-range-dependencies'].default,
31
31
  shouldInheritGreaterReleaseType = builder['inherit-greater-release-type'].default,
32
32
  shouldExcludeDevChanges = builder['exclude-dev-changes'].default,
33
+ shouldValidateDependencyVisibility = builder['validate-dependency-visibility'].default,
33
34
  shouldCleanUpAfterFailedPush = builder['clean-up-after-failed-push'].default,
34
35
  scripts = builder['scripts'].default,
35
36
  packageFiles = builder['package-files'].default,
@@ -77,6 +78,7 @@ async function release({
77
78
  shouldBumpInRangeDependencies,
78
79
  shouldInheritGreaterReleaseType,
79
80
  shouldExcludeDevChanges,
81
+ shouldValidateDependencyVisibility,
80
82
  });
81
83
 
82
84
  for (let releaseTree of releaseTrees) {