Skip to content

Commit

Permalink
Issue#309 (#336)
Browse files Browse the repository at this point in the history
* Issue#309
"changeset add" doesn't show changed packages because of '/' vs '\\' path issue

* Linting fix

* Update .changeset/chilled-moose-sing.md

Co-Authored-By: Zoltan Kochan <zkochan@users.noreply.github.com>

Co-authored-by: Mitchell Hamilton <mitchell@hamil.town>
Co-authored-by: Zoltan Kochan <zkochan@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 21, 2020
1 parent 02faafd commit aa840db
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-moose-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/git": patch
---

Changed packages detection fixed on Windows.
1 change: 1 addition & 0 deletions packages/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@changesets/errors": "^0.1.4",
"@changesets/types": "^2.0.1",
"@manypkg/get-packages": "^1.0.1",
"is-subdir": "^1.1.1",
"spawndamnit": "^2.0.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/git/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import spawn from "spawndamnit";
import path from "path";
import { getPackages } from "@manypkg/get-packages";
import { GitError } from "@changesets/errors";
import isSubdir from "is-subdir";

async function add(pathToFile: string, cwd: string) {
const gitCmd = await spawn("git", ["add", pathToFile], { cwd });
Expand Down Expand Up @@ -108,7 +109,7 @@ async function getChangedPackagesSinceRef({
let packages = await getPackages(cwd);

const fileNameToPackage = (fileName: string) =>
packages.packages.find(pkg => fileName.startsWith(pkg.dir + path.sep))!;
packages.packages.find(pkg => isSubdir(pkg.dir, fileName))!;

const fileExistsInPackage = (fileName: string) =>
!!fileNameToPackage(fileName);
Expand Down
16 changes: 15 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,13 @@ bcrypt-pbkdf@^1.0.0:
dependencies:
tweetnacl "^0.14.3"

better-path-resolve@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/better-path-resolve/-/better-path-resolve-1.0.0.tgz#13a35a1104cdd48a7b74bf8758f96a1ee613f99d"
integrity sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==
dependencies:
is-windows "^1.0.0"

binary-extensions@^1.0.0:
version "1.13.1"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65"
Expand Down Expand Up @@ -3805,6 +3812,13 @@ is-stream@^1.1.0:
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=

is-subdir@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/is-subdir/-/is-subdir-1.1.1.tgz#423e66902f9c5f159b9cc4826c820df083059538"
integrity sha512-VYpq0S7gPBVkkmfwkvGnx1EL9UVIo87NQyNcgMiNUdQCws3CJm5wj2nB+XPL7zigvjxhuZgp3bl2yBcKkSIj1w==
dependencies:
better-path-resolve "1.0.0"

is-symbol@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38"
Expand All @@ -3817,7 +3831,7 @@ is-typedarray@~1.0.0:
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=

is-windows@^1.0.2:
is-windows@^1.0.0, is-windows@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==
Expand Down

0 comments on commit aa840db

Please sign in to comment.