Skip to content

Commit

Permalink
Merge branch 'next' into feat/SAPP-1970
Browse files Browse the repository at this point in the history
  • Loading branch information
EoinFalconer committed Jan 13, 2025
2 parents 6e48550 + f3151c3 commit bd048cd
Show file tree
Hide file tree
Showing 76 changed files with 494 additions and 5,141 deletions.
8 changes: 4 additions & 4 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 @@ -162,7 +162,7 @@ jobs:
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 @@ -245,7 +245,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
2 changes: 1 addition & 1 deletion dev/design-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"@sanity/icons": "^3.5.7",
"@sanity/ui": "^2.11.1",
"@sanity/ui": "^2.11.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion dev/embedded-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"preview": "vite preview"
},
"dependencies": {
"@sanity/ui": "^2.11.1",
"@sanity/ui": "^2.11.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion dev/page-building-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@sanity/vision": "workspace:*",
"babel-plugin-react-compiler": "19.0.0-beta-63e3235-20250105",
"babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
"react": "^18.2.0",
"react-compiler-runtime": "19.0.0-beta-55955c9-20241229",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion dev/starter-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"start": "../.bin/sanity start --port 3337"
},
"dependencies": {
"babel-plugin-react-compiler": "19.0.0-beta-63e3235-20250105",
"babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
"react": "^18.3.1",
"react-compiler-runtime": "19.0.0-beta-55955c9-20241229",
"react-dom": "^18.3.1",
Expand Down
4 changes: 2 additions & 2 deletions dev/studio-e2e-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"@sanity/color-input": "^4.0.1",
"@sanity/google-maps-input": "^4.0.0",
"@sanity/icons": "^3.5.7",
"@sanity/ui": "^2.11.1",
"@sanity/ui": "^2.11.2",
"@sanity/vision": "3.69.0",
"babel-plugin-react-compiler": "19.0.0-beta-63e3235-20250105",
"babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"sanity": "workspace:*",
Expand Down
6 changes: 3 additions & 3 deletions dev/test-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"workshop:dev": "node -r esbuild-register scripts/workshop/dev.ts"
},
"dependencies": {
"@portabletext/editor": "^1.21.0",
"@portabletext/editor": "^1.21.1",
"@portabletext/react": "^3.0.0",
"@sanity/assist": "^3.0.2",
"@sanity/block-tools": "3.69.0",
Expand All @@ -37,7 +37,7 @@
"@sanity/react-loader": "^1.8.3",
"@sanity/tsdoc": "1.0.169",
"@sanity/types": "workspace:*",
"@sanity/ui": "^2.11.1",
"@sanity/ui": "^2.11.2",
"@sanity/ui-workshop": "^1.0.0",
"@sanity/util": "workspace:*",
"@sanity/uuid": "^3.0.1",
Expand Down Expand Up @@ -65,7 +65,7 @@
},
"devDependencies": {
"@million/lint": "1.0.14",
"babel-plugin-react-compiler": "19.0.0-beta-63e3235-20250105",
"babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
"chokidar": "^3.6.0",
"vite": "^5.4.11"
}
Expand Down
4 changes: 2 additions & 2 deletions dev/test-studio/sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const sharedSettings = definePlugin({
],
})

const defaultWorkspace = {
const defaultWorkspace = defineConfig({
name: 'default',
title: 'Test Studio',
projectId: 'ppsg7ml5',
Expand All @@ -179,7 +179,7 @@ const defaultWorkspace = {
tasks: {
enabled: true,
},
}
})

export default defineConfig([
defaultWorkspace,
Expand Down
2 changes: 1 addition & 1 deletion examples/ecommerce-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"@sanity/cli": "3.69.0",
"@sanity/ui": "^2.11.1",
"@sanity/ui": "^2.11.2",
"react": "^18.3.1",
"react-barcode": "^1.4.1",
"react-dom": "^18.3.1",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"@sanity/prettier-config": "^1.0.3",
"@sanity/test": "0.0.1-alpha.1",
"@sanity/tsdoc": "1.0.169",
"@sanity/ui": "^2.11.1",
"@sanity/ui": "^2.11.2",
"@sanity/uuid": "^3.0.2",
"@types/glob": "^7.2.0",
"@types/lodash": "^4.17.7",
Expand All @@ -144,7 +144,7 @@
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-compiler": "19.0.0-beta-63e3235-20250105",
"eslint-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-tsdoc": "^0.3.0",
Expand Down
1 change: 0 additions & 1 deletion packages/@sanity/cli/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# package specific
/templates
/test/test-template
20 changes: 11 additions & 9 deletions packages/@sanity/cli/src/util/remoteTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,17 @@ export async function applyEnvVariables(
value: string,
useQuotes: boolean,
) => {
const pattern = varRegex instanceof RegExp ? varRegex : new RegExp(`${varRegex}=.*$`, 'gm')
const match = content.match(pattern)
if (!match) return content

const varName = match[0].split('=')[0]
return content.replace(
new RegExp(`${varName}=.*$`, 'gm'),
`${varName}=${useQuotes ? `"${value}"` : value}`,
)
const varPattern = typeof varRegex === 'string' ? varRegex : varRegex.source
const pattern = new RegExp(`.*${varPattern}=.*$`, 'gm')
const matches = content.matchAll(pattern)
return Array.from(matches).reduce((updatedContent, match) => {
if (!match[0]) return updatedContent
const varName = match[0].split('=')[0].trim()
return updatedContent.replace(
new RegExp(`${varName}=.*$`, 'gm'),
`${varName}=${useQuotes ? `"${value}"` : value}`,
)
}, content)
}

let envContent = templateContent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NEXT_PUBLIC_SANITY_PROJECT_ID=
SANITY_STUDIO_PROJECT_ID=

NEXT_PUBLIC_SANITY_DATASET=
SANITY_STUDIO_DATASET=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a test template solely for the purpose of testing the `init --template` command when using remote templates.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {type NextConfig} from 'next'

const nextConfig: NextConfig = {
/* config options here */
}

export default nextConfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "test-template",
"version": "1.0.0",
"main": "package.json",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"next": "^15",
"next-sanity": "^9",
"sanity": "^3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {defineCliConfig} from 'sanity/cli'

export default defineCliConfig({
api: {
projectId: process.env.SANITY_STUDIO_PROJECT_ID,
dataset: process.env.SANITY_STUDIO_DATASET,
},
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'

export default defineConfig({
name: 'sanity-template-astro-clean',
title: 'Sanity Astro Starter',
projectId: process.env.SANITY_STUDIO_PROJECT_ID,
dataset: process.env.SANITY_STUDIO_DATASET,
plugins: [structureTool()],
schema: {
types: [],
},
})
12 changes: 7 additions & 5 deletions packages/@sanity/cli/test/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describeCliTest('CLI: `sanity init v3`', () => {
'--dataset',
testRunArgs.dataset,
'--template',
'sanity-io/sanity/packages/@sanity/cli/test/test-template',
'sanity-io/sanity/packages/@sanity/cli/test/__fixtures__/remote-template',
'--output-path',
`${baseTestPath}/${outpath}`,
'--package-manager',
Expand Down Expand Up @@ -145,7 +145,7 @@ describeCliTest('CLI: `sanity init v3`', () => {
'--dataset',
testRunArgs.dataset,
'--template',
'https://github.com/sanity-io/sanity/tree/next/packages/@sanity/cli/test/test-template',
'https://github.com/sanity-io/sanity/tree/next/packages/@sanity/cli/test/__fixtures__/remote-template',
'--output-path',
`${baseTestPath}/${outpath}`,
'--package-manager',
Expand Down Expand Up @@ -183,7 +183,7 @@ describeCliTest('CLI: `sanity init v3`', () => {
'--dataset',
testRunArgs.dataset,
'--template',
'sanity-io/sanity/packages/@sanity/cli/test/test-template',
'sanity-io/sanity/packages/@sanity/cli/test/__fixtures__/remote-template',
'--output-path',
`${baseTestPath}/${outpath}`,
'--package-manager',
Expand All @@ -192,8 +192,10 @@ describeCliTest('CLI: `sanity init v3`', () => {

const envContent = await fs.readFile(path.join(baseTestPath, outpath, '.env.local'), 'utf-8')

expect(envContent).toContain(`SANITY_PROJECT_ID=${cliProjectId}`)
expect(envContent).toContain(`SANITY_DATASET=${testRunArgs.dataset}`)
expect(envContent).toContain(`NEXT_PUBLIC_SANITY_PROJECT_ID=${cliProjectId}`)
expect(envContent).toContain(`SANITY_STUDIO_PROJECT_ID=${cliProjectId}`)
expect(envContent).toContain(`NEXT_PUBLIC_SANITY_DATASET=${testRunArgs.dataset}`)
expect(envContent).toContain(`SANITY_STUDIO_DATASET=${testRunArgs.dataset}`)
})

testConcurrent('fails with invalid repository format', async () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/@sanity/cli/test/test-template/.env.local.example

This file was deleted.

2 changes: 0 additions & 2 deletions packages/@sanity/cli/test/test-template/.eslintignore

This file was deleted.

4 changes: 0 additions & 4 deletions packages/@sanity/cli/test/test-template/.eslintrc

This file was deleted.

42 changes: 0 additions & 42 deletions packages/@sanity/cli/test/test-template/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions packages/@sanity/cli/test/test-template/.prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions packages/@sanity/cli/test/test-template/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions packages/@sanity/cli/test/test-template/app/(blog)/actions.ts

This file was deleted.

Loading

0 comments on commit bd048cd

Please sign in to comment.