mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Fix stuff
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+2
-2
@@ -90,8 +90,8 @@ test("getChangedPackages works", async () => {
|
||||
name: "some-package",
|
||||
version: "1.0.0"
|
||||
});
|
||||
await exec("git", ["add", "."]);
|
||||
await exec("git", ["commit", "-m", "'initial commit'"]);
|
||||
await exec("git", ["add", "."], { cwd: dir });
|
||||
await exec("git", ["commit", "-m", "initial commit"], { cwd: dir });
|
||||
let emptyWorkspaces = await getChangedPackages(dir);
|
||||
expect(emptyWorkspaces).toEqual([]);
|
||||
let workspace = {
|
||||
|
||||
@@ -28,11 +28,12 @@ export async function getChangedPackages(cwd: string) {
|
||||
|
||||
let workspacesByDirectory = new Map(workspaces.map(x => [x.dir, x]));
|
||||
|
||||
let output = await execWithOutput("git", ["diff", "--only-names"], { cwd });
|
||||
let output = await execWithOutput("git", ["diff", "--name-only"], { cwd });
|
||||
let names = output.stdout.split("\n");
|
||||
let changedWorkspaces: Workspace[] = [];
|
||||
for (let name of names) {
|
||||
let dirname = path.dirname(name);
|
||||
if (name === "") continue;
|
||||
let dirname = path.resolve(cwd, path.dirname(name));
|
||||
let workspace = workspacesByDirectory.get(dirname);
|
||||
if (workspace !== undefined) {
|
||||
changedWorkspaces.push(workspace);
|
||||
|
||||
Reference in New Issue
Block a user