-
Notifications
You must be signed in to change notification settings - Fork 11
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: Add compiler option to read project's tsconfig file #51
base: master
Are you sure you want to change the base?
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.
This PR is very important. I'm approving but I left a list of comments, so please answer them if possible. Thank you so much for this work.
@@ -29,10 +31,16 @@ export class TypescriptCompiler { | |||
private readonly ts: TypeScript, | |||
private readonly appValidator: AppsEngineValidator, | |||
) { | |||
this.compilerOptions = { | |||
// Things we shouldn't allow the app dev changing | |||
this.nonConfigurableCompilerOptions = { |
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.
Why not? Is there a reason for this options to be hardcoded?
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.
Because these options affect the output of the compilation, and that's up to the host system to decide, not the app developer
const dirents = await fs.readdir(directory, { withFileTypes: true }); | ||
const dirsToIgnore = projectExcludes.concat(['node_modules', '.git']); |
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.
Can this be included in app.json file? Also, can we add files here too?
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.
That's what the projectExcludes
parameter is for
const a = JSON.parse(tsconfigFile.toString()) as TSConfig; | ||
return a; | ||
} catch { | ||
logger.warn('Invalid tsconfig.json file - ignoring'); |
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.
Please, let's not ignore the file if it throws any error.
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.
We need to ignore the tsconfig file if it is invalid, we can't risk breaking backward compatibility
hi @d-gubert, may I ask why u stop working on this ticket? |
Adding a new option for the AppsCompiler to read and use
compilerOptions
from thetsconfig.json
file inside the app's root folder.The default behavior is to not use the file - it is opt-in. This is because, since the compiler never used the settings from that file, some config might cause compilation errors that never occured before.
The CLI will handle the addition of this option
ARCH-1143