Skip to content

Commit a3026e1

Browse files
committedJan 27, 2020
fix: 🐛 fixed endless loop on win32
1 parent 3c74ce8 commit a3026e1

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"lint": "yarn lint:eslint && yarn lint:ts",
4747
"lint:eslint": "npx eslint bin/*.js src/*.ts --cache --fix",
4848
"lint:ts": "npx tsc -p tsconfig.build.json --noEmit",
49-
"prepublishOnly": "yarn build",
49+
"prepack": "yarn build",
5050
"release": "source .env && npx semantic-release --color --no-ci"
5151
},
5252
"husky": {

‎src/cli.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ export class Cli {
111111
}
112112

113113
gitRoot(cwd = process.cwd()): string | undefined {
114-
if (cwd == "/") return undefined
115-
const p = path.posix.resolve(cwd, "./.git")
114+
const p = path.resolve(cwd, "./.git")
116115
if (fs.existsSync(p) && fs.lstatSync(p).isDirectory()) return p
117-
return this.gitRoot(path.resolve(cwd, "../"))
116+
const up = path.resolve(cwd, "../")
117+
if (up == cwd) return
118+
return this.gitRoot(up)
118119
}
119120

120121
static async create(argv = process.argv, exitOverride = false) {

‎src/config.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ export class Config {
5151
* @param cwd
5252
*/
5353
static findRoot(pattern: string, cwd = process.cwd()): string | undefined {
54-
if (cwd == "/") return undefined
55-
const p = path.posix.resolve(cwd, pattern)
54+
const p = path.resolve(cwd, pattern)
5655
if (fs.existsSync(p)) return cwd
57-
const up = path.posix.resolve(cwd, "../")
56+
const up = path.resolve(cwd, "../")
5857
if (up == cwd) return undefined
5958
return Config.findRoot(pattern, up)
6059
}
@@ -72,7 +71,7 @@ export class Config {
7271
]
7372
for (const p of searchPaths) {
7473
if (p) {
75-
const file = path.posix.resolve(p, "./devmoji.config.js")
74+
const file = path.resolve(p, "./devmoji.config.js")
7675
if (fs.existsSync(file)) {
7776
configFile = file
7877
break

0 commit comments

Comments
 (0)
Please sign in to comment.