Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Commit 5c786b7

Browse files
committed
chore: replaced parcel with pkg-utils for building
1 parent 89ecdc3 commit 5c786b7

File tree

7 files changed

+2455
-272
lines changed

7 files changed

+2455
-272
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ commitlint.config.js
33
lib
44
lint-staged.config.js
55
*.js
6+
package.config.ts

package-lock.json

Lines changed: 2418 additions & 254 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {defineConfig} from '@sanity/pkg-utils'
2+
3+
export default defineConfig({
4+
dist: 'lib',
5+
minify: true,
6+
legacyExports: true,
7+
})

package.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
"description": "Ace editor for editing code",
55
"source": "./src/index.ts",
66
"exports": {
7-
".": {
8-
"require": "./lib/cjs/index.js",
9-
"default": "./lib/esm/index.js"
10-
}
7+
".": {
8+
"types": "./lib/src/index.d.ts",
9+
"source": "./src/index.ts",
10+
"import": "./lib/index.esm.js",
11+
"require": "./lib/index.js",
12+
"default": "./lib/index.esm.js"
13+
}
1114
},
12-
"main": "./lib/cjs/index.js",
13-
"module": "./lib/esm/index.js",
14-
"types": "./lib/types/index.d.ts",
15+
"main": "./lib/index.js",
16+
"module": "./lib/index.esm.js",
17+
"types": "./lib/src/index.d.ts",
1518
"files": [
1619
"src",
1720
"lib",
@@ -22,10 +25,10 @@
2225
"license": "MIT",
2326
"scripts": {
2427
"clean": "rimraf lib",
25-
"prebuild": "npm run clean && plugin-kit verify-package --silent",
26-
"build": "parcel build --no-cache",
28+
"prebuild": "npm run clean && plugin-kit verify-package --silent && pkg-utils",
29+
"build": "pkg-utils build",
30+
"watch": "pkg-utils watch",
2731
"link-watch": "plugin-kit link-watch",
28-
"watch": "parcel watch",
2932
"prepublishOnly": "npm run build",
3033
"compile": "tsc --noEmit",
3134
"lint": "eslint .",
@@ -45,7 +48,7 @@
4548
],
4649
"dependencies": {
4750
"@sanity/icons": "^1.2.8",
48-
"@sanity/incompatible-plugin": "^1.0.3",
51+
"@sanity/incompatible-plugin": "^1.0.4",
4952
"@sanity/ui": "^0.38.2",
5053
"ace-builds": "^1.9.5",
5154
"react-ace": "^10.1.0"
@@ -58,6 +61,7 @@
5861
"@parcel/packager-ts": "2.6.2",
5962
"@parcel/transformer-typescript-types": "2.6.2",
6063
"@sanity/plugin-kit": "^1.1.0-ecosystem-preset.5",
64+
"@sanity/pkg-utils": "^1.11.0",
6165
"@sanity/semantic-release-preset": "^2.0.1",
6266
"@testing-library/jest-dom": "^5.16.5",
6367
"@testing-library/react": "^12.1.3",
@@ -105,7 +109,8 @@
105109
},
106110
"sanityPlugin": {
107111
"verifyPackage": {
108-
"babelConfig": false
112+
"babelConfig": false,
113+
"scripts": false
109114
}
110115
}
111116
}

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {createPlugin} from 'sanity'
2-
import {codeSchema, CodeDefinition} from './schema'
32

3+
import {codeSchema, codeTypeName, CodeDefinition} from './schema'
44
import PreviewCode, {PreviewCodeProps} from './PreviewCode'
55
export type {CodeInputProps, CodeSchemaType, CodeOptions} from './CodeInput'
6+
67
export type {CodeInputLanguage, CodeInputValue} from './types'
78

89
export {PreviewCode, type PreviewCodeProps}
9-
export {codeSchema}
10+
export {codeSchema, codeTypeName}
1011
export type {CodeDefinition}
1112
/**
1213
* @public

src/schema.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export type {CodeInputProps, CodeSchemaType} from './CodeInput'
99
export type {CodeInputLanguage, CodeInputValue} from './types'
1010
export type {PreviewCode, PreviewCodeProps, CodeInput}
1111

12-
const codeTypeName = 'code' as const
12+
/**
13+
* @public
14+
*/
15+
export const codeTypeName = 'code' as const
1316

1417
/**
1518
* @public
@@ -26,6 +29,9 @@ declare module '@sanity/types' {
2629
}
2730
}
2831

32+
/**
33+
* @public
34+
*/
2935
export const codeSchema = defineType({
3036
name: 'code',
3137
type: 'object',

tsconfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
"downlevelIteration": true,
2121
"declaration": true,
2222
"allowSyntheticDefaultImports": true,
23-
"baseUrl": ".",
24-
"checkJs": false
25-
23+
"checkJs": false,
24+
"rootDir": "src"
2625
},
2726
"include": ["./src"]
2827
}

0 commit comments

Comments
 (0)