Skip to content

Commit

Permalink
fix: compiled for sanity 3.0.0-rc.0
Browse files Browse the repository at this point in the history
Upgraded with
"npx @sanity/plugin-kit inject --preset semver-workflow --preset renovatebot"
  • Loading branch information
snorrees committed Nov 3, 2022
1 parent 5285578 commit 2bef91d
Show file tree
Hide file tree
Showing 23 changed files with 26,926 additions and 18,026 deletions.
12 changes: 11 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
; editorconfig.org
root = true
charset= utf8

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
indent_style = space

[*.md]
trim_trailing_whitespace = false
6 changes: 2 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/node_modules/
/lib/
.eslintrc.js
commitlint.config.js
lib
lint-staged.config.js
*.md
*.yml
package.config.ts
*.js
96 changes: 77 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,85 @@
name: CI
name: CI & Release
on:
- push
- pull_request
# Build on pushes to release branches
push:
branches: [v3]
# Build on pull requests targeting release branches
pull_request:
branches: [v3]
workflow_dispatch:
inputs:
release:
description: Release new version
required: true
default: false
type: boolean

jobs:
test:
runs-on: ${{ matrix.platform }}
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
node-version:
- 16
log-the-inputs:
name: Log inputs
runs-on: ubuntu-latest
steps:
- run: |
echo "Inputs: $INPUTS"
env:
INPUTS: ${{ toJSON(inputs) }}
build:
name: Lint & Build
runs-on: ubuntu-latest
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: npm
- run: npm ci
- run: npm run lint --if-present
- run: npm run prepublishOnly

test:
name: Test
needs: build
strategy:
matrix:
os: [ macos-latest, ubuntu-latest ]
node: [ lts/*, current ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: npm
- run: npm ci
- run: npm test --if-present

release:
name: Semantic release
needs: test
runs-on: ubuntu-latest
# only run if opt-in during workflow_dispatch
if: inputs.release == true
steps:
- uses: actions/checkout@v3
with:
# Need to fetch entire commit history to
# analyze every commit since last release
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run lint
- run: npm run build
#- run: npm test
node-version: lts/*
cache: npm
- run: npm ci
# Branches that will release new versions are defined in .releaserc.json
- run: npx semantic-release --dry-run
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
# e.g. git tags were pushed but it exited before `npm publish`
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
65 changes: 58 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,61 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
lib
yarn.lock
jspm_packages

# dont ignore this, need it for stable CI
#package-lock.json
/**/*/.DS_Store
.idea/
# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# macOS finder cache file
.DS_Store

# VS Code settings
.vscode

# IntelliJ
.idea
*.iml

# Cache
.cache

# Yalc
.yalc
yalc.lock

##npm package zips
*.tgz

# Compiled plugin
lib

.parcel-cache
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/test
/coverage
.editorconfig
.eslintrc
.gitignore
.github
.prettierrc
.travis.yml
.nyc_output
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
legacy-peer-deps=true
legacy-peer-deps=true
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
semi: false,
printWidth: 100,
bracketSpacing: false,
singleQuote: true,
}
4 changes: 4 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@sanity/semantic-release-preset",
"branches": ["main", {"name": "v3", "channel": "studio-v3", "prerelease": "v3-studio"}]
}
22 changes: 18 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Copyright © 2020 Liam Martens
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (c) 2022 Sanity.io

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,23 @@ The plugin is now installed, but you will need to complete the following steps t
While most of the UI is the same in the official version of this plugin there are some breaking changes you should be aware of before migrating:

[Coming from sanity-plugin-intl-input](docs/coming-from-sanity-plugin-intl-input.md)


## License

MIT-licensed. See LICENSE.

## Develop & test

This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
with default configuration for build & watch scripts.

See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
on how to run this plugin with hotreload in the studio.

### Release new version

Run ["CI & Release" workflow](https://github.com/sanity-io/document-internationalization/actions/workflows/main.yml).
Make sure to select the main branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.
2 changes: 1 addition & 1 deletion docs/desk-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
DuplicateWithi18nAction,
} from '@sanity/document-internationalization'

export default createConfig({
export default defineConfig({
// ...
plugins: [
documentI18n({ /* ... */}),
Expand Down
10 changes: 5 additions & 5 deletions docs/enabling-and-configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ We will assume the following starting scenario:
```js
import {deskTool} from 'sanity/desk'

export default createConfig({
export default defineConfig({
plugins: [deskTool()]
})
```
Expand All @@ -19,7 +19,7 @@ Your configuration file will look something like this:
```js
import { withDocumentI18nPlugin } from '@sanity/document-internationalization'

export default createConfig({
export default defineConfig({
// ...
plugins: withDocumentI18nPlugin([
// ... other plugins
Expand All @@ -40,7 +40,7 @@ If you need even more control, you can refer to the more advanced [desk structur
import {deskTool} from 'sanity/desk'
import {withDocumentI18nPlugin, getDocumentList} from '@sanity/document-internationalization'

export default createConfig({
export default defineConfig({
// ...
plugins: withDocumentI18nPlugin((pluginConfig) => ([
// ... other plugins
Expand All @@ -53,7 +53,7 @@ export default createConfig({
})
})

export default createConfig({
export default defineConfig({
// ...
plugins: [
documentI18n(
Expand Down Expand Up @@ -141,7 +141,7 @@ This option configures the field names used by the plugin
```js
import { documentI18n } from "@sanity/document-internationalization";

export default createConfig({
export default defineConfig({
// ...
plugins: [
documentI18n({
Expand Down
4 changes: 2 additions & 2 deletions docs/usage-with-custom-publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
} from '@sanity/document-internationalization'


export default createConfig({
export default defineConfig({
// ...
plugins: [
documentI18n({ /* ... */}),
Expand Down Expand Up @@ -73,7 +73,7 @@ import {
} from '@sanity/document-internationalization'


export default createConfig({
export default defineConfig({
// ...
plugins: [
documentI18n({ /* ... */}),
Expand Down
Loading

0 comments on commit 2bef91d

Please sign in to comment.