Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Nov 29, 2019
1 parent 6a2c8c4 commit b5a3df7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions cli/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"p-map": "^3.0.0",
"prisma-datamodel": "1.34.10",
"prompts": "^2.3.0",
"read-pkg-up": "^7.0.0",
"resolve-pkg": "^2.0.0",
"rimraf": "^3.0.0",
"tar": "^5.0.5",
Expand Down
3 changes: 3 additions & 0 deletions cli/sdk/src/getGenerators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ export async function getGenerators({
// resolve output path
if (generator.output) {
generator.output = path.resolve(baseDir, generator.output)
debug(`Resolving based on generator.output to ${generator.output}`)
} else if (paths) {
generator.output = paths.outputPath
debug(`Resolving based on paths to ${generator.output}`)
} else {
if (
!generatorInstance.manifest ||
Expand All @@ -134,6 +136,7 @@ The generator needs to either define the \`defaultOutput\` path in the manifest
defaultOutput: generatorInstance.manifest.defaultOutput,
baseDir,
})
debug(`Resolving else to ${generator.output}`, { baseDir })
}

const options: GeneratorOptions = {
Expand Down
10 changes: 10 additions & 0 deletions cli/sdk/src/getPackedPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import makeDir from 'make-dir'
import { promisify } from 'util'
import rimraf from 'rimraf'
import Debug from 'debug'
import readPkgUp from 'read-pkg-up'
const debug = Debug('getPackedPackage')

// why not directly use Sindre's 'del'? Because it's not ncc-able :/
Expand All @@ -28,6 +29,15 @@ export async function getPackedPackage(

debug({ packageDir })

if (!packageDir) {
const pkg = await readPkgUp({
cwd: target,
})
if (pkg && pkg.packageJson.name === name) {
packageDir = path.dirname(pkg.path)
}
}

if (!packageDir) {
throw new Error(
`Error in getPackage: Could not resolve package ${name} from ${__dirname}`,
Expand Down

0 comments on commit b5a3df7

Please sign in to comment.