monorepo-next 7.1.1 → 7.2.2

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
@@ -120,6 +120,7 @@ Options:
120
120
  --bump-files
121
121
  [array] [default: ["package.json","bower.json","manifest.json","package-lock.j
122
122
  son","npm-shrinkwrap.json"]]
123
+ --default-branch [string] [default: "master"]
123
124
 
124
125
  next run
125
126
 
@@ -41,12 +41,16 @@ module.exports = {
41
41
  default: defaults.scripts,
42
42
  },
43
43
  'package-files': {
44
- default: defaults.packageFiles,
45
44
  type: 'array',
45
+ default: defaults.packageFiles,
46
46
  },
47
47
  'bump-files': {
48
- default: defaults.bumpFiles,
49
48
  type: 'array',
49
+ default: defaults.bumpFiles,
50
+ },
51
+ 'default-branch': {
52
+ type: 'string',
53
+ default: 'master',
50
54
  },
51
55
  },
52
56
  async handler(argv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monorepo-next",
3
- "version": "7.1.1",
3
+ "version": "7.2.2",
4
4
  "description": "Detach monorepo packages from normal linking",
5
5
  "bin": {
6
6
  "next": "bin/next.js"
@@ -30,7 +30,7 @@
30
30
  "yarn"
31
31
  ],
32
32
  "scripts": {
33
- "lint:git": "commitlint",
33
+ "lint:git": "commitlint --default-branch main",
34
34
  "lint:js": "eslint . --ext js,json",
35
35
  "lint:md": "remark -f README.md",
36
36
  "start": "node bin/next",
@@ -64,16 +64,17 @@
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
- "rfc6902": "^4.0.2",
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
  },
75
76
  "devDependencies": {
76
- "@crowdstrike/commitlint": "^4.0.0",
77
+ "@crowdstrike/commitlint": "^5.0.0",
77
78
  "chai": "^4.2.0",
78
79
  "chai-as-promised": "^7.1.1",
79
80
  "eslint": "^8.0.0",
@@ -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": "^11.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
  }
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/release.js CHANGED
@@ -30,6 +30,7 @@ async function release({
30
30
  scripts = builder['scripts'].default,
31
31
  packageFiles = builder['package-files'].default,
32
32
  bumpFiles = builder['bump-files'].default,
33
+ defaultBranch = builder['default-branch'].default,
33
34
  versionOverride,
34
35
  preCommitCallback = () => {},
35
36
  prePushCallback = () => {},
@@ -38,7 +39,7 @@ async function release({
38
39
  publishOverride,
39
40
  } = {}) {
40
41
  let currentBranch = await getCurrentBranch(cwd);
41
- if (currentBranch !== 'master') {
42
+ if (currentBranch !== defaultBranch) {
42
43
  return;
43
44
  }
44
45
 
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
- };