Skip to content
This repository was archived by the owner on Jan 9, 2022. It is now read-only.

Commit 4d25d3e

Browse files
Michael.KryvoruchkoMichael.Kryvoruchko
authored andcommitted
feat: set up type generation
1 parent 0bd0050 commit 4d25d3e

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

packages/dialog/build/build.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ const shell = require('shelljs')
44

55
shell.exec('vue-tsc --noEmit')
66
shell.exec('vite build --config build/vite.config.ts')
7-
shell.exec('cp ./build/index.d.ts ./dist/index.es.d.ts')
8-
shell.exec('cp ./build/index.d.ts ./dist/index.upd.d.ts')
7+
shell.exec('vue-tsc --declaration --emitDeclarationOnly --p build/tsconfig.json')

packages/dialog/build/index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/dialog/build/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../dist",
5+
},
6+
"files": [
7+
"../src/index.ts"
8+
]
9+
}

packages/dialog/build/vite.config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ export default defineConfig({
1818
lib: {
1919
entry: resolve('src/index.ts'),
2020
name: 'index',
21-
fileName: format => `index.${format}.js`,
21+
fileName: format => {
22+
let fileEnd = 'js'
23+
24+
if(format === 'es') {
25+
fileEnd = 'mjs'
26+
}else if (format === 'umd') {
27+
fileEnd = 'cjs'
28+
}
29+
30+
return `index.${fileEnd}`
31+
},
2232
},
2333

2434
rollupOptions: {

packages/dialog/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
"version": "1.2.0-beta.1",
44
"scripts": {
55
"dev": "vite --config dev/vite.config.ts",
6-
"build": "node build/build.js"
6+
"build": "node build/build.js",
7+
"build:types": "vue-tsc --declaration --emitDeclarationOnly --p ./build/tsconfig.json"
78
},
8-
"main": "./dist/index.umd.js",
9-
"module": "./dist/index.es.js",
9+
"main": "./dist/index.cjs",
10+
"module": "./dist/index.mjs",
1011
"exports": {
1112
".": {
12-
"import": "./dist/index.es.js",
13-
"require": "./dist/index.umd.js"
13+
"import": "./dist/index.mjs",
14+
"require": "./dist/index.cjs"
1415
},
1516
"./dist/*": "./dist/*",
1617
"./package.json": "./package.json"
1718
},
18-
"types": "dist/index.upd.d.ts",
19+
"types": "dist/index.d.ts",
1920
"keywords": [
2021
"gitart",
2122
"gitart-vue-dialog",

0 commit comments

Comments
 (0)