@@ -11,14 +11,13 @@ param (
1111 [Parameter (Mandatory = $true )]
1212 [string ]
1313 $targetDirectory ,
14- [Parameter (Mandatory = $true )]
1514 [string ]
1615 $sourcePathSegment = " appCatalogs" ,
1716 [string ]
18- $packageName = " @microsoft/msgraph-sdk-javascript "
17+ $packageName = " @microsoft/msgraph-sdk"
1918)
2019Push-Location $targetDirectory
21- $finalPackageName = " $packageName -$rootPathSegment "
20+ $finalPackageName = " $packageName -$ ( $ rootPathSegment.Substring ( 0 , 1 ).ToLower() ) $ ( $rootPathSegment .Substring ( 1 ) ) "
2221$sourceLocation = " packages/$ ( $packageName.Split (' /' )[1 ]) -$sourcePathSegment /"
2322$targetLocation = " packages/$ ( $finalPackageName.Split (' /' )[1 ]) /"
2423npx lerna create $finalPackageName -- yes
@@ -47,11 +46,17 @@ foreach($directory in $directoriesToRemove) {
4746 Remove-Item - r " $targetLocation /$directory "
4847}
4948
49+ $indexFilePath = Join-Path $targetLocation - ChildPath " index.ts"
50+ $indexFileContent = Get-Content $indexFilePath - Raw
51+ $indexFileContent = $indexFileContent.Replace ($sourcePathSegment , $rootPathSegment ).Replace(" $ ( $sourcePathSegment.Substring (0 , 1 ).ToUpper()) $ ( $sourcePathSegment.Substring (1 )) " , " $ ( $rootPathSegment.Substring (0 , 1 ).ToUpper()) $ ( $rootPathSegment.Substring (1 )) " )
52+ $indexFileContent | Set-Content $indexFilePath - NoNewLine
53+
5054$sourcePackageJson = Get-Content - Raw " $sourceLocation /package.json" | ConvertFrom-Json
5155$targetPackageJson = Get-Content - Raw " $targetLocation /package.json" | ConvertFrom-Json
5256$targetPackageJson = $targetPackageJson | Select-Object - ExcludeProperty " directories" , " files"
53- $targetPackageJson.description = $sourcePackageJson.description
54- $targetPackageJson.keywords = $sourcePackageJson.keywords
57+ $targetPackageJson.author = " Microsoft <[email protected] >" 58+ $targetPackageJson.description = " $ ( $rootPathSegment.Substring (0 , 1 ).ToUpper()) $ ( $rootPathSegment.Substring (1 )) fluent API for Microsoft Graph"
59+ $targetPackageJson.keywords = @ (" Microsoft" , " Graph" , " msgraph" , " API" , " SDK" , $rootPathSegment )
5560$targetPackageJson.license = $sourcePackageJson.license
5661$targetPackageJson.main = $sourcePackageJson.main
5762$targetPackageJson.name = $finalPackageName.ToLower () # doing this here to the directory name follows the original name casing
@@ -72,16 +77,13 @@ $dependencies = @(
7277 " @microsoft/kiota-serialization-text"
7378)
7479foreach ($dependency in $dependencies ) {
75- npm i $dependency - w $finalPackageName - S
76- npm i $dependency - w $finalPackageName - S
80+ npm i - S $dependency - w $finalPackageName.ToLower ()
7781}
7882
7983$devDependencies = @ (" typescript" )
8084
8185foreach ($dependency in $devDependencies ) {
82- npm i $dependency - w $finalPackageName - D
83- npm i $dependency - w $finalPackageName - D
86+ npm i - D $dependency - w $finalPackageName.ToLower ()
8487}
85- # doing it twice otherwise the dependency is not saved for som reason
8688
8789Pop-Location
0 commit comments