Do not install typings for plugins installed with '--fetch' option
Note that we still need to install typings for plugins which don’t have typings available on NPM
This commit is contained in:
Родитель
c9c156db66
Коммит
a6afb25adb
|
@ -57,10 +57,12 @@
|
||||||
"typingFile": "cordova/plugins/WebSQL.d.ts"
|
"typingFile": "cordova/plugins/WebSQL.d.ts"
|
||||||
},
|
},
|
||||||
"cordova-plugin-x-toast": {
|
"cordova-plugin-x-toast": {
|
||||||
"typingFile": "cordova/plugins/Toast.d.ts"
|
"typingFile": "cordova/plugins/Toast.d.ts",
|
||||||
|
"forceInstallTypings": true
|
||||||
},
|
},
|
||||||
"ionic-plugin-keyboard": {
|
"ionic-plugin-keyboard": {
|
||||||
"typingFile": "cordova-ionic/plugins/keyboard.d.ts"
|
"typingFile": "cordova-ionic/plugins/keyboard.d.ts",
|
||||||
|
"forceInstallTypings": true
|
||||||
},
|
},
|
||||||
"phonegap-plugin-barcodescanner": {
|
"phonegap-plugin-barcodescanner": {
|
||||||
"typingFile": "cordova/plugins/BarcodeScanner.d.ts"
|
"typingFile": "cordova/plugins/BarcodeScanner.d.ts"
|
||||||
|
@ -68,4 +70,4 @@
|
||||||
"phonegap-plugin-push": {
|
"phonegap-plugin-push": {
|
||||||
"typingFile": "cordova/plugins/Push.d.ts"
|
"typingFile": "cordova/plugins/Push.d.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {CordovaProjectHelper} from './utils/cordovaProjectHelper';
|
||||||
import {CordovaCommandHelper} from './utils/cordovaCommandHelper';
|
import {CordovaCommandHelper} from './utils/cordovaCommandHelper';
|
||||||
import {ExtensionServer} from './extension/extensionServer';
|
import {ExtensionServer} from './extension/extensionServer';
|
||||||
import * as Q from "q";
|
import * as Q from "q";
|
||||||
|
import * as semver from 'semver';
|
||||||
import {PluginSimulator} from "./extension/simulate";
|
import {PluginSimulator} from "./extension/simulate";
|
||||||
import {Telemetry} from './utils/telemetry';
|
import {Telemetry} from './utils/telemetry';
|
||||||
import {TelemetryHelper} from './utils/telemetryHelper';
|
import {TelemetryHelper} from './utils/telemetryHelper';
|
||||||
|
@ -213,6 +214,24 @@ function getRelativeTypeDefinitionFilePath(projectRoot: string, parentPath: stri
|
||||||
|
|
||||||
function updatePluginTypeDefinitions(cordovaProjectRoot: string): void {
|
function updatePluginTypeDefinitions(cordovaProjectRoot: string): void {
|
||||||
let installedPlugins: string[] = CordovaProjectHelper.getInstalledPlugins(cordovaProjectRoot);
|
let installedPlugins: string[] = CordovaProjectHelper.getInstalledPlugins(cordovaProjectRoot);
|
||||||
|
|
||||||
|
const nodeModulesDir = path.resolve(cordovaProjectRoot, 'node_modules');
|
||||||
|
if (semver.gte(vscode.version, '1.7.2-insider') && fs.existsSync(nodeModulesDir)) {
|
||||||
|
// Read installed node modules and filter out plugins that have been already installed in node_modules
|
||||||
|
// This happens if user has used '--fetch' option to install plugin. In this case VSCode will provide
|
||||||
|
// own intellisense for these plugins using ATA (automatic typings acquisition)
|
||||||
|
try {
|
||||||
|
const installedNpmModules: string[] = fs.readdirSync(nodeModulesDir);
|
||||||
|
installedPlugins = installedPlugins
|
||||||
|
.filter(pluginId => {
|
||||||
|
// plugins with `forceInstallTypings` flag don't have typings on NPM yet,
|
||||||
|
// so we still need to install these even if they present in 'node_modules'
|
||||||
|
return getPluginTypingsJson()[pluginId].forceInstallTypings ||
|
||||||
|
installedNpmModules.indexOf(pluginId) === -1;
|
||||||
|
});
|
||||||
|
} catch (e) { }
|
||||||
|
}
|
||||||
|
|
||||||
let newTypeDefs = getNewTypeDefinitions(installedPlugins);
|
let newTypeDefs = getNewTypeDefinitions(installedPlugins);
|
||||||
let cordovaPluginTypesFolder = CordovaProjectHelper.getCordovaPluginTypeDefsPath(cordovaProjectRoot);
|
let cordovaPluginTypesFolder = CordovaProjectHelper.getCordovaPluginTypeDefsPath(cordovaProjectRoot);
|
||||||
let ionicPluginTypesFolder = CordovaProjectHelper.getIonicPluginTypeDefsPath(cordovaProjectRoot);
|
let ionicPluginTypesFolder = CordovaProjectHelper.getIonicPluginTypeDefsPath(cordovaProjectRoot);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче