How to use darwin method in root

Best JavaScript code snippet using root

gulpfile.vscode.js

Source:gulpfile.vscode.js Github

copy

Full Screen

1/*---------------------------------------------------------------------------------------------2 * Copyright (c) Microsoft Corporation. All rights reserved.3 * Licensed under the MIT License. See License.txt in the project root for license information.4 *--------------------------------------------------------------------------------------------*/5'use strict';6const gulp = require('gulp');7const fs = require('fs');8const os = require('os');9const cp = require('child_process');10const path = require('path');11const es = require('event-stream');12const azure = require('gulp-azure-storage');13const electron = require('gulp-atom-electron');14const vfs = require('vinyl-fs');15const rename = require('gulp-rename');16const replace = require('gulp-replace');17const filter = require('gulp-filter');18const json = require('gulp-json-editor');19const _ = require('underscore');20const util = require('./lib/util');21const task = require('./lib/task');22const ext = require('./lib/extensions');23const buildfile = require('../src/buildfile');24const common = require('./lib/optimize');25const root = path.dirname(__dirname);26const commit = util.getVersion(root);27const packageJson = require('../package.json');28const product = require('../product.json');29const crypto = require('crypto');30const i18n = require('./lib/i18n');31const deps = require('./dependencies');32const getElectronVersion = require('./lib/electron').getElectronVersion;33const createAsar = require('./lib/asar').createAsar;34const minimist = require('minimist');35const { compileBuildTask } = require('./gulpfile.compile');36const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname));37// @ts-ignore38const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n));39const nodeModules = ['electron', 'original-fs']40 // @ts-ignore JSON checking: dependencies property is optional41 .concat(Object.keys(product.dependencies || {}))42 .concat(_.uniq(productionDependencies.map(d => d.name)))43 .concat(baseModules);44// Build45const vscodeEntryPoints = _.flatten([46 buildfile.entrypoint('vs/workbench/workbench.main'),47 buildfile.base,48 buildfile.workbench,49 buildfile.code50]);51const vscodeResources = [52 'out-build/main.js',53 'out-build/cli.js',54 'out-build/driver.js',55 'out-build/bootstrap.js',56 'out-build/bootstrap-fork.js',57 'out-build/bootstrap-amd.js',58 'out-build/bootstrap-window.js',59 'out-build/paths.js',60 'out-build/vs/**/*.{svg,png,cur,html}',61 '!out-build/vs/code/browser/**/*.html',62 'out-build/vs/base/common/performance.js',63 'out-build/vs/base/node/languagePacks.js',64 'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,cpuUsage.sh,ps.sh}',65 'out-build/vs/base/browser/ui/octiconLabel/octicons/**',66 'out-build/vs/workbench/browser/media/*-theme.css',67 'out-build/vs/workbench/contrib/debug/**/*.json',68 'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt',69 'out-build/vs/workbench/contrib/webview/browser/pre/*.js',70 'out-build/vs/workbench/contrib/webview/electron-browser/pre/*.js',71 'out-build/vs/**/markdown.css',72 'out-build/vs/workbench/contrib/tasks/**/*.json',73 'out-build/vs/workbench/contrib/welcome/walkThrough/**/*.md',74 'out-build/vs/workbench/services/files/**/*.exe',75 'out-build/vs/workbench/services/files/**/*.md',76 'out-build/vs/code/electron-browser/workbench/**',77 'out-build/vs/code/electron-browser/sharedProcess/sharedProcess.js',78 'out-build/vs/code/electron-browser/issue/issueReporter.js',79 'out-build/vs/code/electron-browser/processExplorer/processExplorer.js',80 '!**/test/**'81];82const BUNDLED_FILE_HEADER = [83 '/*!--------------------------------------------------------',84 ' * Copyright (C) Microsoft Corporation. All rights reserved.',85 ' *--------------------------------------------------------*/'86].join('\n');87const optimizeVSCodeTask = task.define('optimize-vscode', task.series(88 task.parallel(89 util.rimraf('out-vscode'),90 compileBuildTask91 ),92 common.optimizeTask({93 src: 'out-build',94 entryPoints: vscodeEntryPoints,95 resources: vscodeResources,96 loaderConfig: common.loaderConfig(nodeModules),97 header: BUNDLED_FILE_HEADER,98 out: 'out-vscode',99 bundleInfo: undefined100 })101));102const optimizeIndexJSTask = task.define('optimize-index-js', task.series(103 optimizeVSCodeTask,104 () => {105 const fullpath = path.join(process.cwd(), 'out-vscode/bootstrap-window.js');106 const contents = fs.readFileSync(fullpath).toString();107 const newContents = contents.replace('[/*BUILD->INSERT_NODE_MODULES*/]', JSON.stringify(nodeModules));108 fs.writeFileSync(fullpath, newContents);109 }110));111const sourceMappingURLBase = `https://ticino.blob.core.windows.net/sourcemaps/${commit}`;112const minifyVSCodeTask = task.define('minify-vscode', task.series(113 task.parallel(114 util.rimraf('out-vscode-min'),115 optimizeIndexJSTask116 ),117 common.minifyTask('out-vscode', `${sourceMappingURLBase}/core`)118));119// Package120// @ts-ignore JSON checking: darwinCredits is optional121const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));122function darwinBundleDocumentType(extensions, icon) {123 return {124 name: product.nameLong + ' document',125 role: 'Editor',126 ostypes: ["TEXT", "utxt", "TUTX", "****"],127 extensions: extensions,128 iconFile: icon129 };130}131const config = {132 version: getElectronVersion(),133 productAppName: product.nameLong,134 companyName: 'Microsoft Corporation',135 copyright: 'Copyright (C) 2019 Microsoft. All rights reserved',136 darwinIcon: 'resources/darwin/code.icns',137 darwinBundleIdentifier: product.darwinBundleIdentifier,138 darwinApplicationCategoryType: 'public.app-category.developer-tools',139 darwinHelpBookFolder: 'VS Code HelpBook',140 darwinHelpBookName: 'VS Code HelpBook',141 darwinBundleDocumentTypes: [142 darwinBundleDocumentType(["bat", "cmd"], 'resources/darwin/bat.icns'),143 darwinBundleDocumentType(["bowerrc"], 'resources/darwin/bower.icns'),144 darwinBundleDocumentType(["c", "h"], 'resources/darwin/c.icns'),145 darwinBundleDocumentType(["config", "editorconfig", "gitattributes", "gitconfig", "gitignore", "ini"], 'resources/darwin/config.icns'),146 darwinBundleDocumentType(["cc", "cpp", "cxx", "hh", "hpp", "hxx"], 'resources/darwin/cpp.icns'),147 darwinBundleDocumentType(["cs", "csx"], 'resources/darwin/csharp.icns'),148 darwinBundleDocumentType(["css"], 'resources/darwin/css.icns'),149 darwinBundleDocumentType(["go"], 'resources/darwin/go.icns'),150 darwinBundleDocumentType(["asp", "aspx", "cshtml", "htm", "html", "jshtm", "jsp", "phtml", "shtml"], 'resources/darwin/html.icns'),151 darwinBundleDocumentType(["jade"], 'resources/darwin/jade.icns'),152 darwinBundleDocumentType(["jav", "java"], 'resources/darwin/java.icns'),153 darwinBundleDocumentType(["js", "jscsrc", "jshintrc", "mjs"], 'resources/darwin/javascript.icns'),154 darwinBundleDocumentType(["json"], 'resources/darwin/json.icns'),155 darwinBundleDocumentType(["less"], 'resources/darwin/less.icns'),156 darwinBundleDocumentType(["markdown", "md", "mdoc", "mdown", "mdtext", "mdtxt", "mdwn", "mkd", "mkdn"], 'resources/darwin/markdown.icns'),157 darwinBundleDocumentType(["php"], 'resources/darwin/php.icns'),158 darwinBundleDocumentType(["ps1", "psd1", "psm1"], 'resources/darwin/powershell.icns'),159 darwinBundleDocumentType(["py"], 'resources/darwin/python.icns'),160 darwinBundleDocumentType(["gemspec", "rb"], 'resources/darwin/ruby.icns'),161 darwinBundleDocumentType(["scss"], 'resources/darwin/sass.icns'),162 darwinBundleDocumentType(["bash", "bash_login", "bash_logout", "bash_profile", "bashrc", "profile", "rhistory", "rprofile", "sh", "zlogin", "zlogout", "zprofile", "zsh", "zshenv", "zshrc"], 'resources/darwin/shell.icns'),163 darwinBundleDocumentType(["sql"], 'resources/darwin/sql.icns'),164 darwinBundleDocumentType(["ts"], 'resources/darwin/typescript.icns'),165 darwinBundleDocumentType(["tsx", "jsx"], 'resources/darwin/react.icns'),166 darwinBundleDocumentType(["vue"], 'resources/darwin/vue.icns'),167 darwinBundleDocumentType(["ascx", "csproj", "dtd", "wxi", "wxl", "wxs", "xml", "xaml"], 'resources/darwin/xml.icns'),168 darwinBundleDocumentType(["eyaml", "eyml", "yaml", "yml"], 'resources/darwin/yaml.icns'),169 darwinBundleDocumentType(["clj", "cljs", "cljx", "clojure", "code-workspace", "coffee", "ctp", "dockerfile", "dot", "edn", "fs", "fsi", "fsscript", "fsx", "handlebars", "hbs", "lua", "m", "makefile", "ml", "mli", "pl", "pl6", "pm", "pm6", "pod", "pp", "properties", "psgi", "pug", "r", "rs", "rt", "svg", "svgz", "t", "txt", "vb", "xcodeproj", "xcworkspace"], 'resources/darwin/default.icns')170 ],171 darwinBundleURLTypes: [{172 role: 'Viewer',173 name: product.nameLong,174 urlSchemes: [product.urlProtocol]175 }],176 darwinForceDarkModeSupport: true,177 darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : undefined,178 linuxExecutableName: product.applicationName,179 winIcon: 'resources/win32/code.ico',180 token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || undefined,181 // @ts-ignore JSON checking: electronRepository is optional182 repo: product.electronRepository || undefined183};184function getElectron(arch) {185 return () => {186 const electronOpts = _.extend({}, config, {187 platform: process.platform,188 arch,189 ffmpegChromium: true,190 keepDefaultApp: true191 });192 return gulp.src('package.json')193 .pipe(json({ name: product.nameShort }))194 .pipe(electron(electronOpts))195 .pipe(filter(['**', '!**/app/package.json']))196 .pipe(vfs.dest('.build/electron'));197 };198}199gulp.task(task.define('electron', task.series(util.rimraf('.build/electron'), getElectron(process.arch))));200gulp.task(task.define('electron-ia32', task.series(util.rimraf('.build/electron'), getElectron('ia32'))));201gulp.task(task.define('electron-x64', task.series(util.rimraf('.build/electron'), getElectron('x64'))));202gulp.task(task.define('electron-arm', task.series(util.rimraf('.build/electron'), getElectron('armv7l'))));203gulp.task(task.define('electron-arm64', task.series(util.rimraf('.build/electron'), getElectron('arm64'))));204/**205 * Compute checksums for some files.206 *207 * @param {string} out The out folder to read the file from.208 * @param {string[]} filenames The paths to compute a checksum for.209 * @return {Object} A map of paths to checksums.210 */211function computeChecksums(out, filenames) {212 var result = {};213 filenames.forEach(function (filename) {214 var fullPath = path.join(process.cwd(), out, filename);215 result[filename] = computeChecksum(fullPath);216 });217 return result;218}219/**220 * Compute checksum for a file.221 *222 * @param {string} filename The absolute path to a filename.223 * @return {string} The checksum for `filename`.224 */225function computeChecksum(filename) {226 var contents = fs.readFileSync(filename);227 var hash = crypto228 .createHash('md5')229 .update(contents)230 .digest('base64')231 .replace(/=+$/, '');232 return hash;233}234function packageTask(platform, arch, sourceFolderName, destinationFolderName, opts) {235 opts = opts || {};236 const destination = path.join(path.dirname(root), destinationFolderName);237 platform = platform || process.platform;238 return () => {239 const out = sourceFolderName;240 const checksums = computeChecksums(out, [241 'vs/workbench/workbench.main.js',242 'vs/workbench/workbench.main.css',243 'vs/code/electron-browser/workbench/workbench.html',244 'vs/code/electron-browser/workbench/workbench.js'245 ]);246 const src = gulp.src(out + '/**', { base: '.' })247 .pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + out), 'out'); }))248 .pipe(util.setExecutableBit(['**/*.sh']))249 .pipe(filter(['**', '!**/*.js.map']));250 const root = path.resolve(path.join(__dirname, '..'));251 const sources = es.merge(src, ext.packageExtensionsStream({252 sourceMappingURLBase: sourceMappingURLBase253 }));254 let version = packageJson.version;255 // @ts-ignore JSON checking: quality is optional256 const quality = product.quality;257 if (quality && quality !== 'stable') {258 version += '-' + quality;259 }260 const name = product.nameShort;261 const packageJsonUpdates = { name, version };262 // for linux url handling263 if (platform === 'linux') {264 packageJsonUpdates.desktopName = `${product.applicationName}-url-handler.desktop`;265 }266 const packageJsonStream = gulp.src(['package.json'], { base: '.' })267 .pipe(json(packageJsonUpdates));268 const date = new Date().toISOString();269 const productJsonUpdate = { commit, date, checksums };270 if (shouldSetupSettingsSearch()) {271 productJsonUpdate.settingsSearchBuildId = getSettingsSearchBuildId(packageJson);272 }273 const productJsonStream = gulp.src(['product.json'], { base: '.' })274 .pipe(json(productJsonUpdate));275 const license = gulp.src(['LICENSES.chromium.html', product.licenseFileName, 'ThirdPartyNotices.txt', 'licenses/**'], { base: '.', allowEmpty: true });276 // TODO the API should be copied to `out` during compile, not here277 const api = gulp.src('src/vs/vscode.d.ts').pipe(rename('out/vs/vscode.d.ts'));278 const depsSrc = [279 ..._.flatten(productionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`])),280 // @ts-ignore JSON checking: dependencies is optional281 ..._.flatten(Object.keys(product.dependencies || {}).map(d => [`node_modules/${d}/**`, `!node_modules/${d}/**/{test,tests}/**`]))282 ];283 const deps = gulp.src(depsSrc, { base: '.', dot: true })284 .pipe(filter(['**', '!**/package-lock.json']))285 .pipe(util.cleanNodeModules(path.join(__dirname, '.nativeignore')))286 .pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar'));287 let all = es.merge(288 packageJsonStream,289 productJsonStream,290 license,291 api,292 sources,293 deps294 );295 if (platform === 'win32') {296 all = es.merge(all, gulp.src([297 'resources/win32/bower.ico',298 'resources/win32/c.ico',299 'resources/win32/config.ico',300 'resources/win32/cpp.ico',301 'resources/win32/csharp.ico',302 'resources/win32/css.ico',303 'resources/win32/default.ico',304 'resources/win32/go.ico',305 'resources/win32/html.ico',306 'resources/win32/jade.ico',307 'resources/win32/java.ico',308 'resources/win32/javascript.ico',309 'resources/win32/json.ico',310 'resources/win32/less.ico',311 'resources/win32/markdown.ico',312 'resources/win32/php.ico',313 'resources/win32/powershell.ico',314 'resources/win32/python.ico',315 'resources/win32/react.ico',316 'resources/win32/ruby.ico',317 'resources/win32/sass.ico',318 'resources/win32/shell.ico',319 'resources/win32/sql.ico',320 'resources/win32/typescript.ico',321 'resources/win32/vue.ico',322 'resources/win32/xml.ico',323 'resources/win32/yaml.ico',324 'resources/win32/code_70x70.png',325 'resources/win32/code_150x150.png'326 ], { base: '.' }));327 } else if (platform === 'linux') {328 all = es.merge(all, gulp.src('resources/linux/code.png', { base: '.' }));329 } else if (platform === 'darwin') {330 const shortcut = gulp.src('resources/darwin/bin/code.sh')331 .pipe(rename('bin/code'));332 all = es.merge(all, shortcut);333 }334 let result = all335 .pipe(util.skipDirectories())336 .pipe(util.fixWin32DirectoryPermissions())337 .pipe(electron(_.extend({}, config, { platform, arch, ffmpegChromium: true })))338 .pipe(filter(['**', '!LICENSE', '!LICENSES.chromium.html', '!version']));339 // result = es.merge(result, gulp.src('resources/completions/**', { base: '.' }));340 if (platform === 'win32') {341 result = es.merge(result, gulp.src('resources/win32/bin/code.js', { base: 'resources/win32', allowEmpty: true }));342 result = es.merge(result, gulp.src('resources/win32/bin/code.cmd', { base: 'resources/win32' })343 .pipe(replace('@@NAME@@', product.nameShort))344 .pipe(rename(function (f) { f.basename = product.applicationName; })));345 result = es.merge(result, gulp.src('resources/win32/bin/code.sh', { base: 'resources/win32' })346 .pipe(replace('@@NAME@@', product.nameShort))347 .pipe(replace('@@PRODNAME@@', product.nameLong))348 .pipe(replace('@@VERSION@@', version))349 .pipe(replace('@@COMMIT@@', commit))350 .pipe(replace('@@APPNAME@@', product.applicationName))351 .pipe(replace('@@DATAFOLDER@@', product.dataFolderName))352 .pipe(replace('@@QUALITY@@', quality))353 .pipe(rename(function (f) { f.basename = product.applicationName; f.extname = ''; })));354 result = es.merge(result, gulp.src('resources/win32/VisualElementsManifest.xml', { base: 'resources/win32' })355 .pipe(rename(product.nameShort + '.VisualElementsManifest.xml')));356 } else if (platform === 'linux') {357 result = es.merge(result, gulp.src('resources/linux/bin/code.sh', { base: '.' })358 .pipe(replace('@@PRODNAME@@', product.nameLong))359 .pipe(replace('@@NAME@@', product.applicationName))360 .pipe(rename('bin/' + product.applicationName)));361 }362 // submit all stats that have been collected363 // during the build phase364 if (opts.stats) {365 result.on('end', () => {366 const { submitAllStats } = require('./lib/stats');367 submitAllStats(product, commit).then(() => console.log('Submitted bundle stats!'));368 });369 }370 return result.pipe(vfs.dest(destination));371 };372}373const buildRoot = path.dirname(root);374const BUILD_TARGETS = [375 { platform: 'win32', arch: 'ia32' },376 { platform: 'win32', arch: 'x64' },377 { platform: 'darwin', arch: null, opts: { stats: true } },378 { platform: 'linux', arch: 'ia32' },379 { platform: 'linux', arch: 'x64' },380 { platform: 'linux', arch: 'arm' },381 { platform: 'linux', arch: 'arm64' },382];383BUILD_TARGETS.forEach(buildTarget => {384 const dashed = (str) => (str ? `-${str}` : ``);385 const platform = buildTarget.platform;386 const arch = buildTarget.arch;387 const opts = buildTarget.opts;388 ['', 'min'].forEach(minified => {389 const sourceFolderName = `out-vscode${dashed(minified)}`;390 const destinationFolderName = `VSCode${dashed(platform)}${dashed(arch)}`;391 const vscodeTask = task.define(`vscode${dashed(platform)}${dashed(arch)}${dashed(minified)}`, task.series(392 task.parallel(393 minified ? minifyVSCodeTask : optimizeVSCodeTask,394 util.rimraf(path.join(buildRoot, destinationFolderName))395 ),396 packageTask(platform, arch, sourceFolderName, destinationFolderName, opts)397 ));398 gulp.task(vscodeTask);399 });400});401// Transifex Localizations402const innoSetupConfig = {403 'zh-cn': { codePage: 'CP936', defaultInfo: { name: 'Simplified Chinese', id: '$0804', } },404 'zh-tw': { codePage: 'CP950', defaultInfo: { name: 'Traditional Chinese', id: '$0404' } },405 'ko': { codePage: 'CP949', defaultInfo: { name: 'Korean', id: '$0412' } },406 'ja': { codePage: 'CP932' },407 'de': { codePage: 'CP1252' },408 'fr': { codePage: 'CP1252' },409 'es': { codePage: 'CP1252' },410 'ru': { codePage: 'CP1251' },411 'it': { codePage: 'CP1252' },412 'pt-br': { codePage: 'CP1252' },413 'hu': { codePage: 'CP1250' },414 'tr': { codePage: 'CP1254' }415};416const apiHostname = process.env.TRANSIFEX_API_URL;417const apiName = process.env.TRANSIFEX_API_NAME;418const apiToken = process.env.TRANSIFEX_API_TOKEN;419gulp.task(task.define(420 'vscode-translations-push',421 task.series(422 optimizeVSCodeTask,423 function () {424 const pathToMetadata = './out-vscode/nls.metadata.json';425 const pathToExtensions = './extensions/*';426 const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}';427 return es.merge(428 gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),429 gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),430 gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())431 ).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken)432 ).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken));433 }434 )435));436gulp.task(task.define(437 'vscode-translations-export',438 task.series(439 optimizeVSCodeTask,440 function () {441 const pathToMetadata = './out-vscode/nls.metadata.json';442 const pathToExtensions = './extensions/*';443 const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}';444 return es.merge(445 gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),446 gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),447 gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())448 ).pipe(vfs.dest('../vscode-translations-export'));449 }450 )451));452gulp.task('vscode-translations-pull', function () {453 return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => {454 let includeDefault = !!innoSetupConfig[language.id].defaultInfo;455 return i18n.pullSetupXlfFiles(apiHostname, apiName, apiToken, language, includeDefault).pipe(vfs.dest(`../vscode-translations-import/${language.id}/setup`));456 }));457});458gulp.task('vscode-translations-import', function () {459 var options = minimist(process.argv.slice(2), {460 string: 'location',461 default: {462 location: '../vscode-translations-import'463 }464 });465 return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => {466 let id = language.transifexId || language.id;467 return gulp.src(`${options.location}/${id}/setup/*/*.xlf`)468 .pipe(i18n.prepareIslFiles(language, innoSetupConfig[language.id]))469 .pipe(vfs.dest(`./build/win32/i18n`));470 }));471});472// Sourcemaps473gulp.task('upload-vscode-sourcemaps', () => {474 const vs = gulp.src('out-vscode-min/**/*.map', { base: 'out-vscode-min' }) // client source-maps only475 .pipe(es.mapSync(f => {476 f.path = `${f.base}/core/${f.relative}`;477 return f;478 }));479 const extensionsOut = gulp.src(['extensions/**/out/**/*.map', '!extensions/**/node_modules/**'], { base: '.' });480 const extensionsDist = gulp.src(['extensions/**/dist/**/*.map', '!extensions/**/node_modules/**'], { base: '.' });481 return es.merge(vs, extensionsOut, extensionsDist)482 .pipe(es.through(function (data) {483 // debug484 console.log('Uploading Sourcemap', data.relative);485 this.emit('data', data);486 }))487 .pipe(azure.upload({488 account: process.env.AZURE_STORAGE_ACCOUNT,489 key: process.env.AZURE_STORAGE_ACCESS_KEY,490 container: 'sourcemaps',491 prefix: commit + '/'492 }));493});494// This task is only run for the MacOS build495const generateVSCodeConfigurationTask = task.define('generate-vscode-configuration', () => {496 return new Promise((resolve, reject) => {497 const buildDir = process.env['AGENT_BUILDDIRECTORY'];498 if (!buildDir) {499 return reject(new Error('$AGENT_BUILDDIRECTORY not set'));500 }501 if (process.env.VSCODE_QUALITY !== 'insider' && process.env.VSCODE_QUALITY !== 'stable') {502 return resolve();503 }504 const userDataDir = path.join(os.tmpdir(), 'tmpuserdata');505 const extensionsDir = path.join(os.tmpdir(), 'tmpextdir');506 const appName = process.env.VSCODE_QUALITY === 'insider' ? 'Visual\\ Studio\\ Code\\ -\\ Insiders.app' : 'Visual\\ Studio\\ Code.app';507 const appPath = path.join(buildDir, `VSCode-darwin/${appName}/Contents/Resources/app/bin/code`);508 const codeProc = cp.exec(`${appPath} --export-default-configuration='${allConfigDetailsPath}' --wait --user-data-dir='${userDataDir}' --extensions-dir='${extensionsDir}'`);509 const timer = setTimeout(() => {510 codeProc.kill();511 reject(new Error('export-default-configuration process timed out'));512 }, 10 * 1000);513 codeProc.stdout.on('data', d => console.log(d.toString()));514 codeProc.stderr.on('data', d => console.log(d.toString()));515 codeProc.on('exit', () => {516 clearTimeout(timer);517 resolve();518 });519 codeProc.on('error', err => {520 clearTimeout(timer);521 reject(err);522 });523 });524});525const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json');526gulp.task(task.define(527 'upload-vscode-configuration',528 task.series(529 generateVSCodeConfigurationTask,530 () => {531 if (!shouldSetupSettingsSearch()) {532 const branch = process.env.BUILD_SOURCEBRANCH;533 console.log(`Only runs on master and release branches, not ${branch}`);534 return;535 }536 if (!fs.existsSync(allConfigDetailsPath)) {537 throw new Error(`configuration file at ${allConfigDetailsPath} does not exist`);538 }539 const settingsSearchBuildId = getSettingsSearchBuildId(packageJson);540 if (!settingsSearchBuildId) {541 throw new Error('Failed to compute build number');542 }543 return gulp.src(allConfigDetailsPath)544 .pipe(azure.upload({545 account: process.env.AZURE_STORAGE_ACCOUNT,546 key: process.env.AZURE_STORAGE_ACCESS_KEY,547 container: 'configuration',548 prefix: `${settingsSearchBuildId}/${commit}/`549 }));550 }551 )552));553function shouldSetupSettingsSearch() {554 const branch = process.env.BUILD_SOURCEBRANCH;555 return branch && (/\/master$/.test(branch) || branch.indexOf('/release/') >= 0);556}557function getSettingsSearchBuildId(packageJson) {558 try {559 const branch = process.env.BUILD_SOURCEBRANCH;560 const branchId = branch.indexOf('/release/') >= 0 ? 0 :561 /\/master$/.test(branch) ? 1 :562 2; // Some unexpected branch563 const out = cp.execSync(`git rev-list HEAD --count`);564 const count = parseInt(out.toString());565 // <version number><commit count><branchId (avoid unlikely conflicts)>566 // 1.25.1, 1,234,567 commits, master = 1250112345671567 return util.versionStringToNumber(packageJson.version) * 1e8 + count * 10 + branchId;568 } catch (e) {569 throw new Error('Could not determine build number: ' + e.toString());570 }...

Full Screen

Full Screen

fight.js

Source:fight.js Github

copy

Full Screen

1var player = {health: 200, strength: 25};2var darwin = {health: 200, strength: 40};3var pLuck = 0;4var dLuck = 0;5var pAccuracy = 0;6var dAccuracy = 0;7function playerAccuracy() {8 "use strict";9 pAccuracy = Math.floor(Math.random() * 100) + 1;10 return playerAccuracy;11}12function darwinAccuracy() {13 "use strict";14 dAccuracy = Math.floor(Math.random() * 100) + 1;15 return darwinAccuracy;16}17function updateDarwinStrength() {18 "use strict";19 if (darwin.health > 175) {20 return darwin.strength;21 } else if (darwin.health > 125) {22 darwin.strength = 70;23 return darwin.strength;24 } else if (darwin.health > 75) {25 darwin.strength = 90;26 return darwin.strength;27 } else if (darwin.health > 0) {28 darwin.strength = 110;29 return darwin.strength;30 }31}32function playerLuck() {33 "use strict";34 pLuck = Math.floor(Math.random() * 100) + 1;35 return pLuck;36}37function darwinLuck() {38 "use strict";39 dLuck = Math.floor(Math.random() * 100) + 1;40 return dLuck;41}42function chooseAttack() {43 "use strict";44 var pChoice = prompt("You have " + player.health + " HP and Darwin has " + darwin.health + " HP, would you like to (K) kick, (D) dive, or (J) jab Darwin? Or do you want to drink a potion? (H) for a health potion, (S) for a strength potion");45 if (pChoice.toLowerCase() === "k") {46 alert("Risky");47 if (pAccuracy <= 80) {48 alert("You idiot! You missed and Darwin makes a counter attack! You take 20 damage!");49 player.health -= 20;50 return player.health;51 } else if (player.strength > 80 && pLuck > 90) {52 alert("Critical hit! Darwin suffers 100 damage!");53 darwin.health -= 100;54 return darwin.health;55 } else if (player.strength > 60 && pLuck > 90) {56 alert("Critical hit! Darwin suffers 70 damage!");57 darwin.health -= 70;58 return darwin.health;59 } else if (player.strength > 40 && pLuck > 90) {60 alert("Critical hit! Darwin suffers 50 damage!");61 darwin.health -= 50;62 return darwin.health;63 } else if (pLuck > 90) {64 alert("Critical hit! Darwin suffers 40 damage!");65 darwin.health -= 40;66 return darwin.health;67 } else if (player.strength > 80) {68 alert("That's a powerful kick! Darwin suffers 35 damage!");69 darwin.health -= 35;70 return darwin.health;71 } else if (player.strength > 60) {72 alert("That's a tough kick! Darwin suffers 30 damage!");73 darwin.health -= 30;74 return darwin.health;75 } else if (player.strength > 40) {76 alert("That's a nice kick! Darwin suffers 25 damage!");77 darwin.health -= 25;78 return darwin.health;79 } else {80 alert("That's a weak kick son. Darwin takes only 20 damage!");81 darwin.health -= 20;82 return darwin.health;83 }84 85 } else if (pChoice.toLowerCase() === "d") {86 alert("Lets dive at Darwin!");87 if (pAccuracy <= 50) {88 alert('Darwin dodged the attack! a little bit of strength whittles away. Also, Darwin wanted to say something... "SUCK IT FOOL!"');89 player.strength -= 5;90 return player.strength;91 } else if (player.strength > 80 && pLuck > 90) {92 alert("Critical hit! Darwin suffers 60 damage!");93 darwin.health -= 60;94 return darwin.health;95 } else if (player.strength > 60 && pLuck > 90) {96 alert("Critical hit! Darwin suffers 40 damage!");97 darwin.health -= 40;98 return darwin.health;99 } else if (player.strength > 40 && pLuck > 90) {100 alert("Critical hit! Darwin suffers 30 damage!");101 darwin.health -= 30;102 return darwin.health;103 } else if (pLuck > 90) {104 alert("Critical hit! Darwin suffers 25 damage!");105 darwin.health -= 25;106 return darwin.health;107 } else if (player.strength > 80) {108 alert("That's an insane dive! Darwin suffers 40 damage!");109 darwin.health -= 40;110 return darwin.health;111 } else if (player.strength > 60) {112 alert("That's a smart dive! Darwin suffers 30 damage!");113 darwin.health -= 30;114 return darwin.health;115 } else if (player.strength > 40) {116 alert("That's a decent dive! Darwin suffers 20 damage!");117 darwin.health -= 20;118 return darwin.health;119 } else {120 alert("That's not a great dive, but Darwin still suffers 10 damage!");121 darwin.health -= 10;122 return darwin.health;123 }124 125 } else if (pChoice.toLowerCase() === "j") {126 alert("quick jab!");127 if (pAccuracy <= 1) {128 alert("Ahh! you missed the jab and lost a great deal of strength You are butthole!");129 player.strength -= 50;130 return player.strength;131 } else if (player.strength > 80 && pLuck > 90) {132 alert("Critical hit! Darwin suffers 50 damage!");133 darwin.health -= 35;134 return darwin.health;135 } else if (player.strength > 60 && pLuck > 90) {136 alert("Critical hit! Darwin suffers 35 damage!");137 darwin.health -= 20;138 return darwin.health;139 } else if (player.strength > 40 && pLuck > 90) {140 alert("Critical hit! Darwin suffers 20 damage!");141 darwin.health -= 15;142 return darwin.health;143 } else if (pLuck > 90) {144 alert("Critical hit! Darwin suffers 10 damage!");145 darwin.health -= 10;146 return darwin.health;147 } else if (player.strength > 60) {148 alert("That's a lean jab! Darwin takes 15 damage!");149 darwin.health -= 15;150 return darwin.health;151 } else if (player.strength > 40) {152 alert("That's a sick jab! Darwin suffers 10 damage!");153 darwin.health -= 10;154 return darwin.health;155 } else {156 alert("That's like hitting someone with a napkin! Darwin takes only 5 damage!");157 darwin.health -= 5;158 return darwin.health;159 }160 161 } else if (pChoice.toLowerCase() === "h") {162 alert("You're drinking a health potion...");163 if (pLuck < 10) {164 alert("Oh no! You were poisoned by the potion, you lost some health");165 player.health -= 25;166 } else {167 alert("You were given the benefits of the potion, extra health!");168 player.health += 25;169 }170 } else if (pChoice.toLowerCase() === "s") {171 alert("You're drinking a strength potion...");172 if (pLuck < 10) {173 alert("Oh no! You were poisoned by the potion, you lost some strength");174 player.strength -= 20;175 } else {176 alert("You were given the benefits of the potion, extra strength!");177 player.strength += 20;178 }179 } else {180 alert("You did nothing... waste of an attack...");181 }182}183function chooseDefense() {184 "use strict";185 var pDefense = prompt("Darwin is going to attack with a firm whack. You have " + player.health + " HP, Darwin has " + darwin.health + " HP, do you want to try to (C) counter, (D) dodge, or (B) Block the attack? (Remember: the more risk the more reward, but also better safe than sorry)");186 if (pDefense.toLowerCase() === "c") {187 alert("You have courage");188 if (dAccuracy <= 20) {189 alert("Your counter succeeded! 25 damage dealt");190 darwin.health -= 25;191 return darwin.health;192 } else if (darwin.strength >= 100 && dLuck > 20) {193 alert("You failed, Darwin landed a huge critical hit, it's an instant kill, good try friend");194 player.health = 0;195 return player.health;196 } else if (darwin.strength >= 80 && dLuck > 40) {197 alert("That's tough, Darwin landed a critical hit that does 100 damage!");198 player.health -= 100;199 return player.health;200 } else if (darwin.strength >= 60 && dLuck > 70) {201 alert("You're dumb, now Darwin landed a critical hit that deals 75 damage");202 player.health -= 75;203 return player.health;204 } else if (darwin.strength >= 40 && dLuck > 80) {205 alert("Ouch! Critical hit! Darwin's whack does 50 damage!");206 player.health -= 50;207 return player.health;208 } else if (darwin.strength >= 100) {209 alert("Darwin has turned to a powerful beast, he whacks you dealing 90 damage!");210 player.health -= 90;211 return player.health;212 } else if (darwin.strength >= 80) {213 alert("You haven't learned your lesson, Darwin's powerful whack deals 70 damage!");214 player.health -= 70;215 return player.health;216 } else if (darwin.strength >= 60) {217 alert("Nice, now you just lost 50 HP because you are stupid!");218 player.health -= 50;219 return player.health;220 } else {221 alert("You were over confident! Darwin deals 30 damage!");222 player.health -= 30;223 return player.health;224 }225 } else if (pDefense.toLowerCase() === "d") {226 if (dAccuracy <= 50) {227 alert("You succesully dodged the attack! Keep going!");228 } else if (darwin.strength >= 100 && dLuck > 50) {229 alert("You failed to dodge the attack, and Darwin lands a critical hit! He's also in rage mode, kicking your butt and dealing 100 damage!");230 player.health -= 100;231 return player.health;232 } else if (darwin.strength >= 80 && dLuck > 60) {233 alert("You failed to dodge the attack, and Darwin lands a critical hit! Darwin, AKA THE BEAST, deals a 80 damage whack!");234 player.health -= 80;235 return player.health;236 } else if (darwin.strength >= 60 && dLuck > 70) {237 alert("You failed to dodge the attack, and Darwin lands a critical hit! You lose 50 HP");238 player.health -= 50;239 return player.health;240 } else if (darwin.strength >= 40 && dLuck > 80) {241 alert("You failed to dodge the attack, and Darwin lands a critical hit! It dealt 30 damage!");242 player.health -= 30;243 return player.health;244 } else if (darwin.strength >= 100) {245 alert("Darwin is in rage mode, he destroys you with a whack worth 75 damage!");246 player.health -= 75;247 return player.health;248 } else if (darwin.strength >= 80) {249 alert("You did not successfully dodge Darwin. Darwin powers through you dealing 50 damage!");250 player.health -= 50;251 return player.health;252 } else if (darwin.strength >= 60) {253 alert("You failed to dodge the attack, Darwin deals 30 damage!");254 player.health -= 30;255 return player.health;256 } else {257 alert("You failed to dodge the attack, but it's okay, it only dealt 15 damage");258 player.health -= 15;259 return player.health;260 }261 } else if (pDefense.toLowerCase() === "b") {262 alert("You have played it safe");263 if (darwin.strength >= 100) {264 alert("Darwin is in rage mode, he destoys you like a can of corn, dealing 50 damage");265 player.health -= 50;266 return player.health;267 } else if (darwin.strength >= 80) {268 alert("Darwin whacks the s$%t out of you! dealing 35 damage!");269 player.health -= 35;270 return player.health;271 } else if (darwin.strength >= 60) {272 alert("Darwin is clutch, but your block helps, he deals 25 damage");273 player.health -= 25;274 return player.health;275 } else if (darwin.strength >= 40) {276 alert("Good block, Darwin still lands a solid attack though, you lose 10 HP");277 player.health -= 10;278 return player.health;279 }280 } else {281 alert("You have to counter, dodge, or block, you lose 100 HP for not choosing");282 player.health -= 100;283 return player.health;284 }285}286function game() {287 "use strict";288 alert("If you are new, it is highly recomended that you first check out the directions manual on the home page");289 confirm("Let's start the fight!");290 do {291 updateDarwinStrength();292 playerAccuracy();293 darwinAccuracy();294 playerLuck();295 darwinLuck();296 chooseAttack();297 chooseDefense();298 } while (player.health > 0 && darwin.health > 0);299 if (player.health <= 0) {300 alert("Darwin killed you!");301 player = {health: 200, strength: 25};302 darwin = {health: 200, strength: 40};303 } else if (darwin.health <= 0) {304 alert("You beat Darwin, you're the champ!");305 player = {health: 200, strength: 25};306 darwin = {health: 200, strength: 40};307 } else if (player.health <= 0 && darwin.health <= 0) {308 alert("You both died, no one wins!");309 player = {health: 200, strength: 25};310 darwin = {health: 200, strength: 40};311 }...

Full Screen

Full Screen

electron.js

Source:electron.js Github

copy

Full Screen

1/*---------------------------------------------------------------------------------------------2 * Copyright (c) Microsoft Corporation. All rights reserved.3 * Licensed under the MIT License. See License.txt in the project root for license information.4 *--------------------------------------------------------------------------------------------*/5'use strict';6Object.defineProperty(exports, "__esModule", { value: true });7exports.config = void 0;8const fs = require("fs");9const path = require("path");10const vfs = require("vinyl-fs");11const filter = require("gulp-filter");12const _ = require("underscore");13const util = require("./util");14const root = path.dirname(path.dirname(__dirname));15const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));16const commit = util.getVersion(root);17const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));18function darwinBundleDocumentType(extensions, icon) {19 return {20 name: product.nameLong + ' document',21 role: 'Editor',22 ostypes: ['TEXT', 'utxt', 'TUTX', '****'],23 extensions: extensions,24 iconFile: icon25 };26}27exports.config = {28 version: util.getElectronVersion(),29 productAppName: product.nameLong,30 companyName: 'Microsoft Corporation',31 copyright: 'Copyright (C) 2021 Microsoft. All rights reserved',32 darwinIcon: 'resources/darwin/code.icns',33 darwinBundleIdentifier: product.darwinBundleIdentifier,34 darwinApplicationCategoryType: 'public.app-category.developer-tools',35 darwinHelpBookFolder: 'VS Code HelpBook',36 darwinHelpBookName: 'VS Code HelpBook',37 darwinBundleDocumentTypes: [38 darwinBundleDocumentType(['bat', 'cmd'], 'resources/darwin/bat.icns'),39 darwinBundleDocumentType(['bowerrc'], 'resources/darwin/bower.icns'),40 darwinBundleDocumentType(['c', 'h'], 'resources/darwin/c.icns'),41 darwinBundleDocumentType(['config', 'editorconfig', 'gitattributes', 'gitconfig', 'gitignore', 'ini'], 'resources/darwin/config.icns'),42 darwinBundleDocumentType(['cc', 'cpp', 'cxx', 'c++', 'hh', 'hpp', 'hxx', 'h++'], 'resources/darwin/cpp.icns'),43 darwinBundleDocumentType(['cs', 'csx'], 'resources/darwin/csharp.icns'),44 darwinBundleDocumentType(['css'], 'resources/darwin/css.icns'),45 darwinBundleDocumentType(['go'], 'resources/darwin/go.icns'),46 darwinBundleDocumentType(['asp', 'aspx', 'cshtml', 'htm', 'html', 'jshtm', 'jsp', 'phtml', 'shtml'], 'resources/darwin/html.icns'),47 darwinBundleDocumentType(['jade'], 'resources/darwin/jade.icns'),48 darwinBundleDocumentType(['jav', 'java'], 'resources/darwin/java.icns'),49 darwinBundleDocumentType(['js', 'jscsrc', 'jshintrc', 'mjs', 'cjs'], 'resources/darwin/javascript.icns'),50 darwinBundleDocumentType(['json'], 'resources/darwin/json.icns'),51 darwinBundleDocumentType(['less'], 'resources/darwin/less.icns'),52 darwinBundleDocumentType(['markdown', 'md', 'mdoc', 'mdown', 'mdtext', 'mdtxt', 'mdwn', 'mkd', 'mkdn'], 'resources/darwin/markdown.icns'),53 darwinBundleDocumentType(['php'], 'resources/darwin/php.icns'),54 darwinBundleDocumentType(['ps1', 'psd1', 'psm1'], 'resources/darwin/powershell.icns'),55 darwinBundleDocumentType(['py'], 'resources/darwin/python.icns'),56 darwinBundleDocumentType(['gemspec', 'rb'], 'resources/darwin/ruby.icns'),57 darwinBundleDocumentType(['scss'], 'resources/darwin/sass.icns'),58 darwinBundleDocumentType(['bash', 'bash_login', 'bash_logout', 'bash_profile', 'bashrc', 'profile', 'rhistory', 'rprofile', 'sh', 'zlogin', 'zlogout', 'zprofile', 'zsh', 'zshenv', 'zshrc'], 'resources/darwin/shell.icns'),59 darwinBundleDocumentType(['sql'], 'resources/darwin/sql.icns'),60 darwinBundleDocumentType(['ts'], 'resources/darwin/typescript.icns'),61 darwinBundleDocumentType(['tsx', 'jsx'], 'resources/darwin/react.icns'),62 darwinBundleDocumentType(['vue'], 'resources/darwin/vue.icns'),63 darwinBundleDocumentType(['ascx', 'csproj', 'dtd', 'wxi', 'wxl', 'wxs', 'xml', 'xaml'], 'resources/darwin/xml.icns'),64 darwinBundleDocumentType(['eyaml', 'eyml', 'yaml', 'yml'], 'resources/darwin/yaml.icns'),65 darwinBundleDocumentType(['clj', 'cljs', 'cljx', 'clojure', 'code-workspace', 'coffee', 'containerfile', 'ctp', 'dockerfile', 'dot', 'edn', 'fs', 'fsi', 'fsscript', 'fsx', 'handlebars', 'hbs', 'lua', 'm', 'makefile', 'ml', 'mli', 'pl', 'pl6', 'pm', 'pm6', 'pod', 'pp', 'properties', 'psgi', 'pug', 'r', 'rs', 'rt', 'svg', 'svgz', 't', 'txt', 'vb', 'xcodeproj', 'xcworkspace'], 'resources/darwin/default.icns')66 ],67 darwinBundleURLTypes: [{68 role: 'Viewer',69 name: product.nameLong,70 urlSchemes: [product.urlProtocol]71 }],72 darwinForceDarkModeSupport: true,73 darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : undefined,74 linuxExecutableName: product.applicationName,75 winIcon: 'resources/win32/code.ico',76 token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || undefined,77 repo: product.electronRepository || undefined78};79function getElectron(arch) {80 return () => {81 const electron = require('gulp-atom-electron');82 const json = require('gulp-json-editor');83 const electronOpts = _.extend({}, exports.config, {84 platform: process.platform,85 arch: arch === 'armhf' ? 'arm' : arch,86 ffmpegChromium: true,87 keepDefaultApp: true88 });89 return vfs.src('package.json')90 .pipe(json({ name: product.nameShort }))91 .pipe(electron(electronOpts))92 .pipe(filter(['**', '!**/app/package.json']))93 .pipe(vfs.dest('.build/electron'));94 };95}96async function main(arch = process.arch) {97 const version = util.getElectronVersion();98 const electronPath = path.join(root, '.build', 'electron');99 const versionFile = path.join(electronPath, 'version');100 const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;101 if (!isUpToDate) {102 await util.rimraf(electronPath)();103 await util.streamToPromise(getElectron(arch)());104 }105}106if (require.main === module) {107 main(process.argv[2]).catch(err => {108 console.error(err);109 process.exit(1);110 });...

Full Screen

Full Screen

coinDataDirectories.js

Source:coinDataDirectories.js Github

copy

Full Screen

1export const coinDataDirectories = {2 VRSC: {3 darwin: "Komodo/VRSC",4 linux: ".komodo/VRSC",5 win32: "Komodo/VRSC"6 },7 KMD: {8 darwin: "Komodo",9 linux: "komodo",10 win32: "Komodo"11 },12 AXO: {13 darwin: "Komodo/AXO",14 linux: ".komodo/AXO",15 win32: "Komodo/AXO"16 },17 BEER: {18 darwin: "Komodo/BEER",19 linux: ".komodo/BEER",20 win32: "Komodo/BEER"21 },22 BET: {23 darwin: "Komodo/BET",24 linux: ".komodo/BET",25 win32: "Komodo/BET"26 },27 BNTN: {28 darwin: "Komodo/BNTN",29 linux: ".komodo/BNTN",30 win32: "Komodo/BNTN"31 },32 BOTS: {33 darwin: "Komodo/BOTS",34 linux: ".komodo/BOTS",35 win32: "Komodo/BOTS"36 },37 CEAL: {38 darwin: "Komodo/CEAL",39 linux: ".komodo/CEAL",40 win32: "Komodo/CEAL"41 },42 CHAIN: {43 darwin: "Komodo/CHAIN",44 linux: ".komodo/CHAIN",45 win32: "Komodo/CHAIN"46 },47 ZILLA: {48 darwin: "Komodo/ZILLA",49 linux: ".komodo/ZILLA",50 win32: "Komodo/ZILLA"51 },52 CCL: {53 darwin: "Komodo/CCL",54 linux: ".komodo/CCL",55 win32: "Komodo/CCL"56 },57 COQUI: {58 darwin: "Komodo/COQUI",59 linux: ".komodo/COQUI",60 win32: "Komodo/COQUI"61 },62 CRYPTO: {63 darwin: "Komodo/CRYPTO",64 linux: ".komodo/CRYPTO",65 win32: "Komodo/CRYPTO"66 },67 DSEC: {68 darwin: "Komodo/DSEC",69 linux: ".komodo/DSEC",70 win32: "Komodo/DSEC"71 },72 DEX: {73 darwin: "Komodo/DEX",74 linux: ".komodo/DEX",75 win32: "Komodo/DEX"76 },77 DP: {78 darwin: "Komodo/DP",79 linux: ".komodo/DP",80 win32: "Komodo/DP"81 },82 DION: {83 darwin: "Komodo/DION",84 linux: ".komodo/DION",85 win32: "Komodo/DION"86 },87 EQL: {88 darwin: "Komodo/EQL",89 linux: ".komodo/EQL",90 win32: "Komodo/EQL"91 },92 ETOMIC: {93 darwin: "Komodo/ETOMIC",94 linux: ".komodo/ETOMIC",95 win32: "Komodo/ETOMIC"96 },97 GLXT: {98 darwin: "Komodo/GLXT",99 linux: ".komodo/GLXT",100 win32: "Komodo/GLXT"101 },102 HODL: {103 darwin: "Komodo/HODL",104 linux: ".komodo/HODL",105 win32: "Komodo/HODL"106 },107 JUMBLR: {108 darwin: "Komodo/JUMBLR",109 linux: ".komodo/JUMBLR",110 win32: "Komodo/JUMBLR"111 },112 KMDICE: {113 darwin: "Komodo/KMDICE",114 linux: ".komodo/KMDICE",115 win32: "Komodo/KMDICE"116 },117 KOIN: {118 darwin: "Komodo/KOIN",119 linux: ".komodo/KOIN",120 win32: "Komodo/KOIN"121 },122 KSB: {123 darwin: "Komodo/KSB",124 linux: ".komodo/KSB",125 win32: "Komodo/KSB"126 },127 KV: {128 darwin: "Komodo/KV",129 linux: ".komodo/KV",130 win32: "Komodo/KV"131 },132 LABS: {133 darwin: "Komodo/LABS",134 linux: ".komodo/LABS",135 win32: "Komodo/LABS"136 },137 MGNX: {138 darwin: "Komodo/MGNX",139 linux: ".komodo/MGNX",140 win32: "Komodo/MGNX"141 },142 MORTY: {143 darwin: "Komodo/MORTY",144 linux: ".komodo/MORTY",145 win32: "Komodo/MORTY"146 },147 MSHARK: {148 darwin: "Komodo/MSHARK",149 linux: ".komodo/MSHARK",150 win32: "Komodo/MSHARK"151 },152 MTST3: {153 darwin: "Komodo/MTST3",154 linux: ".komodo/MTST3",155 win32: "Komodo/MTST3"156 },157 MGW: {158 darwin: "Komodo/MGW",159 linux: ".komodo/MGW",160 win32: "Komodo/MGW"161 },162 MVP: {163 darwin: "Komodo/MVP",164 linux: ".komodo/MVP",165 win32: "Komodo/MVP"166 },167 NINJA: {168 darwin: "Komodo/NINJA",169 linux: ".komodo/NINJA",170 win32: "Komodo/NINJA"171 },172 OUR: {173 darwin: "Komodo/OUR",174 linux: ".komodo/OUR",175 win32: "Komodo/OUR"176 },177 PANGEA: {178 darwin: "Komodo/PANGEA",179 linux: ".komodo/PANGEA",180 win32: "Komodo/PANGEA"181 },182 PTX: {183 darwin: "Komodo/PTX",184 linux: ".komodo/PTX",185 win32: "Komodo/PTX"186 },187 PRLPAY: {188 darwin: "Komodo/PRLPAY",189 linux: ".komodo/PRLPAY",190 win32: "Komodo/PRLPAY"191 },192 PIRATE: {193 darwin: "Komodo/PIRATE",194 linux: ".komodo/PIRATE",195 win32: "Komodo/PIRATE"196 },197 PIZZA: {198 darwin: "Komodo/PIZZA",199 linux: ".komodo/PIZZA",200 win32: "Komodo/PIZZA"201 },202 REVS: {203 darwin: "Komodo/REVS",204 linux: ".komodo/REVS",205 win32: "Komodo/REVS"206 },207 RICK: {208 darwin: "Komodo/RICK",209 linux: ".komodo/RICK",210 win32: "Komodo/RICK"211 },212 SPLTEST: {213 darwin: "Komodo/SPLTEST",214 linux: ".komodo/SPLTEST",215 win32: "Komodo/SPLTEST"216 },217 MESH: {218 darwin: "Komodo/MESH",219 linux: ".komodo/MESH",220 win32: "Komodo/MESH"221 },222 SUPERNET: {223 darwin: "Komodo/SUPERNET",224 linux: ".komodo/SUPERNET",225 win32: "Komodo/SUPERNET"226 },227 OOT: {228 darwin: "Komodo/OOT",229 linux: ".komodo/OOT",230 win32: "Komodo/OOT"231 },232 VRSCTEST: {233 darwin: "Komodo/VRSCTEST",234 linux: ".komodo/VRSCTEST",235 win32: "Komodo/VRSCTEST"236 },237 VOTE2020: {238 darwin: "Komodo/VOTE2020",239 linux: ".komodo/VOTE2020",240 win32: "Komodo/VOTE2020"241 },242 WLC21: {243 darwin: "Komodo/WLC21",244 linux: ".komodo/WLC21",245 win32: "Komodo/WLC21"246 },247 ZEXO: {248 darwin: "Komodo/ZEXO",249 linux: ".komodo/ZEXO",250 win32: "Komodo/ZEXO"251 },252 ZEC: {253 darwin: "Zcash",254 linux: ".zcash",255 win32: "Zcash"256 },...

Full Screen

Full Screen

DarwinListbox.js

Source:DarwinListbox.js Github

copy

Full Screen

1var dragRegionBoxes = new Array();2var testCount = 0;3// Constructor for DarwinListbox class.4function DarwinListbox(window, id, locationX, locationY, width, height, background, bordercolor, highlightcolor, allowMultipleSelect, allowDrag, allowDrop, allowRearrange) {5 // Remember some arguments for later.6 this.window = window;7 this.id = id;8 this.body = '';9 this.contents = new Array();10 this.highlightcolor = highlightcolor;11 this.mousedown = false;12 this.allowMultipleSelect = allowMultipleSelect;13 this.allowDrag = allowDrag;14 this.allowDrop = allowDrop;15 this.locationX = locationX;16 this.locationY = locationY;17 this.sizeX = width;18 this.sizeY = height;19 this.width = width;20 this.height = height;21 this.bordercolor = bordercolor;22 // If this is droppable, add it to the list of droppable regions.23 if (allowDrop)24 dragRegionBoxes[dragRegionBoxes.length] = this;25 this.allowRearrange = allowRearrange;26 // Output a CSS-P style sheet for this document.27 var d = window.document;28 d.writeln('<style type="text/css">');29 d.write('#' + id + ' { ');30 width += 17;31 d.write('overflow: scroll; ');32 d.write('border-style: solid; ');33 d.write('border-width: 1px; ');34 d.write('border-color: ' + bordercolor + '; ');35 d.write('background: ' + background + '; ');36 if (width) d.write('width: ' + width + 'px; ');37 if (height) d.write('height: ' + width + 'px; ');38 d.writeln('}');39 d.writeln('<' + '/style>');40}41// This will output the initial HTML42DarwinListbox.prototype.output = function() {43 var d = this.window.document;44 45 d.writeln('<div id="' + this.id + '">');46 d.writeln(this.body);47 d.writeln('<' + '/div>');48 49 // save references to the element50 this.element = d.getElementById(this.id);51 this.style = this.element.style;52 53 // set the document's events54 if (document.captureEvents)55 document.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN|Event.MOUSEMOVE);56}57DarwinListbox.prototype.draw = function() {58 var str = '';59 60 for (var i in this.contents) {61 str += '<div id="' + this.id + i + '" class="line-item" onmouseover="this.parent.handleMouseOver(this)" onmouseout="this.parent.handleMouseOut(this)" onselectstart="return false" onmousemove="this.parent.handleMouseOver(this)">';62 this.contents[i].parent = this;63 str += this.contents[i].draw();64 str += '<' + '/div>';65 }66 67 this.element.innerHTML = str;68 69 for (var i in this.contents) {70 this.window.document.getElementById(this.id + i).parent = this;71 }72}73DarwinListbox.prototype.selectOne = function(obj) {74 var itemClicked = obj.id.replace(this.id, '');75 76 // if the item is already selected, do nothing77 if (!this.contents[itemClicked].selected) {78 // deselect everything79 for (var i in this.contents) {80 this.window.document.getElementById(this.id + i).style.background = 'inherit';81 this.contents[i].selected = false;82 }83 // select the clicked item84 obj.style.background = this.highlightcolor;85 this.contents[itemClicked].selected = true;86 87 // send it a callback message so it can handle any UI changes88 this.contents[itemClicked].onupdate();89 }90 else {91 }92 // set the last item clicked in case they shift-click next time93 this.lastItemClicked = itemClicked;94}95DarwinListbox.prototype.handleMouseOver = function(obj) {96 var d = this.window.document;97 this.window.status = obj.id;98 this.window.currentDarwinObj = obj;99 if (d.onmousemove == darwinHandleMouseMove) {100 if (this.allowDrop)101 this.selectOne(obj);102 }103 else {104 d.onmousedown = darwinHandleMouseDown;105 }106}107// this gets called when the user mouses out of a list item108DarwinListbox.prototype.handleMouseOut = function(obj) {109 if (this.window.document.onmousemove == darwinHandleMouseMove) {110 this.window.currentDarwinObj = null;111 this.window.document.onmousedown = null;112 }113}114// this should get called when the user drops something onto the listbox115DarwinListbox.prototype.handleDrop = function(obj) {116 117}118function darwinHandleMouseDown(e) {119 if (e) {120 var currentX = e.pageX;121 var currentY = e.pageY;122 }123 else {124 var currentX = event.clientX + GetScrollPos(0);125 var currentY = event.clientY + GetScrollPos(1);126 e = window.event;127 }128 var itemClicked = window.currentDarwinObj.id.replace(window.currentDarwinObj.parent.id, '');129 window.currentDarwinObj.parent.selectOne(window.currentDarwinObj);130 131 // set up the drag widget, and send mouse move and up events to it132 if (darwinDragWidget) {133 var g = darwinDragWidget;134 var d = window.document;135 darwinOriginalDragX = currentX;136 darwinOriginalDrayY = currentY;137 g.contents = new Array(window.currentDarwinObj.parent.contents[itemClicked]);138 g.draw();139 d.onmousemove = darwinHandleMouseMove;140 d.onmouseup = darwinHandleMouseUp;141 }142 143 this.mousedown = true;144 return false;...

Full Screen

Full Screen

DarwinDragWidget.js

Source:DarwinDragWidget.js Github

copy

Full Screen

1// Constants2var offsetX = 12;3var offsetY = 0;4var tolerance = 6;5// Globals6var darwinOriginalDragX = 0;7var darwinOriginalDrayY = 0;8var currentDragBox = null;9// Constructor for the DarwinDragWidget class.10function DarwinDragWidget(window, multipleSelectedString) {11 // Remember some arguments for later.12 this.window = window;13 this.id = 'darwinDragWidget';14 this.body = '';15 this.multipleSelectedString = multipleSelectedString;16 // Output a CSS-P style sheet for this document.17 var d = window.document;18 d.writeln('<style type="text/css">');19 d.write('#darwinDragWidget { position: absolute; ');20 d.write('left: 0px; top: 0px; ');21 d.write('visibility: hidden; ');22 d.writeln('}');23 d.write('#darwinInvisibleCover { position: absolute; ');24 d.write('left: 0px; top: 0px; ');25 d.write('width: 4px; height: 4px; ');26 d.write('visibility: hidden; ');27 d.writeln('}');28 d.writeln('<' + '/style>');29}30// This will output the initial HTML31DarwinDragWidget.prototype.output = function() {32 var d = this.window.document;33 34 d.writeln('<div id="' + this.id + '" class=line-item>');35 d.writeln(this.body);36 d.writeln('<' + '/div>');37 38 d.writeln('<div id="darwinInvisibleCover" onmouseout="SetStyleVisible(\'darwinInvisibleCover\', false)">');39 d.writeln('<img src="images/invis_dragcover.gif" width=4 height=4>');40 d.writeln('<' + '/div>');41 42 // save references to the element43 this.element = d.getElementById(this.id);44 this.style = this.element.style;45 this.window.darwinDragWidget = this;46 this.element.object = this;47}48DarwinDragWidget.prototype.draw = function() {49 if (this.contents) {50 if (this.contents.length == 1)51 this.element.innerHTML = this.contents[0].draw();52 else53 this.element.innerHTML = this.multipleSelectedString;54 55 this.style.visibility = 'hidden';56 this.offsetX = this.style.pixelWidth / 2;57 this.offsetY = this.style.pixelHeight / 2;58 }59}60function GetScrollPos(d) {61 if ((document.documentElement) && (document.documentElement.scrollTop)) {62 if (d == 0) 63 return document.body.scrollLeft + document.documentElement.scrollLeft;64 else65 return document.body.scrollTop + document.documentElement.scrollTop;66 }67 else {68 if (d == 0)69 return document.body.scrollLeft;70 else71 return document.body.scrollTop;72 }73}74function darwinHandleMouseMove(e) {75 if (e) {76 var currentX = e.pageX;77 var currentY = e.pageY;78 }79 else {80 var currentX = event.clientX + GetScrollPos(0);81 var currentY = event.clientY + GetScrollPos(1);82 }83 if ((Math.abs(currentX - darwinOriginalDragX) > tolerance) || (Math.abs(currentY - darwinOriginalDrayY) > tolerance)) {84 SetStylePos('darwinDragWidget', 0, currentX + offsetX);85 SetStylePos('darwinDragWidget', 1, currentY + offsetY);86 darwinDragWidget.style.visibility = 'visible';87 if (IsNS6()) {88 currentDragBox = null;89 for (i = 0; i < dragRegionBoxes.length; i++) {90 var g = dragRegionBoxes[i];91 var regionEndX = g.locationX + g.sizeX;92 var regionEndY = g.locationY + g.sizeY;93 if ((currentX > g.locationX) && (currentX < regionEndX) && (currentY > g.locationY) && (currentY < regionEndY)) {94 g.element.style.backgroundColor = g.highlightcolor;95 currentDragBox = g;96 }97 else {98 if (currentDragBox == g)99 currentDragBox = null;100 g.element.style.backgroundColor = '#FFFFFF';101 }102 }103 }104 }105 return false;106}107function darwinHandleMouseUp(e) {108 var d = darwinDragWidget.window.document;109 var str = '';110 darwinDragWidget.style.visibility = 'hidden';111 // stop tracking events112 d.onmousemove = null;113 d.onmouseup = null;114 if (currentDragBox) {115 for (i = 0; i < dragRegionBoxes.length; i++) {116 var g = dragRegionBoxes[i];117 g.element.style.backgroundColor = '#FFFFFF';118 }119 var allElements = currentDragBox.element.getElementsByTagName('div');120 if (allElements.length > 0) {121 var lastElement = allElements[allElements.length-1];122 lastElement.scrollIntoView();123 }124 }125 return true;...

Full Screen

Full Screen

variants.js

Source:variants.js Github

copy

Full Screen

1'use strict'2module.exports = [3 {4 name: 'chrome',5 channel: 'stable',6 // For darwin finder7 darwin: 'chrome',8 // Array of commands in a *nix environment9 commands: ['google-chrome', 'google-chrome-stable'],10 // To extract version from $(command --version)11 versionRegex: /Google Chrome (\S+)/i12 },13 {14 name: 'chrome',15 channel: 'beta',16 darwin: 'chrome-beta',17 commands: ['google-chrome-beta'],18 versionRegex: /Google Chrome (\S+)/i19 },20 {21 name: 'chrome',22 channel: 'dev',23 darwin: 'chrome-dev',24 commands: ['google-chrome-unstable'],25 versionRegex: /Google Chrome (\S+)/i26 },27 {28 name: 'chrome',29 channel: 'canary',30 darwin: 'chrome-canary',31 commands: ['google-chrome-canary'],32 versionRegex: /Google Chrome (\S+)/i33 },34 {35 name: 'chromium',36 channel: 'stable',37 darwin: 'chromium',38 commands: ['chromium', 'chromium-browser'],39 versionRegex: /Chromium (\S+)/i40 },41 {42 name: 'chromium',43 channel: 'dev',44 darwin: 'chromium-dev',45 commands: ['chromium-dev'],46 versionRegex: /Chromium (\S+)/i47 },48 {49 name: 'firefox',50 channel: 'release',51 darwin: 'firefox',52 commands: ['firefox'],53 versionRegex: /Mozilla Firefox (\S+)/i54 },55 {56 name: 'firefox',57 channel: 'developer',58 darwin: 'firefox-developer',59 commands: ['firefox-developer'],60 versionRegex: /Mozilla Firefox (\S+)/i61 },62 {63 name: 'firefox',64 channel: 'nightly',65 darwin: 'firefox-nightly',66 commands: ['firefox-nightly'],67 versionRegex: /Mozilla Firefox (\S+)/i68 },69 {70 name: 'safari',71 darwin: 'safari',72 commands: ['safari']73 },74 {75 name: 'msedge',76 channel: 'stable',77 darwin: 'msedge',78 commands: ['msedge'],79 versionRegex: /Microsoft Edge (\S+)/i80 },81 {82 name: 'msedge',83 channel: 'beta',84 darwin: 'msedge-beta',85 commands: ['msedge-beta'],86 versionRegex: /Microsoft Edge (\S+)/i87 },88 {89 name: 'msedge',90 channel: 'canary',91 darwin: 'msedge-canary',92 commands: ['msedge-canary'],93 versionRegex: /Microsoft Edge (\S+)/i94 },95 {96 name: 'brave',97 channel: 'release',98 darwin: 'brave',99 commands: ['brave-browser', 'brave'],100 versionRegex: /Brave Browser (\S+)/i101 },102 {103 name: 'brave',104 channel: 'beta',105 darwin: 'brave-beta',106 commands: ['brave-browser-beta', 'brave-beta'],107 versionRegex: /Brave Browser (\S+)/i108 },109 {110 name: 'brave',111 channel: 'dev',112 darwin: 'brave-dev',113 commands: ['brave-browser-dev', 'brave-dev'],114 versionRegex: /Brave Browser (\S+)/i115 },116 {117 name: 'brave',118 channel: 'nightly',119 darwin: 'brave-nightly',120 commands: ['brave-browser-nightly', 'brave-nightly'],121 versionRegex: /Brave Browser (\S+)/i122 },123 {124 name: 'opera',125 channel: 'stable',126 darwin: 'opera',127 commands: ['opera'],128 versionRegex: /Opera (\S+)/i129 }...

Full Screen

Full Screen

build-macos.js

Source:build-macos.js Github

copy

Full Screen

1#!/usr/bin/env node2var shell = require('shelljs');3var productName = process.argv[2];4var companyName = process.argv[3];5var versionLabel = process.argv[4];6var yearLabel = process.argv[5];7var command = 'npm i && rm -rf ./dist/darwin && rm -rf "./dist/Gapminder Offline-darwin-x64" && ' +8 'IS_ELECTRON_APP=true webpack && ./node_modules/.bin/electron-packager . "' + productName + '" ' +9 '--out=dist/darwin ' +10 '--platform=darwin ' +11 '--arch=x64 ' +12 '--version=0.37.5 ' +13 '--icon=build/icon.ico ' +14 '--ignore="(.zip|node_modules/.bin|node_modules/electron-builder|pack.json|README.md)" ' +15 'app-version="' + versionLabel + '" ' +16 '--version-string.CompanyName="' + companyName + '" ' +17 '--version-string.ProductName="' + productName + '" ' +18 '--version-string.FileVersion="' + versionLabel + '" ' +19 '--version-string.ProductVersion="' + versionLabel + '" ' +20 '--version-string.LegalCopyright="© ' + companyName + ', ' + yearLabel + '" && ' +21 'cp ./updater-darwin "./dist/darwin/Gapminder Offline-darwin-x64" && ' +22 'cp ./run-darwin "./dist/darwin/Gapminder Offline-darwin-x64" && ' +23 './node_modules/.bin/build "dist/darwin/' + productName + '" --platform=darwin &&' +24 'rm -rf ./node_modules/* && '+25 'cd "./dist/darwin" && ' +26 'npm i --production && ' +27 'rm -rf "./Gapminder Offline-darwin-x64/Gapminder Offline.app/Contents/Resources/app/node_modules" && ' +28 'cp -r ../../node_modules "./Gapminder Offline-darwin-x64/Gapminder Offline.app/Contents/Resources/app/" && ' +29 'zip --symlinks -r "../../GapminderOffline-darwin.zip" "./Gapminder Offline-darwin-x64" && ' +30 'rm -rf ../darwin && rm -rf "../GapminderOffline-darwin-x64"';...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var sudo = require('sudo');2var options = {3 spawnOptions: { /* other options for spawn */ }4};5var child = sudo(['node', 'index.js'], options);6child.stdout.on('data', function (data) {7 console.log(data.toString());8});9child.stderr.on('data', function (data) {10 console.log(data.toString());11});12child.on('close', function (code) {13 console.log('child process exited with code ' + code.toString());14});15child.on('error', function (err) {16 throw err;17});

Full Screen

Using AI Code Generation

copy

Full Screen

1var exec = require('child_process').exec;2var child = exec('sudo -S echo "test"', function(err, stdout, stderr) {3 if (err) throw err;4 console.log(stdout);5});6child.stdin.write('password\n');7child.stdin.end();

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('root');2var myRoot = new root();3myRoot.darwin(function(err, res) {4 if(err) {5 console.log(err);6 } else {7 console.log(res);8 }9});

Full Screen

Using AI Code Generation

copy

Full Screen

1var darwin = require('darwin');2if (darwin.isRoot()) {3 console.log('user is root');4} else {5 console.log('user is not root');6}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful