Skip to content

Commit

Permalink
Bundle typescript type in VLS
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Nov 10, 2020
1 parent cdd6b2b commit 7844163
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/rollup-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function generateTypingsVls() {
return new Promise((resolve, reject) => {
const tsc = spawn(
getServerPath('node_modules/.bin/tsc'),
['--declaration', '--declarationDir', './dist/types', '--emitDeclarationOnly', '--pretty'],
['--declaration', '--declarationDir', './typings', '--emitDeclarationOnly', '--pretty'],
{ cwd: getServerPath('./'), shell: true }
);
tsc.stdout.on('data', data => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@
"prettier": "^2.1.2",
"rollup": "^2.26.11",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-dts": "^1.4.13",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"shelljs": "^0.8.4",
Expand Down
1 change: 1 addition & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
typings
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Pine Wu <octref@gmail.com>",
"license": "MIT",
"main": "dist/vls.js",
"typings": "dist/types/main.d.ts",
"typings": "dist/vls.d.ts",
"bin": {
"vls": "./bin/vls"
},
Expand Down
11 changes: 11 additions & 0 deletions server/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
generateTypingsVls
} = require('../build/rollup-plugins.js');
const vlsPkg = require('./package.json');
const dts = require('rollup-plugin-dts').default;

const getVLSPath = getRootPath('server');

Expand Down Expand Up @@ -59,5 +60,15 @@ module.exports = [
linkVlsInCLI(),
...createPlugins(getVLSPath('tsconfig.json'))
]
},
// bundle typings
{
input: getVLSPath('typings/main.d.ts'),
output: {
file: getVLSPath('dist/vls.d.ts'),
format: 'es'
},
onwarn,
plugins: [dts()]
}
];
4 changes: 0 additions & 4 deletions vti/src/typing.d.ts

This file was deleted.

7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,13 @@ rollup-plugin-delete@^2.0.0:
dependencies:
del "^5.1.0"

rollup-plugin-dts@^1.4.13:
version "1.4.13"
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-1.4.13.tgz#4f086e84f4fdcc1f49160799ebc66f6b09db292b"
integrity sha512-7mxoQ6PcmCkBE5ZhrjGDL4k42XLy8BkSqpiRi1MipwiGs+7lwi4mQkp2afX+OzzLjJp/TGM8llfe8uayIUhPEw==
optionalDependencies:
"@babel/code-frame" "^7.10.4"

rollup-plugin-terser@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d"
Expand Down

0 comments on commit 7844163

Please sign in to comment.