Skip to content

Commit d3a1a91

Browse files
authored
Merge pull request #1150 from microsoftgraph/dev
main refresh
2 parents 89e4059 + c266dbb commit d3a1a91

10 files changed

+61
-25
lines changed

.azure-pipelines/generation-pipeline.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ resources:
8383
endpoint: microsoftgraph
8484
name: microsoftgraph/msgraph-sdk-typescript
8585
ref: dev
86+
- repository: msgraph-beta-sdk-typescript
87+
type: github
88+
endpoint: microsoftgraph
89+
name: microsoftgraph/msgraph-beta-sdk-typescript
90+
ref: main
8691
- repository: msgraph-sdk-python
8792
type: github
8893
endpoint: microsoftgraph
@@ -680,7 +685,36 @@ stages:
680685
- template: generation-templates/typescript-sdk.yml
681686
parameters:
682687
repoName: msgraph-sdk-typescript
683-
packageName: '@microsoft/msgraph-sdk-javascript'
688+
packageName: '@microsoft/msgraph-sdk'
689+
690+
- stage: stage_typescript_sdk_beta
691+
dependsOn:
692+
- stage_build_and_publish_kiota
693+
- stage_beta_openapi
694+
condition: |
695+
and
696+
(
697+
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
698+
in(dependencies.stage_beta_openapi.result, 'Succeeded', 'Skipped')
699+
)
700+
jobs:
701+
- job: typescript_sdk_beta
702+
steps:
703+
- template: generation-templates/language-generation-kiota.yml
704+
parameters:
705+
language: 'typescript'
706+
version: 'beta'
707+
repoName: 'msgraph-beta-sdk-typescript'
708+
branchName: $(betaBranch)
709+
targetClassName: "GraphBetaBaseServiceClient"
710+
targetNamespace: "github.com/microsoftgraph/msgraph-sdk-typescript/"
711+
customArguments: "-b -e '/me' -e '/me/**'" # Exclude me and enable backing store
712+
cleanMetadataFolder: $(cleanOpenAPIFolderBeta)
713+
languageSpecificSteps:
714+
- template: generation-templates/typescript-sdk.yml
715+
parameters:
716+
repoName: msgraph-beta-sdk-typescript
717+
packageName: '@microsoft/msgraph-beta-sdk'
684718

685719
- stage: stage_python_v1
686720
dependsOn:

.azure-pipelines/generation-templates/typescript-sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ parameters:
33
type: string
44
- name: packageName
55
type: string
6-
default: '@microsoft/msgraph-sdk-javascript'
6+
default: '@microsoft/msgraph-sdk'
77

88
steps:
99
- pwsh: '$(scriptsDirectory)/clean-typescript-files.ps1 -targetDirectory "$(Build.SourcesDirectory)/${{ parameters.repoName }}/packages/" -packageName "${{ parameters.packageName }}"'

GraphODataTemplateWriter.Test/GraphODataTemplateWriter.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
<ItemGroup>
1919
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
2020
<PackageReference Include="MSTest.TestAdapter">
21-
<Version>3.1.1</Version>
21+
<Version>3.2.0</Version>
2222
</PackageReference>
2323
<PackageReference Include="MSTest.TestFramework">
24-
<Version>3.1.1</Version>
24+
<Version>3.2.0</Version>
2525
</PackageReference>
2626
</ItemGroup>
2727
</Project>

scripts/clean-typescript-files.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ param (
33
[string]
44
$targetDirectory,
55
[string]
6-
$packageName = "@microsoft/msgraph-sdk-javascript"
6+
$packageName = "@microsoft/msgraph-sdk"
77
)
88
Push-Location $targetDirectory
99

@@ -13,15 +13,15 @@ $mainPackageDirectoryPath = Join-Path $targetDirectory -ChildPath $mainPackageDi
1313

1414
Push-Location $mainPackageDirectoryPath
1515
Get-ChildItem -Directory | ForEach-Object { Remove-Item -r $_.FullName }
16-
Remove-Item $kiotaLockFileName
16+
Remove-Item $kiotaLockFileName -ErrorAction SilentlyContinue -Verbose
1717
Pop-Location
1818

1919
$directories = Get-ChildItem -Directory -Exclude $mainPackageDirectoryName | Where-Object { -not($_.Name.EndsWith("-tests")) }
2020
foreach ($directory in $directories) {
2121
Push-Location $directory.FullName
2222
Get-ChildItem -Directory | ForEach-Object {Remove-Item -r $_.FullName}
2323
Remove-Item *.ts -Exclude "index.ts", "*ServiceClient.ts"
24-
Remove-Item $kiotaLockFileName
24+
Remove-Item $kiotaLockFileName -ErrorAction SilentlyContinue -Verbose
2525
Pop-Location
2626
}
2727
Pop-Location

scripts/copy-typescript-sdk-models.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ param (
66
[string]
77
$sourceDirectory,
88
[string]
9-
$packageName = "@microsoft/msgraph-sdk-javascript"
9+
$packageName = "@microsoft/msgraph-sdk"
1010
)
1111

1212
Write-Host "Path to repo models directory: $targetDirectory"

scripts/create-typescript-root-package.ps1

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
)
2019
Push-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])/"
2423
npx 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
)
7479
foreach($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

8185
foreach($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

8789
Pop-Location

scripts/fix-typescript-fluent-packages-imports.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ param (
33
[string]
44
$targetDirectory,
55
[string]
6-
$packageName = "@microsoft/msgraph-sdk-javascript"
6+
$packageName = "@microsoft/msgraph-sdk"
77
)
88
Push-Location $targetDirectory
99
if (Test-Path .\models) {

scripts/generate-open-api.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Write-Host $command
5757
try {
5858
Invoke-Expression "$command"
5959
# temporary fix for the server url https://github.com/microsoftgraph/msgraph-metadata/issues/124
60-
$content = get-content $outputFile
60+
$content = Get-Content $outputFile -Raw
6161
$updatedContent = $content -replace "http://localhost", "https://graph.microsoft.com/$endpointVersion"
6262
Set-Content $outputFile $updatedContent -NoNewline
6363
if(Test-Path $oldOutputFile)

scripts/generate-typescript.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ param (
99
[string]
1010
$targetDirectory,
1111
[string]
12-
$packageName = "@microsoft/msgraph-sdk-javascript",
12+
$packageName = "@microsoft/msgraph-sdk",
1313
[string]
1414
$kiotaPath = "kiota",
1515
[string]
@@ -25,9 +25,9 @@ $rootSegments = Get-ChildItem -Directory -Exclude $modelsPackageDirectoryName -P
2525
foreach($rootSegment in $rootSegments) {
2626
$fluentAPIPackageDirectoryPath = "$targetDirectory/$modelsPackageDirectoryName-$rootSegment"
2727
Write-Host "generating segment $rootSegment"
28-
Invoke-Expression "$kiotaPath generate -o $fluentAPIPackageDirectoryPath -d $descriptionPath -c $($rootSegment.Substring(0,1).ToUpper() + $rootSegment.Substring(1))ServiceClient -l TypeScript -n github.com/microsoftgraph/msgraph-sdk-typescript/ -e '/me' -e '/me/**' -i '/$rootSegment' -i '/$rootSegment/**'$additionalArguments"
29-
.\scripts\fix-typescript-fluent-packages-imports.ps1 -targetDirectory $fluentAPIPackageDirectoryPath -packageName $packageName
28+
Invoke-Expression "$kiotaPath generate -o $fluentAPIPackageDirectoryPath -d $descriptionPath -c $($rootSegment.Substring(0,1).ToUpper() + $rootSegment.Substring(1))ServiceClient -l TypeScript -n github.com/microsoftgraph/msgraph-sdk-typescript/ -e '/me' -e '/me/**' -i '/$rootSegment' -i '/$rootSegment/**' $additionalArguments"
29+
Invoke-Expression "$PSScriptRoot\fix-typescript-fluent-packages-imports.ps1 -targetDirectory '$fluentAPIPackageDirectoryPath' -packageName '$packageName'"
3030
}
3131
$modelsPackagePath = "$targetDirectory/$modelsPackageDirectoryName"
3232
Invoke-Expression "$kiotaPath generate -o $modelsPackagePath -d $descriptionPath -c $clientName -l TypeScript -n github.com/microsoftgraph/msgraph-sdk-typescript/ -e '/me' -e '/me/**' $additionalArguments"
33-
.\scripts\remove-typescript-fluent-api-from-main-package.ps1 -targetDirectory $modelsPackagePath
33+
Invoke-Expression "$PSScriptRoot\remove-typescript-fluent-api-from-main-package.ps1 -targetDirectory '$modelsPackagePath'"

scripts/remove-typescript-fluent-api-from-main-package.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ param (
44
$targetDirectory
55
)
66
Push-Location $targetDirectory
7-
Remove-Item *.ts -Verbose -Exclude "index.ts", "graphServiceClient.ts"
7+
Remove-Item *.ts -Verbose -Exclude "index.ts", "graphServiceClient.ts", "graphBetaServiceClient.ts"
88
Get-ChildItem -Directory -Exclude models | ForEach-Object {Remove-Item -r $_.FullName}
99
Pop-Location

0 commit comments

Comments
 (0)