Skip to content

Commit 7bd973f

Browse files
authored
Create assets src directory (github#41570)
1 parent f390f58 commit 7bd973f

20 files changed

+51
-28
lines changed

.github/workflows/dont-delete-assets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
id: comment
3838
env:
3939
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
run: .github/actions-scripts/deleted-assets-pr-comment.js
40+
run: src/assets/scripts/deleted-assets-pr-comment.js
4141

4242
- name: Find possible previous comment
4343
if: ${{ steps.comment.outputs.markdown != '' }}

.github/workflows/orphaned-assets-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: |
4242
set -e
4343
44-
filesToRemove=`./script/find-orphaned-assets.js`
44+
filesToRemove=`./src/assets/scripts/find-orphaned-assets.js`
4545
[ -z "$filesToRemove" ] && exit 0
4646
4747
${filesToRemove} | xargs git rm

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
// Note that *if you add* to this, remember to also add that
4343
// to the **required checks** in the branch protection rules.
4444
return [
45+
{ name: 'assets', path: 'src/assets/tests', },
46+
// { name: 'audit-logs', path: 'src/assets/audit-logs', },
4547
{ name: 'automated-pipelines', path: 'src/automated-pipelines/tests', },
4648
{ name: 'content', path: 'tests/content', },
4749
{ name: 'content-render', path: 'src/content-render/tests', },

.github/workflows/validate-asset-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
- uses: ./.github/actions/node-npm-setup
2424

2525
- name: Validate all asset images
26-
run: ./script/validate-asset-images.js
26+
run: src/assets/scripts/validate-asset-images.js

jest.config.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,10 @@ export default {
2323
'@primer/behaviors': '<rootDir>/node_modules/@primer/behaviors/dist/cjs/index.js',
2424
},
2525
reporters,
26-
modulePathIgnorePatterns: ['assets/'],
26+
// modulePathIgnorePatterns: ['assets/'],
2727
setupFilesAfterEnv: ['./jest.setup.js', 'jest-expect-message'],
2828
testEnvironment: 'node',
29-
testPathIgnorePatterns: [
30-
'node_modules/',
31-
'vendor/',
32-
'tests/fixtures/',
33-
'tests/helpers/',
34-
'tests/javascripts/',
35-
],
29+
testPathIgnorePatterns: ['node_modules/', 'vendor/', 'tests/fixtures/', 'tests/helpers/'],
3630
testMatch: ['**/tests/**/*.js'],
3731
testLocationInResults: isActions,
3832
globalSetup: './script/start-server-for-jest.js',

middleware/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ import featuredLinks from '#src/landings/middleware/featured-links.js'
5353
import learningTrack from '#src/learning-track/middleware/learning-track.js'
5454
import next from './next.js'
5555
import renderPage from './render-page.js'
56-
import assetPreprocessing from './asset-preprocessing.js'
56+
import assetPreprocessing from '#src/assets/middleware/asset-preprocessing.js'
5757
import archivedAssetRedirects from './archived-asset-redirects.js'
5858
import favicons from './favicons.js'
59-
import setStaticAssetCaching from './static-asset-caching.js'
59+
import setStaticAssetCaching from '#src/assets/middleware/static-asset-caching.js'
6060
import fastHead from './fast-head.js'
6161
import fastlyCacheTest from './fastly-cache-test.js'
6262
import trailingSlashes from './trailing-slashes.js'
6363
import fastlyBehavior from './fastly-behavior.js'
6464
import mockVaPortal from './mock-va-portal.js'
65-
import dynamicAssets from './dynamic-assets.js'
65+
import dynamicAssets from '#src/assets/middleware/dynamic-assets.js'
6666
import contextualizeSearch from '#src/search/middleware/contextualize.js'
6767
import shielding from '#src/shielding/middleware/index.js'
6868

src/assets/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ASSETS
2+
3+
TBD what is ASSETS
4+
5+
## What ASSETS does
6+
7+
TBD why is ASSETS on the docs
8+
9+
## How ASSETS works
10+
11+
TBD step-by-step instructions to work on ASSETS
12+
13+
## How to work on ASSETS
14+
15+
TBD step-by-step instructions on how to work on ASSETS
16+
17+
## How to get help for ASSETS
18+
19+
TBD reference material
File renamed without changes.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import fs from 'fs/promises'
22

33
import sharp from 'sharp'
44

5-
import { assetCacheControl, defaultCacheControl } from './cache-control.js'
6-
import { setFastlySurrogateKey, SURROGATE_ENUMS } from './set-fastly-surrogate-key.js'
5+
import { assetCacheControl, defaultCacheControl } from '../../../middleware/cache-control.js'
6+
import {
7+
setFastlySurrogateKey,
8+
SURROGATE_ENUMS,
9+
} from '../../../middleware/set-fastly-surrogate-key.js'
710

811
/**
912
* This is the indicator that is a virtual part of the URL.

middleware/static-asset-caching.js renamed to src/assets/middleware/static-asset-caching.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { setFastlySurrogateKey, SURROGATE_ENUMS } from './set-fastly-surrogate-key.js'
1+
import {
2+
setFastlySurrogateKey,
3+
SURROGATE_ENUMS,
4+
} from '../../../middleware/set-fastly-surrogate-key.js'
25

36
export default function setStaticAssetCaching(req, res, next) {
47
if (isChecksummed(req.path)) {

0 commit comments

Comments
 (0)