monorepo-next 7.2.0 → 7.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monorepo-next",
3
- "version": "7.2.0",
3
+ "version": "7.2.3",
4
4
  "description": "Detach monorepo packages from normal linking",
5
5
  "bin": {
6
6
  "next": "bin/next.js"
@@ -64,11 +64,12 @@
64
64
  "execa": "^5.0.0",
65
65
  "glob": "^7.1.4",
66
66
  "inquirer": "^8.0.0",
67
- "minimatch": "^3.0.4",
67
+ "minimatch": "^5.0.0",
68
68
  "npm-packlist": "^3.0.0",
69
69
  "rfc6902": "^5.0.0",
70
70
  "semver": "7.3.5",
71
71
  "standard-version": "9.3.2",
72
+ "superset": "^2.0.1",
72
73
  "tmp": "0.2.1",
73
74
  "yargs": "^17.0.0"
74
75
  },
@@ -89,7 +90,7 @@
89
90
  "remark-cli": "^10.0.0",
90
91
  "remark-preset-lint-crowdstrike": "^2.0.0",
91
92
  "renovate-config-standard": "^2.0.0",
92
- "sinon": "^12.0.0",
93
+ "sinon": "^13.0.0",
93
94
  "sinon-chai": "^3.5.0",
94
95
  "standard-node-template": "2.0.0",
95
96
  "yargs-help-output": "^2.0.0"
@@ -11,9 +11,7 @@ const {
11
11
  const { collectPackages } = require('./build-dep-graph');
12
12
  const minimatch = require('minimatch');
13
13
  const { getChangedReleasableFiles } = require('./releasable');
14
- const {
15
- union,
16
- } = require('./set');
14
+ const Set = require('superset');
17
15
 
18
16
  async function getPackageChangedFiles({
19
17
  fromCommit,
@@ -37,7 +35,7 @@ async function getPackageChangedFiles({
37
35
  committedChanges = getLinesFromOutput(committedChanges);
38
36
  let dirtyChanges = await git(['status', '--porcelain', packageCwd, '-u'], options);
39
37
  dirtyChanges = getLinesFromOutput(dirtyChanges).map(line => line.substr(3));
40
- let changedFiles = Array.from(union(committedChanges, dirtyChanges));
38
+ let changedFiles = Array.from(new Set(committedChanges).union(dirtyChanges));
41
39
 
42
40
  return changedFiles;
43
41
  }
@@ -155,7 +153,7 @@ async function buildChangeGraph({
155
153
 
156
154
  let dag = buildDAG(workspaceMeta, _package.packageName);
157
155
 
158
- packagesWithChanges[dag.packageName] = {
156
+ packagesWithChanges[_package.packageName] = {
159
157
  changedFiles: newFiles,
160
158
  changedReleasableFiles,
161
159
  dag,
@@ -51,6 +51,7 @@ async function init({
51
51
  shouldVersionBump = true,
52
52
  }) {
53
53
  let {
54
+ isPackage,
54
55
  packageName: name,
55
56
  cwd,
56
57
  } = dag;
@@ -72,7 +73,7 @@ async function init({
72
73
  }
73
74
 
74
75
  let canBumpVersion = !!(version && name);
75
- let canPublish = dag.isPackage;
76
+ let canPublish = isPackage;
76
77
  let shouldBumpVersion = canBumpVersion && shouldVersionBump;
77
78
  let shouldPublish = canPublish && shouldBumpVersion;
78
79
 
package/src/detach.js CHANGED
@@ -68,7 +68,7 @@ async function detach({
68
68
  choices,
69
69
  }]);
70
70
 
71
- let dependencts = answers.map(answer => {
71
+ let dependents = answers.map(answer => {
72
72
  // switch to key/value instead of array?
73
73
  let isPackage = answer !== workspaceKey;
74
74
 
@@ -80,7 +80,7 @@ async function detach({
80
80
  // prevent loops
81
81
  const attach = require('./attach');
82
82
 
83
- for (let node of dependencts) {
83
+ for (let node of dependents) {
84
84
  await attach({
85
85
  package: path.basename(cwd),
86
86
  cwd: node.cwd,
package/src/releasable.js CHANGED
@@ -4,11 +4,7 @@ const packlist = require('npm-packlist');
4
4
  const path = require('path');
5
5
  const { createTmpDir } = require('./tmp');
6
6
  const fs = { ...require('fs'), ...require('fs').promises };
7
- const {
8
- union,
9
- intersection,
10
- map,
11
- } = require('./set');
7
+ const Set = require('superset');
12
8
  const { createPatch } = require('rfc6902');
13
9
  const {
14
10
  getFileAtCommit,
@@ -92,13 +88,9 @@ async function _getChangedReleasableFiles({
92
88
  }
93
89
  }
94
90
 
95
- changedPublishedFilesNew = intersection(
96
- union(
97
- changedPublishedFilesOld,
98
- filesContributingToReleasability,
99
- ),
100
- changedFiles,
101
- );
91
+ changedPublishedFilesNew = changedPublishedFilesOld
92
+ .union(filesContributingToReleasability)
93
+ .intersect(changedFiles);
102
94
 
103
95
  return changedPublishedFilesNew;
104
96
  }
@@ -140,12 +132,12 @@ async function getChangedReleasableFiles({
140
132
 
141
133
  let changedPublishedFiles = await _getChangedReleasableFiles({
142
134
  cwd: packageCwd,
143
- changedFiles: map(changedFiles, file => path.relative(packageCwd, path.join(workspacesCwd, file))),
135
+ changedFiles: changedFiles.map(file => path.relative(packageCwd, path.join(workspacesCwd, file))),
144
136
  });
145
137
 
146
138
  let relative = path.relative(workspacesCwd, packageCwd);
147
139
 
148
- changedPublishedFiles = map(changedPublishedFiles, file => path.join(relative, file));
140
+ changedPublishedFiles = changedPublishedFiles.map(file => path.join(relative, file));
149
141
 
150
142
  if (shouldExcludeDevChanges) {
151
143
  let relativePackageJsonPath = path.join(relative, 'package.json');
@@ -163,7 +155,7 @@ async function getChangedReleasableFiles({
163
155
  }
164
156
  }
165
157
 
166
- return Array.from(changedPublishedFiles);
158
+ return Array.from(changedPublishedFiles).sort();
167
159
  }
168
160
 
169
161
  module.exports = {
package/src/set.js DELETED
@@ -1,34 +0,0 @@
1
- 'use strict';
2
-
3
- function union(a, b) {
4
- return new Set([...a, ...b]);
5
- }
6
-
7
- function intersection(a, b) {
8
- let set = new Set();
9
-
10
- for (let elem of b) {
11
- if (a.has(elem)) {
12
- set.add(elem);
13
- }
14
- }
15
-
16
- return set;
17
- }
18
-
19
- function map(set, callback) {
20
- let newSet = new Set();
21
- let i = 0;
22
-
23
- for (let value of set) {
24
- newSet.add(callback(value, i++));
25
- }
26
-
27
- return newSet;
28
- }
29
-
30
- module.exports = {
31
- union,
32
- intersection,
33
- map,
34
- };