Skip to content

Commit

Permalink
Merge branch 'sanity-io:next' into feature/add-unattended-mode-for-un…
Browse files Browse the repository at this point in the history
…deploy
  • Loading branch information
nkgentile authored Jan 16, 2025
2 parents 78392c8 + 8d3ac75 commit afb159b
Show file tree
Hide file tree
Showing 574 changed files with 10,988 additions and 31,420 deletions.
1 change: 0 additions & 1 deletion .eslintignore.react-compiler
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dev/test-studio/workshop/scopes.js
dev/design-studio/*
dev/embedded-studio/*
dev/starter-cra-studio/*
dev/starter-next-studio/*
dev/starter-studio/*
dev/strict-studio/*
dev/studio-e2e-studio/*
Expand Down
89 changes: 55 additions & 34 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@
// @ts-check
'use strict'

const noRestrictedImportPaths = [
{
name: '@sanity/ui',
importNames: [
'Button',
'ButtonProps',
'Dialog',
'DialogProps',
'ErrorBoundary',
'MenuButton',
'MenuButtonProps',
'MenuGroup',
'MenuGroupProps',
'MenuItem',
'MenuItemProps',
'Popover',
'PopoverProps',
'Tab',
'TabProps',
'Tooltip',
'TooltipProps',
'TooltipDelayGroupProvider',
'TooltipDelayGroupProviderProps',
],
message:
'Please use the (more opinionated) exported components in sanity/src/ui-components instead.',
},
{
name: 'styled-components',
importNames: ['default'],
message: 'Please use `import {styled} from "styled-components"` instead.',
},
{
name: 'react',
importNames: ['default', 'createContext', 'createElement'],
message:
'Please use named imports, e.g. `import {useEffect, useMemo, type ComponentType} from "react"` instead.\nPlease place "context" in _singletons\nPlease use JSX instead of createElement, for example `createElement(Icon)` should be `<Icon />`',
},
]

const extensions = ['.cjs', '.mjs', '.js', '.jsx', '.ts', '.tsx']

/** @type {import('eslint').Linter.Config} */
Expand Down Expand Up @@ -180,48 +220,29 @@ const config = {
'packages/sanity/src/_singletons/**',
'packages/sanity/src/_createContext/**',
],
rules: {
'no-restricted-imports': [
'error',
{
paths: noRestrictedImportPaths,
},
],
},
},
{
files: ['packages/sanity/src/core/**'],
excludedFiles: ['**/__workshop__/**'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@sanity/ui',
importNames: [
'Button',
'ButtonProps',
'Dialog',
'DialogProps',
'ErrorBoundary',
'MenuButton',
'MenuButtonProps',
'MenuGroup',
'MenuGroupProps',
'MenuItem',
'MenuItemProps',
'Popover',
'PopoverProps',
'Tab',
'TabProps',
'Tooltip',
'TooltipProps',
'TooltipDelayGroupProvider',
'TooltipDelayGroupProviderProps',
],
message:
'Please use the (more opinionated) exported components in sanity/src/ui-components instead.',
},
{
name: 'styled-components',
importNames: ['default'],
message: 'Please use `import {styled} from "styled-components"` instead.',
},
{
name: 'react',
importNames: ['default', 'createContext', 'createElement'],
name: 'sanity',
message:
'Please use named imports, e.g. `import {useEffect, useMemo, type ComponentType} from "react"` instead.\nPlease place "context" in _singletons\nPlease use JSX instead of createElement, for example `createElement(Icon)` should be `<Icon />`',
'Please import from a relative path instead (since you are inside `packages/sanity/src/core`).',
},
...noRestrictedImportPaths,
],
},
],
Expand Down
14 changes: 14 additions & 0 deletions .github/eslint-compact.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
"code": 6
}
]
},
{
"owner": "turbo-eslint-compact",
"pattern": [
{
"regexp": "^(?:[^:]+: )?([^:]+):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(Error|Warning|Info)\\s-\\s(.+)\\s\\((.+)\\)\\.?$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
}
]
}
5 changes: 5 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"rollback"
],
"matchPackageNames": [
"!@portabletext/block-tools",
"!@portabletext/editor",
"!@sanity/client",
"!@sanity/tsdoc",
Expand All @@ -41,6 +42,7 @@
{
"matchDepTypes": ["dependencies"],
"matchPackageNames": [
"@portabletext/block-tools",
"@portabletext/editor",
"@sanity/bifur-client",
"@sanity/client",
Expand All @@ -49,6 +51,7 @@
"@sanity/insert-menu",
"@sanity/mutate",
"@sanity/presentation",
"@sanity/template-validator",
"@sanity/ui",
"get-it",
"groq-js",
Expand All @@ -60,6 +63,7 @@
{
"description": "Ensure internal and important packages open a PRs right away, without waiting for manual approval",
"matchPackageNames": [
"@portabletext/block-tools",
"@portabletext/editor",
"@sanity/bifur-client",
"@sanity/client",
Expand All @@ -70,6 +74,7 @@
"@sanity/mutate",
"@sanity/pkg-utils",
"@sanity/presentation",
"@sanity/template-validator",
"@sanity/tsdoc",
"@sanity/ui",
"esbuild",
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/e2e-ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
install:
timeout-minutes: 30
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
playwright-ct-test:
timeout-minutes: 30
needs: [install]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
Expand Down Expand Up @@ -152,17 +152,17 @@ jobs:
NODE_OPTIONS: --max_old_space_size=8192
run: pnpm --filter sanity test:ct --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-ct-report
name: playwright-ct-report-${{ matrix.project }}-${{ matrix.shardIndex }}
path: ${{ github.workspace }}/packages/sanity/blob-report
retention-days: 30

merge-reports:
if: always()
needs: [playwright-ct-test]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -198,9 +198,10 @@ jobs:
run: pnpm install

- name: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: playwright-ct-report
pattern: playwright-ct-report-*
merge-multiple: true
path: ${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report

- name: Merge into HTML Report
Expand Down Expand Up @@ -229,10 +230,10 @@ jobs:
comment_tag: "playwright-ct-report"
filePath: ${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report/playwright-report-pr-comment.md

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-ct-report
name: full-playwright-ct-report
path: |
${{ github.workspace }}/packages/sanity/playwright-ct/report
${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report
Expand All @@ -245,7 +246,7 @@ jobs:
actions: write # needed to delete the cache
timeout-minutes: 30
name: Cleanup (${{ matrix.project }})
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: [playwright-ct-test]

strategy:
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/e2e-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ jobs:
SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }}
run: pnpm test:e2e --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
name: playwright-report-${{ matrix.project }}-${{ matrix.shardIndex }}
path: blob-report
retention-days: 30
merge-reports:
Expand Down Expand Up @@ -340,18 +340,19 @@ jobs:
run: pnpm install

- name: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: playwright-report
pattern: playwright-report-*
merge-multiple: true
path: playwright-report

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./playwright-report

- name: Upload HTML report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
name: full-html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 30

Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ jobs:
SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }}
run: pnpm test:e2e --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
name: playwright-report-${{ matrix.project }}-${{ matrix.shardIndex }}
path: blob-report
retention-days: 30
merge-reports:
Expand Down Expand Up @@ -260,18 +260,19 @@ jobs:
run: pnpm install

- name: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: playwright-report
pattern: playwright-report-*
merge-multiple: true
path: playwright-report

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./playwright-report

- name: Upload HTML report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
name: full-html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 30

Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/efps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ jobs:
RECORD_VIDEO: ${{ github.event.inputs.record_video || false }}
run: pnpm efps:test -- -- --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: efps-report
name: efps-report-${{ matrix.shardIndex }}
path: ${{ github.workspace }}/perf/efps/results/
retention-days: 30

Expand Down Expand Up @@ -138,9 +138,10 @@ jobs:
run: pnpm install

- name: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: efps-report
pattern: efps-report-*
merge-multiple: true
path: perf/efps/results

- name: Write report
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/lintPr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ jobs:
- name: Install project dependencies
run: pnpm install

- name: Register Problem Matcher for ESLint that handles -f compact and shows warnings inline on PRs
run: echo "::add-matcher::.github/eslint-compact.json"

- name: Lint files
run: pnpm lint
run: pnpm turbo run lint --output-logs=full --continue -- -f compact
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
/packages/@sanity/*/coverage
/packages/@sanity/*/lib
/packages/@sanity/*/node_modules
/packages/@sanity/block-tools/test/**/input.html
/packages/@sanity/client/umd
/packages/@sanity/cli/bin/sanity-cli.js
/packages/@sanity/cli/templates
Expand Down
2 changes: 1 addition & 1 deletion dev/depcheck-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "depcheck-test",
"version": "3.68.3",
"version": "3.70.0",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>"
Expand Down
Loading

0 comments on commit afb159b

Please sign in to comment.