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 1
1
const getManifest = require ( "./getManifest" ) ;
2
2
const glob = require ( "./glob" ) ;
3
+ const { slash } = require ( "./utils" ) ;
3
4
const path = require ( "path" ) ;
4
5
const { getPackagesSync } = require ( "@manypkg/get-packages" ) ;
5
6
@@ -29,7 +30,7 @@ function getPackagePaths(cwd, ignorePackages = null) {
29
30
}
30
31
31
32
// 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 ) ) ) ;
33
34
34
35
// If packages to be ignored come from CLI, we need to combine them with the ones from manifest workspaces
35
36
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) {
52
52
return versions . filter ( ( version ) => withPrerelease || ! prerelease ( version ) ) . sort ( rcompare ) [ 0 ] ;
53
53
}
54
54
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
+
55
67
module . exports = {
56
68
tagsToVersions,
57
69
getHighestVersion,
58
70
getLowestVersion,
59
71
getLatestVersion,
72
+ slash,
60
73
} ;
You can’t perform that action at this time.
0 commit comments