-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⭐add some new path to create schema of declaration
- Loading branch information
1 parent
07961c2
commit df59d08
Showing
3 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { Project, log, emptyDir } from "../../deps.ts"; | ||
import { rgb24 } from "https://deno.land/[email protected]/fmt/colors.ts"; | ||
import { denoResolutionHost } from "../utils/mod.ts"; | ||
import { denoResolutionHost, throwError } from "../utils/mod.ts"; | ||
import { addFunQLInterfaceToSourceFile } from "./utils/addInterfaceToSrcFile.ts"; | ||
|
||
export const getSchemaDeclarations = async (dirPath?: string) => { | ||
|
@@ -16,7 +16,15 @@ export const getSchemaDeclarations = async (dirPath?: string) => { | |
//handle differentiate between schema and schemas | ||
const dir = | ||
project.getDirectory(`${__dirname}/schema`) || | ||
project.getDirectory(`${__dirname}/schemas`); | ||
project.getDirectory(`${__dirname}/schemas`) || | ||
project.getDirectory(`${__dirname}/src/schemas`) || | ||
project.getDirectory(`${__dirname}/src/schema`); | ||
|
||
//throws error if dir not found | ||
!dir && | ||
throwError( | ||
"directory of schema was not found, please move your schemas to path ./src/schema(s) or ./schema(s)" | ||
); | ||
|
||
const createdSourceFile = project.createSourceFile( | ||
`${__dirname}/declarations/schema/schema.ts`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./denoResolutionHost.ts"; | ||
export * from "./throwError.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const throwError = (msg?: string) => { | ||
throw new Error(msg); | ||
}; |