From 838f4024b30ffc477ea6fbc1eba8e21afc3aff2e Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Tue, 27 Feb 2018 15:41:00 +0100 Subject: [PATCH] fixes #43973 --- build/builtin/browser-main.js | 3 +-- build/gulpfile.extensions.js | 6 +----- build/gulpfile.vscode.js | 12 ++++-------- build/lib/builtInExtensions.js | 3 +-- build/lib/util.ts | 2 +- build/lib/watch/watch-nsfw.js | 2 +- build/lib/watch/watch-win32.js | 4 ++-- build/npm/postinstall.js | 2 +- 8 files changed, 12 insertions(+), 22 deletions(-) diff --git a/build/builtin/browser-main.js b/build/builtin/browser-main.js index 83a5ba4e592..60b30655c0c 100644 --- a/build/builtin/browser-main.js +++ b/build/builtin/browser-main.js @@ -14,8 +14,7 @@ const builtInExtensionsPath = path.join(__dirname, '..', 'builtInExtensions.json const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json'); function readJson(filePath) { - //@ts-ignore review - return JSON.parse(fs.readFileSync(filePath)); + return JSON.parse(fs.readFileSync(filePath, { encoding: 'utf8' })); } function writeJson(filePath, obj) { diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js index ac1b08c6fd2..3bb9b02f3af 100644 --- a/build/gulpfile.extensions.js +++ b/build/gulpfile.extensions.js @@ -94,11 +94,8 @@ const tasks = compilations.map(function (tsconfigFile) { sourceRoot: '../src' })) .pipe(tsFilter.restore) - // @ts-ignore review .pipe(build ? nlsDev.createAdditionalLanguageFiles(languages, i18nPath, out) : es.through()) - // @ts-ignore review .pipe(build ? nlsDev.bundleMetaDataFiles(headerId, headerOut) : es.through()) - // @ts-ignore review .pipe(build ? nlsDev.bundleLanguageFiles() : es.through()) .pipe(reporter.end(emitError)); @@ -146,8 +143,7 @@ const tasks = compilations.map(function (tsconfigFile) { const watchInput = watcher(src, srcOpts); return watchInput - // @ts-ignore review - .pipe(util.incremental(() => pipeline(true), input)) + .pipe(util.incremental(() => pipeline(), input)) .pipe(gulp.dest(out)); }); diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 5fdadab9318..e92b517d9ca 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -39,7 +39,7 @@ const getElectronVersion = require('./lib/electron').getElectronVersion; const createAsar = require('./lib/asar').createAsar; const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname)); -//@ts-ignore review +// @ts-ignore const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n)); const nodeModules = ['electron', 'original-fs'] .concat(Object.keys(product.dependencies || {})) @@ -107,7 +107,6 @@ gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compil header: BUNDLED_FILE_HEADER, out: 'out-vscode', languages: languages, - // @ts-ignore review bundleInfo: undefined })); @@ -250,7 +249,6 @@ function packageTask(platform, arch, opts) { // // TODO@Dirk: this filter / buffer is here to make sure the nls.json files are buffered .pipe(nlsFilter) .pipe(buffer()) - //@ts-ignore review .pipe(nlsDev.createAdditionalLanguageFiles(languages, path.join(__dirname, '..', 'i18n'))) .pipe(nlsFilter.restore); })); @@ -303,7 +301,6 @@ function packageTask(platform, arch, opts) { .pipe(util.cleanNodeModule('native-is-elevated', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node'])) .pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node'])) .pipe(util.cleanNodeModule('spdlog', ['binding.gyp', 'build/**', 'deps/**', 'src/**', 'test/**'], ['**/*.node'])) - //@ts-ignore review .pipe(util.cleanNodeModule('jschardet', ['dist/**'])) .pipe(util.cleanNodeModule('windows-foreground-love', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node'])) .pipe(util.cleanNodeModule('windows-process-tree', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node'])) @@ -446,8 +443,7 @@ gulp.task('vscode-translations-pull', function () { gulp.task('vscode-translations-import', function () { [...i18n.defaultLanguages, ...i18n.extraLanguages].forEach(language => { gulp.src(`../vscode-localization/${language.id}/build/*/*.xlf`) - //@ts-ignore review - .pipe(i18n.prepareI18nFiles(language)) + .pipe(i18n.prepareI18nFiles()) .pipe(vfs.dest(`./i18n/${language.folderName}`)); gulp.src(`../vscode-localization/${language.id}/setup/*/*.xlf`) .pipe(i18n.prepareIslFiles(language, innoSetupConfig[language.id])) @@ -478,8 +474,8 @@ gulp.task('upload-vscode-sourcemaps', ['minify-vscode'], () => { const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json'); gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () => { const branch = process.env.BUILD_SOURCEBRANCH; - //@ts-ignore review - if (!branch.endsWith('/master') && branch.indexOf('/release/') < 0) { + + if (!/\/master$/.test(branch) && branch.indexOf('/release/') < 0) { console.log(`Only runs on master and release branches, not ${branch}`); return; } diff --git a/build/lib/builtInExtensions.js b/build/lib/builtInExtensions.js index c538416ce4d..c03360cf002 100644 --- a/build/lib/builtInExtensions.js +++ b/build/lib/builtInExtensions.js @@ -32,10 +32,9 @@ function isUpToDate(extension) { return false; } - const packageContents = fs.readFileSync(packagePath); + const packageContents = fs.readFileSync(packagePath, { encoding: 'utf8' }); try { - //@ts-ignore review const diskVersion = JSON.parse(packageContents).version; return (diskVersion === extension.version); } catch (err) { diff --git a/build/lib/util.ts b/build/lib/util.ts index afcedc828c4..bae298f5f05 100644 --- a/build/lib/util.ts +++ b/build/lib/util.ts @@ -129,7 +129,7 @@ export function skipDirectories(): NodeJS.ReadWriteStream { }); } -export function cleanNodeModule(name: string, excludes: string[], includes: string[]): NodeJS.ReadWriteStream { +export function cleanNodeModule(name: string, excludes: string[], includes?: string[]): NodeJS.ReadWriteStream { const toGlob = (path: string) => '**/node_modules/' + name + (path ? '/' + path : ''); const negate = (str: string) => '!' + str; diff --git a/build/lib/watch/watch-nsfw.js b/build/lib/watch/watch-nsfw.js index 306ab481039..fb2b2758d02 100644 --- a/build/lib/watch/watch-nsfw.js +++ b/build/lib/watch/watch-nsfw.js @@ -30,7 +30,7 @@ function watch(root) { path: path, base: root }); - //@ts-ignore review + //@ts-ignore file.event = type; result.emit('data', file); } diff --git a/build/lib/watch/watch-win32.js b/build/lib/watch/watch-win32.js index de9c76c90d6..d0cd307ba16 100644 --- a/build/lib/watch/watch-win32.js +++ b/build/lib/watch/watch-win32.js @@ -25,7 +25,7 @@ function watch(root) { var child = cp.spawn(watcherPath, [root]); child.stdout.on('data', function (data) { - //@ts-ignore review + // @ts-ignore var lines = data.toString('utf8').split('\n'); for (var i = 0; i < lines.length; i++) { var line = lines[i].trim(); @@ -47,7 +47,7 @@ function watch(root) { path: changePathFull, base: root }); - //@ts-ignore review + //@ts-ignore file.event = toChangeType(changeType); result.emit('data', file); } diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index d4ab203a1fd..a0001b8bfb5 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -50,7 +50,7 @@ extensions.forEach(extension => yarnInstall(`extensions/${extension}`)); function yarnInstallBuildDependencies() { // make sure we install the deps of build/lib/watch for the system installed // node, since that is the driver of gulp - //@ts-ignore review + //@ts-ignore const env = Object.assign({}, process.env); const watchPath = path.join(path.dirname(__dirname), 'lib', 'watch'); const yarnrcPath = path.join(watchPath, '.yarnrc');