Skip to content

Commit f8a7120

Browse files
committed
chore: bundle script
1 parent bff54c4 commit f8a7120

File tree

5 files changed

+20
-27
lines changed

5 files changed

+20
-27
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
registry-url: https://registry.npmjs.org/
2424
- run: yarn install
2525
- run: yarn rebirth
26-
- run: yarn restyle
2726
- run: npm publish --access=public
2827
env:
2928
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

libundler.config.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ export default defineConfig({
55
outFileName: 'vue-codemirror',
66
entry: './src/index.ts',
77
outDir: './dist',
8-
targets: ['esm', 'umd'],
9-
external: ['vue'],
10-
exports: 'named',
11-
sourcemap: false,
12-
globals: {
13-
vue: 'Vue'
14-
}
8+
targets: ['esm', 'cjs'],
9+
external: ['vue', 'csstype', /@codemirror\/.*/],
10+
exports: 'named'
1511
})

package.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@
2121
"files": [
2222
"dist"
2323
],
24-
"sideEffects": false,
25-
"type": "module",
26-
"main": "dist/vue-codemirror.js",
27-
"module": "dist/vue-codemirror.js",
28-
"types": "dist/index.d.ts",
24+
"main": "./dist/vue-codemirror.cjs.js",
25+
"module": "./dist/vue-codemirror.esm.js",
26+
"types": "./dist/vue-codemirror.esm.d.ts",
2927
"exports": {
3028
".": {
31-
"import": "./index.js",
32-
"require": "./index.js",
33-
"types": "./dist/vue.d.ts"
29+
"require": "./dist/vue-codemirror.cjs.js",
30+
"import": "./dist/vue-codemirror.esm.js",
31+
"types": "./dist/vue-codemirror.esm.d.ts"
3432
},
3533
"./dist/*": "./dist/*",
3634
"./package.json": "./package.json"
@@ -41,18 +39,17 @@
4139
"test": "vitest run --coverage",
4240
"lint": "eslint --ext .js,.ts,.vue src test",
4341
"rebirth": "npm run lint && npm run test && npm run build",
44-
"restyle": "cp \"./dist/vue-codemirror.esm.css\" \"./style.css\"",
4542
"release": ". ./scripts/release.sh"
4643
},
4744
"peerDependencies": {
4845
"vue": "3.x"
4946
},
5047
"dependencies": {
5148
"@codemirror/basic-setup": "^0.20.0",
49+
"@codemirror/commands": "0.20.0",
50+
"@codemirror/language": "0.20.0",
5251
"@codemirror/state": "^0.20.0",
5352
"@codemirror/view": "^0.20.0",
54-
"@codemirror/language": "0.20.0",
55-
"@codemirror/commands": "0.20.0",
5653
"csstype": "^2.6.8"
5754
},
5855
"devDependencies": {

src/component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ export default defineComponent({
8181
}
8282

8383
const config = computed(() => {
84-
const config: any = {}
85-
for (let key in props) {
86-
// @ts-ignore
87-
config[key] = props[key] ?? defaultConfig[key]
88-
}
89-
return config as Required<Props>
84+
return Object.keys(props).reduce(
85+
(result, key) => ({
86+
...result,
87+
// @ts-ignore
88+
[key]: props[key] ?? defaultConfig[key]
89+
}),
90+
{} as Required<Props>
91+
)
9092
})
9193

9294
onMounted(() => {

test/index.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { TransitionGroup } from 'vue'
21
import { test, expect, vi } from 'vitest'
32
import { mount } from '@vue/test-utils'
43
import VueCodemirror, { Codemirror, install } from '../src/index'
@@ -16,6 +15,6 @@ test('export type', async () => {
1615

1716
test('mount component', async () => {
1817
const wrapper = mount(Codemirror, { props: { modelValue: 'Hello, world!' } })
19-
const tgWrapper = wrapper.getComponent(TransitionGroup)
18+
expect(wrapper.emitted()).toHaveProperty('ready')
2019
// TODO: test case
2120
})

0 commit comments

Comments
 (0)