File tree Expand file tree Collapse file tree 4 files changed +33
-13
lines changed
autorest.typescript/src/generators/static Expand file tree Collapse file tree 4 files changed +33
-13
lines changed Original file line number Diff line number Diff line change 44import { Project } from "ts-morph" ;
55import { getAutorestOptions } from "../../autorestSession" ;
66
7- const highLevelTsBrowserConfig : Record < string , any > = {
8- "extends" : [
9- "./tsconfig.test.json" ,
10- "../../../tsconfig.browser.base.json"
11- ]
12- } ;
13-
147export function generateTsBrowserConfig ( project : Project ) {
158 const {
9+ packageDetails,
1610 generateMetadata,
1711 } = getAutorestOptions ( ) ;
1812
1913 if ( ! generateMetadata ) {
2014 return ;
2115 }
16+
17+ const highLevelTsBrowserConfig : Record < string , any > = {
18+ "extends" : "../../../tsconfig.browser.base.json" ,
19+ "compilerOptions" : {
20+ "paths" : {
21+ [ packageDetails . name ] : [ "./dist/browser/index.d.ts" ] ,
22+ [ `${ packageDetails . name } /*` ] : [ "./dist/browser/*" ] ,
23+ "$internal/*" : [ "./dist/browser/*" ]
24+ }
25+ }
26+ } ;
27+
2228 project . createSourceFile ( "tsconfig.browser.config.json" , JSON . stringify ( highLevelTsBrowserConfig ) , {
2329 overwrite : true
2430 } ) ;
Original file line number Diff line number Diff line change 33
44import { Project } from "ts-morph" ;
55import { RLCModel } from "../interfaces.js" ;
6+ import { getPackageName } from "./utils.js" ;
67
78export function buildTsTestBrowserConfig ( model : RLCModel ) {
89 const isAzureSdkForJs = model . options ?. azureSdkForJs ?? false ;
@@ -16,9 +17,17 @@ export function buildTsTestBrowserConfig(model: RLCModel) {
1617
1718 const filePath = "tsconfig.browser.config.json" ;
1819 const project = new Project ( ) ;
20+ const name = getPackageName ( model ) ;
1921
20- const content = {
21- extends : [ "./tsconfig.test.json" , "../../../tsconfig.browser.base.json" ]
22+ const content : Record < string , any > = {
23+ extends : "../../../tsconfig.browser.base.json" ,
24+ compilerOptions : {
25+ paths : {
26+ [ name ] : [ "./dist/browser/index.d.ts" ] ,
27+ [ `${ name } /*` ] : [ "./dist/browser/*" ] ,
28+ "$internal/*" : [ "./dist/browser/*" ]
29+ }
30+ }
2231 } ;
2332
2433 const configFile = project . createSourceFile (
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { buildAzureMonorepoPackage } from "./packageJson/buildAzureMonorepoPacka
1515import { buildAzureStandalonePackage } from "./packageJson/buildAzureStandalonePackage.js" ;
1616import { buildFlavorlessPackage } from "./packageJson/buildFlavorlessPackage.js" ;
1717import { getRelativePartFromSrcPath } from "../helpers/pathUtils.js" ;
18+ import { getPackageName } from "./utils.js" ;
1819
1920interface PackageFileOptions {
2021 exports ?: Record < string , any > ;
@@ -141,10 +142,6 @@ function getDescription(model: RLCModel): string {
141142 return description ;
142143}
143144
144- function getPackageName ( model : RLCModel ) : string {
145- return model . options ?. packageDetails ?. name ?? model . libraryName ;
146- }
147-
148145function getClientFilePath ( model : RLCModel ) {
149146 const { srcPath } = model ;
150147 const sdkReletivePart = getRelativePartFromSrcPath ( srcPath ) ;
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation.
2+ // Licensed under the MIT License.
3+
4+ import { RLCModel } from "../interfaces.js" ;
5+
6+ export function getPackageName ( model : RLCModel ) : string {
7+ return model . options ?. packageDetails ?. name ?? model . libraryName ;
8+ }
You can’t perform that action at this time.
0 commit comments