Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: use rootDirs not rootDir
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 25, 2018
1 parent cc87e10 commit dcba41b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface ICLIConfig extends IConfig {

export interface TSConfig {
compilerOptions: {
rootDir?: string
rootDirs?: string[]
outDir?: string
}
}
Expand Down Expand Up @@ -172,8 +172,9 @@ export class Config {
if (!orig) return
orig = path.join(this.root, orig)
if (!this.tsconfig) return orig
let {rootDir, outDir} = this.tsconfig.compilerOptions
if (!rootDir || !outDir) return orig
let {rootDirs, outDir} = this.tsconfig.compilerOptions
if (!rootDirs || !rootDirs.length || !outDir) return orig
let rootDir = rootDirs[0]
try {
// rewrite path from ./lib/foo to ./src/foo
const lib = path.join(this.root, outDir) // ./lib
Expand Down
6 changes: 3 additions & 3 deletions test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('PluginConfig', () => {
configDir: path.join('/my/home/.config/heroku-cli-status'),
errlog: path.join('/my/home/Library/Caches/heroku-cli-status/error.log'),
dataDir: path.join('/my/home/.local/share/heroku-cli-status'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'src/commands'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'lib/commands'),
home: path.join('/my/home'),
})
})
Expand All @@ -39,7 +39,7 @@ describe('PluginConfig', () => {
configDir: path.join('/my/home/.config/heroku-cli-status'),
errlog: path.join('/my/home/.cache/heroku-cli-status/error.log'),
dataDir: path.join('/my/home/.local/share/heroku-cli-status'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'src/commands'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'lib/commands'),
home: path.join('/my/home'),
})
})
Expand All @@ -55,7 +55,7 @@ describe('PluginConfig', () => {
configDir: path.join('/my/home/localappdata/heroku-cli-status'),
errlog: path.join('/my/home/localappdata/heroku-cli-status/error.log'),
dataDir: path.join('/my/home/localappdata/heroku-cli-status'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'src/commands'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'lib/commands'),
home: path.join('/my/home'),
})
})
Expand Down

0 comments on commit dcba41b

Please sign in to comment.