mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-06-15 08:25:07 -04:00
Merge from master
This commit is contained in:
@@ -8,6 +8,10 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
|
||||
|
||||
/**
|
||||
* @param {string} location
|
||||
* @param {*} [opts]
|
||||
*/
|
||||
function yarnInstall(location, opts) {
|
||||
opts = opts || {};
|
||||
opts.cwd = location;
|
||||
@@ -56,4 +60,11 @@ runtime "${runtime}"`;
|
||||
|
||||
yarnInstall(`build`); // node modules required for build
|
||||
yarnInstall('test/smoke'); // node modules required for smoketest
|
||||
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
|
||||
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
|
||||
|
||||
// Remove the windows process tree typings as this causes duplicate identifier errors in tsc builds
|
||||
const processTreeDts = path.join('node_modules', 'windows-process-tree', 'typings', 'windows-process-tree.d.ts');
|
||||
if (fs.existsSync(processTreeDts)) {
|
||||
console.log('Removing windows-process-tree.d.ts');
|
||||
fs.unlinkSync(processTreeDts);
|
||||
}
|
||||
@@ -5,10 +5,21 @@
|
||||
|
||||
let err = false;
|
||||
|
||||
const major = parseInt(/^(\d+)\./.exec(process.versions.node)[1]);
|
||||
const majorNodeVersion = parseInt(/^(\d+)\./.exec(process.versions.node)[1]);
|
||||
|
||||
if (major < 8) {
|
||||
console.error('\033[1;31m*** Please use node>=8.\033[0;0m');
|
||||
if (majorNodeVersion < 8 || majorNodeVersion >= 9) {
|
||||
console.error('\033[1;31m*** Please use node >=8 and <9.\033[0;0m');
|
||||
err = true;
|
||||
}
|
||||
|
||||
const cp = require('child_process');
|
||||
const yarnVersion = cp.execSync('yarn -v', { encoding: 'utf8' }).trim();
|
||||
const parsedYarnVersion = /^(\d+)\.(\d+)\./.exec(yarnVersion);
|
||||
const majorYarnVersion = parseInt(parsedYarnVersion[1]);
|
||||
const minorYarnVersion = parseInt(parsedYarnVersion[2]);
|
||||
|
||||
if (majorYarnVersion < 1 || minorYarnVersion < 10) {
|
||||
console.error('\033[1;31m*** Please use yarn >=1.10.1.\033[0;0m');
|
||||
err = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ const cp = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* @param {string} location
|
||||
*/
|
||||
function updateGrammar(location) {
|
||||
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
const result = cp.spawnSync(npm, ['run', 'update-grammar'], {
|
||||
@@ -36,7 +39,7 @@ extensions.forEach(extension => updateGrammar(`extensions/${extension}`));
|
||||
// run integration tests
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
cp.spawn('.\scripts\test-integration.bat', [], { env: process.env, stdio: 'inherit' });
|
||||
cp.spawn('.\\scripts\\test-integration.bat', [], { env: process.env, stdio: 'inherit' });
|
||||
} else {
|
||||
cp.spawn('/bin/bash', ['./scripts/test-integration.sh'], { env: process.env, stdio: 'inherit' });
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ var cson = require('cson-parser');
|
||||
var https = require('https');
|
||||
var url = require('url');
|
||||
|
||||
/**
|
||||
* @param {string} urlString
|
||||
*/
|
||||
function getOptions(urlString) {
|
||||
var _url = url.parse(urlString);
|
||||
var headers = {
|
||||
@@ -19,7 +22,7 @@ function getOptions(urlString) {
|
||||
};
|
||||
var token = process.env['GITHUB_TOKEN'];
|
||||
if (token) {
|
||||
headers['Authorization'] = 'token ' + token
|
||||
headers['Authorization'] = 'token ' + token;
|
||||
}
|
||||
return {
|
||||
protocol: _url.protocol,
|
||||
@@ -30,6 +33,10 @@ function getOptions(urlString) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @param {number} redirectCount
|
||||
*/
|
||||
function download(url, redirectCount) {
|
||||
return new Promise((c, e) => {
|
||||
var content = '';
|
||||
@@ -112,7 +119,7 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas
|
||||
}
|
||||
|
||||
try {
|
||||
fs.writeFileSync(dest, JSON.stringify(result, null, '\t'));
|
||||
fs.writeFileSync(dest, JSON.stringify(result, null, '\t').replace(/\n/g, '\r\n'));
|
||||
if (info) {
|
||||
console.log('Updated ' + path.basename(dest) + ' to ' + repoId + '@' + info.commitSha.substr(0, 7) + ' (' + info.commitDate.substr(0, 10) + ')');
|
||||
} else {
|
||||
|
||||
@@ -9,16 +9,31 @@ let i18n = require("../lib/i18n");
|
||||
|
||||
let fs = require("fs");
|
||||
let path = require("path");
|
||||
|
||||
let gulp = require('gulp');
|
||||
let vfs = require("vinyl-fs");
|
||||
let rimraf = require('rimraf');
|
||||
let minimist = require('minimist');
|
||||
|
||||
function update(idOrPath) {
|
||||
function update(options) {
|
||||
let idOrPath = options._;
|
||||
if (!idOrPath) {
|
||||
throw new Error('Argument must be the location of the localization extension.');
|
||||
}
|
||||
let transifex = options.transifex;
|
||||
let location = options.location;
|
||||
if (transifex === true && location !== undefined) {
|
||||
throw new Error('Either --transifex or --location can be specified, but not both.');
|
||||
}
|
||||
if (!transifex && !location) {
|
||||
transifex = true;
|
||||
}
|
||||
if (location !== undefined && !fs.existsSync(location)) {
|
||||
throw new Error(`${location} doesn't exist.`);
|
||||
}
|
||||
let locExtFolder = idOrPath;
|
||||
if (/^\w{2}(-\w+)?$/.test(idOrPath)) {
|
||||
locExtFolder = '../vscode-language-pack-' + idOrPath;
|
||||
locExtFolder = path.join('..', 'vscode-loc', 'i18n', `vscode-language-pack-${idOrPath}`);
|
||||
}
|
||||
let locExtStat = fs.statSync(locExtFolder);
|
||||
if (!locExtStat || !locExtStat.isDirectory) {
|
||||
@@ -54,21 +69,64 @@ function update(idOrPath) {
|
||||
rimraf.sync(translationDataFolder);
|
||||
}
|
||||
|
||||
console.log('Downloading translations for \'' + languageId + '\' to \'' + translationDataFolder + '\'...');
|
||||
const translationPaths = [];
|
||||
i18n.pullI18nPackFiles(server, userName, apiToken, { id: languageId }, translationPaths)
|
||||
.pipe(vfs.dest(translationDataFolder)).on('end', function () {
|
||||
localization.translations = [];
|
||||
for (let tp of translationPaths) {
|
||||
localization.translations.push({ id: tp.id, path: `./translations/${tp.resourceName}`});
|
||||
}
|
||||
fs.writeFileSync(path.join(locExtFolder, 'package.json'), JSON.stringify(packageJSON, null, '\t'));
|
||||
});
|
||||
|
||||
if (transifex) {
|
||||
console.log(`Downloading translations for ${languageId} to '${translationDataFolder}' ...`);
|
||||
let translationPaths = [];
|
||||
i18n.pullI18nPackFiles(server, userName, apiToken, { id: languageId }, translationPaths)
|
||||
.on('error', (error) => {
|
||||
console.log(`Error occured while importing translations:`);
|
||||
translationPaths = undefined;
|
||||
if (Array.isArray(error)) {
|
||||
error.forEach(console.log);
|
||||
} else if (error) {
|
||||
console.log(error);
|
||||
} else {
|
||||
console.log('Unknown error');
|
||||
}
|
||||
})
|
||||
.pipe(vfs.dest(translationDataFolder))
|
||||
.on('end', function () {
|
||||
if (translationPaths !== undefined) {
|
||||
localization.translations = [];
|
||||
for (let tp of translationPaths) {
|
||||
localization.translations.push({ id: tp.id, path: `./translations/${tp.resourceName}`});
|
||||
}
|
||||
fs.writeFileSync(path.join(locExtFolder, 'package.json'), JSON.stringify(packageJSON, null, '\t'));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(`Importing translations for ${languageId} form '${location}' to '${translationDataFolder}' ...`);
|
||||
let translationPaths = [];
|
||||
gulp.src(path.join(location, languageId, '**', '*.xlf'))
|
||||
.pipe(i18n.prepareI18nPackFiles(i18n.externalExtensionsWithTranslations, translationPaths, languageId === 'ps'))
|
||||
.on('error', (error) => {
|
||||
console.log(`Error occured while importing translations:`);
|
||||
translationPaths = undefined;
|
||||
if (Array.isArray(error)) {
|
||||
error.forEach(console.log);
|
||||
} else if (error) {
|
||||
console.log(error);
|
||||
} else {
|
||||
console.log('Unknown error');
|
||||
}
|
||||
})
|
||||
.pipe(vfs.dest(translationDataFolder))
|
||||
.on('end', function () {
|
||||
if (translationPaths !== undefined) {
|
||||
localization.translations = [];
|
||||
for (let tp of translationPaths) {
|
||||
localization.translations.push({ id: tp.id, path: `./translations/${tp.resourceName}`});
|
||||
}
|
||||
fs.writeFileSync(path.join(locExtFolder, 'package.json'), JSON.stringify(packageJSON, null, '\t'));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
if (path.basename(process.argv[1]) === 'update-localization-extension.js') {
|
||||
update(process.argv[2]);
|
||||
var options = minimist(process.argv.slice(2), {
|
||||
boolean: 'transifex',
|
||||
string: 'location'
|
||||
});
|
||||
update(options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user