-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix: 🐛 use ECMAScript syntax to import ajv #19
fix: 🐛 use ECMAScript syntax to import ajv #19
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 will break unless the esModuleInterop
option in tsconfig is true
, and is only needed if "module": "es2015"
is specified. It needs to test the tsconfig that gets loaded and then choose between the two of them. Probably we should use the es6 style if esModuleInterop
is true
.
This change seems to work in all |
09dd978
to
19c84ca
Compare
I've added some tests that attempt to build the generated files with different module settings and all seem to pass. If, however, I revert back to using the |
You don't see to have tested the |
}); | ||
|
||
const buildProject = async (project: string) => { | ||
await exec(`cp tsconfig.${project}.json tsconfig.json`, {cwd: testDir}); |
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.
One problem I noticed is that typescript-json-validator
will pull from the project's tsconfig.json
file, even if the project was run with a different config file, IE, tsconfig.test.json
.
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.
Thanks for all the work on this. The tests now look really thorough which is excellent. I think it's nearly there.
src/template.ts
Outdated
export const IMPORT_AJV = `import Ajv = require('ajv');`; | ||
|
||
export const IMPORT_AJV = (): string => { | ||
const tsConfig = loadTsConfig(); |
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 we pass tsconfig
in as a parameter. It already gets loaded once in order to generate the json schema. We don't really want to load it again. That way you also won't need to default to process.cwd()
and it would be easier to add a --project
flag to explicitly select a tsconfig file.
🎉 This PR is included in version 2.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes: #17