зеркало из https://github.com/github/docs.git
Create assets src directory (#41570)
This commit is contained in:
Родитель
f390f582ec
Коммит
7bd973f1d0
|
@ -37,7 +37,7 @@ jobs:
|
|||
id: comment
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: .github/actions-scripts/deleted-assets-pr-comment.js
|
||||
run: src/assets/scripts/deleted-assets-pr-comment.js
|
||||
|
||||
- name: Find possible previous comment
|
||||
if: ${{ steps.comment.outputs.markdown != '' }}
|
||||
|
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
run: |
|
||||
set -e
|
||||
|
||||
filesToRemove=`./script/find-orphaned-assets.js`
|
||||
filesToRemove=`./src/assets/scripts/find-orphaned-assets.js`
|
||||
[ -z "$filesToRemove" ] && exit 0
|
||||
|
||||
${filesToRemove} | xargs git rm
|
||||
|
|
|
@ -42,6 +42,8 @@ jobs:
|
|||
// Note that *if you add* to this, remember to also add that
|
||||
// to the **required checks** in the branch protection rules.
|
||||
return [
|
||||
{ name: 'assets', path: 'src/assets/tests', },
|
||||
// { name: 'audit-logs', path: 'src/assets/audit-logs', },
|
||||
{ name: 'automated-pipelines', path: 'src/automated-pipelines/tests', },
|
||||
{ name: 'content', path: 'tests/content', },
|
||||
{ name: 'content-render', path: 'src/content-render/tests', },
|
||||
|
|
|
@ -23,4 +23,4 @@ jobs:
|
|||
- uses: ./.github/actions/node-npm-setup
|
||||
|
||||
- name: Validate all asset images
|
||||
run: ./script/validate-asset-images.js
|
||||
run: src/assets/scripts/validate-asset-images.js
|
||||
|
|
|
@ -23,16 +23,10 @@ export default {
|
|||
'@primer/behaviors': '<rootDir>/node_modules/@primer/behaviors/dist/cjs/index.js',
|
||||
},
|
||||
reporters,
|
||||
modulePathIgnorePatterns: ['assets/'],
|
||||
// modulePathIgnorePatterns: ['assets/'],
|
||||
setupFilesAfterEnv: ['./jest.setup.js', 'jest-expect-message'],
|
||||
testEnvironment: 'node',
|
||||
testPathIgnorePatterns: [
|
||||
'node_modules/',
|
||||
'vendor/',
|
||||
'tests/fixtures/',
|
||||
'tests/helpers/',
|
||||
'tests/javascripts/',
|
||||
],
|
||||
testPathIgnorePatterns: ['node_modules/', 'vendor/', 'tests/fixtures/', 'tests/helpers/'],
|
||||
testMatch: ['**/tests/**/*.js'],
|
||||
testLocationInResults: isActions,
|
||||
globalSetup: './script/start-server-for-jest.js',
|
||||
|
|
|
@ -53,16 +53,16 @@ import featuredLinks from '#src/landings/middleware/featured-links.js'
|
|||
import learningTrack from '#src/learning-track/middleware/learning-track.js'
|
||||
import next from './next.js'
|
||||
import renderPage from './render-page.js'
|
||||
import assetPreprocessing from './asset-preprocessing.js'
|
||||
import assetPreprocessing from '#src/assets/middleware/asset-preprocessing.js'
|
||||
import archivedAssetRedirects from './archived-asset-redirects.js'
|
||||
import favicons from './favicons.js'
|
||||
import setStaticAssetCaching from './static-asset-caching.js'
|
||||
import setStaticAssetCaching from '#src/assets/middleware/static-asset-caching.js'
|
||||
import fastHead from './fast-head.js'
|
||||
import fastlyCacheTest from './fastly-cache-test.js'
|
||||
import trailingSlashes from './trailing-slashes.js'
|
||||
import fastlyBehavior from './fastly-behavior.js'
|
||||
import mockVaPortal from './mock-va-portal.js'
|
||||
import dynamicAssets from './dynamic-assets.js'
|
||||
import dynamicAssets from '#src/assets/middleware/dynamic-assets.js'
|
||||
import contextualizeSearch from '#src/search/middleware/contextualize.js'
|
||||
import shielding from '#src/shielding/middleware/index.js'
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# ASSETS
|
||||
|
||||
TBD what is ASSETS
|
||||
|
||||
## What ASSETS does
|
||||
|
||||
TBD why is ASSETS on the docs
|
||||
|
||||
## How ASSETS works
|
||||
|
||||
TBD step-by-step instructions to work on ASSETS
|
||||
|
||||
## How to work on ASSETS
|
||||
|
||||
TBD step-by-step instructions on how to work on ASSETS
|
||||
|
||||
## How to get help for ASSETS
|
||||
|
||||
TBD reference material
|
|
@ -2,8 +2,11 @@ import fs from 'fs/promises'
|
|||
|
||||
import sharp from 'sharp'
|
||||
|
||||
import { assetCacheControl, defaultCacheControl } from './cache-control.js'
|
||||
import { setFastlySurrogateKey, SURROGATE_ENUMS } from './set-fastly-surrogate-key.js'
|
||||
import { assetCacheControl, defaultCacheControl } from '../../../middleware/cache-control.js'
|
||||
import {
|
||||
setFastlySurrogateKey,
|
||||
SURROGATE_ENUMS,
|
||||
} from '../../../middleware/set-fastly-surrogate-key.js'
|
||||
|
||||
/**
|
||||
* This is the indicator that is a virtual part of the URL.
|
|
@ -1,4 +1,7 @@
|
|||
import { setFastlySurrogateKey, SURROGATE_ENUMS } from './set-fastly-surrogate-key.js'
|
||||
import {
|
||||
setFastlySurrogateKey,
|
||||
SURROGATE_ENUMS,
|
||||
} from '../../../middleware/set-fastly-surrogate-key.js'
|
||||
|
||||
export default function setStaticAssetCaching(req, res, next) {
|
||||
if (isChecksummed(req.path)) {
|
|
@ -18,7 +18,7 @@
|
|||
// [end-readme]
|
||||
|
||||
import { program } from 'commander'
|
||||
import main from '../.github/actions-scripts/deleted-assets-pr-comment.js'
|
||||
import main from './deleted-assets-pr-comment.js'
|
||||
|
||||
program
|
||||
.description('If applicable, print a snippet of Markdown about deleted assets')
|
|
@ -12,8 +12,8 @@ import path from 'path'
|
|||
import { program } from 'commander'
|
||||
import walk from 'walk-sync'
|
||||
|
||||
import walkFiles from './helpers/walk-files.js'
|
||||
import languages from '../lib/languages.js'
|
||||
import walkFiles from '../../../script/helpers/walk-files.js'
|
||||
import languages from '../../../lib/languages.js'
|
||||
|
||||
const EXCEPTIONS = new Set([
|
||||
'assets/images/site/favicon.ico',
|
|
@ -2,8 +2,8 @@ import { jest } from '@jest/globals'
|
|||
import sharp from 'sharp'
|
||||
import { fileTypeFromBuffer } from 'file-type'
|
||||
|
||||
import { SURROGATE_ENUMS } from '../../middleware/set-fastly-surrogate-key.js'
|
||||
import { get, head } from '../helpers/e2etest.js'
|
||||
import { SURROGATE_ENUMS } from '../../../middleware/set-fastly-surrogate-key.js'
|
||||
import { get, head } from '../../../tests/helpers/e2etest.js'
|
||||
|
||||
describe('dynamic assets', () => {
|
||||
jest.setTimeout(3 * 60 * 1000)
|
|
@ -1,9 +1,9 @@
|
|||
import nock from 'nock'
|
||||
import { expect, jest } from '@jest/globals'
|
||||
|
||||
import { checkCachingHeaders } from '../helpers/caching-headers.js'
|
||||
import { setDefaultFastlySurrogateKey } from '../../middleware/set-fastly-surrogate-key.js'
|
||||
import archivedEnterpriseVersionsAssets from '../../middleware/archived-enterprise-versions-assets.js'
|
||||
import { checkCachingHeaders } from '../../../tests/helpers/caching-headers.js'
|
||||
import { setDefaultFastlySurrogateKey } from '../../../middleware/set-fastly-surrogate-key.js'
|
||||
import archivedEnterpriseVersionsAssets from '../../../middleware/archived-enterprise-versions-assets.js'
|
||||
|
||||
function mockRequest(path, { headers }) {
|
||||
const _headers = Object.fromEntries(
|
|
@ -3,8 +3,8 @@ import path from 'path'
|
|||
|
||||
import { jest, expect } from '@jest/globals'
|
||||
|
||||
import { get } from '../helpers/e2etest.js'
|
||||
import { checkCachingHeaders } from '../helpers/caching-headers.js'
|
||||
import { get } from '../../../tests/helpers/e2etest.js'
|
||||
import { checkCachingHeaders } from '../../../tests/helpers/caching-headers.js'
|
||||
|
||||
function getNextStaticAsset(directory) {
|
||||
const root = path.join('.next', 'static', directory)
|
|
@ -5,3 +5,5 @@ This is the Next.js pages directory.
|
|||
See <https://nextjs.org/docs/pages/building-your-application/configuring/src-directory>
|
||||
|
||||
There is almost no code in this directory, instead the actual pages live with their subject siblings. These files directly export from the page files in the relative subjects.
|
||||
|
||||
TODO migrate code out of `_error.tsx`, `_document.tsx`, and `404.tsx`.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import sharp from 'sharp'
|
||||
|
||||
import { get, head, getDOM } from '../helpers/e2etest.js'
|
||||
import { get, head, getDOM } from '../../tests/helpers/e2etest.js'
|
||||
import { MAX_WIDTH } from '#src/content-render/unified/rewrite-asset-img-tags.js'
|
||||
|
||||
describe('render Markdown image tags', () => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче