monorepo-next 11.3.0 → 11.4.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 +6 -0
- package/bin/commands/changed-files.js +2 -0
- package/bin/commands/changed.js +2 -0
- package/bin/commands/run.js +2 -0
- package/bin/common-args.js +5 -0
- package/package.json +1 -1
- package/src/build-change-graph.js +30 -6
- package/src/changed-files.js +2 -0
- package/src/changed.js +2 -0
- package/src/run.js +2 -0
package/README.md
CHANGED
@@ -58,6 +58,8 @@ Options:
|
|
58
58
|
monorepo dev dep change or manually bumping an
|
59
59
|
external dev dep, don't count it towards a package
|
60
60
|
change. [boolean] [default: false]
|
61
|
+
--exclude-deleted Excluded deleted files from the changeset.
|
62
|
+
[boolean] [default: false]
|
61
63
|
|
62
64
|
next changed
|
63
65
|
|
@@ -73,6 +75,8 @@ Options:
|
|
73
75
|
monorepo dev dep change or manually bumping an
|
74
76
|
external dev dep, don't count it towards a package
|
75
77
|
change. [boolean] [default: false]
|
78
|
+
--exclude-deleted Excluded deleted files from the changeset.
|
79
|
+
[boolean] [default: false]
|
76
80
|
|
77
81
|
next cycles
|
78
82
|
|
@@ -158,6 +162,8 @@ Options:
|
|
158
162
|
monorepo dev dep change or manually bumping an
|
159
163
|
external dev dep, don't count it towards a package
|
160
164
|
change. [boolean] [default: false]
|
165
|
+
--exclude-deleted Excluded deleted files from the changeset.
|
166
|
+
[boolean] [default: false]
|
161
167
|
--silent Don't print logs and errors
|
162
168
|
[boolean] [default: false]
|
163
169
|
```
|
@@ -13,6 +13,7 @@ module.exports = {
|
|
13
13
|
},
|
14
14
|
'only-include-releasable': commonArgs['only-include-releasable'],
|
15
15
|
'exclude-dev-changes': commonArgs['exclude-dev-changes'],
|
16
|
+
'exclude-deleted': commonArgs['exclude-deleted'],
|
16
17
|
},
|
17
18
|
async handler(argv) {
|
18
19
|
const changedFiles = require('../../src/changed-files');
|
@@ -21,6 +22,7 @@ module.exports = {
|
|
21
22
|
...argv,
|
22
23
|
shouldOnlyIncludeReleasable: argv['only-include-releasable'],
|
23
24
|
shouldExcludeDevChanges: argv['exclude-dev-changes'],
|
25
|
+
shouldExcludeDeleted: argv['exclude-deleted'],
|
24
26
|
});
|
25
27
|
|
26
28
|
for (let file of _changedFiles) {
|
package/bin/commands/changed.js
CHANGED
@@ -9,6 +9,7 @@ module.exports = {
|
|
9
9
|
builder: {
|
10
10
|
'only-include-releasable': commonArgs['only-include-releasable'],
|
11
11
|
'exclude-dev-changes': commonArgs['exclude-dev-changes'],
|
12
|
+
'exclude-deleted': commonArgs['exclude-deleted'],
|
12
13
|
},
|
13
14
|
async handler(argv) {
|
14
15
|
const changed = require('../../src/changed');
|
@@ -17,6 +18,7 @@ module.exports = {
|
|
17
18
|
...argv,
|
18
19
|
shouldOnlyIncludeReleasable: argv['only-include-releasable'],
|
19
20
|
shouldExcludeDevChanges: argv['exclude-dev-changes'],
|
21
|
+
shouldExcludeDeleted: argv['exclude-deleted'],
|
20
22
|
});
|
21
23
|
|
22
24
|
for (let name of _changed) {
|
package/bin/commands/run.js
CHANGED
@@ -8,6 +8,7 @@ module.exports = {
|
|
8
8
|
builder: {
|
9
9
|
'only-include-releasable': commonArgs['only-include-releasable'],
|
10
10
|
'exclude-dev-changes': commonArgs['exclude-dev-changes'],
|
11
|
+
'exclude-deleted': commonArgs['exclude-deleted'],
|
11
12
|
'silent': commonArgs['silent'],
|
12
13
|
},
|
13
14
|
async handler(argv) {
|
@@ -17,6 +18,7 @@ module.exports = {
|
|
17
18
|
...argv,
|
18
19
|
shouldOnlyIncludeReleasable: argv['only-include-releasable'],
|
19
20
|
shouldExcludeDevChanges: argv['exclude-dev-changes'],
|
21
|
+
shouldExcludeDeleted: argv['exclude-deleted'],
|
20
22
|
args: process.argv.slice(3),
|
21
23
|
});
|
22
24
|
},
|
package/bin/common-args.js
CHANGED
@@ -13,6 +13,11 @@ module.exports = {
|
|
13
13
|
type: 'boolean',
|
14
14
|
default: false,
|
15
15
|
},
|
16
|
+
'exclude-deleted': {
|
17
|
+
describe: 'Excluded deleted files from the changeset.',
|
18
|
+
type: 'boolean',
|
19
|
+
default: false,
|
20
|
+
},
|
16
21
|
'silent': {
|
17
22
|
describe: 'Don\'t print logs and errors',
|
18
23
|
type: 'boolean',
|
package/package.json
CHANGED
@@ -27,6 +27,8 @@ async function getPackageChangedFiles({
|
|
27
27
|
// down to 25 seconds from 39 seconds.
|
28
28
|
shouldRunPerPackage = true,
|
29
29
|
|
30
|
+
shouldExcludeDeleted,
|
31
|
+
|
30
32
|
options,
|
31
33
|
}) {
|
32
34
|
// Be careful you don't accidentally use `...` instead of `..`.
|
@@ -35,23 +37,43 @@ async function getPackageChangedFiles({
|
|
35
37
|
//
|
36
38
|
// I tried using ls-tree instead of diff when it is a new package (fromCommit is first commit in repo),
|
37
39
|
// but it took the same amount of time.
|
38
|
-
let committedChanges = await git(['diff', '--name-
|
40
|
+
let committedChanges = await git(['diff', '--name-status', `${fromCommit}..${toCommit}`, ...shouldRunPerPackage ? [packageCwd] : []], options);
|
41
|
+
|
42
|
+
committedChanges = getLinesFromOutput(committedChanges).reduce((committedChanges, line) => {
|
43
|
+
let isDeleted = line[0] === 'D';
|
44
|
+
let shouldExclude = shouldExcludeDeleted && isDeleted;
|
45
|
+
|
46
|
+
if (!shouldExclude) {
|
47
|
+
line = line.substr(2);
|
48
|
+
|
49
|
+
committedChanges.add(line);
|
50
|
+
}
|
39
51
|
|
40
|
-
|
52
|
+
return committedChanges;
|
53
|
+
}, new Set());
|
41
54
|
|
42
55
|
let dirtyChanges = await git(['status', '--porcelain', '--untracked-files', ...shouldRunPerPackage ? [packageCwd] : []], options);
|
43
56
|
|
44
|
-
dirtyChanges = getLinesFromOutput(dirtyChanges).
|
57
|
+
dirtyChanges = getLinesFromOutput(dirtyChanges).reduce((dirtyChanges, line) => {
|
58
|
+
let isDeleted = line[1] === 'D';
|
59
|
+
let shouldExclude = shouldExcludeDeleted && isDeleted;
|
60
|
+
|
45
61
|
line = line.substr(3);
|
46
62
|
|
47
63
|
// if filename has space like `sample index.js`, if its modified and uncommited, that file will have double quotes in git status
|
48
64
|
// example: '"packages/package-a/sample index.js"'. We need to strip `"` for that reason.
|
49
65
|
line = line.replaceAll('"', '');
|
50
66
|
|
51
|
-
|
52
|
-
|
67
|
+
if (shouldExclude) {
|
68
|
+
committedChanges.delete(line);
|
69
|
+
} else {
|
70
|
+
dirtyChanges.add(line);
|
71
|
+
}
|
72
|
+
|
73
|
+
return dirtyChanges;
|
74
|
+
}, new Set());
|
53
75
|
|
54
|
-
let changedFiles =
|
76
|
+
let changedFiles = committedChanges.union(dirtyChanges);
|
55
77
|
|
56
78
|
if (!shouldRunPerPackage) {
|
57
79
|
let packageChangedFiles = new Set();
|
@@ -94,6 +116,7 @@ async function buildChangeGraph({
|
|
94
116
|
workspaceMeta,
|
95
117
|
shouldOnlyIncludeReleasable,
|
96
118
|
shouldExcludeDevChanges,
|
119
|
+
shouldExcludeDeleted,
|
97
120
|
fromCommit,
|
98
121
|
fromCommitIfNewer,
|
99
122
|
toCommit = 'HEAD',
|
@@ -161,6 +184,7 @@ async function buildChangeGraph({
|
|
161
184
|
toCommit,
|
162
185
|
packageCwd: _package.cwd,
|
163
186
|
shouldRunPerPackage: false,
|
187
|
+
shouldExcludeDeleted,
|
164
188
|
options: {
|
165
189
|
cwd: workspaceMeta.cwd,
|
166
190
|
cached,
|
package/src/changed-files.js
CHANGED
@@ -19,6 +19,7 @@ async function changedFiles({
|
|
19
19
|
cwd = process.cwd(),
|
20
20
|
shouldOnlyIncludeReleasable = builder['only-include-releasable'].default,
|
21
21
|
shouldExcludeDevChanges = builder['exclude-dev-changes'].default,
|
22
|
+
shouldExcludeDeleted = builder['exclude-deleted'].default,
|
22
23
|
fromCommit,
|
23
24
|
fromCommitIfNewer,
|
24
25
|
toCommit,
|
@@ -38,6 +39,7 @@ async function changedFiles({
|
|
38
39
|
workspaceMeta,
|
39
40
|
shouldOnlyIncludeReleasable,
|
40
41
|
shouldExcludeDevChanges,
|
42
|
+
shouldExcludeDeleted,
|
41
43
|
fromCommit,
|
42
44
|
fromCommitIfNewer,
|
43
45
|
toCommit,
|
package/src/changed.js
CHANGED
@@ -12,6 +12,7 @@ async function changed({
|
|
12
12
|
cwd = process.cwd(),
|
13
13
|
shouldOnlyIncludeReleasable = builder['only-include-releasable'].default,
|
14
14
|
shouldExcludeDevChanges = builder['exclude-dev-changes'].default,
|
15
|
+
shouldExcludeDeleted = builder['exclude-deleted'].default,
|
15
16
|
fromCommit,
|
16
17
|
fromCommitIfNewer,
|
17
18
|
toCommit,
|
@@ -26,6 +27,7 @@ async function changed({
|
|
26
27
|
workspaceMeta,
|
27
28
|
shouldOnlyIncludeReleasable,
|
28
29
|
shouldExcludeDevChanges,
|
30
|
+
shouldExcludeDeleted,
|
29
31
|
fromCommit,
|
30
32
|
fromCommitIfNewer,
|
31
33
|
toCommit,
|
package/src/run.js
CHANGED
@@ -13,6 +13,7 @@ async function run({
|
|
13
13
|
cwd = process.cwd(),
|
14
14
|
shouldOnlyIncludeReleasable = builder['only-include-releasable'].default,
|
15
15
|
shouldExcludeDevChanges = builder['exclude-dev-changes'].default,
|
16
|
+
shouldExcludeDeleted = builder['exclude-deleted'].default,
|
16
17
|
silent,
|
17
18
|
args,
|
18
19
|
cached,
|
@@ -25,6 +26,7 @@ async function run({
|
|
25
26
|
workspaceMeta,
|
26
27
|
shouldOnlyIncludeReleasable,
|
27
28
|
shouldExcludeDevChanges,
|
29
|
+
shouldExcludeDeleted,
|
28
30
|
cached,
|
29
31
|
});
|
30
32
|
|