Add WS as a dep of notebooks (#8154)

* add ws as an optional dep of noteoboks

* fix method of adding ws

* fix parsing for yarnrc

* remove optional reps
This commit is contained in:
Anthony Dresser
2019-11-01 12:19:06 -07:00
committed by GitHub
parent 29a46b9f8b
commit bd988f62a2
3 changed files with 31 additions and 4 deletions

View File

@@ -8,13 +8,27 @@
'use strict';
const withDefaults = require('../shared.webpack.config');
const fs = require('fs');
const path = require('path');
const externals = {
'node-fetch': 'commonjs node-fetch'
};
// conditionally add ws if we are going to be running in a node environment
const yarnrcPath = path.join(__dirname, '.yarnrc');
if (fs.existsSync(yarnrcPath)) {
const yarnrc = fs.readFileSync(yarnrcPath).toString();
const properties = yarnrc.split(/\r?\n/).map(r => r.split(' '));
if (properties.find(r => r[0] === 'runtime')[1] === '"node"') {
externals['ws'] = 'commonjs ws';
}
}
module.exports = withDefaults({
context: __dirname,
entry: {
extension: './src/extension.ts'
},
externals: {
'node-fetch': 'commonjs node-fetch'
}
externals: externals
});

View File

@@ -448,7 +448,8 @@
"request": "^2.88.0",
"temp-write": "^3.4.0",
"vscode-languageclient": "^5.3.0-next.1",
"vscode-nls": "^4.0.0"
"vscode-nls": "^4.0.0",
"ws": "^7.2.0"
},
"devDependencies": {
"@types/decompress": "^4.2.3",

View File

@@ -339,6 +339,11 @@ assert@^1.4.1:
dependencies:
util "0.10.3"
async-limiter@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
@@ -2680,6 +2685,13 @@ wrappy@1:
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
ws@^7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.0.tgz#422eda8c02a4b5dba7744ba66eebbd84bcef0ec7"
integrity sha512-+SqNqFbwTm/0DC18KYzIsMTnEWpLwJsiasW/O17la4iDRRIO9uaHbvKiAS3AHgTiuuWerK/brj4O6MYZkei9xg==
dependencies:
async-limiter "^1.0.0"
xml@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"