-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: output dir config & remove dep on pkg 'main' #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
@@ -12,6 +12,7 @@ commanderStatic | |||
`) | |||
.option("-p, --project [projectPath]", `Default: './' -- Root path of the project to denoify, target directory is supposed to contain a 'package.json' and 'tsconfig.json'.`) | |||
.option("--src [srcDirPath]", `Default: '[projectPath]/src' | '[projectPath]/lib' -- Path to the directory containing the source .ts files. If the provided path is not absolute it is assumed relative to [projectPath]`) | |||
.option("--out [outputDirPath]", `Default: '$(dirname <tsconfig.outDir>)/deno_lib' -- Path to the output directory`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it
if (!("main" in packageJsonParsed)) { | ||
//TODO: We shouldn't force users to specify a default export. | ||
throw new Error([ | ||
"A main field in package.json need to be specified", | ||
"otherwise we don't know what file the mod.ts should export." | ||
].join(" ")); | ||
} | ||
|
||
if ( | ||
!isInsideOrIsDir({ | ||
"dirPath": tsconfigOutDir, | ||
"fileOrDirPath": path.normalize(packageJsonParsed["main"]) | ||
}) | ||
) { | ||
throw new Error(`The package.json main should point to a file inside ${tsconfigOutDir}`) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I no longer have all the context in mind to remember why I deemed important to have this fail early strategy here.
I am willing to trust you on the fact that it can be safely removed.
I just released a new version featuring your changes |
mod.ts
cannot be generated. Currentlydenoify
requires that package.jsonmain
should be insidetsconfig.outDir
. It causesdenoify
cannot work on some projects and there is no workaround.