Skip to content

Commit

Permalink
Improve error message on missing path
Browse files Browse the repository at this point in the history
  • Loading branch information
miniBill committed Dec 15, 2023
1 parent 93ffb9d commit 8b2376a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,21 +443,24 @@ async function reinstall_everything(install_dir: string, codeGenJson: CodeGenJso
// Install all dependencies
const elmSources = []
for (const item of codeGenJson.dependencies.local) {
console.log("Installing " + item)
if (item.endsWith(".json")) {
console.log("From json " + item)
console.log("Installing from JSON docs " + chalk.yellow(item))
let docs = JSON.parse(fs.readFileSync(item).toString())
run_package_generator(install_dir, { docs: docs })
} else if (item.endsWith(".elm")) {
console.log("Installing from Elm file " + chalk.yellow(item))
elmSources.push(fs.readFileSync(item).toString())
} else if (item.endsWith(path.sep)) {
} else {
console.log("Installing from path " + chalk.yellow(item))
if (fs.existsSync(item)) {
getFilesWithin(item, ".elm").forEach((elmPath) => {
elmSources.push(fs.readFileSync(elmPath).toString())
})
} else {
console.log(
`\n${chalk.yellow(item)} is listed in your elm-codegen.json but doesn't exist!\nMaybe it should be removed?\n`
`\n${chalk.yellow(
item
)} is listed in your elm-codegen.json but doesn't exist!\nMaybe it should be removed?\nLocal paths are relative to the path elm-codegen is running from, which is usually the one containing the package.json file.\n`
)
}
}
Expand Down

0 comments on commit 8b2376a

Please sign in to comment.