Skip to content

Commit

Permalink
fix: improve studio typings
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Aug 12, 2022
1 parent 0a17606 commit 918743d
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 34 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"typesVersions": {
"*": {
"studio": [
"./dist/studio.d.ts"
"./lib/dts/studio.d.ts"
]
}
},
Expand All @@ -50,7 +50,7 @@
],
"scripts": {
"prebuild": "npm run clean && node scripts/preParcel.js",
"build": "npm run tsdx build && parcel build",
"build": "npm run tsdx build && parcel build && tsc --declarationDir lib/dts --project tsconfig.studio.json",
"clean": "rimraf lib",
"coverage": "npm test -- --coverage",
"dev": "next",
Expand All @@ -61,7 +61,7 @@
"test": "jest",
"tsdx": "tsdx --tsconfig ./tsconfig.tsdx.json",
"type-check": "tsc --noEmit",
"update:icons": "cp node_modules/@sanity/server/lib/static/favicons/* public"
"update:icons": "cp node_modules/@sanity/server/lib/static/favicons/* src/studio && cp src/studio/favicon-{192,512}.png publi && cp src/studio/webmanifest.json public/manifest.webmanifest"
},
"browserslist": "chrome 59, safari 11, firefox 56, edge 14, ie 11",
"prettier": {
Expand Down
17 changes: 11 additions & 6 deletions src/studio/NextStudioHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
import Head from 'next/head'
import {type ComponentProps, memo, useCallback} from 'react'

import iconApple from '../../public/apple-touch-icon.png'
import iconIco from '../../public/favicon.ico'
import iconSvg from '../../public/favicon.svg'
import icon192 from '../../public/favicon-192.png'
import icon512 from '../../public/favicon-512.png'
import webmanifest from '../../public/webmanifest.json'
// @ts-ignore
import iconApple from './apple-touch-icon.png'
// @ts-ignore
import iconIco from './favicon.ico'
// @ts-ignore
import iconSvg from './favicon.svg'
// @ts-ignore
import icon192 from './favicon-192.png'
// @ts-ignore
import icon512 from './favicon-512.png'
import type {MetaThemeColors} from './utils'
import webmanifest from './webmanifest.json'

// Interop between how Parcel and Next deals with asset imports
const interop = (href: string | {src: string}): string =>
Expand Down
File renamed without changes
Binary file added src/studio/favicon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/studio/favicon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes
File renamed without changes.
27 changes: 27 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"baseUrl": ".",
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
}
26 changes: 2 additions & 24 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
{
"extends": "./tsconfig.base",
"compilerOptions": {
"baseUrl": ".",
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
Expand Down
10 changes: 10 additions & 0 deletions tsconfig.studio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.base",
"compilerOptions": {
"rootDir": "src",
"declaration": true,
"emitDeclarationOnly": true
},
"include": ["src/*.ts", "src/*.tsx"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion tsconfig.tsdx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig",
"extends": "./tsconfig.base",
"compilerOptions": {
"rootDir": "./src"
},
Expand Down

1 comment on commit 918743d

@vercel
Copy link

@vercel vercel bot commented on 918743d Aug 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-sanity – ./

next-sanity.sanity.build
next.sanity.build
next-sanity-git-main.sanity.build

Please sign in to comment.