diff --git a/build-tools/utils/__tests__/token-versions.test.js b/build-tools/utils/__tests__/token-versions.test.js index 85dcde7f1d..8f5fd82791 100644 --- a/build-tools/utils/__tests__/token-versions.test.js +++ b/build-tools/utils/__tests__/token-versions.test.js @@ -18,13 +18,8 @@ const variablesMap = { shadowModal: 'shadow-modal', }; -test('versions border + typography tokens matched by the default groups and leaves others (incl. border colors) version-less', () => { - expect(getTokenVersions(variablesMap)).toEqual({ - borderRadiusButton: 'v3-1', - borderWidthField: 'v3-1', - colorChartsPurple300: 'v3-1', - fontFamilyBase: 'v3-1', - }); +test('versions every token using the default fallback group', () => { + expect(getTokenVersions(variablesMap)).toEqual(mapValues(variablesMap, () => 'v3-1')); }); test('assigns the version of the first matching group', () => { diff --git a/build-tools/utils/token-versions.js b/build-tools/utils/token-versions.js index 4189e282de..775897fa8e 100644 --- a/build-tools/utils/token-versions.js +++ b/build-tools/utils/token-versions.js @@ -1,17 +1,9 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -const DEFAULT_TOKEN_VERSION = 'v3-1'; - -// Groups map a token-name pattern (matched against the token's CSS variable name) to a version. -// Tokens matching no group stay version-less and keep the legacy value-based hashes. Tokens are -// being migrated in batches (one batch per line), and eventually all tokens will be migrated to -// the new format. -const versionGroups = [ - { pattern: /^border-/, version: DEFAULT_TOKEN_VERSION }, - { pattern: /^(font|letter-spacing|line-height)-/, version: DEFAULT_TOKEN_VERSION }, - { pattern: /^color-(charts|severity)-/, version: DEFAULT_TOKEN_VERSION }, -]; +// Groups map a token-name pattern (matched against the token's CSS variable name) +// to a version. The fallback group (/^.*$/) should always be at the end. +const versionGroups = [{ pattern: /^.*$/, version: 'v3-1' }]; // Builds the token -> version allowlist from the full token -> cssName map. function getTokenVersions(variablesMap, groups = versionGroups) {