File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 11const getManifest = require ( "./getManifest" ) ;
22const glob = require ( "./glob" ) ;
3+ const { slash } = require ( "./utils" ) ;
34const path = require ( "path" ) ;
45const { getPackagesSync } = require ( "@manypkg/get-packages" ) ;
56
@@ -29,7 +30,7 @@ function getPackagePaths(cwd, ignorePackages = null) {
2930 }
3031
3132 // remove cwd from results
32- const packages = workspace . packages . map ( ( p ) => path . relative ( cwd , p . dir ) ) ;
33+ const packages = workspace . packages . map ( ( p ) => slash ( path . relative ( cwd , p . dir ) ) ) ;
3334
3435 // If packages to be ignored come from CLI, we need to combine them with the ones from manifest workspaces
3536 if ( Array . isArray ( ignorePackages ) ) packages . push ( ...ignorePackages . map ( ( p ) => `!${ p } ` ) ) ;
Original file line number Diff line number Diff line change @@ -52,9 +52,22 @@ function getLatestVersion(versions, withPrerelease) {
5252 return versions . filter ( ( version ) => withPrerelease || ! prerelease ( version ) ) . sort ( rcompare ) [ 0 ] ;
5353}
5454
55+ // https://github.com/sindresorhus/slash/blob/b5cdd12272f94cfc37c01ac9c2b4e22973e258e5/index.js#L1
56+ function slash ( path ) {
57+ const isExtendedLengthPath = / ^ \\ \\ \? \\ / . test ( path ) ;
58+ const hasNonAscii = / [ ^ \u0000 - \u0080 ] + / . test ( path ) ; // eslint-disable-line no-control-regex
59+
60+ if ( isExtendedLengthPath || hasNonAscii ) {
61+ return path ;
62+ }
63+
64+ return path . replace ( / \\ / g, "/" ) ;
65+ }
66+
5567module . exports = {
5668 tagsToVersions,
5769 getHighestVersion,
5870 getLowestVersion,
5971 getLatestVersion,
72+ slash,
6073} ;
You can’t perform that action at this time.
0 commit comments