Skip to content

Commit

Permalink
Merge branch 'next' into feat/studio-manifests-cont
Browse files Browse the repository at this point in the history
  • Loading branch information
snorrees authored Sep 26, 2024
2 parents 0246fa6 + 7aed0c0 commit 73f8bb2
Show file tree
Hide file tree
Showing 222 changed files with 6,595 additions and 3,303 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cli-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
run: |
node -v
npm -v
pnpm test -- --silent --selectProjects=@sanity/cli
pnpm test:jest --silent --selectProjects=@sanity/cli
env:
# Update token in github and change below to ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }} after merge to next
SANITY_CI_CLI_AUTH_TOKEN_STAGING: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN_STAGING }}
77 changes: 77 additions & 0 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Unit tests

on:
# Build on pushes branches that have a PR (including drafts)
pull_request:
# Build on commits pushed to branches without a PR if it's in the allowlist
push:
branches: [next]

jobs:
test:
timeout-minutes: 60
name: Jest tests (${{ matrix.os }} / node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
continue-on-error: ${{ matrix.experimental }}

strategy:
# we want to know if a test fails on a specific node version
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [18, 20]
experimental: [false]
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
# include:
# - os: windows-latest
# node: 16
# experimental: true

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
v1-${{ runner.os }}-pnpm-store-${{ env.cache-name }}-
v1-${{ runner.os }}-pnpm-store-
v1-${{ runner.os }}-
- name: Install project dependencies
run: pnpm install

- name: Test
id: test
run: |
node -v
pnpm test:jest --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }} --ignoreProjects=@sanity/cli
env:
GITHUB_SHARD_IDENTIFIER: ${{ matrix.shardIndex }}-${{ matrix.shardTotal }}
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,4 @@ jobs:
id: test
run: |
node -v
npm -v
pnpm test -- --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }} --ignoreProjects=@sanity/cli
env:
GITHUB_SHARD_IDENTIFIER: ${{ matrix.shardIndex }}-${{ matrix.shardTotal }}
pnpm test:vitest
32 changes: 0 additions & 32 deletions dev/aliases.cjs

This file was deleted.

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.57.4",
"version": "3.58.0",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion dev/design-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "design-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"description": "Sanity Design Studio",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion dev/embedded-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "embedded-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"scripts": {
"build": "tsc && vite build && sanity manifest extract",
Expand Down
2 changes: 1 addition & 1 deletion dev/page-building-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-page-building-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion dev/starter-next-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-starter-next-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion dev/starter-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-starter-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion dev/strict-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-strict-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions dev/studio-e2e-testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "studio-e2e-testing",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"keywords": [
"sanity"
Expand All @@ -18,7 +18,7 @@
"@sanity/google-maps-input": "^4.0.0",
"@sanity/icons": "^3.4.0",
"@sanity/ui": "^2.8.9",
"@sanity/vision": "3.57.4",
"@sanity/vision": "3.58.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion dev/test-next-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-test-next-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions dev/test-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-test-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand All @@ -19,7 +19,7 @@
"@portabletext/editor": "^1.1.0",
"@portabletext/react": "^3.0.0",
"@sanity/assist": "^3.0.2",
"@sanity/block-tools": "3.57.4",
"@sanity/block-tools": "3.58.0",
"@sanity/client": "^6.21.3",
"@sanity/color": "^3.0.0",
"@sanity/google-maps-input": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/blog-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blog-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"description": "Content studio running with schema from the blog init template",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion examples/clean-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clean-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"description": "Content studio running with schema from the clean template",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions examples/ecommerce-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ecommerce-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"description": "",
"keywords": [
Expand Down Expand Up @@ -29,7 +29,7 @@
"start": "sanity dev --port 3337"
},
"dependencies": {
"@sanity/cli": "3.57.4",
"@sanity/cli": "3.58.0",
"@sanity/ui": "^2.8.9",
"react": "^18.3.1",
"react-barcode": "^1.4.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/movies-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "movies-studio",
"version": "3.57.4",
"version": "3.58.0",
"private": true,
"description": "Content studio running with schema from the moviedb init template",
"keywords": [
Expand Down
20 changes: 0 additions & 20 deletions jest.config.cjs

This file was deleted.

17 changes: 17 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* This tells jest which projects exists
*/
import path from 'node:path'
import globby from 'globby'
import {resolveDirName} from '@repo/test-config/jest'

const jestConfigFiles = globby.sync('*/**/jest.config.mjs', {ignore: ['**/node_modules']})

/** @type {import("jest").Config} */
export default {
projects: jestConfigFiles
.map((file) => path.relative(resolveDirName(import.meta.url), path.dirname(file)))
.map((projectPath) => `<rootDir>/${projectPath}`),
// Ignore e2e tests
modulePathIgnorePatterns: ['<rootDir>/test/'],
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"packages/groq",
"packages/sanity"
],
"version": "3.57.4"
"version": "3.58.0"
}
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
"release:rc": "pnpm build && lerna publish --force-publish --dist-tag=dev-preview --preid=rc --exact",
"release:tag": "RELEASE_TAG=\"${RELEASE_TAG:-canary}\"; pnpm build && lerna publish --canary --force-publish --no-git-tag-version --dist-tag=$RELEASE_TAG --preid=$RELEASE_TAG --exact",
"start": "run-s dev",
"test": "jest --forceExit",
"test": "run-s test:vitest test:jest",
"test:jest": "jest --forceExit",
"test:vitest": "vitest --run",
"test:e2e": "playwright test",
"test:exports": "turbo run test --filter=@repo/test-exports",
"tsdoc:dev": "sanity-tsdoc dev",
Expand All @@ -97,14 +99,14 @@
},
"prettier": "@sanity/prettier-config",
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@google-cloud/storage": "^7.11.0",
"@jest/globals": "^29.7.0",
"@playwright/test": "1.44.1",
"@repo/dev-aliases": "workspace:*",
"@repo/package.config": "workspace:*",
"@repo/test-config": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@sanity/client": "^6.21.3",
"@sanity/eslint-config-i18n": "1.0.0",
Expand Down Expand Up @@ -152,7 +154,6 @@
"globby": "^10.0.0",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"js-yaml": "^4.1.0",
"lerna": "^8.1.8",
"lint-staged": "^12.1.2",
Expand All @@ -169,6 +170,7 @@
"typescript": "5.6.2",
"vite": "^4.5.3",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^2.1.1",
"yargs": "^17.3.0"
},
"optionalDependencies": {
Expand Down
33 changes: 33 additions & 0 deletions packages/@repo/dev-aliases/dev-aliases.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable tsdoc/syntax */

// NOTE: THIS FILE NEEDS TO REMAIN COMMONJS
// It can be converted to ESM/TS when we either not use jest anymore, or node/jest runner natively supports ESM (including with import.meta etc).

/**
* The path mappings/aliases used by various tools in the monorepo to map imported modules to
* source files in order to speed up rebuilding and avoid having a separate watcher process to build
* from `src` to `lib`.
*
* This file is currently read by:
* - Vite when running the dev server (only when running in this monorepo)
* - jest when running test suite
*
* @type Record<string, string>
*/
const devAliases = {
// NOTE: do not use regex in the module expressions,
// because they will be escaped by the jest config
'@sanity/block-tools': '@sanity/block-tools/src',
'@sanity/diff': '@sanity/diff/src',
'@sanity/cli': '@sanity/cli/src',
'@sanity/mutator': '@sanity/mutator/src',
'@sanity/schema': '@sanity/schema/src/_exports',
'@sanity/migrate': '@sanity/migrate/src/_exports',
'@sanity/types': '@sanity/types/src',
'@sanity/util': '@sanity/util/src/_exports',
'@sanity/vision': '@sanity/vision/src',
'sanity': 'sanity/src/_exports',
'groq': 'groq/src/_exports.mts',
}

module.exports = devAliases
Loading

0 comments on commit 73f8bb2

Please sign in to comment.