Skip to content

Commit

Permalink
Merge branch 'fix/enhance-error-apollo-suspense' of github.com:dac09/…
Browse files Browse the repository at this point in the history
…redwood into fix/enhance-error-apollo-suspense

* 'fix/enhance-error-apollo-suspense' of github.com:dac09/redwood: (92 commits)
  chore(deps): update dependency @types/yargs to v17.0.32 (redwoodjs#9759)
  Make it easier to find useMatch docs (redwoodjs#9756)
  chore(unit tests): Use side-effect import to fix TS errors (redwoodjs#9754)
  fix(context): Refactor context (redwoodjs#9371)
  docs: Replaced deprecated <Set private> with PrivateSet within router.md (redwoodjs#9749)
  add TS support for storybook preview tsx config extension (redwoodjs#9309)
  fix(studio): Fix windows path issues (redwoodjs#9752)
  redwoodjs#9620: Update studio to support variable components (Mailer) (redwoodjs#9639)
  chore(tasks): Add comparison view to nmHoisting visualisation (redwoodjs#9751)
  chore(cli): make fs modules used in the CLI consistent (redwoodjs#9746)
  chore(tooling): Make sure console boxen print on a new line
  chore(CI): fix publish release candidate
  feat(CLI): add check node version middleware, rm `.nvmrc`, yarn engines (redwoodjs#9728)
  docs: added some clarification on serverless functions getting executed in a non-serverless environment (redwoodjs#9742)
  Fix sshExec() errors not displaying (redwoodjs#9743)
  chore(tooling): Add missing word in release tooling output
  Update Metadata docs (redwoodjs#9744)
  chore(CI): update test project fixture and CRWA for deploy target CI repo (redwoodjs#9730)
  chore(tooling): add script for getting nested dependency data (redwoodjs#9734)
  Trusted Documents docs: Proofreading corrections (redwoodjs#9737)
  ...
  • Loading branch information
dac09 committed Dec 27, 2023
2 parents 62228a0 + b2a22fe commit dba3868
Show file tree
Hide file tree
Showing 519 changed files with 19,534 additions and 19,994 deletions.
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,23 @@ module.exports = {
'@redwoodjs/process-env-computed': 'off',
},
},
{
files: ['packages/project-config/**'],
excludedFiles: [
'**/__tests__/**',
'**/*.test.ts?(x)',
'**/*.spec.ts?(x)',
],
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: false,
optionalDependencies: false,
peerDependencies: true,
},
],
},
},
],
}
2 changes: 1 addition & 1 deletion .github/actions/check_create_redwood_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"@actions/core": "1.10.1",
"@actions/exec": "1.1.1"
},
"packageManager": "yarn@3.7.0"
"packageManager": "yarn@4.0.2"
}
28 changes: 14 additions & 14 deletions .github/actions/check_create_redwood_app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,57 @@
# Manual changes might be lost - proceed with caution!

__metadata:
version: 6
cacheKey: 8c0
version: 8
cacheKey: 10c0

"@actions/core@npm:1.10.1":
version: 1.10.1
resolution: "@actions/core@npm:1.10.1"
dependencies:
"@actions/http-client": ^2.0.1
uuid: ^8.3.2
checksum: 7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832
"@actions/http-client": "npm:^2.0.1"
uuid: "npm:^8.3.2"
checksum: 8c0/7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832
languageName: node
linkType: hard

"@actions/exec@npm:1.1.1":
version: 1.1.1
resolution: "@actions/exec@npm:1.1.1"
dependencies:
"@actions/io": ^1.0.1
checksum: 4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a
"@actions/io": "npm:^1.0.1"
checksum: 8c0/4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a
languageName: node
linkType: hard

"@actions/http-client@npm:^2.0.1":
version: 2.0.1
resolution: "@actions/http-client@npm:2.0.1"
dependencies:
tunnel: ^0.0.6
checksum: b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67
tunnel: "npm:^0.0.6"
checksum: 8c0/b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67
languageName: node
linkType: hard

"@actions/io@npm:^1.0.1":
version: 1.1.2
resolution: "@actions/io@npm:1.1.2"
checksum: 61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1
checksum: 8c0/61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1
languageName: node
linkType: hard

"check_test_project_fixture@workspace:.":
version: 0.0.0-use.local
resolution: "check_test_project_fixture@workspace:."
dependencies:
"@actions/core": 1.10.1
"@actions/exec": 1.1.1
"@actions/core": "npm:1.10.1"
"@actions/exec": "npm:1.1.1"
languageName: unknown
linkType: soft

"tunnel@npm:^0.0.6":
version: 0.0.6
resolution: "tunnel@npm:0.0.6"
checksum: e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75
checksum: 8c0/e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75
languageName: node
linkType: hard

Expand All @@ -61,6 +61,6 @@ __metadata:
resolution: "uuid@npm:8.3.2"
bin:
uuid: dist/bin/uuid
checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54
checksum: 8c0/bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54
languageName: node
linkType: hard
2 changes: 1 addition & 1 deletion .github/actions/check_test_project_fixture/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"@actions/core": "1.10.1",
"@actions/exec": "1.1.1"
},
"packageManager": "yarn@3.7.0"
"packageManager": "yarn@4.0.2"
}
28 changes: 14 additions & 14 deletions .github/actions/check_test_project_fixture/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,57 @@
# Manual changes might be lost - proceed with caution!

__metadata:
version: 6
cacheKey: 8c0
version: 8
cacheKey: 10c0

"@actions/core@npm:1.10.1":
version: 1.10.1
resolution: "@actions/core@npm:1.10.1"
dependencies:
"@actions/http-client": ^2.0.1
uuid: ^8.3.2
checksum: 7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832
"@actions/http-client": "npm:^2.0.1"
uuid: "npm:^8.3.2"
checksum: 8c0/7a61446697a23dcad3545cf0634dedbdedf20ae9a0ee6ee977554589a15deb4a93593ee48a41258933d58ce0778f446b0d2c162b60750956fb75e0b9560fb832
languageName: node
linkType: hard

"@actions/exec@npm:1.1.1":
version: 1.1.1
resolution: "@actions/exec@npm:1.1.1"
dependencies:
"@actions/io": ^1.0.1
checksum: 4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a
"@actions/io": "npm:^1.0.1"
checksum: 8c0/4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a
languageName: node
linkType: hard

"@actions/http-client@npm:^2.0.1":
version: 2.0.1
resolution: "@actions/http-client@npm:2.0.1"
dependencies:
tunnel: ^0.0.6
checksum: b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67
tunnel: "npm:^0.0.6"
checksum: 8c0/b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67
languageName: node
linkType: hard

"@actions/io@npm:^1.0.1":
version: 1.1.2
resolution: "@actions/io@npm:1.1.2"
checksum: 61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1
checksum: 8c0/61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1
languageName: node
linkType: hard

"check_test_project_fixture@workspace:.":
version: 0.0.0-use.local
resolution: "check_test_project_fixture@workspace:."
dependencies:
"@actions/core": 1.10.1
"@actions/exec": 1.1.1
"@actions/core": "npm:1.10.1"
"@actions/exec": "npm:1.1.1"
languageName: unknown
linkType: soft

"tunnel@npm:^0.0.6":
version: 0.0.6
resolution: "tunnel@npm:0.0.6"
checksum: e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75
checksum: 8c0/e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75
languageName: node
linkType: hard

Expand All @@ -61,6 +61,6 @@ __metadata:
resolution: "uuid@npm:8.3.2"
bin:
uuid: dist/bin/uuid
checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54
checksum: 8c0/bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54
languageName: node
linkType: hard
40 changes: 40 additions & 0 deletions .github/actions/detect-changes/cases/code_changes.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Detects if the given file path points to a code file (as apposed to a docs
* file)
*/
function isCodeFile(filePath) {
if (filePath.startsWith('docs')) {
return false
}

if (
[
'CHANGELOG.md',
'CODE_OF_CONDUCT.md',
'CONTRIBUTING.md',
'CONTRIBUTORS.md',
'LICENSE',
'README.md',
'SECURITY.md',
].includes(filePath)
) {
return false
}

return true
}

/**
* Checks if the given array of file paths contains any files with potential
* code changes
*/
export function hasCodeChanges(changedFiles) {
return changedFiles.some((file) => {
if (isCodeFile(file)) {
console.log(`Found code file: ${file}`)
return true
}

return false
})
}
33 changes: 0 additions & 33 deletions .github/actions/detect-changes/cases/onlydocs.mjs

This file was deleted.

4 changes: 3 additions & 1 deletion .github/actions/detect-changes/cases/rsc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export function rscChanged(changedFiles){
changedFile.startsWith('packages/internal/') ||
changedFile.startsWith('packages/project-config/') ||
changedFile.startsWith('packages/web/') ||
changedFile.startsWith('packages/vite/')
changedFile.startsWith('packages/vite/') ||
changedFile.startsWith('__fixtures__/test-project-rsa') ||
changedFile.startsWith('__fixtures__/test-project-rsc-external-packages')
) {
console.log('RSC change detected:', changedFile)
return true
Expand Down
73 changes: 65 additions & 8 deletions .github/actions/detect-changes/detectChanges.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,69 @@
import fs from 'node:fs'

import core from '@actions/core'
import { exec, getExecOutput } from '@actions/exec'
import { onlyDocsChanged } from './cases/onlydocs.mjs'
import { hasCodeChanges } from './cases/code_changes.mjs'
import { rscChanged } from './cases/rsc.mjs'
import { ssrChanged } from './cases/ssr.mjs'

const getPrNumber = (githubRef) => {
// Example GITHUB_REF refs/pull/9544/merge
const result = /refs\/pull\/(\d+)\/merge/g.exec(process.env.GITHUB_REF)

let prNumber = result?.[1]

if (!prNumber) {
try {
// Example GITHUB_EVENT_PATH
// /home/runner/work/_temp/_github_workflow/event.json
const ev = JSON.parse(
fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8')
)
prNumber = ev.pull_request?.number
} catch {
// fall through
}
}

if (!prNumber) {
throw new Error('Could not find the PR number')
}

return prNumber
}

async function getChangedFiles(page = 1) {
const prNumber = getPrNumber()

console.log(`Getting changed files for PR ${prNumber} (page ${page})`)

let changedFiles = []

// Query the GitHub API to get the changed files in the PR
const githubToken = process.env.GITHUB_TOKEN
const url = `https://api.github.com/repos/redwoodjs/redwood/pulls/${prNumber}/files?per_page=100&page=${page}`
const resp = await fetch(url, {
headers: {
Authorization: githubToken ? `Bearer ${githubToken}` : undefined,
['X-GitHub-Api-Version']: '2022-11-28',
Accept: 'application/vnd.github+json',
},
})

const json = await resp.json()
const files = json.map((file) => file.filename) || []

changedFiles = changedFiles.concat(files)

// Look at the headers to see if the result is paginated
const linkHeader = resp.headers.get('link')
if (linkHeader && linkHeader.includes('rel="next"')) {
const files = await getChangedFiles(page + 1)
changedFiles = changedFiles.concat(files)
}

return changedFiles
}

async function main() {
const branch = process.env.GITHUB_BASE_REF

Expand All @@ -15,14 +75,11 @@ async function main() {
return
}

await exec(`git fetch origin ${branch}`)

const { stdout } = await getExecOutput(`git diff origin/${branch} --name-only`)
const changedFiles = stdout.toString().trim().split('\n').filter(Boolean)
const changedFiles = await getChangedFiles()
console.log(`${changedFiles.length} changed files`)

const onlyDocs = onlyDocsChanged(changedFiles)
if(onlyDocs){
if (!hasCodeChanges(changedFiles)) {
console.log('No code changes detected, only docs')
core.setOutput('onlydocs', true)
core.setOutput('rsc', false)
core.setOutput('ssr', false)
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/detect-changes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"@actions/core": "1.10.1",
"@actions/exec": "1.1.1"
},
"packageManager": "yarn@3.7.0"
"packageManager": "yarn@4.0.2"
}
Loading

0 comments on commit dba3868

Please sign in to comment.