From 05ab1dd76ebc99c6935591f363d12777d719e2b6 Mon Sep 17 00:00:00 2001 From: Matthieu Riegler Date: Sun, 2 Nov 2025 00:53:32 +0100 Subject: [PATCH] docs(docs-infra): pull version picker info from shared versions.json fixes #64842 --- adev/BUILD.bazel | 1 + adev/src/app/app.component.spec.ts | 5 - adev/src/app/app.config.ts | 5 - adev/src/app/core/constants/versions.ts | 77 ------- .../navigation/navigation.component.html | 215 ++++++++++-------- .../layout/navigation/navigation.component.ts | 2 +- .../src/app/core/providers/current-version.ts | 11 - .../services/version-manager.service.spec.ts | 130 +++++++---- .../core/services/version-manager.service.ts | 158 ++++++------- adev/src/assets/others/BUILD.bazel | 16 ++ adev/src/assets/others/versions.json | 78 +++++++ 11 files changed, 368 insertions(+), 330 deletions(-) delete mode 100644 adev/src/app/core/constants/versions.ts delete mode 100644 adev/src/app/core/providers/current-version.ts create mode 100644 adev/src/assets/others/BUILD.bazel create mode 100644 adev/src/assets/others/versions.json diff --git a/adev/BUILD.bazel b/adev/BUILD.bazel index 078abbe91db..97ca7dbaf71 100644 --- a/adev/BUILD.bazel +++ b/adev/BUILD.bazel @@ -37,6 +37,7 @@ TEST_FILES = APPLICATION_FILES + [ APPLICATION_ASSETS = [ "//adev/src/assets/images", + "//adev/src/assets/others", "//adev/src/assets/previews", "//adev/src/assets:tutorials", "//adev/src/assets/icons", diff --git a/adev/src/app/app.component.spec.ts b/adev/src/app/app.component.spec.ts index e2d72f3b2e1..94ebac649af 100644 --- a/adev/src/app/app.component.spec.ts +++ b/adev/src/app/app.component.spec.ts @@ -11,7 +11,6 @@ import {AppComponent} from './app.component'; import {provideRouter, withComponentInputBinding} from '@angular/router'; import {routes} from './routes'; import {Search, WINDOW} from '@angular/docs'; -import {CURRENT_MAJOR_VERSION} from './core/providers/current-version'; describe('AppComponent', () => { const fakeSearch = {}; @@ -30,10 +29,6 @@ describe('AppComponent', () => { provide: Search, useValue: fakeSearch, }, - { - provide: CURRENT_MAJOR_VERSION, - useValue: fakeCurrentMajorVersion, - }, ], }); const fixture = TestBed.createComponent(AppComponent); diff --git a/adev/src/app/app.config.ts b/adev/src/app/app.config.ts index 868eed181de..faf91ef2474 100644 --- a/adev/src/app/app.config.ts +++ b/adev/src/app/app.config.ts @@ -45,7 +45,6 @@ import {CustomErrorHandler} from './core/services/errors-handling/error-handler' import {ExampleContentLoader} from './core/services/example-content-loader.service'; import {ReuseTutorialsRouteStrategy} from './features/tutorial/tutorials-route-reuse-strategy'; import {routes} from './routes'; -import {CURRENT_MAJOR_VERSION} from './core/providers/current-version'; import {AppScroller} from './app-scroller'; export const appConfig: ApplicationConfig = { @@ -78,10 +77,6 @@ export const appConfig: ApplicationConfig = { provideEnvironmentInitializer(() => inject(AppScroller)), provideEnvironmentInitializer(() => inject(AnalyticsService)), provideAlgoliaSearchClient(environment), - { - provide: CURRENT_MAJOR_VERSION, - useValue: Number(VERSION.major), - }, {provide: ENVIRONMENT, useValue: environment}, {provide: ErrorHandler, useClass: CustomErrorHandler}, {provide: PREVIEWS_COMPONENTS, useValue: PREVIEWS_COMPONENTS_MAP}, diff --git a/adev/src/app/core/constants/versions.ts b/adev/src/app/core/constants/versions.ts deleted file mode 100644 index 1c62311727d..00000000000 --- a/adev/src/app/core/constants/versions.ts +++ /dev/null @@ -1,77 +0,0 @@ -/*! - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.dev/license - */ - -export const VERSIONS_CONFIG = { - aDevVersionsLinkPattern: 'https://{{prefix}}{{version}}angular.dev', - aioVersions: [ - { - version: 'v18', - url: 'https://v18.angular.dev/overview', - }, - { - version: 'v17', - url: 'https://v17.angular.io/docs', - }, - { - version: 'v16', - url: 'https://v16.angular.io/docs', - }, - { - version: 'v15', - url: 'https://v15.angular.io/docs', - }, - { - version: 'v14', - url: 'https://v14.angular.io/docs', - }, - { - version: 'v13', - url: 'https://v13.angular.io/docs', - }, - { - version: 'v12', - url: 'https://v12.angular.io/docs', - }, - { - version: 'v11', - url: 'https://v11.angular.io/docs', - }, - { - version: 'v10', - url: 'https://v10.angular.io/docs', - }, - { - version: 'v9', - url: 'https://v9.angular.io/docs', - }, - { - version: 'v8', - url: 'https://v8.angular.io/docs', - }, - { - version: 'v7', - url: 'https://v7.angular.io/docs', - }, - { - version: 'v6', - url: 'https://v6.angular.io/docs', - }, - { - version: 'v5', - url: 'https://v5.angular.io/docs', - }, - { - version: 'v4', - url: 'https://v4.angular.io/docs', - }, - { - version: 'v2', - url: 'https://v2.angular.io/docs', - }, - ], -}; diff --git a/adev/src/app/core/layout/navigation/navigation.component.html b/adev/src/app/core/layout/navigation/navigation.component.html index e1e8aa9a3fe..f7d84a26012 100644 --- a/adev/src/app/core/layout/navigation/navigation.component.html +++ b/adev/src/app/core/layout/navigation/navigation.component.html @@ -62,9 +62,9 @@