-
Notifications
You must be signed in to change notification settings - Fork 54
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
Resolve config from extends package #781
Resolve config from extends package #781
Conversation
import SilentError from 'silent-error'; | ||
import { GlintConfig } from './config.js'; | ||
import { GlintConfigInput } from '@glint/core/config-types'; | ||
import type * as TS from 'typescript'; | ||
|
||
const require = createRequire(import.meta.url); | ||
export const require = createRequire(import.meta.url); |
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 export this?
conventionally, we really only want to use createRequire in the file it's used in, since the resolution rules are specific to the import.meta.url
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.
ah, it's for mocking in tests.
can you add a block-comment with something like:
/**
* @private
*
* Only exported for testing purposes. Do not import.
*/
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.
Done
JSON.stringify({ | ||
extends: '@package1/tsconfig.json', | ||
glint: { | ||
environment: '../local-env', |
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.
what's local-env?
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.
To be honest, I simply followed the example from the previous test which uses a predefined environment in the beforeEach
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 is looking good -- left some questions.
Also, would you be willing to PR this to the main branch as well?
Definitely, I will create a PR against the main branch |
PR Created |
@NullVoxPopuli @wagenet It looks like the two jobs that didn't go so well also had problems in the 1.5.0 release. |
try { | ||
currentPath = require.resolve(currentContents.extends); | ||
} catch (error) { | ||
// control the exception, do nothing. |
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.
Should we log the error?
Or log some message? Could be goofy to debug otherwise?
What's the error thrown here?
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.
If I log anything this test and others will fail
Please refer to the image below that shows the error being displayed.
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.
ahh ok. thanks!
thanks for this! do you want to make the same changes on main as well? |
Yep, let's make sure that the exception is not propagated. |
Resolve glint configuration when your tsconfig.json extends from a package, ex
path: tsconfig.json
path: node_modules/@package1/tsconfig.json
Note: I'm uncertain if this is the correct branch to merge with. If it isn't, please let me know.