Skip to content

Commit 89e4059

Browse files
irvinesundaydependabot[bot]baywetandrueastman
authored
Merges dev into main (#1143)
* Bump submodules/vipr from `6fdc76e` to `b03ce4e` Bumps [submodules/vipr](https://github.com/microsoft/vipr) from `6fdc76e` to `b03ce4e`. - [Release notes](https://github.com/microsoft/vipr/releases) - [Commits](microsoft/Vipr@6fdc76e...b03ce4e) --- updated-dependencies: - dependency-name: submodules/vipr dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Bump submodules/vipr from `b03ce4e` to `33fcde1` Bumps [submodules/vipr](https://github.com/microsoft/vipr) from `b03ce4e` to `33fcde1`. - [Release notes](https://github.com/microsoft/vipr/releases) - [Commits](microsoft/Vipr@b03ce4e...33fcde1) --- updated-dependencies: - dependency-name: submodules/vipr dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Bump NLog from 5.2.7 to 5.2.8 Bumps [NLog](https://github.com/NLog/NLog) from 5.2.7 to 5.2.8. - [Release notes](https://github.com/NLog/NLog/releases) - [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md) - [Commits](NLog/NLog@v5.2.7...v5.2.8) --- updated-dependencies: - dependency-name: NLog dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump submodules/vipr from `33fcde1` to `2d1dd83` Bumps [submodules/vipr](https://github.com/microsoft/vipr) from `33fcde1` to `2d1dd83`. - [Release notes](https://github.com/microsoft/vipr/releases) - [Commits](microsoft/Vipr@33fcde1...2d1dd83) --- updated-dependencies: - dependency-name: submodules/vipr dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Bump submodules/vipr from `2d1dd83` to `a791736` Bumps [submodules/vipr](https://github.com/microsoft/vipr) from `2d1dd83` to `a791736`. - [Release notes](https://github.com/microsoft/vipr/releases) - [Commits](microsoft/Vipr@2d1dd83...a791736) --- updated-dependencies: - dependency-name: submodules/vipr dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Bump Microsoft.Extensions.Configuration.Binder from 8.0.0 to 8.0.1 Bumps [Microsoft.Extensions.Configuration.Binder](https://github.com/dotnet/runtime) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](dotnet/runtime@v8.0.0...v8.0.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Configuration.Binder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump submodules/vipr from `a791736` to `3ac51b4` Bumps [submodules/vipr](https://github.com/microsoft/vipr) from `a791736` to `3ac51b4`. - [Release notes](https://github.com/microsoft/vipr/releases) - [Commits](microsoft/Vipr@a791736...3ac51b4) --- updated-dependencies: - dependency-name: submodules/vipr dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Bump apidoctor from `9d9914c` to `443405b` Bumps [apidoctor](https://github.com/OneDrive/apidoctor) from `9d9914c` to `443405b`. - [Commits](OneDrive/apidoctor@9d9914c...443405b) --- updated-dependencies: - dependency-name: apidoctor dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Bump submodules/vipr from `3ac51b4` to `3a66e16` Bumps [submodules/vipr](https://github.com/microsoft/vipr) from `3ac51b4` to `3a66e16`. - [Release notes](https://github.com/microsoft/vipr/releases) - [Commits](microsoft/Vipr@3ac51b4...3a66e16) --- updated-dependencies: - dependency-name: submodules/vipr dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Switch v1.0 metadata source to use local file in metadata repo. (#1140) * - initial script drafts Signed-off-by: Vincent Biret <[email protected]> * - avoids nuking the modular augmentation Signed-off-by: Vincent Biret <[email protected]> * - makes package name configurable for the script Signed-off-by: Vincent Biret <[email protected]> * - adds exception for the service client Signed-off-by: Vincent Biret <[email protected]> * - fixes import path Signed-off-by: Vincent Biret <[email protected]> * - adds a root segments list for v1 Signed-off-by: Vincent Biret <[email protected]> * - drafts a script to create all fluent api packages in typescript Signed-off-by: Vincent Biret <[email protected]> * - drafts a script to generate typescript service libs Signed-off-by: Vincent Biret <[email protected]> * - adds templating of the modular augmentation Signed-off-by: Vincent Biret <[email protected]> * - adds generation of the main models package Signed-off-by: Vincent Biret <[email protected]> * - fixes client name Signed-off-by: Vincent Biret <[email protected]> * - fixes new lines being inserted by set content Signed-off-by: Vincent Biret <[email protected]> * - fixes kiota call from ts generation script Signed-off-by: Vincent Biret <[email protected]> * - switches to parallel foreach for typescript generation Signed-off-by: Vincent Biret <[email protected]> * - fixes a bug with models generation Signed-off-by: Vincent Biret <[email protected]> * - disables hint mode for generation Signed-off-by: Vincent Biret <[email protected]> * - updates clean typescript script for new structure Signed-off-by: Vincent Biret <[email protected]> * - updates copy script for typescript SDK Signed-off-by: Vincent Biret <[email protected]> * - reverts change to variables as it doesn't work for steps templates Signed-off-by: Vincent Biret <[email protected]> * - fixes push of extra and unnecessary validation files Signed-off-by: Vincent Biret <[email protected]> * - adds the ability to skip openapi capture * - updates condition when skipping OpenAPI capture Signed-off-by: Vincent Biret <[email protected]> * - replicates skip generation changes for kiota Signed-off-by: Vincent Biret <[email protected]> * - adds a move step when not capturing openapi metadata Signed-off-by: Vincent Biret <[email protected]> * - thank you copilot for inserting things I didn't want Signed-off-by: Vincent Biret <[email protected]> * - removes redundant validation Signed-off-by: Vincent Biret <[email protected]> * - fixes models cleanup scritp for typescript * - fixes path to dependant script Signed-off-by: Vincent Biret <[email protected]> * - fixes variable reference Signed-off-by: Vincent Biret <[email protected]> * - fixes imports replacements Signed-off-by: Vincent Biret <[email protected]> * - removes temporary files * - avoids removing service clients during ts cleanup Signed-off-by: Vincent Biret <[email protected]> * - normalizes the package name according to npm conventions Signed-off-by: Vincent Biret <[email protected]> * - excludes tests package from copy and cleanup Signed-off-by: Vincent Biret <[email protected]> * - updates scaffolding script to install live packages Signed-off-by: Vincent Biret <[email protected]> * - removes extraneous depeendency Signed-off-by: Vincent Biret <[email protected]> * - reverts suppression since the original script was fixed Signed-off-by: Vincent Biret <[email protected]> * - typo fix Signed-off-by: Vincent Biret <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Vincent Biret <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vincent Biret <[email protected]> Co-authored-by: Eastman <[email protected]>
1 parent 0b2bc75 commit 89e4059

16 files changed

+261
-52
lines changed

.azure-pipelines/generation-pipeline.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ parameters:
132132
displayName: Skip metadata capture and clean
133133
type: boolean
134134

135+
- name: skipOpenApiCaptureAndClean
136+
default: false
137+
displayName: Skip OpenAPI capture and clean
138+
type: boolean
139+
135140
- name: publishChanges
136141
default: true
137142
type: boolean
@@ -159,7 +164,7 @@ variables:
159164
cleanOpenAPIFolderBeta: 'clean_beta_openapi'
160165
cleanOpenAPIFolderV1: 'clean_v10_openapi'
161166
rawMetadataFileBeta: '$(Build.SourcesDirectory)/msgraph-metadata/schemas/beta-Prod.csdl'
162-
rawMetadataFileV1: 'https://graph.microsoft.com/v1.0/$metadata' # We want to run against the metadata we have captured.
167+
rawMetadataFileV1: '$(Build.SourcesDirectory)/msgraph-metadata/schemas/v1.0-Prod.csdl'
163168
typewriterDirectory: '$(Build.SourcesDirectory)/typewriter'
164169
kiotaDirectory: '$(Build.SourcesDirectory)/kiota'
165170
typewriterExecutable: '$(typewriterDirectory)/Typewriter'
@@ -174,6 +179,7 @@ variables:
174179
publishChanges: ${{ parameters.publishChanges }}
175180
overrideSkipCI: ${{ parameters.overrideSkipCI }}
176181
skipMetadataCaptureAndClean: ${{ parameters.skipMetadataCaptureAndClean }}
182+
skipOpenApiCaptureAndClean: ${{ parameters.skipOpenApiCaptureAndClean }}
177183
phpVersion: 7.2
178184

179185
# This stage is the core dependency for all other stages.
@@ -233,7 +239,7 @@ stages:
233239

234240
- stage: stage_v1_openapi
235241
dependsOn: stage_v1_metadata
236-
condition: in(dependencies.stage_v1_metadata.result, 'Succeeded', 'Skipped')
242+
condition: and(in(dependencies.stage_v1_metadata.result, 'Succeeded', 'Skipped'), eq( ${{ parameters.skipOpenApiCaptureAndClean }}, false))
237243
jobs:
238244
- template: generation-templates/capture-openapi.yml
239245
parameters:
@@ -243,7 +249,7 @@ stages:
243249

244250
- stage: stage_beta_openapi
245251
dependsOn: stage_beta_metadata
246-
condition: in(dependencies.stage_beta_metadata.result, 'Succeeded', 'Skipped')
252+
condition: and(in(dependencies.stage_beta_metadata.result, 'Succeeded', 'Skipped'), eq( ${{ parameters.skipOpenApiCaptureAndClean }}, false))
247253
jobs:
248254
- template: generation-templates/capture-openapi.yml
249255
parameters:
@@ -259,7 +265,7 @@ stages:
259265
and
260266
(
261267
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
262-
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
268+
in(dependencies.stage_v1_openapi.result, 'Succeeded', 'Skipped')
263269
)
264270
jobs:
265271
- job: csharp_v1_kiota
@@ -288,7 +294,7 @@ stages:
288294
and
289295
(
290296
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
291-
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
297+
in(dependencies.stage_beta_openapi.result, 'Succeeded', 'Skipped')
292298
)
293299
jobs:
294300
- job: csharp_beta_kiota
@@ -317,7 +323,7 @@ stages:
317323
and
318324
(
319325
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
320-
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
326+
in(dependencies.stage_v1_openapi.result, 'Succeeded', 'Skipped')
321327
)
322328
jobs:
323329
- job: go_v1
@@ -345,7 +351,7 @@ stages:
345351
and
346352
(
347353
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
348-
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
354+
in(dependencies.stage_beta_openapi.result, 'Succeeded', 'Skipped')
349355
)
350356
jobs:
351357
- job: go_beta
@@ -373,7 +379,7 @@ stages:
373379
and
374380
(
375381
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
376-
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
382+
in(dependencies.stage_v1_openapi.result, 'Succeeded', 'Skipped')
377383
)
378384
jobs:
379385
- job: ruby_v1
@@ -402,7 +408,7 @@ stages:
402408
and
403409
(
404410
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
405-
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
411+
in(dependencies.stage_beta_openapi.result, 'Succeeded', 'Skipped')
406412
)
407413
jobs:
408414
- job: ruby_beta
@@ -484,7 +490,7 @@ stages:
484490
and
485491
(
486492
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
487-
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
493+
in(dependencies.stage_v1_openapi.result, 'Succeeded', 'Skipped')
488494
)
489495
jobs:
490496
- job: java_v1_kiota
@@ -514,7 +520,7 @@ stages:
514520
and
515521
(
516522
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
517-
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
523+
in(dependencies.stage_beta_openapi.result, 'Succeeded', 'Skipped')
518524
)
519525
jobs:
520526
- job: java_beta_kiota
@@ -545,7 +551,7 @@ stages:
545551
and
546552
(
547553
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
548-
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
554+
in(dependencies.stage_beta_openapi.result, 'Succeeded', 'Skipped')
549555
)
550556
jobs:
551557
- job: php_beta_kiota
@@ -574,7 +580,7 @@ stages:
574580
and
575581
(
576582
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
577-
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
583+
in(dependencies.stage_v1_openapi.result, 'Succeeded', 'Skipped')
578584
)
579585
jobs:
580586
- job: php_v1_kiota
@@ -655,7 +661,7 @@ stages:
655661
and
656662
(
657663
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
658-
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
664+
in(dependencies.stage_v1_openapi.result, 'Succeeded', 'Skipped')
659665
)
660666
jobs:
661667
- job: typescript_sdk_v1
@@ -668,12 +674,13 @@ stages:
668674
branchName: $(v1Branch)
669675
targetClassName: "GraphBaseServiceClient"
670676
targetNamespace: "github.com/microsoftgraph/msgraph-sdk-typescript/"
671-
customArguments: "-e '/me' -e '/me/**'" # Exclude me
677+
customArguments: "-b -e '/me' -e '/me/**'" # Exclude me and enable backing store
672678
cleanMetadataFolder: $(cleanOpenAPIFolderV1)
673679
languageSpecificSteps:
674680
- template: generation-templates/typescript-sdk.yml
675681
parameters:
676682
repoName: msgraph-sdk-typescript
683+
packageName: '@microsoft/msgraph-sdk-javascript'
677684

678685
- stage: stage_python_v1
679686
dependsOn:
@@ -683,7 +690,7 @@ stages:
683690
and
684691
(
685692
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
686-
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
693+
in(dependencies.stage_v1_openapi.result, 'Succeeded', 'Skipped')
687694
)
688695
jobs:
689696
- job: python_v1
@@ -712,7 +719,7 @@ stages:
712719
and
713720
(
714721
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
715-
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
722+
in(dependencies.stage_beta_openapi.result, 'Succeeded', 'Skipped')
716723
)
717724
jobs:
718725
- job: python_beta
@@ -741,7 +748,7 @@ stages:
741748
and
742749
(
743750
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
744-
eq(dependencies.stage_v1_openapi.result, 'Succeeded')
751+
in(dependencies.stage_v1_openapi.result, 'Succeeded', 'Skipped')
745752
)
746753
jobs:
747754
- job: cli_v1_kiota
@@ -771,7 +778,7 @@ stages:
771778
and
772779
(
773780
eq(dependencies.stage_build_and_publish_kiota.result, 'Succeeded'),
774-
eq(dependencies.stage_beta_openapi.result, 'Succeeded')
781+
in(dependencies.stage_beta_openapi.result, 'Succeeded', 'Skipped')
775782
)
776783
jobs:
777784
- job: cli_beta_kiota

.azure-pipelines/generation-templates/set-up-for-generation-kiota.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,31 @@ steps:
1414
version: '8.x' # Kiota is a NET8 app
1515
- ${{ parameters.downloadSteps }}
1616

17-
#Download the openAPI artifacts
17+
# checkout metadata repo if capture and clean step is skipped
18+
- checkout: msgraph-metadata
19+
displayName: checkout metadata
20+
fetchDepth: 1
21+
persistCredentials: true
22+
submodules: recursive
23+
condition: or(eq(variables.skipMetadataCaptureAndClean, true), eq(variables.skipOpenApiCaptureAndClean, true))
24+
25+
- pwsh: |
26+
md $(Build.SourcesDirectory)/msgraph-metadata/clean_v10_openapi
27+
md $(Build.SourcesDirectory)/msgraph-metadata/clean_beta_openapi
28+
Move-Item -Path $(Build.SourcesDirectory)/msgraph-metadata/openapi/v1.0/openapi.yaml -Destination $(Build.SourcesDirectory)/msgraph-metadata/clean_v10_openapi/
29+
Move-Item -Path $(Build.SourcesDirectory)/msgraph-metadata/openapi/beta/openapi.yaml -Destination $(Build.SourcesDirectory)/msgraph-metadata/clean_beta_openapi/
30+
displayName: Move metadata to expected location
31+
condition: or(eq(variables.skipMetadataCaptureAndClean, true), eq(variables.skipOpenApiCaptureAndClean, true))
32+
33+
# if capture and clean step is not skipped
34+
# then download the artifact from capture and clean steps
35+
# follow the same folder structure as msgraph-metadata repo
36+
# so that metadata reference path is always the same
1837
- task: DownloadBuildArtifacts@0
1938
inputs:
2039
buildType: 'current'
2140
downloadType: 'single'
2241
artifactName: ${{ parameters.cleanMetadataFolder }}
2342
downloadPath: '$(Build.SourcesDirectory)/msgraph-metadata'
43+
condition: and(eq(variables.skipMetadataCaptureAndClean, false), eq(variables.skipOpenApiCaptureAndClean, false))
2444
displayName: Downloading metadata from artifacts

.azure-pipelines/generation-templates/set-up-for-generation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ steps:
1818
fetchDepth: 1
1919
persistCredentials: true
2020
submodules: recursive
21-
condition: eq(variables.skipMetadataCaptureAndClean, true)
21+
condition: or(eq(variables.skipMetadataCaptureAndClean, true), eq(variables.skipOpenApiCaptureAndClean, true))
2222

2323
# if capture and clean step is not skipped
2424
# then download the artifact from capture and clean steps
@@ -30,5 +30,5 @@ steps:
3030
downloadType: 'single'
3131
artifactName: ${{ parameters.cleanMetadataFolder }}
3232
downloadPath: '$(Build.SourcesDirectory)/msgraph-metadata'
33-
condition: eq(variables.skipMetadataCaptureAndClean, false)
33+
condition: and(eq(variables.skipMetadataCaptureAndClean, false), eq(variables.skipOpenApiCaptureAndClean, false))
3434
displayName: Downloading metadata from artifacts

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
parameters:
22
- name: repoName
33
type: string
4+
- name: packageName
5+
type: string
6+
default: '@microsoft/msgraph-sdk-javascript'
47

58
steps:
6-
- pwsh: '$(scriptsDirectory)/clean-typescript-files.ps1'
7-
displayName: 'Remove generated models and requests from the repo src folder'
8-
env:
9-
MainDirectory: '$(Build.SourcesDirectory)/${{ parameters.repoName }}/src/'
9+
- pwsh: '$(scriptsDirectory)/clean-typescript-files.ps1 -targetDirectory "$(Build.SourcesDirectory)/${{ parameters.repoName }}/packages/" -packageName "${{ parameters.packageName }}"'
10+
displayName: 'Remove generated models and requests from the repo folder'
1011

11-
- pwsh: '$(scriptsDirectory)/copy-typescript-sdk-models.ps1'
12+
- pwsh: '$(scriptsDirectory)/copy-typescript-sdk-models.ps1 -sourceDirectory "$(kiotaDirectory)/output/" -targetDirectory "$(Build.SourcesDirectory)/${{ parameters.repoName }}/packages/" -packageName "${{ parameters.packageName }}"'
1213
displayName: 'Update models'
13-
env:
14-
BuildConfiguration: $(buildConfiguration)
15-
OutputFullPath: $(kiotaDirectory)/output/*
16-
RepoModelsDir: '$(Build.SourcesDirectory)/${{ parameters.repoName }}/src/'
1714

1815
- pwsh : $(Build.SourcesDirectory)/${{ parameters.repoName }}/scripts/incrementMinorVersion.ps1
1916
displayName: 'Increment minor version number'

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cSpell.words": [
3+
"msgraph",
4+
"pwsh"
5+
]
6+
}

scripts/clean-typescript-files.ps1

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1-
$directories = Get-ChildItem -Path $env:MainDirectory -Directory -Exclude @("graphclient")
2-
foreach ($directory in $directories) {
3-
Remove-Item -Path $directory.FullName -Recurse -Force -Verbose
4-
}
1+
param (
2+
[Parameter(Mandatory = $true)]
3+
[string]
4+
$targetDirectory,
5+
[string]
6+
$packageName = "@microsoft/msgraph-sdk-javascript"
7+
)
8+
Push-Location $targetDirectory
59

6-
$files = Get-ChildItem -Path $env:MainDirectory -File -Filter "*.ts"
7-
foreach ($file in $files) {
8-
Remove-Item -Path $file.FullName -Force
9-
}
10+
$kiotaLockFileName = "kiota-lock.json"
11+
$mainPackageDirectoryName = $packageName.Split("/")[1]
12+
$mainPackageDirectoryPath = Join-Path $targetDirectory -ChildPath $mainPackageDirectoryName
1013

14+
Push-Location $mainPackageDirectoryPath
15+
Get-ChildItem -Directory | ForEach-Object { Remove-Item -r $_.FullName }
16+
Remove-Item $kiotaLockFileName
17+
Pop-Location
1118

12-
Write-Host "Removed the existing generated files in the repo's main directory: $env:MainDirectory" -ForegroundColor Green
19+
$directories = Get-ChildItem -Directory -Exclude $mainPackageDirectoryName | Where-Object { -not($_.Name.EndsWith("-tests")) }
20+
foreach ($directory in $directories) {
21+
Push-Location $directory.FullName
22+
Get-ChildItem -Directory | ForEach-Object {Remove-Item -r $_.FullName}
23+
Remove-Item *.ts -Exclude "index.ts", "*ServiceClient.ts"
24+
Remove-Item $kiotaLockFileName
25+
Pop-Location
26+
}
27+
Pop-Location
28+
Write-Host "Removed the existing generated files in the repo's main directory: $targetDirectory" -ForegroundColor Green
Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
Write-Host "Path to repo models directory: $env:RepoModelsDir"
1+
param (
2+
[Parameter(Mandatory = $true)]
3+
[string]
4+
$targetDirectory,
5+
[Parameter(Mandatory = $true)]
6+
[string]
7+
$sourceDirectory,
8+
[string]
9+
$packageName = "@microsoft/msgraph-sdk-javascript"
10+
)
211

3-
If(!(test-path $env:RepoModelsDir))
4-
{
5-
New-Item -ItemType Directory -Force -Path $env:RepoModelsDir
12+
Write-Host "Path to repo models directory: $targetDirectory"
13+
$mainPackageDirectoryName = $packageName.Split("/")[1]
14+
$modelsPackagePath = Join-Path $targetDirectory -ChildPath $mainPackageDirectoryName
15+
Copy-Item (Join-Path $sourceDirectory -ChildPath "models") -Destination $modelsPackagePath -Recurse -Force
16+
Invoke-Expression "$PSScriptRoot\remove-typescript-fluent-api-from-main-package.ps1 -targetDirectory $modelsPackagePath"
17+
18+
$packagesDirectories = Get-ChildItem $targetDirectory -Directory -Exclude $mainPackageDirectoryName | Where-Object { -not($_.Name.EndsWith("-tests")) }
19+
foreach ($directory in $packagesDirectories) {
20+
$fluentAPISegmentName = $directory.Name.Replace("$mainPackageDirectoryName-", "")
21+
Copy-Item (Join-Path $sourceDirectory -ChildPath $fluentAPISegmentName) -Destination $directory.FullName -Recurse -Force
22+
Invoke-Expression "$PSScriptRoot\fix-typescript-fluent-packages-imports.ps1 -targetDirectory $($directory.FullName) -packageName $packageName"
623
}
724

8-
Copy-Item $env:OutputFullPath -Destination $env:RepoModelsDir -Recurse -Force
925
Write-Host "Copied the generated files into the repo. From: $env:OutputFullPath to: $env:RepoModelsDir" -ForegroundColor Green

0 commit comments

Comments
 (0)