Skip to content

Commit 1ff77f0

Browse files
author
aws-amplify-bot
committed
Merge remote-tracking branch 'origin/main' into pre-prod/main
2 parents c485977 + c76c70e commit 1ff77f0

File tree

12 files changed

+322
-255
lines changed

12 files changed

+322
-255
lines changed

.eslintrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
],
77
"parser": "@typescript-eslint/parser",
88
"plugins": ["@typescript-eslint", "prettier"],
9+
"parserOptions": {
10+
"ecmaVersion": 2024,
11+
"sourceType": "module"
12+
},
913
"rules": {
1014
"react-hooks/exhaustive-deps": "error",
1115
"@typescript-eslint/no-explicit-any": "warn",

.github/dependabot.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "daily"
7-
allow:
8-
# Allow updates for any packages starting with "@aws-amplify"
9-
- dependency-name: "@aws-amplify*"
107
# Maintain dependencies for GitHub Actions
118
- package-ecosystem: "github-actions"
129
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@docsearch/react": "3",
1616
"ajv": "^8.16.0",
1717
"aws-amplify": "^6.0.9",
18-
"next": "^14.2.25",
18+
"next": "^14.2.30",
1919
"next-image-export-optimizer": "^1.18.0",
2020
"next-transpile-modules": "^9.0.0",
2121
"parse-imports": "^1.1.0",
@@ -39,10 +39,11 @@
3939
"@testing-library/user-event": "^13.5.0",
4040
"@types/fs-extra": "^9.0.1",
4141
"@types/jest": "^26.0.19",
42-
"@types/node": "^12.12.9",
42+
"@types/node": "^20.0.0",
4343
"@types/react": "^18.0.0",
4444
"@types/url-parse": "^1.4.3",
4545
"@typescript-eslint/eslint-plugin": "^6.13.1",
46+
"@typescript-eslint/parser": "^6.13.1",
4647
"axios": "^1.11.0",
4748
"cheerio": "^1.0.0-rc.12",
4849
"classnames": "^2.3.2",
@@ -55,7 +56,6 @@
5556
"eslint-plugin-next": "^0.0.0",
5657
"eslint-plugin-prettier": "^5.0.1",
5758
"fs-extra": "^9.0.1",
58-
"git-jiggy": "1.1.1",
5959
"husky": "^8.0.1",
6060
"jest": "^29.7.0",
6161
"jest-cli": "^29.7.0",
@@ -79,7 +79,7 @@
7979
"tiny-glob": "0.2.9",
8080
"ts-jest": "^29.1.2",
8181
"ts-node": "^8.5.0",
82-
"typescript": "^4.9",
82+
"typescript": "^5.3.0",
8383
"unist-util-visit": "^4.1.0"
8484
},
8585
"resolutions": {
@@ -92,13 +92,14 @@
9292
"cross-spawn": "^7.0.5",
9393
"semver": "7.5.2",
9494
"tough-cookie": "4.1.3",
95-
"aws-cdk-lib": "2.80.0",
95+
"aws-cdk-lib": "2.189.1",
9696
"@adobe/css-tools": "4.3.2",
9797
"follow-redirects": "^1.15.6",
9898
"sharp": "0.33.1",
9999
"ejs": "3.1.10",
100100
"braces": "^3.0.3",
101-
"ws": "^8.17.1"
101+
"ws": "^8.17.1",
102+
"tmp": "^0.2.4"
102103
},
103104
"scripts": {
104105
"clean": "rm -rf node_modules yarn.lock",
@@ -120,5 +121,8 @@
120121
"lint": "next lint",
121122
"clean-references": "node tasks/clean-references.mjs"
122123
},
124+
"overrides": {
125+
"tmp": "^0.2.4"
126+
},
123127
"packageManager": "[email protected]"
124128
}

src/directory/generateDirectory.mjs

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,80 @@ import { promises as fs } from 'fs';
22
import { fileURLToPath } from 'url';
33
import { cwd } from 'node:process';
44
import path from 'path';
5+
import { execFile } from 'child_process';
6+
import { promisify } from 'util';
57
import JSON5 from 'json5';
68
import { directory } from './directory.mjs';
79
import { writeFile } from 'fs/promises';
8-
import { getLastModifiedDate } from 'git-jiggy';
910
import { API_CATEGORIES, API_SUB_CATEGORIES } from '../data/api-categories.mjs';
1011

12+
const execFileAsync = promisify(execFile);
13+
1114
// Set up the root path so that we can get the correct path from the current working directory
1215
const rootPath = path.resolve(cwd(), 'src/pages');
1316

17+
let gitDatesCache;
18+
19+
/**
20+
* Initializes and caches Git last-modified dates for files under `rootPath`.
21+
* Executes:
22+
* git log --follow --name-only --pretty=format:%ct -- .
23+
* The output is a sequence of lines like:
24+
* 1625030400
25+
* src/pages/index.js
26+
* src/pages/about.js
27+
*
28+
* Parses lines of Unix timestamps and file paths, mapping each file to the ISO date
29+
* of its most recent commit. Caches the result to avoid repeated Git invocations.
30+
*/
31+
async function initializeGitCache() {
32+
if (gitDatesCache) return gitDatesCache;
33+
34+
try {
35+
const { stdout } = await execFileAsync(
36+
'git',
37+
['log', '--follow', '--name-only', '--pretty=format:%ct', '--', '.'],
38+
{ cwd: rootPath, maxBuffer: 50 * 1024 * 1024, timeout: 30000 }
39+
);
40+
41+
const cache = new Map();
42+
let currentDate;
43+
44+
for (const line of stdout.trim().split('\n')) {
45+
if (/^\d+$/.test(line)) {
46+
currentDate = new Date(Number(line) * 1000).toISOString();
47+
} else if (line && !cache.has(line)) {
48+
cache.set(line, currentDate);
49+
}
50+
}
51+
52+
gitDatesCache = cache;
53+
} catch (err) {
54+
console.warn(`Git operation failed: ${err.message}`);
55+
gitDatesCache = new Map();
56+
}
57+
58+
return gitDatesCache;
59+
}
60+
61+
/**
62+
* Retrieves the last modified date for a given file by looking it up
63+
* in the cached Git dates map. Initializes the cache on first invocation.
64+
*
65+
* @param {string} filePath - Absolute path to the target file.
66+
* @returns {Promise<string>} ISO 8601 date string of the last Git commit touching that file.
67+
* @throws {Error} If no Git date is found for the given file.
68+
*/
69+
async function getLastModifiedDate(filePath) {
70+
const cache = await initializeGitCache();
71+
72+
if (!cache.has(filePath)) {
73+
throw new Error(`Git date not found for: ${filePath}`);
74+
}
75+
76+
return cache.get(filePath);
77+
}
78+
1479
/**
1580
* Helper function to use RegEx to grab the "meta" object
1681
* @param {string} filePath

src/directory/generateFlatDirectory.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { fileURLToPath } from 'url';
22
import path from 'path';
33
import { writeFile } from 'fs/promises';
4-
import directory from './directory.json' assert { type: 'json' };
4+
import directory from './directory.json' with { type: 'json' };
55

66
function flattenJSON(jsonObj, flattened = {}) {
77
if (Array.isArray(jsonObj.children)) {

src/pages/_document.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import crypto from 'crypto';
22
import Document, { Html, Head, Main, NextScript } from 'next/document';
3+
import { ALGOLIA_APP_ID } from '../constants/algolia';
34

45
const cspHashOf = (text) => {
56
const hash = crypto.createHash('sha256');
@@ -14,7 +15,8 @@ const ANALYTICS_CSP = {
1415
'https://aws.demdex.net',
1516
'https://dpm.demdex.net',
1617
'https://cm.everesttech.net',
17-
'*.shortbread.aws.dev'
18+
'https://prod.tools.shortbread.aws.dev',
19+
'https://prod.log.shortbread.aws.dev'
1820
],
1921
img: [
2022
'https://amazonwebservices.d2.sc.omtrdc.net',
@@ -23,8 +25,8 @@ const ANALYTICS_CSP = {
2325
'https://cm.everesttech.net'
2426
],
2527
frame: ['https://aws.demdex.net', 'https://dpm.demdex.net'],
26-
script: ['*.shortbread.aws.dev'],
27-
style: ['*.shortbread.aws.dev']
28+
script: ['https://prod.assets.shortbread.aws.dev'],
29+
style: ['https://prod.assets.shortbread.aws.dev']
2830
},
2931
prod: {
3032
connect: [
@@ -71,7 +73,7 @@ const getCspContent = (context) => {
7173
' '
7274
)} ${ANALYTICS_CSP.alpha.connect.join(
7375
' '
74-
)} https://*.algolia.net https://*.algolianet.com *.amazonaws.com;
76+
)} https://${ALGOLIA_APP_ID}-dsn.algolia.net https://${ALGOLIA_APP_ID}-1.algolianet.com https://${ALGOLIA_APP_ID}-2.algolianet.com https://${ALGOLIA_APP_ID}-3.algolianet.com;
7577
img-src 'self' https://img.shields.io data: ${ANALYTICS_CSP.all.img.join(
7678
' '
7779
)} ${ANALYTICS_CSP.alpha.img.join(' ')};
@@ -94,7 +96,7 @@ const getCspContent = (context) => {
9496
' '
9597
)} ${ANALYTICS_CSP.prod.connect.join(
9698
' '
97-
)} https://*.algolia.net https://*.algolianet.com *.amazonaws.com;
99+
)} https://${ALGOLIA_APP_ID}-dsn.algolia.net https://${ALGOLIA_APP_ID}-1.algolianet.com https://${ALGOLIA_APP_ID}-2.algolianet.com https://${ALGOLIA_APP_ID}-3.algolianet.com;
98100
img-src 'self' https://img.shields.io ${ANALYTICS_CSP.all.img.join(
99101
' '
100102
)} ${ANALYTICS_CSP.prod.img.join(' ')};

src/pages/gen1/[platform]/tools/cli-legacy/overwrite-customize-resolvers/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ $util.toJson({
579579

580580
Amazon OpenSearch domains can take a while to deploy. Take this time to read up on OpenSearch to see what capabilities you are about to unlock.
581581

582-
[Getting Started with OpenSearch](https://opensearch.org/docs/opensearch/index/)
582+
[Getting Started with OpenSearch](https://docs.opensearch.org/latest/)
583583

584584
- After the update is complete but before creating any objects, update your OpenSearch index mapping.
585585

src/pages/gen1/[platform]/tools/cli-legacy/searchable-directive/index.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ The `filter` parameter in the search query has a searchable type field that corr
9999

100100
- `eq` - which uses the OpenSearch keyword type to match for the exact term.
101101
- `ne` - this is the inverse operation of `eq`.
102-
- `matchPhrase` - searches using OpenSearch's [Match Phrase Query](https://opensearch.org/docs/opensearch/query-dsl/full-text/#match-phrase) to filter the documents in the search query.
103-
- `matchPhrasePrefix` - This uses OpenSearch's [Match Phrase Prefix Query](https://opensearch.org/docs/opensearch/query-dsl/full-text/#match-phrase-prefix) to filter the documents in the search query.
104-
- `multiMatch` - Corresponds to the OpenSearch [Multi Match Query](https://opensearch.org/docs/opensearch/query-dsl/full-text/#multi-match).
105-
- `exists` - Corresponds to the OpenSearch [Exists Query](https://opensearch.org/docs/opensearch/query-dsl/term/#exists).
106-
- `wildcard` - Corresponds to the OpenSearch [Wildcard Query](https://opensearch.org/docs/opensearch/query-dsl/term/#wildcards).
107-
- `regexp` - Corresponds to the OpenSearch [Regexp Query](https://opensearch.org/docs/opensearch/query-dsl/term/#regex).
102+
- `matchPhrase` - searches using OpenSearch's [Match Phrase Query](https://docs.opensearch.org/latest/query-dsl/full-text/match-phrase/) to filter the documents in the search query.
103+
- `matchPhrasePrefix` - This uses OpenSearch's [Match Phrase Prefix Query](https://docs.opensearch.org/latest/query-dsl/full-text/match-phrase-prefix/) to filter the documents in the search query.
104+
- `multiMatch` - Corresponds to the OpenSearch [Multi Match Query](https://docs.opensearch.org/latest/query-dsl/full-text/multi-match/).
105+
- `exists` - Corresponds to the OpenSearch [Exists Query](https://docs.opensearch.org/latest/query-dsl/term/exists/).
106+
- `wildcard` - Corresponds to the OpenSearch [Wildcard Query](https://docs.opensearch.org/latest/query-dsl/term/wildcard/).
107+
- `regexp` - Corresponds to the OpenSearch [Regexp Query](https://docs.opensearch.org/latest/query-dsl/term/regexp/).
108108

109109
The `sort` parameter can be used to specify the order of the search results, can be ascending (`asc`) or descending (`desc`), if not specified ascending order is used.
110110

src/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export default function Page() {
135135
query: { platform: DEFAULT_PLATFORM }
136136
}}
137137
>
138-
Write TypeScript across your app&pos;s frontend and backend. Get
138+
Write TypeScript across your app&#39;s frontend and backend. Get
139139
schema validation, dot completion, and end-to-end types while you
140140
code.
141141
</FeatureItem>

tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"removeComments": true,
1616
"strict": true,
1717
"strictPropertyInitialization": false,
18-
"target": "es2017"
18+
"target": "ES2024"
1919
},
2020
"exclude": ["node_modules"]
2121
}

0 commit comments

Comments
 (0)