Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update pkg-utils and export config #192

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ yalc.lock
*.tgz

# Compiled plugin
lib

dist
27,379 changes: 6,549 additions & 20,830 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {defineConfig} from '@sanity/pkg-utils'

export default defineConfig({
dist: 'lib',
minify: true,
legacyExports: true,
dist: 'dist',
tsconfig: 'tsconfig.dist.json',

// Remove this block to enable strict export validation
extract: {
rules: {
Expand All @@ -13,4 +14,4 @@ export default defineConfig({
'ae-missing-release-tag': 'off',
},
},
})
})
35 changes: 20 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,38 @@
"author": "Sanity.io <[email protected]>",
"exports": {
".": {
"types": "./lib/src/index.d.ts",
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"import": "./lib/index.esm.js",
"require": "./lib/index.js",
"default": "./lib/index.esm.js"
"require": "./dist/index.js",
"node": {
"module": "./dist/index.esm.js",
"import": "./dist/index.cjs.mjs"
},
"import": "./dist/index.esm.js",
"default": "./dist/index.esm.js"
},
"./package.json": "./package.json"
},
"main": "./lib/index.js",
"module": "./lib/index.esm.js",
"main": "./dist/index.js",
"module": "./dist/index.esm.js",
"source": "./src/index.ts",
"types": "./lib/src/index.d.ts",
"types": "./dist/index.d.ts",
"files": [
"src",
"lib",
"v2-incompatible.js",
"sanity.json"
],
"scripts": {
"prebuild": "npm run clean && plugin-kit verify-package --silent && pkg-utils",
"build": "pkg-utils build",
"clean": "rimraf lib",
"build": "run-s clean && plugin-kit verify-package --silent && pkg-utils build --strict && pkg-utils --strict",
"clean": "rimraf dist",
"dev": "npm run watch",
"format": "prettier --write --cache --ignore-unknown .",
"link-watch": "plugin-kit link-watch",
"lint": "eslint .",
"prepare": "husky install",
"prepublishOnly": "npm run build",
"watch": "pkg-utils watch"
"prepublishOnly": "run-s build",
"watch": "pkg-utils watch --strict"
},
"dependencies": {
"@hookform/resolvers": "^3.1.1",
Expand All @@ -66,6 +70,7 @@
"groq": "^3.0.0",
"is-hotkey": "^0.2.0",
"nanoid": "^3.3.3",
"npm-run-all": "^4.1.5",
"pluralize": "^8.0.0",
"react-dropzone": "^11.3.1",
"react-file-icon": "^1.1.0",
Expand All @@ -81,11 +86,11 @@
"devDependencies": {
"@commitlint/cli": "^17.2.0",
"@commitlint/config-conventional": "^17.2.0",
"@sanity/client": "^4.0.1",
"@sanity/client": "^6.7.0",
"@sanity/color": "^2.1.20",
"@sanity/icons": "^2.0.0",
"@sanity/pkg-utils": "^2.0.0",
"@sanity/plugin-kit": "^2.1.16",
"@sanity/pkg-utils": "^2.4.8",
"@sanity/plugin-kit": "^3.1.10",
"@sanity/semantic-release-preset": "^2.0.2",
"@types/is-hotkey": "^0.1.7",
"@types/pluralize": "^0.0.29",
Expand Down
16 changes: 16 additions & 0 deletions tsconfig.dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.settings",
"include": ["./src"],
"exclude": [
"./src/**/__fixtures__",
"./src/**/__mocks__",
"./src/**/*.test.ts",
"./src/**/*.test.tsx"
],
"compilerOptions": {
"rootDir": ".",
"outDir": "./dist",
"jsx": "react-jsx",
"emitDeclarationOnly": true
}
}
31 changes: 6 additions & 25 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
{
"extends": "./tsconfig.settings",
"include": ["./src", "./package.config.ts"],
"compilerOptions": {
"jsx": "preserve",
"moduleResolution": "node",
"target": "esnext",
"module": "esnext",
"esModuleInterop": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"strict": true,
"sourceMap": false,
"inlineSourceMap": false,
"downlevelIteration": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "lib",
"paths": {
"@types": ["./src/types"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"isolatedModules": true,
"checkJs": false,
"rootDir": "src"
},
"include": [".d.ts", "src/**/*"]
"rootDir": ".",
"jsx": "react-jsx",
"noEmit": true
}
}
18 changes: 18 additions & 0 deletions tsconfig.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"paths": {
"@types": ["./src/types"]
},
"moduleResolution": "node",
"target": "esnext",
"module": "esnext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"esModuleInterop": true,
"strict": true,
"downlevelIteration": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"isolatedModules": true
}
}
Loading