relacher 0.0.7-rc.2 → 0.0.7-rc.5
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 +1 -1
- package/src/prepare.ts +3 -28
- package/src/vcs/common.ts +12 -2
package/package.json
CHANGED
package/src/prepare.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
PrepareOptions,
|
|
15
15
|
} from './types';
|
|
16
16
|
import type { UpdateAction, UpdateActionResolved } from './updater';
|
|
17
|
-
import { VcsProviderService
|
|
17
|
+
import { VcsProviderService } from './vcs';
|
|
18
18
|
import { VersionManagerService, type VersionManager } from './versioning';
|
|
19
19
|
import { isBumpEqual, isPreRelease } from './versioning/bump';
|
|
20
20
|
import type { BumpSize } from './versioning/types';
|
|
@@ -177,33 +177,8 @@ export function prepare(
|
|
|
177
177
|
|
|
178
178
|
const cwd = options.cwd || process.cwd();
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const vcs: VcsProvider = vcsOption.value;
|
|
183
|
-
if (typeof vcs.isTracked === 'function') {
|
|
184
|
-
const filtered: PackageConfig[] = [];
|
|
185
|
-
for (const pkg of packages) {
|
|
186
|
-
const targetPath = pkg.manifestPath
|
|
187
|
-
? path.resolve(cwd, pkg.manifestPath)
|
|
188
|
-
: path.resolve(cwd, pkg.watch?.[0] || '.');
|
|
189
|
-
|
|
190
|
-
const isTracked = yield* vcs.isTracked(targetPath);
|
|
191
|
-
if (isTracked) {
|
|
192
|
-
filtered.push(pkg);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
trackedPackages = filtered;
|
|
196
|
-
|
|
197
|
-
const activeNames = new Set(trackedPackages.map((p) => p.name));
|
|
198
|
-
for (const pkg of trackedPackages) {
|
|
199
|
-
if (pkg.depends) {
|
|
200
|
-
pkg.depends = pkg.depends.filter((d) => activeNames.has(d));
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const items = yield* initReportItems(trackedPackages, cwd, options);
|
|
180
|
+
// Packages passed in were already validated and tracked by the builder.
|
|
181
|
+
const items = yield* initReportItems(packages, cwd, options);
|
|
207
182
|
const sorted = topologicalSort(items);
|
|
208
183
|
versionManager.propagateBumps(sorted);
|
|
209
184
|
versionManager.propagateCoupledBumps(sorted);
|
package/src/vcs/common.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
|
|
3
4
|
export function isInsideGitWorkTree(cwd: string): boolean {
|
|
4
5
|
try {
|
|
@@ -14,7 +15,11 @@ export function isInsideGitWorkTree(cwd: string): boolean {
|
|
|
14
15
|
|
|
15
16
|
export function isGitTracked(filePath: string, cwd: string): boolean {
|
|
16
17
|
try {
|
|
17
|
-
|
|
18
|
+
const relPath = path.isAbsolute(filePath)
|
|
19
|
+
? path.relative(cwd, filePath).replace(/\\/g, '/')
|
|
20
|
+
: filePath.replace(/\\/g, '/');
|
|
21
|
+
|
|
22
|
+
execFileSync('git', ['ls-files', '--error-unmatch', relPath || '.'], {
|
|
18
23
|
cwd,
|
|
19
24
|
stdio: ['ignore', 'ignore', 'ignore'],
|
|
20
25
|
});
|
|
@@ -38,7 +43,12 @@ export function isInsideJjWorkTree(cwd: string): boolean {
|
|
|
38
43
|
|
|
39
44
|
export function isJjTracked(filePath: string, cwd: string): boolean {
|
|
40
45
|
try {
|
|
41
|
-
|
|
46
|
+
// Jujutsu requires relative paths from cwd:
|
|
47
|
+
const relPath = path.isAbsolute(filePath)
|
|
48
|
+
? path.relative(cwd, filePath).replace(/\\/g, '/')
|
|
49
|
+
: filePath.replace(/\\/g, '/');
|
|
50
|
+
|
|
51
|
+
const out = execFileSync('jj', ['--color=never', 'files', relPath || '.'], {
|
|
42
52
|
cwd,
|
|
43
53
|
encoding: 'utf8',
|
|
44
54
|
stdio: ['ignore', 'pipe', 'ignore'],
|