@@ -23,11 +23,26 @@ struct GenerateDocIndexCommand: ParsableCommand {
2323 func run( ) throws {
2424 try FileManager . default. changeWorkingDirectory ( repoPath)
2525 let contents = try generateDocIndexContents ( )
26- try saveDocIndex ( contents)
26+ let docIndexFileName = " Sources/Core/AWSSDKForSwift/Documentation.docc/AWSSDKForSwift.md "
27+ try saveDocIndex ( contents, docIndexFileName)
28+ // New doc index page for internal build hosted docs.
29+ let newDocIndexFileName = " Sources/Core/SDKForSwift/Documentation.docc/SDKForSwift.md "
30+ try saveDocIndex ( convertToNewFormat ( contents) , newDocIndexFileName)
2731 }
2832
2933 // MARK: - Helpers
3034
35+ /// Converts old format relative links to new format
36+ func convertToNewFormat( _ content: String ) -> String {
37+ return content. replacingOccurrences (
38+ of: " ../../../../../swift/api/ " ,
39+ with: " ../../../../../sdk-for-swift/latest/api/ "
40+ ) . replacingOccurrences (
41+ of: " /latest) " ,
42+ with: " ) "
43+ )
44+ }
45+
3146 /// Returns the contents of the generated doc index.
3247 /// This determines the versions of the dependencies and the list of services to include and then generates the doc index with those values.
3348 ///
@@ -50,15 +65,14 @@ struct GenerateDocIndexCommand: ParsableCommand {
5065 /// If no file exists, then this will create a new file. Otherwise, this will overwrite the existing file.
5166 ///
5267 /// - Parameter contents: The contents of the doc index.
53- func saveDocIndex( _ contents: String ) throws {
54- let docIndexFileName = " Sources/Core/AWSSDKForSwift/Documentation.docc/AWSSDKForSwift.md "
55- log ( " Saving doc index to \( docIndexFileName) ... " )
68+ func saveDocIndex( _ contents: String , _ destination: String ) throws {
69+ log ( " Saving doc index to \( destination) ... " )
5670 try contents. write (
57- toFile: docIndexFileName ,
71+ toFile: destination ,
5872 atomically: true ,
5973 encoding: . utf8
6074 )
61- log ( " Successfully saved doc index to \( docIndexFileName ) " )
75+ log ( " Successfully saved doc index to \( destination ) " )
6276 }
6377
6478 /// Returns the list of services to include in the doc index.
0 commit comments