-
Notifications
You must be signed in to change notification settings - Fork 75
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
[RLC] Hybrid codegen #2338
[RLC] Hybrid codegen #2338
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.
left some small and probably naive comments :)
packages/typespec-test/test/openai/generated/typespec-ts/package.json
Outdated
Show resolved
Hide resolved
"disableDocsMs": true, | ||
"apiRefLink": "https://docs.microsoft.com/javascript/api/@msinternal/openai?view=azure-node-preview" | ||
} | ||
}, | ||
"tshy": { |
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.
Is there a reason why we're not doing browser builds as part of RLC generation?
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 think it's because RLC types is meaningless as they are just generated for better user experience ?
"disableDocsMs": true, | ||
"apiRefLink": "https://docs.microsoft.com/javascript/api/@msinternal/openai?view=azure-node-preview" | ||
} | ||
}, | ||
"tshy": { |
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 think it's because RLC types is meaningless as they are just generated for better user experience ?
packages/rlc-common/src/metadata/packageJson/azurePackageCommon.ts
Outdated
Show resolved
Hide resolved
c3dc479
to
844fb1d
Compare
|
||
if (model.options?.moduleKind === "cjs") { | ||
mainEntryPointFilePath = `./types${ | ||
generateTest || isModularLibrary ? "/src" : "" |
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 don't need to consider the generateSample here?
model.options || {}; | ||
const project = new Project(); | ||
|
||
let mainEntryPointFilePath = "./dist/esm/index.d.ts"; |
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 am trying to understand if it's esm, we don't really need to compile the samples and tests? so does the cjs compile result? I mean in 'dist/commonjs' folder
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.
LGTM, just some minor comments
"apiRefLink": "https://docs.microsoft.com/javascript/api/@msinternal/ai-anomaly-detector?view=azure-node-preview" | ||
} | ||
"main": "./dist/commonjs/index.js", | ||
"types": "./dist/commonjs/index.d.ts" |
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.
Does that mean we will build types in both cjs and esm? Both of them are the extract same definitions?
}, | ||
"import": { | ||
"types": "./dist/esm/index.d.ts", | ||
"default": "./dist/esm/index.js" |
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.
Could you help me understand the dist structure here? How do we organize sample and test build codes? Will it be like:
dist/
├─ esm/
│ ├─ test/
│ ├─ samples-dev/
│ ├─ src?/
│ ├─ index.d.ts/ (whoes index file? src/sample/test?)
│ ├─ index.js/
.....
"./src/**/*.ts", | ||
"./src/**/*.mts", | ||
"./src/**/*.cts", | ||
"test/**/*.ts" |
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.
the test folder may not be always there? e.g if customers disable the test gen or in non-branded we disable test gen by default?
"include": ${ | ||
options.isAzureSdkForJs | ||
? `["dist-test/browser/**/*.spec.js"]` | ||
: `["test/**/*.spec.ts"]` |
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 may not get the point that we need to distugsh with isAzureSdkForJs
option with diff path?
beforeEach(async function (this: Context) { | ||
recorder = await createRecorder(this); | ||
beforeEach(async function () { | ||
// recorder = await createRecorder(this); |
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.
Does that mean the recorder is not working yet? if yes can we release this change?
} = getAutorestOptions(); | ||
const options: RLCOptions = {}; | ||
const options: RLCOptions = { moduleKind: "cjs" }; |
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'd like to clarify some details, there are two main changes
- changed to esm
- upgrade our build/test dependencies and steps
Are the two changes coupled with each other? Will the HLC need to adopt this? I mean if HLC won't adopt, can old code run correctly in SDK repo?
}, | ||
"react-native": { | ||
"types": "./dist/react-native/index.d.ts", | ||
"default": "./dist/react-native/index.js" |
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.
interesting, should the cjs code be the same as browser one after building?
another detail to confirm is that the replacement logic will be still working, right?
Scoped to TypeSpec generation. Autorest generation should remain the same