Skip to content

Commit 9f77c85

Browse files
committed
chore: Update package.json and tsup.config.ts for hyperlink, hypermultimedia, indent, and inline-code extensions to improve module exports and build scripts
1 parent 5fd3849 commit 9f77c85

File tree

9 files changed

+120
-51
lines changed

9 files changed

+120
-51
lines changed

packages/extension-hyperlink/package.json

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22
"name": "@docs.plus/extension-hyperlink",
33
"version": "3.0.0",
44
"description": "Hyperlink component for docs.plus",
5-
"main": "dist/index.cjs",
6-
"module": "dist/index.js",
7-
"umd": "dist/index.umd.js",
8-
"types": "dist/index.d.ts",
5+
"main": "./dist/index.cjs",
6+
"module": "./dist/index.js",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"import": {
11+
"types": "./dist/index.d.ts",
12+
"default": "./dist/index.js"
13+
},
14+
"require": {
15+
"types": "./dist/index.d.ts",
16+
"default": "./dist/index.cjs"
17+
}
18+
}
19+
},
920
"author": "Hossein Marzban",
1021
"license": "MIT",
1122
"type": "module",
@@ -15,14 +26,16 @@
1526
"directory": "packages/extension-hyperlink"
1627
},
1728
"scripts": {
18-
"build": "bunx tsup",
19-
"build:prod": "NODE_ENV=production bunx tsup",
29+
"build": "NODE_ENV=production bunx tsup",
30+
"build:dev": "bunx tsup",
2031
"dev": "bunx tsup --watch",
2132
"lint": "eslint src --ext .ts,.tsx",
2233
"lint:fix": "eslint src --ext .ts,.tsx --fix",
23-
"watch": "bunx tsup --watch",
2434
"update:packages": "bunx npm-check-updates -u"
2535
},
36+
"files": [
37+
"dist"
38+
],
2639
"keywords": [
2740
"tiptap",
2841
"tiptap extension",
@@ -40,6 +53,8 @@
4053
"@tiptap/pm": "^3.6.2"
4154
},
4255
"devDependencies": {
56+
"@tiptap/core": "^3.6.2",
57+
"@tiptap/pm": "^3.6.2",
4358
"@eslint/js": "^9.38.0",
4459
"@typescript-eslint/eslint-plugin": "^8.46.1",
4560
"@typescript-eslint/parser": "^8.46.1",

packages/extension-hyperlink/tsup.config.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const isProduction = process.env.NODE_ENV === 'production'
55
export default defineConfig({
66
entry: ['src/index.ts'],
77
outDir: 'dist',
8-
format: ['cjs', 'esm'],
8+
format: ['esm', 'cjs'],
99
external: ['@tiptap/core', '@tiptap/pm'],
1010
dts: {
1111
entry: './src/index.ts',
@@ -16,12 +16,10 @@ export default defineConfig({
1616
minify: isProduction,
1717
outExtension({ format }) {
1818
return {
19-
js: format === 'esm' ? '.js' : format === 'cjs' ? '.cjs' : '.umd.js'
19+
js: format === 'esm' ? '.js' : '.cjs'
2020
}
2121
},
2222
esbuildOptions(options) {
23-
// Only preserve console logs in development
2423
options.drop = isProduction ? ['console'] : []
25-
},
26-
globalName: 'DocsplusExtensionHyperlink'
24+
}
2725
})

packages/extension-hypermultimedia/package.json

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22
"name": "@docs.plus/extension-hypermultimedia",
33
"version": "1.4.0",
44
"description": "Insert embeded multimedia components for docs.plus",
5-
"main": "dist/index.cjs",
6-
"module": "dist/index.js",
7-
"umd": "dist/index.umd.js",
8-
"types": "dist/index.d.ts",
5+
"main": "./dist/index.cjs",
6+
"module": "./dist/index.js",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"import": {
11+
"types": "./dist/index.d.ts",
12+
"default": "./dist/index.js"
13+
},
14+
"require": {
15+
"types": "./dist/index.d.ts",
16+
"default": "./dist/index.cjs"
17+
}
18+
}
19+
},
920
"author": "Hossein Marzban",
1021
"license": "MIT",
1122
"type": "module",
@@ -15,14 +26,16 @@
1526
"directory": "packages/extension-hypermultimedia"
1627
},
1728
"scripts": {
18-
"build": "bunx tsup --dts",
19-
"dev": "bunx tsup --watch --dts",
20-
"watch": "bunx tsup --watch --dts",
21-
"clean": "rm -rf dist",
29+
"build": "NODE_ENV=production bunx tsup",
30+
"build:dev": "bunx tsup",
31+
"dev": "bunx tsup --watch",
2232
"lint": "eslint src --ext .ts,.tsx",
2333
"lint:fix": "eslint src --ext .ts,.tsx --fix",
2434
"update:packages": "bunx npm-check-updates -u"
2535
},
36+
"files": [
37+
"dist"
38+
],
2639
"keywords": [
2740
"tiptap",
2841
"tiptap extension",
@@ -44,6 +57,8 @@
4457
"tippy.js": "^6.3.7"
4558
},
4659
"devDependencies": {
60+
"@tiptap/core": "^3.6.2",
61+
"@tiptap/pm": "^3.6.2",
4762
"@eslint/js": "^9.38.0",
4863
"@types/minimatch": "^6.0.0",
4964
"@typescript-eslint/eslint-plugin": "^8.46.1",

packages/extension-hypermultimedia/tsup.config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ export default defineConfig({
1616
minify: isProduction,
1717
outExtension({ format }) {
1818
return {
19-
js: format === 'esm' ? '.js' : format === 'cjs' ? '.cjs' : '.umd.js'
19+
js: format === 'esm' ? '.js' : '.cjs'
2020
}
2121
},
2222
esbuildOptions(options) {
23-
// Only preserve console logs in development
2423
options.drop = isProduction ? ['console'] : []
25-
},
26-
globalName: 'DocsplusExtensionHypermultimedia'
24+
}
2725
})

packages/extension-indent/package.json

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22
"name": "@docs.plus/extension-indent",
33
"version": "0.1.1",
44
"description": "A Tiptap extension for managing text indentation in documents",
5-
"main": "dist/index.cjs",
6-
"module": "dist/index.js",
7-
"umd": "dist/index.umd.js",
8-
"types": "dist/index.d.ts",
5+
"main": "./dist/index.cjs",
6+
"module": "./dist/index.js",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"import": {
11+
"types": "./dist/index.d.ts",
12+
"default": "./dist/index.js"
13+
},
14+
"require": {
15+
"types": "./dist/index.d.ts",
16+
"default": "./dist/index.cjs"
17+
}
18+
}
19+
},
920
"author": "Hossein Marzban",
1021
"license": "MIT",
1122
"type": "module",
@@ -15,12 +26,16 @@
1526
"directory": "packages/extension-indent"
1627
},
1728
"scripts": {
18-
"build": "bunx tsup --dts",
19-
"dev": "bunx tsup --watch --dts",
20-
"lint": "eslint . --ext .ts",
21-
"test": "jest",
29+
"build": "NODE_ENV=production bunx tsup",
30+
"build:dev": "bunx tsup",
31+
"dev": "bunx tsup --watch",
32+
"lint": "eslint src --ext .ts",
33+
"lint:fix": "eslint src --ext .ts --fix",
2234
"update:packages": "bunx npm-check-updates -u"
2335
},
36+
"files": [
37+
"dist"
38+
],
2439
"keywords": [
2540
"tiptap",
2641
"tiptap extension",
@@ -36,6 +51,8 @@
3651
"@tiptap/pm": "^3.6.2"
3752
},
3853
"devDependencies": {
54+
"@tiptap/core": "^3.6.2",
55+
"@tiptap/pm": "^3.6.2",
3956
"typescript": "^5.9.3",
4057
"tsup": "^8.5.0",
4158
"eslint": "^9.38.0"
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
import { defineConfig } from 'tsup'
22

3+
const isProduction = process.env.NODE_ENV === 'production'
4+
35
export default defineConfig({
46
entry: ['src/index.ts'],
7+
outDir: 'dist',
58
format: ['esm', 'cjs'],
69
external: ['@tiptap/core', '@tiptap/pm'],
710
dts: {
811
entry: './src/index.ts',
912
resolve: true
1013
},
11-
clean: true,
12-
minify: true,
13-
sourcemap: true,
14+
sourcemap: isProduction,
15+
clean: isProduction,
16+
minify: isProduction,
1417
outExtension({ format }) {
1518
return {
16-
js: format === 'esm' ? '.js' : format === 'cjs' ? '.cjs' : '.umd.js'
19+
js: format === 'esm' ? '.js' : '.cjs'
1720
}
1821
},
19-
globalName: 'DocsplusExtensionIndent'
22+
esbuildOptions(options) {
23+
options.drop = isProduction ? ['console'] : []
24+
}
2025
})

packages/extension-inline-code/package.json

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22
"name": "@docs.plus/extension-inline-code",
33
"version": "0.1.1",
44
"description": "A Tiptap extension for inline code formatting",
5-
"main": "dist/index.cjs",
6-
"module": "dist/index.js",
7-
"umd": "dist/index.umd.js",
8-
"types": "dist/index.d.ts",
5+
"main": "./dist/index.cjs",
6+
"module": "./dist/index.js",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"import": {
11+
"types": "./dist/index.d.ts",
12+
"default": "./dist/index.js"
13+
},
14+
"require": {
15+
"types": "./dist/index.d.ts",
16+
"default": "./dist/index.cjs"
17+
}
18+
}
19+
},
920
"author": "Hossein Marzban",
1021
"license": "MIT",
1122
"type": "module",
@@ -15,12 +26,16 @@
1526
"directory": "packages/extension-inline-code"
1627
},
1728
"scripts": {
18-
"build": "bunx tsup --dts",
19-
"dev": "bunx tsup --watch --dts",
20-
"lint": "eslint . --ext .ts",
21-
"test": "jest",
29+
"build": "NODE_ENV=production bunx tsup",
30+
"build:dev": "bunx tsup",
31+
"dev": "bunx tsup --watch",
32+
"lint": "eslint src --ext .ts",
33+
"lint:fix": "eslint src --ext .ts --fix",
2234
"update:packages": "bunx npm-check-updates -u"
2335
},
36+
"files": [
37+
"dist"
38+
],
2439
"keywords": [
2540
"tiptap",
2641
"tiptap extension",
@@ -36,6 +51,8 @@
3651
"@tiptap/pm": "^3.6.2"
3752
},
3853
"devDependencies": {
54+
"@tiptap/core": "^3.6.2",
55+
"@tiptap/pm": "^3.6.2",
3956
"@types/minimatch": "^6.0.0",
4057
"eslint": "^9.38.0",
4158
"tsup": "^8.5.0",

packages/extension-inline-code/src/inline-code.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ export const InlineCode = Mark.create<InlineCodeOptions>({
149149

150150
// Check if we're at the end of the document
151151
if (nextPos >= state.doc.content.size) {
152-
console.log({})
153152
// Insert a space after the code tag and move cursor there
154153
const tr = state.tr
155154
tr.insertText(' ', pos)
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
import { defineConfig } from 'tsup'
22

3+
const isProduction = process.env.NODE_ENV === 'production'
4+
35
export default defineConfig({
46
entry: ['src/index.ts'],
7+
outDir: 'dist',
58
format: ['esm', 'cjs'],
69
external: ['@tiptap/core', '@tiptap/pm'],
710
dts: {
811
entry: './src/index.ts',
912
resolve: true
1013
},
11-
clean: true,
12-
minify: true,
13-
sourcemap: true,
14+
sourcemap: isProduction,
15+
clean: isProduction,
16+
minify: isProduction,
1417
outExtension({ format }) {
1518
return {
16-
js: format === 'esm' ? '.js' : format === 'cjs' ? '.cjs' : '.umd.js'
19+
js: format === 'esm' ? '.js' : '.cjs'
1720
}
1821
},
19-
globalName: 'DocsplusExtensionInlineCode'
22+
esbuildOptions(options) {
23+
options.drop = isProduction ? ['console'] : []
24+
}
2025
})

0 commit comments

Comments
 (0)