Skip to content

Commit 100f3eb

Browse files
committed
fix: apply upstream v2-studio fixes, add semver automation workflow
- fix: correctly infer filename from files containing uppercase extensions, tweak upload card layout - fix: fix minor regression with tag positioning, dont portal tooltips to prevent overflow issues - ci: add semver automation workflow - fix: catch errors when preview images fail to be generated (#88) - fix: throw an error when trying to call window.crypto from insecure contexts (#50) - fix: don't hardcode z-indices, correctly render last filter item (#57, #82)
1 parent 4517bb5 commit 100f3eb

File tree

43 files changed

+19741
-14533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+19741
-14533
lines changed

.d.ts

-1
This file was deleted.

.eslintrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
extends: [
77
'sanity/react', // must come before sanity/typescript
88
'sanity/typescript',
9-
'plugin:prettier/recommended'
9+
'prettier'
1010
],
1111
overrides: [
1212
{
@@ -19,7 +19,7 @@ module.exports = {
1919
},
2020
project: './tsconfig.json'
2121
},
22-
plugins: ['@typescript-eslint'],
22+
plugins: ['prettier'],
2323
rules: {
2424
'@typescript-eslint/explicit-function-return-type': 0,
2525
'@typescript-eslint/no-shadow': 'error',

.github/workflows/main.yml

+77-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,85 @@
1-
name: CI
1+
name: CI & Release
22
on:
3-
- push
4-
- pull_request
3+
# Build on pushes to release branches
4+
push:
5+
branches: ['main', 'v3']
6+
# Build on pull requests targeting release branches
7+
pull_request:
8+
branches: ['main', 'v3']
9+
workflow_dispatch:
10+
inputs:
11+
release:
12+
description: Release new version
13+
required: true
14+
default: false
15+
type: boolean
16+
517
jobs:
6-
test:
7-
runs-on: ${{ matrix.platform }}
8-
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }}
9-
strategy:
10-
fail-fast: false
11-
matrix:
12-
platform: [ubuntu-latest, macos-latest, windows-latest]
13-
node-version:
14-
- 16
18+
log-the-inputs:
19+
name: Log inputs
20+
runs-on: ubuntu-latest
21+
steps:
22+
- run: |
23+
echo "Inputs: $INPUTS"
24+
env:
25+
INPUTS: ${{ toJSON(inputs) }}
26+
27+
build:
28+
name: Lint & Build
29+
runs-on: ubuntu-latest
1530
steps:
1631
- name: Set git to use LF
1732
run: |
1833
git config --global core.autocrlf false
1934
git config --global core.eol lf
20-
- uses: actions/checkout@v2
21-
- uses: actions/setup-node@v1
35+
- uses: actions/checkout@v3
36+
- uses: actions/setup-node@v3
37+
with:
38+
node-version: lts/*
39+
cache: npm
40+
- run: npm ci
41+
- run: npm run lint --if-present
42+
- run: npm run prepublishOnly
43+
44+
test:
45+
name: Test
46+
needs: build
47+
strategy:
48+
matrix:
49+
os: [macos-latest, ubuntu-latest]
50+
node: [lts/*, current]
51+
runs-on: ${{ matrix.os }}
52+
steps:
53+
- uses: actions/checkout@v3
54+
- uses: actions/setup-node@v3
55+
with:
56+
node-version: ${{ matrix.node }}
57+
cache: npm
58+
- run: npm ci
59+
- run: npm test --if-present
60+
61+
release:
62+
name: Semantic release
63+
needs: test
64+
runs-on: ubuntu-latest
65+
# only run if opt-in during workflow_dispatch
66+
if: inputs.release == true
67+
steps:
68+
- uses: actions/checkout@v3
69+
with:
70+
# Need to fetch entire commit history to
71+
# analyze every commit since last release
72+
fetch-depth: 0
73+
- uses: actions/setup-node@v3
2274
with:
23-
node-version: ${{ matrix.node-version }}
24-
- run: npm install
25-
- run: npm run lint
26-
- run: npm run build
27-
#- run: npm test
75+
node-version: lts/*
76+
cache: npm
77+
- run: npm ci
78+
# Branches that will release new versions are defined in .releaserc.json
79+
- run: npx semantic-release
80+
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
81+
# e.g. git tags were pushed but it exited before `npm publish`
82+
if: always()
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

.releaserc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "@sanity/semantic-release-preset",
3+
"branches": ["main", {"name": "v3", "channel": "studio-v3", "prerelease": "v3-studio"}]
4+
}

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Robin Pyon
3+
Copyright (c) 2022 Robin Pyon
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
21+
THE SOFTWARE.

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sanity Media
22

3-
> ⚠️ This version of `sanity-plugin-media` is for [Sanity Studio V3](https://www.sanity.io/blog/sanity-studio-v3-developer-preview), which is currently in developer preview.
3+
> This version of `sanity-plugin-media` is for [Sanity Studio V3](https://www.sanity.io/blog/sanity-studio-v3-developer-preview), which is currently in developer preview.
44
>
55
> The Studio V2 compatible version can be found on the [V2 branch](https://github.com/robinpyon/sanity-plugin-media).
66
@@ -48,20 +48,18 @@ _Individual asset view_
4848

4949
## Install (V3 Studio only)
5050

51-
In your Sanity project folder, install the plugin and its peer dependency:
51+
In your Sanity project folder:
5252

5353
```sh
54-
npm install --save sanity-plugin-media@v3-studio @mdx-js/react
54+
npm install --save sanity-plugin-media@v3-studio
5555
```
5656

5757
or
5858

5959
```sh
60-
yarn add sanity-plugin-media@v3-studio @mdx-js/react
60+
yarn add sanity-plugin-media@v3-studio
6161
```
6262

63-
`@mdx-js/react` will be removed as a dependency in a future version.
64-
6563
## Usage
6664

6765
Add it as a plugin in your `sanity.config.ts` (or .js) file:

commitlint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['@commitlint/config-conventional'],
2+
extends: ['@commitlint/config-conventional']
33
}

0 commit comments

Comments
 (0)