Skip to content

Commit

Permalink
[major] Sanity V3 Upgrade (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh authored Feb 21, 2024
1 parent 105dedb commit d518458
Show file tree
Hide file tree
Showing 36 changed files with 30,778 additions and 13,532 deletions.
6 changes: 0 additions & 6 deletions .babelrc

This file was deleted.

6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.js
.eslintrc.js
commitlint.config.js
dist
lint-staged.config.js
package.config.ts
41 changes: 38 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,42 @@
{
"extends": "@ahmdigital/eslint-config/react-config",
"parser": "@typescript-eslint/parser",
"root": true,
"env": {
"node": true,
"browser": true
},
"extends": [
"@ahmdigital/eslint-config/ts-config",
"@ahmdigital/eslint-config/react-config",
"sanity",
"sanity/typescript",
"sanity/react",
"plugin:import/typescript",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended",
"plugin:react/jsx-runtime"
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"rules": {
"jest/no-deprecated-functions": "off"
"jsdoc/require-param-type": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never",
"mjs": "never"
}
]
}
}
49 changes: 21 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
Expand All @@ -23,45 +20,41 @@ coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

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

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
# macOS finder cache file
.DS_Store

# Yarn Integrity file
.yarn-integrity
# VS Code settings
.vscode

# dotenv environment variables file
.env
# IntelliJ
.idea
*.iml

# next.js build output
.next
# Cache
.cache

# Yalc
.yalc
yalc.lock

# npm package zips
*.tgz

lib
*.aes
*.decrypted
codeship_deploy_key*
codeship.env
# Compiled plugin
dist
26 changes: 13 additions & 13 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Expand Down
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
Yes, please!

Repo still needs a way of running locally without a studio, but for now use npm link and develop it against your own studio.

Will add a test runner (jest) at some point if this takes off.
19 changes: 14 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
FROM node:16

WORKDIR /root/app
WORKDIR /var/app

COPY package.json package-lock.json ./
RUN npm ci --quiet --no-optional && \
npm cache clean --force
COPY .eslintignore .
COPY .eslintrc .
COPY package-lock.json .
COPY package.json .
COPY package.config.ts .

RUN npm install

COPY .eslintrc .babelrc ./
COPY src ./src
COPY sanity.json .
COPY jest.config.js .
COPY tsconfig.dist.json .
COPY tsconfig.json .
COPY tsconfig.settings.json .
COPY v2-incompatible.js .
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Cameron Chamberlain
Copyright (c) 2024 Josh Edwards

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
# Content Model Graph
# sanity-plugin-content-model-graph

[![Codeship Status for ahmdigital/content-model-graph](https://app.codeship.com/projects/114f2570-022a-0138-b1be-367aa528a0e6/status?branch=master)](https://app.codeship.com/projects/378236)

Graph your Sanity.io content model straight in your Studio using this tool
> This is a **Sanity Studio v3** plugin.
## Installation

1. `sanity install content-model-graph`
2. There's no step 2.
```sh
npm install sanity-plugin-content-model-graph
```

## Usage

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

```ts
import { defineConfig } from "sanity";
import { myPlugin } from "sanity-plugin-content-model-graph";

export default defineConfig({
//...
plugins: [myPlugin({})],
});
```

## Examples (need updating, it looks nicer now)

Expand All @@ -21,12 +34,14 @@ Graph your Sanity.io content model straight in your Studio using this tool
![Screen Shot 2019-11-16 at 11 52 00 pm](https://user-images.githubusercontent.com/4197647/68993455-77886700-08cc-11ea-8a5c-1653d44fee07.png)
![Screen Shot 2019-11-16 at 11 52 12 pm](https://user-images.githubusercontent.com/4197647/68993452-77886700-08cc-11ea-8426-02447b894b9f.png)

## Contributing
## License

Yes, please!
[MIT](LICENSE) © ahm Digital

Repo still needs a way of running locally without a studio, but for now use `npm link` and develop it against your own studio.
## Develop & test

Will add a CD integration to npm if this takes off. For now we at least have CI for lint.
This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
with default configuration for build & watch scripts.

*NOTE:* This repo is manually released for now.
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.
6 changes: 3 additions & 3 deletions codeship-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
type: parallel
service: build-service
steps:
- command: npm run lint
# - command: npm t -- --coverage
- command: npm run build
- command: npm run lint
- command: npm t -- --coverage
- command: npm run build
6 changes: 1 addition & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
clearMocks: true,
coverageDirectory: 'coverage',
preset: 'ts-jest',
testEnvironment: 'node',
};
Loading

0 comments on commit d518458

Please sign in to comment.